misc updates, remove mipmapping
This commit is contained in:
parent
88a6cbe826
commit
1ce918c0af
377 changed files with 2910 additions and 3223 deletions
|
@ -168,7 +168,7 @@ import common.sound.EventType;
|
||||||
import common.sound.MovingSoundMinecart;
|
import common.sound.MovingSoundMinecart;
|
||||||
import common.sound.PositionedSound;
|
import common.sound.PositionedSound;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.CharValidator;
|
import common.util.CharValidator;
|
||||||
import common.util.ChunkPos;
|
import common.util.ChunkPos;
|
||||||
|
@ -176,13 +176,12 @@ import common.util.ExtMath;
|
||||||
import common.util.HitPosition;
|
import common.util.HitPosition;
|
||||||
import common.util.IntHashMap;
|
import common.util.IntHashMap;
|
||||||
import common.util.LongHashMap;
|
import common.util.LongHashMap;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.util.ParticleType;
|
import common.util.ParticleType;
|
||||||
import common.util.Color;
|
import common.util.Color;
|
||||||
import common.util.Displayable;
|
|
||||||
import common.util.Util;
|
import common.util.Util;
|
||||||
import common.util.Var;
|
import common.util.Var;
|
||||||
import common.util.HitPosition.ObjectType;
|
import common.util.HitPosition.ObjectType;
|
||||||
import common.util.Identifyable;
|
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.Chunk;
|
import common.world.Chunk;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -211,28 +210,6 @@ import common.world.World;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Client implements IThreadListener {
|
public class Client implements IThreadListener {
|
||||||
public static enum MipmapType implements Identifyable, Displayable {
|
|
||||||
NONE("off", "Keine"),
|
|
||||||
NEAREST("nearest", "Nächster nachbar"),
|
|
||||||
LINEAR("linear", "Linear interpoliert");
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
private final String display;
|
|
||||||
|
|
||||||
private MipmapType(String name, String display) {
|
|
||||||
this.name = name;
|
|
||||||
this.display = display;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisplay() {
|
|
||||||
return this.display;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SyncFunction implements IntFunction {
|
public static class SyncFunction implements IntFunction {
|
||||||
public void apply(IntVar cv, int value) {
|
public void apply(IntVar cv, int value) {
|
||||||
Client.CLIENT.sync(value);
|
Client.CLIENT.sync(value);
|
||||||
|
@ -312,12 +289,6 @@ public class Client implements IThreadListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class MipmapFunction implements EnumFunction<MipmapType> {
|
|
||||||
public void apply(EnumVar cv, MipmapType value) {
|
|
||||||
Client.CLIENT.updateTexture();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class LightFunction implements FloatFunction {
|
public static class LightFunction implements FloatFunction {
|
||||||
public void apply(FloatVar cv, float value) {
|
public void apply(FloatVar cv, float value) {
|
||||||
Client.CLIENT.renderer.loadRenderers();
|
Client.CLIENT.renderer.loadRenderers();
|
||||||
|
@ -366,11 +337,11 @@ public class Client implements IThreadListener {
|
||||||
return Client.this.getChunk(x, z);
|
return Client.this.getChunk(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Chunk getChunk(BlockPos pos) {
|
public Chunk getChunk(LocalPos pos) {
|
||||||
return Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
return Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected float getTemperature(BlockPos pos) {
|
protected float getTemperature(LocalPos pos) {
|
||||||
if(!isValid(pos))
|
if(!isValid(pos))
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
ChunkClient chunk = Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
ChunkClient chunk = Client.this.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||||
|
@ -385,19 +356,19 @@ public class Client implements IThreadListener {
|
||||||
Client.this.effectRenderer.spawnParticle(Client.this.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, data);
|
Client.this.effectRenderer.spawnParticle(Client.this.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playEffect(EntityNPC player, int sfxType, BlockPos blockPosIn, int data) {
|
public void playEffect(EntityNPC player, int sfxType, LocalPos blockPosIn, int data) {
|
||||||
if(Client.this.getNetHandler() != null)
|
if(Client.this.getNetHandler() != null)
|
||||||
Client.this.getNetHandler().playAuxSFX(sfxType, blockPosIn, data);
|
Client.this.getNetHandler().playAuxSFX(sfxType, blockPosIn, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markBlockForUpdate(BlockPos pos) {
|
public void markBlockForUpdate(LocalPos pos) {
|
||||||
int x = pos.getX();
|
int x = pos.getX();
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ();
|
int z = pos.getZ();
|
||||||
Client.this.renderer.markUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
|
Client.this.renderer.markUpdate(x - 1, y - 1, z - 1, x + 1, y + 1, z + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clientNotifyLight(BlockPos pos) {
|
public void clientNotifyLight(LocalPos pos) {
|
||||||
int x = pos.getX();
|
int x = pos.getX();
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ();
|
int z = pos.getZ();
|
||||||
|
@ -412,15 +383,15 @@ public class Client implements IThreadListener {
|
||||||
Client.this.renderer.setLastLightning(last, color);
|
Client.this.renderer.setLastLightning(last, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkBlockLight(BlockPos pos) {
|
public void checkBlockLight(LocalPos pos) {
|
||||||
Client.this.renderer.checkBlockLight(pos);
|
Client.this.renderer.checkBlockLight(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCombinedLight(BlockPos pos) {
|
public int getCombinedLight(LocalPos pos) {
|
||||||
return Client.this.renderer.getCombinedLight(pos);
|
return Client.this.renderer.getCombinedLight(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCombinedBrightness(BlockPos pos) {
|
public int getCombinedBrightness(LocalPos pos) {
|
||||||
return Client.this.renderer.getCombinedBrightness(pos);
|
return Client.this.renderer.getCombinedBrightness(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -492,7 +463,6 @@ public class Client implements IThreadListener {
|
||||||
public boolean freecam;
|
public boolean freecam;
|
||||||
public boolean servercam;
|
public boolean servercam;
|
||||||
public boolean shaders;
|
public boolean shaders;
|
||||||
public boolean mipmaps;
|
|
||||||
|
|
||||||
private int leftClickCounter;
|
private int leftClickCounter;
|
||||||
private int rightClickTimer;
|
private int rightClickTimer;
|
||||||
|
@ -574,7 +544,7 @@ public class Client implements IThreadListener {
|
||||||
public World world;
|
public World world;
|
||||||
public EntityNPC player;
|
public EntityNPC player;
|
||||||
public HitPosition pointed;
|
public HitPosition pointed;
|
||||||
public BlockPos pointedLiquid;
|
public LocalPos pointedLiquid;
|
||||||
public DisplayMode vidMode;
|
public DisplayMode vidMode;
|
||||||
public String dimensionName;
|
public String dimensionName;
|
||||||
private ChunkClient emptyChunk;
|
private ChunkClient emptyChunk;
|
||||||
|
@ -594,9 +564,9 @@ public class Client implements IThreadListener {
|
||||||
private int lightUpdates = 2048;
|
private int lightUpdates = 2048;
|
||||||
@Variable(name = "chunk_light_range", category = CVarCategory.RENDER, min = 5, max = 1024, display = "Radius Licht-Updates")
|
@Variable(name = "chunk_light_range", category = CVarCategory.RENDER, min = 5, max = 1024, display = "Radius Licht-Updates")
|
||||||
private int lightRange = 32;
|
private int lightRange = 32;
|
||||||
@Variable(name = "gl_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
|
@Variable(name = "draw_fov", category = CVarCategory.RENDER, min = 1.0f, max = 179.0f, display = "Sichtfeld (FOV)", unit = "°", precision = 1)
|
||||||
public float fov = 70.0f;
|
public float fov = 70.0f;
|
||||||
@Variable(name = "gl_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus")
|
@Variable(name = "draw_wireframe", category = CVarCategory.RENDER, display = "Gitter-Render-Modus")
|
||||||
private boolean wireframe = false;
|
private boolean wireframe = false;
|
||||||
|
|
||||||
@Variable(name = "con_timestamps", category = CVarCategory.CONSOLE, display = "Zeiten")
|
@Variable(name = "con_timestamps", category = CVarCategory.CONSOLE, display = "Zeiten")
|
||||||
|
@ -623,7 +593,7 @@ public class Client implements IThreadListener {
|
||||||
@Variable(name = "gui_scale_hotbar", category = CVarCategory.GUI, display = "Leiste vergrößern")
|
@Variable(name = "gui_scale_hotbar", category = CVarCategory.GUI, display = "Leiste vergrößern")
|
||||||
public boolean scaleHotbar = false;
|
public boolean scaleHotbar = false;
|
||||||
@Variable(name = "hud_margin", category = CVarCategory.GUI, min = 0, max = 120, unit = "px", display = "Seitenabstand der HUD")
|
@Variable(name = "hud_margin", category = CVarCategory.GUI, min = 0, max = 120, unit = "px", display = "Seitenabstand der HUD")
|
||||||
private int hudMargin = 8;
|
private int hudMargin = 4;
|
||||||
@Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%")
|
@Variable(name = "phy_sensitivity", category = CVarCategory.INPUT, min = 0.01f, max = 10.0f, display = "Mausempfindlichkeit", precision = 2, unit = "%")
|
||||||
private float sensitivity = 1.0f;
|
private float sensitivity = 1.0f;
|
||||||
@Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms")
|
@Variable(name = "gui_dclick_delay", category = CVarCategory.INPUT, min = 150, max = 750, display = "Doppelklick bei", unit = "ms")
|
||||||
|
@ -644,7 +614,7 @@ public class Client implements IThreadListener {
|
||||||
private boolean chatPermanent = false;
|
private boolean chatPermanent = false;
|
||||||
@Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund")
|
@Variable(name = "overlay_opacity", category = CVarCategory.CONSOLE, min = 0x00, max = 0xff, display = "Deckkraft Hintergrund")
|
||||||
private int hudOpacity = 0x40;
|
private int hudOpacity = 0x40;
|
||||||
@Variable(name = "gl_vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren")
|
@Variable(name = "vsync_flush", category = CVarCategory.RENDER, display = "Puffer leeren")
|
||||||
private boolean glFlush = false;
|
private boolean glFlush = false;
|
||||||
@Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen")
|
@Variable(name = "con_autoclose", category = CVarCategory.CONSOLE, display = "Schließen")
|
||||||
public boolean conAutoclose = true;
|
public boolean conAutoclose = true;
|
||||||
|
@ -709,9 +679,7 @@ public class Client implements IThreadListener {
|
||||||
@Variable(name = "mid_visualizer", category = CVarCategory.SOUND, display = "Visualisation")
|
@Variable(name = "mid_visualizer", category = CVarCategory.SOUND, display = "Visualisation")
|
||||||
public boolean midiVisualizer = true;
|
public boolean midiVisualizer = true;
|
||||||
|
|
||||||
@Variable(name = "gl_tex_mipmaps", category = CVarCategory.RENDER, display = "Mipmaps", callback = MipmapFunction.class)
|
@Variable(name = "draw_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
|
||||||
private MipmapType mipmapType = MipmapType.NONE;
|
|
||||||
@Variable(name = "gl_use_shader", category = CVarCategory.RENDER, display = "Shader verwenden")
|
|
||||||
public boolean useShader = false;
|
public boolean useShader = false;
|
||||||
|
|
||||||
public static final Client CLIENT = new Client();
|
public static final Client CLIENT = new Client();
|
||||||
|
@ -856,7 +824,8 @@ public class Client implements IThreadListener {
|
||||||
this.renderItem.onReload();
|
this.renderItem.onReload();
|
||||||
this.renderer.cacheSprites();
|
this.renderer.cacheSprites();
|
||||||
EntityTexManager.loadNpcTextures();
|
EntityTexManager.loadNpcTextures();
|
||||||
this.updateTexture();
|
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||||
|
TextureUtil.setParams();
|
||||||
this.renderer.loadRenderers();
|
this.renderer.loadRenderers();
|
||||||
this.logFeed("Texturen wurden neu geladen");
|
this.logFeed("Texturen wurden neu geladen");
|
||||||
}
|
}
|
||||||
|
@ -868,7 +837,6 @@ public class Client implements IThreadListener {
|
||||||
this.soundManager = new SoundManager(this);
|
this.soundManager = new SoundManager(this);
|
||||||
Log.RENDER.debug("Maximale Texturgröße: %d", GL15.glGetInteger(GL15.GL_MAX_TEXTURE_SIZE));
|
Log.RENDER.debug("Maximale Texturgröße: %d", GL15.glGetInteger(GL15.GL_MAX_TEXTURE_SIZE));
|
||||||
Log.RENDER.debug("Shader verfügbar: %s", (this.shaders = GL.getCapabilities().OpenGL20) ? "Ja (OpenGL 2.0+)" : "Nein (OpenGL 1.5)");
|
Log.RENDER.debug("Shader verfügbar: %s", (this.shaders = GL.getCapabilities().OpenGL20) ? "Ja (OpenGL 2.0+)" : "Nein (OpenGL 1.5)");
|
||||||
Log.RENDER.debug("Mipmaps verfügbar: %s", (this.mipmaps = GL.getCapabilities().OpenGL30) ? "Ja (OpenGL 3.0+)" : "Nein (OpenGL 1.5-2.1)");
|
|
||||||
GlState.enableTexture2D();
|
GlState.enableTexture2D();
|
||||||
GlState.shadeModel(GL15.GL_SMOOTH);
|
GlState.shadeModel(GL15.GL_SMOOTH);
|
||||||
GL15.glClearDepth(1.0D);
|
GL15.glClearDepth(1.0D);
|
||||||
|
@ -883,7 +851,8 @@ public class Client implements IThreadListener {
|
||||||
GL15.glMatrixMode(GL15.GL_MODELVIEW);
|
GL15.glMatrixMode(GL15.GL_MODELVIEW);
|
||||||
this.textureMap = new TextureMap();
|
this.textureMap = new TextureMap();
|
||||||
this.textureManager.loadTexture(TextureMap.BLOCKS, this.textureMap);
|
this.textureManager.loadTexture(TextureMap.BLOCKS, this.textureMap);
|
||||||
this.updateTexture();
|
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||||
|
TextureUtil.setParams();
|
||||||
this.modelManager = new ModelManager(this.textureMap);
|
this.modelManager = new ModelManager(this.textureMap);
|
||||||
this.modelManager.onReload();
|
this.modelManager.onReload();
|
||||||
this.renderItem = new RenderItem(this.textureManager, this.modelManager);
|
this.renderItem = new RenderItem(this.textureManager, this.modelManager);
|
||||||
|
@ -1009,7 +978,7 @@ public class Client implements IThreadListener {
|
||||||
{
|
{
|
||||||
this.controller.update();
|
this.controller.update();
|
||||||
}
|
}
|
||||||
this.textureMap.update(this.mipmaps && this.mipmapType != MipmapType.NONE);
|
this.textureMap.update();
|
||||||
if (this.open != null)
|
if (this.open != null)
|
||||||
{
|
{
|
||||||
this.open.updateScreen();
|
this.open.updateScreen();
|
||||||
|
@ -1296,7 +1265,7 @@ public class Client implements IThreadListener {
|
||||||
int color = 0x000000;
|
int color = 0x000000;
|
||||||
float bar = -1.0f;
|
float bar = -1.0f;
|
||||||
if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) {
|
if((this.pointed != null && this.pointed.type == ObjectType.BLOCK && this.pointed.block != null) || this.pointedLiquid != null) {
|
||||||
BlockPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block;
|
LocalPos pos = this.pointedLiquid != null ? this.pointedLiquid : this.pointed.block;
|
||||||
State state = this.world.getState(pos);
|
State state = this.world.getState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if(this.pointedLiquid != null ? block.getMaterial().isLiquid() : block != Blocks.air) {
|
if(this.pointedLiquid != null ? block.getMaterial().isLiquid() : block != Blocks.air) {
|
||||||
|
@ -1576,7 +1545,7 @@ public class Client implements IThreadListener {
|
||||||
{
|
{
|
||||||
if (leftClick && this.pointed != null && this.pointed.type == HitPosition.ObjectType.BLOCK)
|
if (leftClick && this.pointed != null && this.pointed.type == HitPosition.ObjectType.BLOCK)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = this.pointed.block;
|
LocalPos blockpos = this.pointed.block;
|
||||||
|
|
||||||
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side))
|
if (this.world.getState(blockpos).getBlock() != Blocks.air && this.controller.damageBlock(blockpos, this.pointed.side))
|
||||||
{
|
{
|
||||||
|
@ -1622,7 +1591,7 @@ public class Client implements IThreadListener {
|
||||||
break;
|
break;
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
this.player.swingItem();
|
this.player.swingItem();
|
||||||
BlockPos blockpos = this.pointed.block;
|
LocalPos blockpos = this.pointed.block;
|
||||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||||
{
|
{
|
||||||
this.controller.clickBlock(blockpos, this.pointed.side);
|
this.controller.clickBlock(blockpos, this.pointed.side);
|
||||||
|
@ -1678,7 +1647,7 @@ public class Client implements IThreadListener {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
BlockPos blockpos = this.pointed.block;
|
LocalPos blockpos = this.pointed.block;
|
||||||
|
|
||||||
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
if (this.world.getState(blockpos).getBlock() != Blocks.air)
|
||||||
{
|
{
|
||||||
|
@ -1987,7 +1956,7 @@ public class Client implements IThreadListener {
|
||||||
if(this.world == null)
|
if(this.world == null)
|
||||||
return mem;
|
return mem;
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ);
|
LocalPos pos = new LocalPos(this.viewEntity.posX, this.viewEntity.getEntityBoundingBox().minY, this.viewEntity.posZ);
|
||||||
String dirStr;
|
String dirStr;
|
||||||
switch(this.viewEntity.getHorizontalFacing()) {
|
switch(this.viewEntity.getHorizontalFacing()) {
|
||||||
case NORTH:
|
case NORTH:
|
||||||
|
@ -2059,7 +2028,7 @@ public class Client implements IThreadListener {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatState(BlockPos pos, String desc) {
|
private String formatState(LocalPos pos, String desc) {
|
||||||
State block = this.world.getState(pos);
|
State block = this.world.getState(pos);
|
||||||
|
|
||||||
if(!this.debugWorld) {
|
if(!this.debugWorld) {
|
||||||
|
@ -2390,6 +2359,8 @@ public class Client implements IThreadListener {
|
||||||
GlState.enableBlend();
|
GlState.enableBlend();
|
||||||
GlState.blendFunc(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA);
|
GlState.blendFunc(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA);
|
||||||
this.initConsole();
|
this.initConsole();
|
||||||
|
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
||||||
|
TextureUtil.setParams();
|
||||||
if(this.shaders)
|
if(this.shaders)
|
||||||
ShaderContext.loadShaders();
|
ShaderContext.loadShaders();
|
||||||
this.startSound(true);
|
this.startSound(true);
|
||||||
|
@ -3529,7 +3500,7 @@ public class Client implements IThreadListener {
|
||||||
private void displayTick(int posX, int posY, int posZ) {
|
private void displayTick(int posX, int posY, int posZ) {
|
||||||
int range = 16;
|
int range = 16;
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
MutablePos pos = new MutablePos();
|
||||||
for(int n = 0; n < 1000; n++) {
|
for(int n = 0; n < 1000; n++) {
|
||||||
int x = posX + rand.zrange(range) - rand.zrange(range);
|
int x = posX + rand.zrange(range) - rand.zrange(range);
|
||||||
int y = posY + rand.zrange(range) - rand.zrange(range);
|
int y = posY + rand.zrange(range) - rand.zrange(range);
|
||||||
|
@ -3670,7 +3641,7 @@ public class Client implements IThreadListener {
|
||||||
int x = ExtMath.floord(this.player.posX) + this.world.rand.range(-radius, radius);
|
int x = ExtMath.floord(this.player.posX) + this.world.rand.range(-radius, radius);
|
||||||
int y = ExtMath.floord(this.player.posY) + this.world.rand.range(-radius, radius);
|
int y = ExtMath.floord(this.player.posY) + this.world.rand.range(-radius, radius);
|
||||||
int z = ExtMath.floord(this.player.posZ) + this.world.rand.range(-radius, radius);
|
int z = ExtMath.floord(this.player.posZ) + this.world.rand.range(-radius, radius);
|
||||||
this.world.checkBlockLight(new BlockPos(x, y, z));
|
this.world.checkBlockLight(new LocalPos(x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3851,11 +3822,6 @@ public class Client implements IThreadListener {
|
||||||
return this.tiles;
|
return this.tiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateTexture() {
|
|
||||||
this.textureManager.bindTexture(TextureMap.BLOCKS);
|
|
||||||
TextureUtil.setParams(this.mipmapType != MipmapType.NONE, this.mipmapType == MipmapType.LINEAR);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] genTriwave(int w, int h, int color1, int color2, int color3, int color4, int color5, int color6) {
|
private static byte[] genTriwave(int w, int h, int color1, int color2, int color3, int color4, int color5, int color6) {
|
||||||
byte[] data = new byte[w * h * 4];
|
byte[] data = new byte[w * h * 4];
|
||||||
byte[] color = new byte[24];
|
byte[] color = new byte[24];
|
||||||
|
|
|
@ -19,7 +19,7 @@ import client.window.Keysym;
|
||||||
import common.collect.Lists;
|
import common.collect.Lists;
|
||||||
import common.network.IPlayer;
|
import common.network.IPlayer;
|
||||||
import common.packet.CPacketComplete;
|
import common.packet.CPacketComplete;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.HitPosition;
|
import common.util.HitPosition;
|
||||||
import common.util.Color;
|
import common.util.Color;
|
||||||
|
@ -282,7 +282,7 @@ public class GuiConsole extends Gui implements FieldCallback {
|
||||||
{
|
{
|
||||||
if (currentText.length() >= 1)
|
if (currentText.length() >= 1)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = null;
|
LocalPos blockpos = null;
|
||||||
int eid = -1;
|
int eid = -1;
|
||||||
if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.BLOCK)
|
if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.BLOCK)
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ public class GuiConsole extends Gui implements FieldCallback {
|
||||||
else if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.ENTITY)
|
else if (this.gm.pointed != null && this.gm.pointed.type == HitPosition.ObjectType.ENTITY)
|
||||||
{
|
{
|
||||||
eid = this.gm.pointed.entity.getId();
|
eid = this.gm.pointed.entity.getId();
|
||||||
blockpos = new BlockPos(this.gm.pointed.entity);
|
blockpos = new LocalPos(this.gm.pointed.entity);
|
||||||
}
|
}
|
||||||
if(currentText.startsWith("/")) {
|
if(currentText.startsWith("/")) {
|
||||||
if(this.gm.player != null) {
|
if(this.gm.player != null) {
|
||||||
|
|
|
@ -3,14 +3,14 @@ package client.gui.container;
|
||||||
import common.block.tech.BlockWorkbench;
|
import common.block.tech.BlockWorkbench;
|
||||||
import common.inventory.ContainerWorkbench;
|
import common.inventory.ContainerWorkbench;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class GuiCrafting extends GuiContainer {
|
public class GuiCrafting extends GuiContainer {
|
||||||
private final BlockWorkbench type;
|
private final BlockWorkbench type;
|
||||||
|
|
||||||
public GuiCrafting(EntityNPC inv, World world, BlockWorkbench type) {
|
public GuiCrafting(EntityNPC inv, World world, BlockWorkbench type) {
|
||||||
super(new ContainerWorkbench(inv, world, BlockPos.ORIGIN, type));
|
super(new ContainerWorkbench(inv, world, LocalPos.ORIGIN, type));
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.ySize = 36 + 18 * ((inv.getInventoryCapacity() + 11) / 12) + 18 * this.type.getSize();
|
this.ySize = 36 + 18 * ((inv.getInventoryCapacity() + 11) / 12) + 18 * this.type.getSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,10 +8,10 @@ import client.gui.element.Field;
|
||||||
import client.gui.element.FieldCallback;
|
import client.gui.element.FieldCallback;
|
||||||
import client.network.ClientPlayer;
|
import client.network.ClientPlayer;
|
||||||
import common.packet.CPacketSign;
|
import common.packet.CPacketSign;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
|
|
||||||
public class GuiSign extends Gui implements FieldCallback {
|
public class GuiSign extends Gui implements FieldCallback {
|
||||||
private final BlockPos position;
|
private final LocalPos position;
|
||||||
private final Field[] lines;
|
private final Field[] lines;
|
||||||
private final String[] tempLines;
|
private final String[] tempLines;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class GuiSign extends Gui implements FieldCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GuiSign(BlockPos sign, String[] lines) {
|
public GuiSign(LocalPos sign, String[] lines) {
|
||||||
this.position = sign;
|
this.position = sign;
|
||||||
this.lines = new Field[lines.length];
|
this.lines = new Field[lines.length];
|
||||||
this.tempLines = new String[lines.length];
|
this.tempLines = new String[lines.length];
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class GuiBinds extends GuiOptions {
|
||||||
}
|
}
|
||||||
y += x != 0 ? 1 : 0;
|
y += x != 0 ? 1 : 0;
|
||||||
x = (150 * cols + 2 * (cols - 1) - 482) / 2;
|
x = (150 * cols + 2 * (cols - 1) - 482) / 2;
|
||||||
this.add(new ActButton(x, 96 + y * 34, 482, 0, new ButtonCallback() {
|
this.add(new ActButton(x, 96 + y * 34, 240, 0, new ButtonCallback() {
|
||||||
public void use(ActButton elem, PressType action) {
|
public void use(ActButton elem, PressType action) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
for(Bind bind : Bind.values()) {
|
for(Bind bind : Bind.values()) {
|
||||||
|
@ -65,9 +65,10 @@ public class GuiBinds extends GuiOptions {
|
||||||
GuiBinds.this.reformat();
|
GuiBinds.this.reformat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "Zurücksetzen"));
|
}, "Tasten zurücksetzen"));
|
||||||
this.addSelector("phy_sensitivity", x, 116 + y * 34, 240, 0);
|
this.addSelector("phy_sensitivity", x + 242, 96 + y * 34, 240, 0);
|
||||||
this.addSelector("gui_dclick_delay", x + 242, 116 + y * 34, 240, 0);
|
this.addSelector("gui_dclick_delay", x, 116 + y * 34, 240, 0);
|
||||||
|
this.addSelector("gui_scroll_lines", x + 242, 116 + y * 34, 240, 0);
|
||||||
super.init(width, height);
|
super.init(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,119 +1,35 @@
|
||||||
package client.gui.options;
|
package client.gui.options;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import client.Client;
|
|
||||||
import client.gui.Font;
|
|
||||||
import client.gui.Formatter;
|
|
||||||
import client.gui.element.Dropdown;
|
|
||||||
import client.gui.element.DropdownCallback;
|
|
||||||
import client.gui.element.Element;
|
|
||||||
import client.gui.element.Fill;
|
|
||||||
import client.gui.element.Slider;
|
|
||||||
import client.gui.element.SliderCallback;
|
|
||||||
import client.gui.element.Toggle;
|
|
||||||
import client.gui.element.ToggleCallback;
|
|
||||||
import client.window.Button;
|
|
||||||
import client.window.DisplayMode;
|
|
||||||
import client.window.Window;
|
|
||||||
import common.collect.Lists;
|
|
||||||
import common.util.ExtMath;
|
|
||||||
import common.util.Color;
|
|
||||||
|
|
||||||
public class GuiDisplay extends GuiOptions {
|
public class GuiDisplay extends GuiOptions {
|
||||||
private static final String[] DISTANCES = new String[] {"Gruselig", "Winzig", "Gering", "Normal", "Weit"};
|
|
||||||
|
|
||||||
private Element distanceSlider;
|
|
||||||
|
|
||||||
protected GuiDisplay() {
|
protected GuiDisplay() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(int width, int height) {
|
public void init(int width, int height) {
|
||||||
this.add(new Toggle(0, 0, 240, 0, false, GuiDisplay.this.gm.fullscreen, new ToggleCallback() {
|
this.addSelector("overlay_enabled", 0, 0, 240, 0);
|
||||||
public void use(Toggle elem, boolean value) {
|
this.addSelector("overlay_opacity", 242, 0, 240, 0);
|
||||||
GuiDisplay.this.gm.full(value);
|
|
||||||
}
|
|
||||||
}, "Vollbild"));
|
|
||||||
int maxModes = ExtMath.clampi((height - ((3 * 20 + 2) * 2 + 18 + 4)) / Font.HEIGHT, 4, 28);
|
|
||||||
DisplayMode[] dmodes = Window.getDisplayModes();
|
|
||||||
if(dmodes != null) {
|
|
||||||
List<DisplayMode> modes = Lists.newArrayList();
|
|
||||||
for(int z = dmodes.length - 1; z >= 0 && modes.size() < maxModes; z--) {
|
|
||||||
DisplayMode mode = dmodes[z];
|
|
||||||
if(mode.width() >= Client.MIN_WIDTH && mode.height() >= Client.MIN_HEIGHT)
|
|
||||||
modes.add(0, mode);
|
|
||||||
}
|
|
||||||
if(modes.isEmpty()) {
|
|
||||||
dmodes = null;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
DisplayMode selected = modes.get(modes.size() - 1);
|
|
||||||
for(DisplayMode mode : modes) {
|
|
||||||
if(mode.equals(this.gm.vidMode))
|
|
||||||
selected = mode;
|
|
||||||
}
|
|
||||||
this.add(new Dropdown<DisplayMode>(242, 0, 240, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback<DisplayMode>() {
|
|
||||||
public void use(Dropdown<DisplayMode> elem, DisplayMode value) {
|
|
||||||
GuiDisplay.this.gm.vidMode = value;
|
|
||||||
GuiDisplay.this.gm.full(true);
|
|
||||||
}
|
|
||||||
}, (String)null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(dmodes == null)
|
|
||||||
this.add(new Fill(242, 0, 240, 0, Color.RED + "<?>"));
|
|
||||||
|
|
||||||
this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() {
|
this.addSelector("overlay_fadeout", 0, 20, 240, 0);
|
||||||
public void use(Slider elem, int value) {
|
this.addSelector("chat_permanent", 242, 20, 240, 0);
|
||||||
GuiDisplay.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0)));
|
|
||||||
GuiDisplay.this.gm.setDirty();
|
|
||||||
}
|
|
||||||
}, new Formatter<Slider>() {
|
|
||||||
public String use(Slider elem) {
|
|
||||||
int value = elem.getValue();
|
|
||||||
return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync"));
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
this.addSelector("gl_vsync_flush", 242, 20, 240, 0);
|
|
||||||
|
|
||||||
this.addSelector("overlay_enabled", 0, 50, 240, 0);
|
this.addSelector("console_size", 0, 40, 240, 0);
|
||||||
this.addSelector("overlay_opacity", 242, 50, 240, 0);
|
this.addSelector("chat_size", 242, 40, 240, 0);
|
||||||
|
|
||||||
this.addSelector("overlay_fadeout", 0, 70, 240, 0);
|
this.addSelector("feed_size", 0, 60, 240, 0);
|
||||||
this.addSelector("chat_permanent", 242, 70, 240, 0);
|
this.addSelector("hotbar_size", 242, 60, 240, 0);
|
||||||
|
|
||||||
this.addSelector("console_size", 0, 90, 240, 0);
|
this.addSelector("crosshair_simple", 0, 90, 240, 0);
|
||||||
this.addSelector("chat_size", 242, 90, 240, 0);
|
this.addSelector("crosshair_size", 242, 90, 240, 0);
|
||||||
|
|
||||||
this.addSelector("feed_size", 0, 110, 240, 0);
|
this.addSelector("crosshair_color_notarget", 0, 125, 240, 0);
|
||||||
this.addSelector("hotbar_size", 242, 110, 240, 0);
|
this.addSelector("crosshair_color_target", 242, 125, 240, 0);
|
||||||
|
|
||||||
this.addSelector("gl_fov", 0, 140, 240, 0);
|
this.addSelector("hud_margin", 0, 145, 240, 0);
|
||||||
|
this.addSelector("gui_scale_hotbar", 242, 145, 240, 0);
|
||||||
this.distanceSlider = this.addSelector("chunk_view_distance", 0, 160, 240, 0);
|
|
||||||
this.addSelector("chunk_build_time", 242, 160, 240, 0);
|
|
||||||
|
|
||||||
this.addSelector("chunk_light_updates", 0, 180, 240, 0);
|
|
||||||
this.addSelector("chunk_light_range", 242, 180, 240, 0);
|
|
||||||
|
|
||||||
super.init(width, height);
|
super.init(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return "Grafik und Anzeige";
|
return "Head-Up-Display";
|
||||||
}
|
|
||||||
|
|
||||||
private String getDistanceName() {
|
|
||||||
int distance = this.gm.renderDistance;
|
|
||||||
distance = distance > 16 ? 16 : distance;
|
|
||||||
String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4];
|
|
||||||
if(distance > 2 && (((distance + 1) / 2) & 1) == 1)
|
|
||||||
str = str + "+";
|
|
||||||
return String.format("Sichtweite: %d [%d, %s]", this.gm.renderDistance, this.gm.renderDistance * 16, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateScreen() {
|
|
||||||
if(!Button.isMouseDown())
|
|
||||||
this.distanceSlider.setText(this.getDistanceName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,129 @@
|
||||||
package client.gui.options;
|
package client.gui.options;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import client.Client;
|
||||||
|
import client.gui.Font;
|
||||||
|
import client.gui.Formatter;
|
||||||
|
import client.gui.element.Dropdown;
|
||||||
|
import client.gui.element.DropdownCallback;
|
||||||
import client.gui.element.Fill;
|
import client.gui.element.Fill;
|
||||||
|
import client.gui.element.Label;
|
||||||
|
import client.gui.element.Slider;
|
||||||
|
import client.gui.element.SliderCallback;
|
||||||
|
import client.gui.element.Toggle;
|
||||||
|
import client.gui.element.ToggleCallback;
|
||||||
|
import client.window.DisplayMode;
|
||||||
|
import client.window.Window;
|
||||||
|
import common.collect.Lists;
|
||||||
import common.util.Color;
|
import common.util.Color;
|
||||||
|
import common.util.ExtMath;
|
||||||
|
|
||||||
public class GuiGraphics extends GuiOptions {
|
public class GuiGraphics extends GuiOptions {
|
||||||
|
private static final String[] DISTANCES = new String[] {
|
||||||
|
"Gruselig", "Winzig", "Gering", "Normal", // 0
|
||||||
|
"Weit", "Weiter", "Sehr weit", "Noch weiter", // 16
|
||||||
|
"Extrem", "Extremer", "Sehr extrem", "Extrem extrem", // 32
|
||||||
|
"Überdreht", "Überdrehter", "Sehr überdreht", "GPU aufheizen", "GPU backen" // 48
|
||||||
|
};
|
||||||
|
|
||||||
|
private Label distanceLabel;
|
||||||
|
private Label fovLabel;
|
||||||
|
|
||||||
protected GuiGraphics() {
|
protected GuiGraphics() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(int width, int height) {
|
public void init(int width, int height) {
|
||||||
this.addSelector("draw_downfall_range", 0, 0, 240, 0);
|
this.add(new Toggle(0, 0, 240, 0, false, GuiGraphics.this.gm.fullscreen, new ToggleCallback() {
|
||||||
this.addSelector("draw_rain_particle_range", 242, 0, 240, 0);
|
public void use(Toggle elem, boolean value) {
|
||||||
|
GuiGraphics.this.gm.full(value);
|
||||||
|
}
|
||||||
|
}, "Vollbild"));
|
||||||
|
int maxModes = ExtMath.clampi((height - ((3 * 20 + 2) * 2 + 18 + 4)) / Font.HEIGHT, 4, 28);
|
||||||
|
DisplayMode[] dmodes = Window.getDisplayModes();
|
||||||
|
if(dmodes != null) {
|
||||||
|
List<DisplayMode> modes = Lists.newArrayList();
|
||||||
|
for(int z = dmodes.length - 1; z >= 0 && modes.size() < maxModes; z--) {
|
||||||
|
DisplayMode mode = dmodes[z];
|
||||||
|
if(mode.width() >= Client.MIN_WIDTH && mode.height() >= Client.MIN_HEIGHT)
|
||||||
|
modes.add(0, mode);
|
||||||
|
}
|
||||||
|
if(modes.isEmpty()) {
|
||||||
|
dmodes = null;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DisplayMode selected = modes.get(modes.size() - 1);
|
||||||
|
for(DisplayMode mode : modes) {
|
||||||
|
if(mode.equals(this.gm.vidMode))
|
||||||
|
selected = mode;
|
||||||
|
}
|
||||||
|
this.add(new Dropdown<DisplayMode>(242, 0, 240, 0, false, modes.toArray(new DisplayMode[modes.size()]), modes.get(modes.size() - 1), selected, new DropdownCallback<DisplayMode>() {
|
||||||
|
public void use(Dropdown<DisplayMode> elem, DisplayMode value) {
|
||||||
|
GuiGraphics.this.gm.vidMode = value;
|
||||||
|
GuiGraphics.this.gm.full(true);
|
||||||
|
}
|
||||||
|
}, (String)null));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(dmodes == null)
|
||||||
|
this.add(new Fill(242, 0, 240, 0, Color.RED + "<?>"));
|
||||||
|
|
||||||
this.addSelector("draw_void_particles", 0, 20, 240, 0);
|
this.add(new Slider(0, 20, 240, 0, 0, 0, 360 - 8, 0, (this.gm.sync < 0) ? (360 - 8) : (this.gm.sync != 0 ? ((this.gm.sync < 10) ? 1 : (this.gm.sync - 9)) : 0), new SliderCallback() {
|
||||||
this.addSelector("draw_void_fog", 242, 20, 240, 0);
|
public void use(Slider elem, int value) {
|
||||||
|
GuiGraphics.this.gm.getVar("win_sync").parse("" + ((value > 0 && value < 360 - 8) ? (value + 9) : (value != 0 ? -1 : 0)));
|
||||||
|
GuiGraphics.this.gm.setDirty();
|
||||||
|
}
|
||||||
|
}, new Formatter<Slider>() {
|
||||||
|
public String use(Slider elem) {
|
||||||
|
int value = elem.getValue();
|
||||||
|
return "Max. Bildrate: " + (value > 0 && value < (360 - 8) ? (value + 9) + " FPS" : (value != 0 ? "Unbegrenzt" : "VSync"));
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
this.addSelector("vsync_flush", 242, 20, 240, 0);
|
||||||
|
|
||||||
this.addSelector("draw_player_firstperson", 0, 40, 240, 0);
|
this.distanceLabel = this.add(new Label(0, 55, 240, ""));
|
||||||
|
this.addSelector("chunk_view_distance", 0, 55, 240, 0);
|
||||||
|
this.fovLabel = this.add(new Label(242, 55, 240, ""));
|
||||||
|
this.addSelector("draw_fov", 242, 55, 240, 0);
|
||||||
|
|
||||||
this.addSelector("crosshair_simple", 0, 60, 240, 0);
|
this.addSelector("chunk_light_range", 0, 75, 240, 0);
|
||||||
this.addSelector("crosshair_size", 242, 60, 240, 0);
|
this.addSelector("chunk_light_updates", 242, 75, 240, 0);
|
||||||
|
|
||||||
this.addSelector("crosshair_color_notarget", 0, 100, 240, 0);
|
this.addSelector("chunk_build_time", 0, 95, 240, 0);
|
||||||
this.addSelector("crosshair_color_target", 242, 100, 240, 0);
|
this.addSelector("draw_player_firstperson", 242, 95, 240, 0);
|
||||||
|
|
||||||
this.addSelector("hud_margin", 0, 140, 240, 0);
|
this.addSelector("draw_downfall_range", 0, 115, 240, 0);
|
||||||
|
this.addSelector("draw_rain_particle_range", 242, 115, 240, 0);
|
||||||
|
|
||||||
|
this.addSelector("draw_void_particles", 0, 135, 240, 0);
|
||||||
|
this.addSelector("draw_void_fog", 242, 135, 240, 0);
|
||||||
|
|
||||||
if(this.gm.shaders)
|
if(this.gm.shaders)
|
||||||
this.addSelector("gl_use_shader", 0, 180, 240, 0);
|
this.addSelector("draw_use_shader", 0, 155, 240, 0);
|
||||||
else
|
else
|
||||||
this.add(new Fill(0, 180, 240, 0, Color.RED + "Shader nicht unterstützt"));
|
this.add(new Fill(0, 155, 240, 0, Color.RED + "Shader nicht unterstützt"));
|
||||||
if(this.gm.mipmaps)
|
|
||||||
this.addSelector("gl_tex_mipmaps", 242, 180, 240, 0);
|
|
||||||
else
|
|
||||||
this.add(new Fill(242, 180, 240, 0, Color.RED + "Mipmaps nicht unterstützt"));
|
|
||||||
|
|
||||||
super.init(width, height);
|
super.init(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
return "Darstellung";
|
return "Grafik und Anzeige";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDistanceName() {
|
||||||
|
int distance = this.gm.renderDistance;
|
||||||
|
String str = distance < 0 ? DISTANCES[0] : DISTANCES[(distance + 1) / 4];
|
||||||
|
if(distance > 2 && (((distance + 1) / 2) & 1) == 1)
|
||||||
|
str = str + "+";
|
||||||
|
return String.format("%d Blöcke, %s", this.gm.renderDistance * 16, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getFovName() {
|
||||||
|
return this.gm.fov < 25.0f ? "Fernglas" : (this.gm.fov > 120.0f ? "Pro-Gamer TM" : "Normal");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateScreen() {
|
||||||
|
this.distanceLabel.setText(this.getDistanceName());
|
||||||
|
this.fovLabel.setText(this.getFovName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,11 @@ public class GuiSound extends GuiOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(int width, int height) {
|
public void init(int width, int height) {
|
||||||
|
this.addSelector("mid_opl_voices", 0, 0, 240, 0);
|
||||||
|
this.addSelector("mid_opl_bank", 242, 0, 240, 0);
|
||||||
|
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 30;
|
||||||
for(Volume volume : Volume.values()) {
|
for(Volume volume : Volume.values()) {
|
||||||
this.addSelector(volume.getCVarName(), x, y, 240, 0);
|
this.addSelector(volume.getCVarName(), x, y, 240, 0);
|
||||||
x = (x == 0) ? 242 : 0;
|
x = (x == 0) ? 242 : 0;
|
||||||
|
@ -19,21 +22,17 @@ public class GuiSound extends GuiOptions {
|
||||||
y += 20;
|
y += 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addSelector("snd_enabled", 0, 50, 240, 0);
|
this.addSelector("snd_enabled", 0, 80, 240, 0);
|
||||||
|
|
||||||
this.addSelector("snd_buffer_size", 0, 70, 240, 0);
|
this.addSelector("snd_buffer_size", 0, 100, 240, 0);
|
||||||
this.addSelector("snd_frame_size", 242, 70, 240, 0);
|
this.addSelector("snd_frame_size", 242, 100, 240, 0);
|
||||||
|
|
||||||
this.add(new ActButton(0, 100, 482, 0, new ButtonCallback() {
|
this.add(new ActButton(0, 120, 482, 0, new ButtonCallback() {
|
||||||
public void use(ActButton elem, PressType action) {
|
public void use(ActButton elem, PressType action) {
|
||||||
GuiSound.this.gm.restartSound(false);
|
GuiSound.this.gm.restartSound(false);
|
||||||
}
|
}
|
||||||
}, "Übernehmen und Audio neu starten"));
|
}, "Übernehmen und Audio neu starten"));
|
||||||
|
|
||||||
|
|
||||||
this.addSelector("mid_opl_voices", 0, 130, 240, 0);
|
|
||||||
this.addSelector("mid_opl_bank", 242, 130, 240, 0);
|
|
||||||
|
|
||||||
this.addSelector("mid_velocity_func", 0, 150, 240, 0);
|
this.addSelector("mid_velocity_func", 0, 150, 240, 0);
|
||||||
this.addSelector("mid_keep_notes", 242, 150, 240, 0);
|
this.addSelector("mid_keep_notes", 242, 150, 240, 0);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import client.gui.element.ButtonCallback;
|
||||||
import client.gui.element.Element;
|
import client.gui.element.Element;
|
||||||
import client.gui.element.Field;
|
import client.gui.element.Field;
|
||||||
import client.gui.element.PressType;
|
import client.gui.element.PressType;
|
||||||
import client.vars.CVar;
|
|
||||||
import client.vars.ColorVar;
|
import client.vars.ColorVar;
|
||||||
|
|
||||||
public class GuiStyle extends GuiOptions {
|
public class GuiStyle extends GuiOptions {
|
||||||
|
@ -31,22 +30,19 @@ public class GuiStyle extends GuiOptions {
|
||||||
protected GuiStyle() {
|
protected GuiStyle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Element addSelector(String cvar, int x, int y, int w, int h) {
|
protected Element addColorSelector(String cvar, int x, int y, int w, int h) {
|
||||||
CVar cv = this.gm.getVar(cvar);
|
ColorVar color = (ColorVar)this.gm.getVar(cvar);
|
||||||
if(cv instanceof ColorVar color) {
|
this.add(color.label(x, y, w));
|
||||||
this.add(color.label(x, y, w));
|
if(this.gm.style != Style.CUSTOM)
|
||||||
if(this.gm.style != Style.CUSTOM)
|
return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style)));
|
||||||
return this.add(new Field(x, y, w, h, color.getFieldValue(this.gm.style)));
|
else
|
||||||
else
|
return this.add(color.editor(x, y, w, h));
|
||||||
return this.add(color.editor(x, y, w, h));
|
|
||||||
}
|
|
||||||
return super.addSelector(cvar, x, y, w, h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(int width, int height) {
|
public void init(int width, int height) {
|
||||||
for(int z = 0; z < STYLE_CVARS.length; z++) {
|
for(int z = 0; z < STYLE_CVARS.length; z++) {
|
||||||
if(STYLE_CVARS[z] != null)
|
if(STYLE_CVARS[z] != null)
|
||||||
this.addSelector(STYLE_CVARS[z], (z / 3) * 120, (z % 3) * 34, 118, 0);
|
this.addColorSelector(STYLE_CVARS[z], (z / 3) * 120, (z % 3) * 34, 118, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addSelector("gui_theme", 0, 3 * 34, 240, 0);
|
this.addSelector("gui_theme", 0, 3 * 34, 240, 0);
|
||||||
|
@ -76,8 +72,9 @@ public class GuiStyle extends GuiOptions {
|
||||||
|
|
||||||
this.addSelector("gui_scale", 0, 3 * 34 + 20, 240, 0);
|
this.addSelector("gui_scale", 0, 3 * 34 + 20, 240, 0);
|
||||||
this.addSelector("gui_font", 242, 3 * 34 + 20, 240, 0);
|
this.addSelector("gui_font", 242, 3 * 34 + 20, 240, 0);
|
||||||
|
|
||||||
this.addSelector("gui_scale_items", 0, 3 * 34 + 40, 240, 0);
|
this.addSelector("gui_scale_items", 0, 3 * 34 + 40, 240, 0);
|
||||||
this.addSelector("gui_scale_hotbar", 242, 3 * 34 + 40, 240, 0);
|
|
||||||
super.init(width, height);
|
super.init(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,11 +128,11 @@ import common.tileentity.Device;
|
||||||
import common.tileentity.TileEntityDisplay;
|
import common.tileentity.TileEntityDisplay;
|
||||||
import common.tileentity.TileEntityItemPipe;
|
import common.tileentity.TileEntityItemPipe;
|
||||||
import common.tileentity.TileEntitySign;
|
import common.tileentity.TileEntitySign;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Pair;
|
import common.util.Pair;
|
||||||
import common.util.ParticleType;
|
import common.util.ParticleType;
|
||||||
import common.util.BlockPos.MutableBlockPos;
|
|
||||||
import common.util.Equipment;
|
import common.util.Equipment;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.village.MerchantRecipeList;
|
import common.village.MerchantRecipeList;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.Weather;
|
import common.world.Weather;
|
||||||
|
@ -1047,7 +1047,7 @@ public class ClientPlayer implements IClientPlayer
|
||||||
else
|
else
|
||||||
this.gm.world.clientParticle(ParticleType.EXPLOSION_LARGE, packetIn.getX(), packetIn.getY(), packetIn.getZ(), 100);
|
this.gm.world.clientParticle(ParticleType.EXPLOSION_LARGE, packetIn.getX(), packetIn.getY(), packetIn.getZ(), 100);
|
||||||
if(packetIn.getBlocks() != null) {
|
if(packetIn.getBlocks() != null) {
|
||||||
for(BlockPos pos : packetIn.getBlocks()) {
|
for(LocalPos pos : packetIn.getBlocks()) {
|
||||||
double d0 = (double)((float)pos.getX() + this.gm.world.rand.floatv());
|
double d0 = (double)((float)pos.getX() + this.gm.world.rand.floatv());
|
||||||
double d1 = (double)((float)pos.getY() + this.gm.world.rand.floatv());
|
double d1 = (double)((float)pos.getY() + this.gm.world.rand.floatv());
|
||||||
double d2 = (double)((float)pos.getZ() + this.gm.world.rand.floatv());
|
double d2 = (double)((float)pos.getZ() + this.gm.world.rand.floatv());
|
||||||
|
@ -1371,12 +1371,12 @@ public class ClientPlayer implements IClientPlayer
|
||||||
this.gm.effectRenderer.spawnParticle(this.gm.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, 0);
|
this.gm.effectRenderer.spawnParticle(this.gm.getRenderViewEntity(), particle, xCoord, yCoord, zCoord, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playSoundAtPos(BlockPos pos, SoundEvent sound, float volume)
|
private void playSoundAtPos(LocalPos pos, SoundEvent sound, float volume)
|
||||||
{
|
{
|
||||||
this.gm.getSoundManager().playSound(new PositionedSound(sound, volume, (float)pos.getX() + 0.5f, (float)pos.getY() + 0.5f, (float)pos.getZ() + 0.5f));
|
this.gm.getSoundManager().playSound(new PositionedSound(sound, volume, (float)pos.getX() + 0.5f, (float)pos.getY() + 0.5f, (float)pos.getZ() + 0.5f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void playAuxSFX(int sfxType, BlockPos blockPosIn, int data)
|
public void playAuxSFX(int sfxType, LocalPos blockPosIn, int data)
|
||||||
{
|
{
|
||||||
switch (sfxType)
|
switch (sfxType)
|
||||||
{
|
{
|
||||||
|
@ -1461,7 +1461,7 @@ public class ClientPlayer implements IClientPlayer
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1025:
|
case 1025:
|
||||||
MutableBlockPos pos = new MutableBlockPos(blockPosIn.getX(), blockPosIn.getY(), blockPosIn.getZ());
|
MutablePos pos = new MutablePos(blockPosIn.getX(), blockPosIn.getY(), blockPosIn.getZ());
|
||||||
for(int z = 0; z < 1000; z++) {
|
for(int z = 0; z < 1000; z++) {
|
||||||
this.spawnParticle(ParticleType.EXPLOSION_HUGE,
|
this.spawnParticle(ParticleType.EXPLOSION_HUGE,
|
||||||
(double)pos.getX() + this.rand.gaussian() * 128.0, (double)pos.getY() + this.rand.gaussian() * 2.0, (double)pos.getZ() + this.rand.gaussian() * 128.0);
|
(double)pos.getX() + this.rand.gaussian() * 128.0, (double)pos.getY() + this.rand.gaussian() * 2.0, (double)pos.getZ() + this.rand.gaussian() * 128.0);
|
||||||
|
|
|
@ -21,7 +21,7 @@ import common.init.ItemRegistry;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
import common.item.consumable.ItemPotion;
|
import common.item.consumable.ItemPotion;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.ParticleType;
|
import common.util.ParticleType;
|
||||||
|
@ -77,7 +77,7 @@ public class EffectRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBrightness(float partial) {
|
public int getBrightness(float partial) {
|
||||||
BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ);
|
LocalPos pos = new LocalPos(this.posX, this.posY, this.posZ);
|
||||||
return world.isBlockLoaded(pos) ? world.getCombinedBrightness(pos) : 0;
|
return world.isBlockLoaded(pos) ? world.getCombinedBrightness(pos) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ public class EffectRenderer {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
|
LocalPos blockpos = new LocalPos(this.posX, this.posY, this.posZ);
|
||||||
State iblockstate = world.getState(blockpos);
|
State iblockstate = world.getState(blockpos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
block.setBlockBounds(world, blockpos);
|
block.setBlockBounds(world, blockpos);
|
||||||
|
@ -1078,7 +1078,7 @@ public class EffectRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void destroyBlock(BlockPos pos, State state) {
|
public void destroyBlock(LocalPos pos, State state) {
|
||||||
if(state.getBlock() != Blocks.air) {
|
if(state.getBlock() != Blocks.air) {
|
||||||
state = state.getBlock().getState(state, this.world, pos);
|
state = state.getBlock().getState(state, this.world, pos);
|
||||||
int i = 4;
|
int i = 4;
|
||||||
|
@ -1096,7 +1096,7 @@ public class EffectRenderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void damageBlock(BlockPos pos, Facing side) {
|
public void damageBlock(LocalPos pos, Facing side) {
|
||||||
State iblockstate = this.world.getState(pos);
|
State iblockstate = this.world.getState(pos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import common.init.Blocks;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
import common.item.ItemAction;
|
import common.item.ItemAction;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -68,12 +68,12 @@ public class ItemRenderer
|
||||||
float f1 = 0.6F;
|
float f1 = 0.6F;
|
||||||
float f2 = 0.0F;
|
float f2 = 0.0F;
|
||||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_POSITION, setColorBuffer(
|
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_POSITION, setColorBuffer(
|
||||||
(float)LIGHT0_POS.xCoord, (float)LIGHT0_POS.yCoord, (float)LIGHT0_POS.zCoord, 0.0f));
|
(float)LIGHT0_POS.x, (float)LIGHT0_POS.y, (float)LIGHT0_POS.z, 0.0f));
|
||||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F));
|
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F));
|
||||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F));
|
GL15.glLightfv(GL15.GL_LIGHT0, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F));
|
||||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_POSITION, setColorBuffer(
|
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_POSITION, setColorBuffer(
|
||||||
(float)LIGHT1_POS.xCoord, (float)LIGHT1_POS.yCoord, (float)LIGHT1_POS.zCoord, 0.0f));
|
(float)LIGHT1_POS.x, (float)LIGHT1_POS.y, (float)LIGHT1_POS.z, 0.0f));
|
||||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F));
|
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_DIFFUSE, setColorBuffer(f1, f1, f1, 1.0F));
|
||||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_AMBIENT, setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F));
|
||||||
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F));
|
GL15.glLightfv(GL15.GL_LIGHT1, GL15.GL_SPECULAR, setColorBuffer(f2, f2, f2, 1.0F));
|
||||||
|
@ -126,7 +126,7 @@ public class ItemRenderer
|
||||||
|
|
||||||
private void setLightMapFromPlayer(EntityNPC clientPlayer)
|
private void setLightMapFromPlayer(EntityNPC clientPlayer)
|
||||||
{
|
{
|
||||||
int i = this.gm.renderer.getCombinedBrightness(new BlockPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ));
|
int i = this.gm.renderer.getCombinedBrightness(new LocalPos(clientPlayer.posX, clientPlayer.posY + (double)clientPlayer.getEyeHeight(), clientPlayer.posZ));
|
||||||
float f = (float)(i & 65535);
|
float f = (float)(i & 65535);
|
||||||
float f1 = (float)(i >> 16);
|
float f1 = (float)(i >> 16);
|
||||||
GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, f, f1);
|
GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, f, f1);
|
||||||
|
@ -394,7 +394,7 @@ public class ItemRenderer
|
||||||
|
|
||||||
if (this.gm.player.isEntityInsideOpaqueBlock())
|
if (this.gm.player.isEntityInsideOpaqueBlock())
|
||||||
{
|
{
|
||||||
State iblockstate = this.gm.world.getState(new BlockPos(this.gm.player));
|
State iblockstate = this.gm.world.getState(new LocalPos(this.gm.player));
|
||||||
EntityNPC entityplayer = this.gm.player;
|
EntityNPC entityplayer = this.gm.player;
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i)
|
for (int i = 0; i < 8; ++i)
|
||||||
|
@ -402,7 +402,7 @@ public class ItemRenderer
|
||||||
double d0 = entityplayer.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayer.width * 0.8F);
|
double d0 = entityplayer.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayer.width * 0.8F);
|
||||||
double d1 = entityplayer.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F);
|
double d1 = entityplayer.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F);
|
||||||
double d2 = entityplayer.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayer.width * 0.8F);
|
double d2 = entityplayer.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayer.width * 0.8F);
|
||||||
BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2);
|
LocalPos blockpos = new LocalPos(d0, d1 + (double)entityplayer.getEyeHeight(), d2);
|
||||||
State iblockstate1 = this.gm.world.getState(blockpos);
|
State iblockstate1 = this.gm.world.getState(blockpos);
|
||||||
|
|
||||||
if (iblockstate1.getBlock().isVisuallyOpaque())
|
if (iblockstate1.getBlock().isVisuallyOpaque())
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.block.Block;
|
||||||
import common.block.liquid.BlockLiquid;
|
import common.block.liquid.BlockLiquid;
|
||||||
import common.entity.Entity;
|
import common.entity.Entity;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -58,12 +58,12 @@ public class MatrixState {
|
||||||
double x = entity.prevX + (entity.posX - entity.prevX) * partial;
|
double x = entity.prevX + (entity.posX - entity.prevX) * partial;
|
||||||
double y = entity.prevY + (entity.posY - entity.prevY) * partial;
|
double y = entity.prevY + (entity.posY - entity.prevY) * partial;
|
||||||
double z = entity.prevZ + (entity.posZ - entity.prevZ) * partial;
|
double z = entity.prevZ + (entity.posZ - entity.prevZ) * partial;
|
||||||
return new Vec3(x + position.xCoord, y + position.yCoord, z + position.zCoord);
|
return new Vec3(x + position.x, y + position.y, z + position.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block getLookedBlock(World world, Entity entity, float partial) {
|
public static Block getLookedBlock(World world, Entity entity, float partial) {
|
||||||
Vec3 view = project(entity, (double)partial);
|
Vec3 view = project(entity, (double)partial);
|
||||||
BlockPos pos = new BlockPos(view);
|
LocalPos pos = new LocalPos(view);
|
||||||
State state = world.getState(pos);
|
State state = world.getState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if(block.getMaterial().isLiquid()) {
|
if(block.getMaterial().isLiquid()) {
|
||||||
|
@ -71,7 +71,7 @@ public class MatrixState {
|
||||||
if(state.getBlock() instanceof BlockLiquid)
|
if(state.getBlock() instanceof BlockLiquid)
|
||||||
height = BlockLiquid.getLiquidHeightPercent(((Integer)state.getValue(BlockLiquid.LEVEL)).intValue()) - 0.11111111F;
|
height = BlockLiquid.getLiquidHeightPercent(((Integer)state.getValue(BlockLiquid.LEVEL)).intValue()) - 0.11111111F;
|
||||||
float y = (float)(pos.getY() + 1) - height;
|
float y = (float)(pos.getY() + 1) - height;
|
||||||
if(view.yCoord >= (double)y)
|
if(view.y >= (double)y)
|
||||||
block = world.getState(pos.up()).getBlock();
|
block = world.getState(pos.up()).getBlock();
|
||||||
}
|
}
|
||||||
return block;
|
return block;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import client.world.ChunkClient;
|
||||||
import client.Client;
|
import client.Client;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Vec3i;
|
import common.util.Vec3i;
|
||||||
import common.world.IWorldAccess;
|
import common.world.IWorldAccess;
|
||||||
|
@ -21,12 +21,12 @@ public class RegionRenderCache implements IWorldAccess
|
||||||
private final int zPos;
|
private final int zPos;
|
||||||
private final ChunkClient[][] chunks;
|
private final ChunkClient[][] chunks;
|
||||||
private final boolean sky;
|
private final boolean sky;
|
||||||
private final BlockPos position;
|
private final LocalPos position;
|
||||||
private final boolean empty;
|
private final boolean empty;
|
||||||
private int[] combinedLights;
|
private int[] combinedLights;
|
||||||
private State[] blockStates;
|
private State[] blockStates;
|
||||||
|
|
||||||
public RegionRenderCache(Client world, BlockPos from, BlockPos to, int sub)
|
public RegionRenderCache(Client world, LocalPos from, LocalPos to, int sub)
|
||||||
{
|
{
|
||||||
this.sky = world.world.dimension.hasSkyLight();
|
this.sky = world.world.dimension.hasSkyLight();
|
||||||
this.xPos = from.getX() - sub >> 4;
|
this.xPos = from.getX() - sub >> 4;
|
||||||
|
@ -62,14 +62,14 @@ public class RegionRenderCache implements IWorldAccess
|
||||||
this.blockStates = new State[16000];
|
this.blockStates = new State[16000];
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntity getTileEntity(BlockPos pos)
|
public TileEntity getTileEntity(LocalPos pos)
|
||||||
{
|
{
|
||||||
int i = (pos.getX() >> 4) - this.xPos;
|
int i = (pos.getX() >> 4) - this.xPos;
|
||||||
int j = (pos.getZ() >> 4) - this.zPos;
|
int j = (pos.getZ() >> 4) - this.zPos;
|
||||||
return this.chunks[i][j].getTileEntity(pos, TileEntity.CreateMode.QUEUED);
|
return this.chunks[i][j].getTileEntity(pos, TileEntity.CreateMode.QUEUED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCombinedLight(BlockPos pos)
|
public int getCombinedLight(LocalPos pos)
|
||||||
{
|
{
|
||||||
int i = this.getPositionIndex(pos);
|
int i = this.getPositionIndex(pos);
|
||||||
int j = this.combinedLights[i];
|
int j = this.combinedLights[i];
|
||||||
|
@ -83,7 +83,7 @@ public class RegionRenderCache implements IWorldAccess
|
||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getState(BlockPos pos)
|
public State getState(LocalPos pos)
|
||||||
{
|
{
|
||||||
int i = this.getPositionIndex(pos);
|
int i = this.getPositionIndex(pos);
|
||||||
State iblockstate = this.blockStates[i];
|
State iblockstate = this.blockStates[i];
|
||||||
|
@ -97,7 +97,7 @@ public class RegionRenderCache implements IWorldAccess
|
||||||
return iblockstate;
|
return iblockstate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private State getBlockStateRaw(BlockPos pos)
|
private State getBlockStateRaw(LocalPos pos)
|
||||||
{
|
{
|
||||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||||
{
|
{
|
||||||
|
@ -111,7 +111,7 @@ public class RegionRenderCache implements IWorldAccess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getPositionIndex(BlockPos p_175630_1_)
|
private int getPositionIndex(LocalPos p_175630_1_)
|
||||||
{
|
{
|
||||||
int i = p_175630_1_.getX() - this.position.getX();
|
int i = p_175630_1_.getX() - this.position.getX();
|
||||||
int j = p_175630_1_.getY() - this.position.getY();
|
int j = p_175630_1_.getY() - this.position.getY();
|
||||||
|
@ -124,7 +124,7 @@ public class RegionRenderCache implements IWorldAccess
|
||||||
return this.empty;
|
return this.empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getBlockLightExt(BlockPos pos)
|
private int getBlockLightExt(LocalPos pos)
|
||||||
{
|
{
|
||||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ public class RegionRenderCache implements IWorldAccess
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getBlockLight(BlockPos pos)
|
private int getBlockLight(LocalPos pos)
|
||||||
{
|
{
|
||||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -45,7 +45,6 @@ import common.collect.Lists;
|
||||||
import common.collect.Maps;
|
import common.collect.Maps;
|
||||||
import common.collect.Sets;
|
import common.collect.Sets;
|
||||||
import common.dimension.DimType;
|
import common.dimension.DimType;
|
||||||
import common.dimension.Shader;
|
|
||||||
import common.effect.Effect;
|
import common.effect.Effect;
|
||||||
import common.entity.Entity;
|
import common.entity.Entity;
|
||||||
import common.entity.npc.EntityCameraHolder;
|
import common.entity.npc.EntityCameraHolder;
|
||||||
|
@ -60,12 +59,13 @@ import common.rng.Random;
|
||||||
import common.sound.PositionedSound;
|
import common.sound.PositionedSound;
|
||||||
import common.sound.Sound;
|
import common.sound.Sound;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.HitPosition;
|
import common.util.HitPosition;
|
||||||
import common.util.InheritanceMultiMap;
|
import common.util.InheritanceMultiMap;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.util.Pair;
|
import common.util.Pair;
|
||||||
import common.util.HitPosition.ObjectType;
|
import common.util.HitPosition.ObjectType;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
|
@ -119,7 +119,7 @@ public class Renderer {
|
||||||
private final RenderManager renderManager;
|
private final RenderManager renderManager;
|
||||||
private final ModelManager manager;
|
private final ModelManager manager;
|
||||||
private final Set<TileEntity> setTileEntities = Sets.<TileEntity>newHashSet();
|
private final Set<TileEntity> setTileEntities = Sets.<TileEntity>newHashSet();
|
||||||
private final Map<BlockPos, Sound> mapSoundPositions = Maps.<BlockPos, Sound>newHashMap();
|
private final Map<LocalPos, Sound> mapSoundPositions = Maps.<LocalPos, Sound>newHashMap();
|
||||||
private final Map<BlockLiquid, Sprite[]> fluids = Maps.newHashMap();
|
private final Map<BlockLiquid, Sprite[]> fluids = Maps.newHashMap();
|
||||||
private final Map<Block, Sprite> dynamic = Maps.newHashMap();
|
private final Map<Block, Sprite> dynamic = Maps.newHashMap();
|
||||||
|
|
||||||
|
@ -308,15 +308,15 @@ public class Renderer {
|
||||||
|
|
||||||
if (this.gm.pointed != null)
|
if (this.gm.pointed != null)
|
||||||
{
|
{
|
||||||
dist = this.gm.pointed.vec.distanceTo(eye);
|
dist = this.gm.pointed.vec.distance(eye);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3 look = entity.getLook(partialTicks);
|
Vec3 look = entity.getLook(partialTicks);
|
||||||
Vec3 eyelook = eye.addVector(look.xCoord * max, look.yCoord * max, look.zCoord * max);
|
Vec3 eyelook = eye.add(look.x * max, look.y * max, look.z * max);
|
||||||
this.pointedEntity = null;
|
this.pointedEntity = null;
|
||||||
Vec3 hit = null;
|
Vec3 hit = null;
|
||||||
float exp = 1.0F;
|
float exp = 1.0F;
|
||||||
List<Entity> list = this.gm.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(look.xCoord * max, look.yCoord * max, look.zCoord * max).expand((double)exp, (double)exp, (double)exp), new Predicate<Entity>()
|
List<Entity> list = this.gm.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().addCoord(look.x * max, look.y * max, look.z * max).expand((double)exp, (double)exp, (double)exp), new Predicate<Entity>()
|
||||||
{
|
{
|
||||||
public boolean test(Entity p_apply_1_)
|
public boolean test(Entity p_apply_1_)
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
else if (objpos != null)
|
else if (objpos != null)
|
||||||
{
|
{
|
||||||
double eyehit = eye.distanceTo(objpos.vec);
|
double eyehit = eye.distance(objpos.vec);
|
||||||
|
|
||||||
if (eyehit < edist || edist == 0.0D)
|
if (eyehit < edist || edist == 0.0D)
|
||||||
{
|
{
|
||||||
|
@ -642,7 +642,7 @@ public class Renderer {
|
||||||
|
|
||||||
if (movingobjectposition != null)
|
if (movingobjectposition != null)
|
||||||
{
|
{
|
||||||
double d7 = movingobjectposition.vec.distanceTo(new Vec3(d0, d1, d2));
|
double d7 = movingobjectposition.vec.distance(new Vec3(d0, d1, d2));
|
||||||
|
|
||||||
if (d7 < d3)
|
if (d7 < d3)
|
||||||
{
|
{
|
||||||
|
@ -860,7 +860,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vec3 getSkyColor(Entity entity, float partial) {
|
private Vec3 getSkyColor(Entity entity, float partial) {
|
||||||
BlockPos pos = new BlockPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
|
LocalPos pos = new LocalPos(ExtMath.floord(entity.posX), ExtMath.floord(entity.posY),
|
||||||
ExtMath.floord(entity.posZ));
|
ExtMath.floord(entity.posZ));
|
||||||
Vec3 vec;
|
Vec3 vec;
|
||||||
if(this.gm.world.dimension.isExterminated())
|
if(this.gm.world.dimension.isExterminated())
|
||||||
|
@ -869,11 +869,11 @@ public class Renderer {
|
||||||
vec = new Vec3(this.gm.world.dimension.getSkyColor());
|
vec = new Vec3(this.gm.world.dimension.getSkyColor());
|
||||||
if(this.gm.world.dimension.hasDaylight()) {
|
if(this.gm.world.dimension.hasDaylight()) {
|
||||||
float mult = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partial)) * 2.0F + 0.5F, 0.0F, 1.0F);
|
float mult = ExtMath.clampf(ExtMath.cos(this.getDayPhase(partial)) * 2.0F + 0.5F, 0.0F, 1.0F);
|
||||||
vec = new Vec3(vec.xCoord * mult, vec.yCoord * mult, vec.zCoord * mult);
|
vec = new Vec3(vec.x * mult, vec.y * mult, vec.z * mult);
|
||||||
}
|
}
|
||||||
float r = (float)vec.xCoord;
|
float r = (float)vec.x;
|
||||||
float g = (float)vec.yCoord;
|
float g = (float)vec.y;
|
||||||
float b = (float)vec.zCoord;
|
float b = (float)vec.z;
|
||||||
|
|
||||||
float rain = this.gm.world.getRainStrength();
|
float rain = this.gm.world.getRainStrength();
|
||||||
if(rain > 0.0F) {
|
if(rain > 0.0F) {
|
||||||
|
@ -898,9 +898,9 @@ public class Renderer {
|
||||||
if(light > 1.0F)
|
if(light > 1.0F)
|
||||||
light = 1.0F;
|
light = 1.0F;
|
||||||
// light = light * 0.45F;
|
// light = light * 0.45F;
|
||||||
r = r * (1.0F - light) + (float)this.lightColor.xCoord * light;
|
r = r * (1.0F - light) + (float)this.lightColor.x * light;
|
||||||
g = g * (1.0F - light) + (float)this.lightColor.yCoord * light;
|
g = g * (1.0F - light) + (float)this.lightColor.y * light;
|
||||||
b = b * (1.0F - light) + (float)this.lightColor.zCoord * light;
|
b = b * (1.0F - light) + (float)this.lightColor.z * light;
|
||||||
}
|
}
|
||||||
|
|
||||||
float space = this.getSpaceFactor();
|
float space = this.getSpaceFactor();
|
||||||
|
@ -917,9 +917,9 @@ public class Renderer {
|
||||||
Vec3 color = new Vec3(this.gm.world.dimension.getCloudColor());
|
Vec3 color = new Vec3(this.gm.world.dimension.getCloudColor());
|
||||||
if(this.gm.world.dimension.isExterminated())
|
if(this.gm.world.dimension.isExterminated())
|
||||||
color = new Vec3(0x000000);
|
color = new Vec3(0x000000);
|
||||||
float r = (float)color.xCoord;
|
float r = (float)color.x;
|
||||||
float g = (float)color.yCoord;
|
float g = (float)color.y;
|
||||||
float b = (float)color.zCoord;
|
float b = (float)color.z;
|
||||||
|
|
||||||
float rain = this.gm.world.getRainStrength();
|
float rain = this.gm.world.getRainStrength();
|
||||||
if(rain > 0.0F) {
|
if(rain > 0.0F) {
|
||||||
|
@ -1003,9 +1003,9 @@ public class Renderer {
|
||||||
{
|
{
|
||||||
Vec3 lightColor = new Vec3(world.dimension.getLightColor());
|
Vec3 lightColor = new Vec3(world.dimension.getLightColor());
|
||||||
float light = world.dimension.hasSkyLight() ? Math.max(sky, brightness) : 1.0f;
|
float light = world.dimension.hasSkyLight() ? Math.max(sky, brightness) : 1.0f;
|
||||||
red = (float)lightColor.xCoord * light;
|
red = (float)lightColor.x * light;
|
||||||
green = (float)lightColor.yCoord * light;
|
green = (float)lightColor.y * light;
|
||||||
blue = (float)lightColor.zCoord * light;
|
blue = (float)lightColor.z * light;
|
||||||
}
|
}
|
||||||
if(space > 0.0f) {
|
if(space > 0.0f) {
|
||||||
red = red * (1.0F - space) + space;
|
red = red * (1.0F - space) + space;
|
||||||
|
@ -1018,9 +1018,9 @@ public class Renderer {
|
||||||
if(intens > 1.0F)
|
if(intens > 1.0F)
|
||||||
intens = 1.0F;
|
intens = 1.0F;
|
||||||
float light = world.dimension.hasSkyLight() ? rsky : 1.0f;
|
float light = world.dimension.hasSkyLight() ? rsky : 1.0f;
|
||||||
red = red * (1.0F - intens) + (float)this.lightColor.xCoord * light * intens;
|
red = red * (1.0F - intens) + (float)this.lightColor.x * light * intens;
|
||||||
green = green * (1.0F - intens) + (float)this.lightColor.yCoord * light * intens;
|
green = green * (1.0F - intens) + (float)this.lightColor.y * light * intens;
|
||||||
blue = blue * (1.0F - intens) + (float)this.lightColor.zCoord * light * intens;
|
blue = blue * (1.0F - intens) + (float)this.lightColor.z * light * intens;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(block > 1.0F)
|
if(block > 1.0F)
|
||||||
|
@ -1320,7 +1320,7 @@ public class Renderer {
|
||||||
this.rng.setSeed((long)this.rendererUpdateCount * 312987231L);
|
this.rng.setSeed((long)this.rendererUpdateCount * 312987231L);
|
||||||
Entity entity = this.gm.getRenderViewEntity();
|
Entity entity = this.gm.getRenderViewEntity();
|
||||||
World world = this.gm.world;
|
World world = this.gm.world;
|
||||||
BlockPos blockpos = new BlockPos(entity);
|
LocalPos blockpos = new LocalPos(entity);
|
||||||
int i = this.gm.rainParticleRange;
|
int i = this.gm.rainParticleRange;
|
||||||
if(i <= 0)
|
if(i <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1344,8 +1344,8 @@ public class Renderer {
|
||||||
|
|
||||||
for (int l = 0; l < k; ++l)
|
for (int l = 0; l < k; ++l)
|
||||||
{
|
{
|
||||||
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.rng.zrange(i) - this.rng.zrange(i), 0, this.rng.zrange(i) - this.rng.zrange(i)));
|
LocalPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.rng.zrange(i) - this.rng.zrange(i), 0, this.rng.zrange(i) - this.rng.zrange(i)));
|
||||||
BlockPos blockpos2 = blockpos1.down();
|
LocalPos blockpos2 = blockpos1.down();
|
||||||
Block block = world.getState(blockpos2).getBlock();
|
Block block = world.getState(blockpos2).getBlock();
|
||||||
float temp = world.getTemperatureC(blockpos1);
|
float temp = world.getTemperatureC(blockpos1);
|
||||||
|
|
||||||
|
@ -1431,7 +1431,7 @@ public class Renderer {
|
||||||
float tic = (float)this.rendererUpdateCount + partial;
|
float tic = (float)this.rendererUpdateCount + partial;
|
||||||
buf.setTranslation(-ax, -ay, -az);
|
buf.setTranslation(-ax, -ay, -az);
|
||||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
MutablePos pos = new MutablePos();
|
||||||
|
|
||||||
for(int z = ez - range; z <= ez + range; z++) {
|
for(int z = ez - range; z <= ez + range; z++) {
|
||||||
for(int x = ex - range; x <= ex + range; x++) {
|
for(int x = ex - range; x <= ex + range; x++) {
|
||||||
|
@ -1540,9 +1540,9 @@ public class Renderer {
|
||||||
Entity entity = this.gm.getRenderViewEntity();
|
Entity entity = this.gm.getRenderViewEntity();
|
||||||
|
|
||||||
Vec3 fog = new Vec3(world.dimension.getFogColor());
|
Vec3 fog = new Vec3(world.dimension.getFogColor());
|
||||||
this.fogColorRed = (float)fog.xCoord;
|
this.fogColorRed = (float)fog.x;
|
||||||
this.fogColorGreen = (float)fog.yCoord;
|
this.fogColorGreen = (float)fog.y;
|
||||||
this.fogColorBlue = (float)fog.zCoord;
|
this.fogColorBlue = (float)fog.z;
|
||||||
|
|
||||||
if(world.dimension.isExterminated()) {
|
if(world.dimension.isExterminated()) {
|
||||||
this.fogColorRed = 0.188f;
|
this.fogColorRed = 0.188f;
|
||||||
|
@ -1568,7 +1568,7 @@ public class Renderer {
|
||||||
{
|
{
|
||||||
double neg = -1.0D;
|
double neg = -1.0D;
|
||||||
Vec3 pos = ExtMath.sin(this.getDayPhase(partial)) > 0.0F ? new Vec3(neg, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D);
|
Vec3 pos = ExtMath.sin(this.getDayPhase(partial)) > 0.0F ? new Vec3(neg, 0.0D, 0.0D) : new Vec3(1.0D, 0.0D, 0.0D);
|
||||||
float shift = (float)entity.getLook(partial).dotProduct(pos);
|
float shift = (float)entity.getLook(partial).dot(pos);
|
||||||
if (shift > 0.0F)
|
if (shift > 0.0F)
|
||||||
{
|
{
|
||||||
float[] sun = calcSunriseSunsetColors(this.getDayPhase(partial), partial);
|
float[] sun = calcSunriseSunsetColors(this.getDayPhase(partial), partial);
|
||||||
|
@ -1585,9 +1585,9 @@ public class Renderer {
|
||||||
float dist = 0.25F + 0.75F * (float)this.gm.renderDistance / 32.0F;
|
float dist = 0.25F + 0.75F * (float)this.gm.renderDistance / 32.0F;
|
||||||
dist = 1.0F - (float)Math.pow((double)dist, 0.25D);
|
dist = 1.0F - (float)Math.pow((double)dist, 0.25D);
|
||||||
Vec3 sky = this.getSkyColor(this.gm.getRenderViewEntity(), partial);
|
Vec3 sky = this.getSkyColor(this.gm.getRenderViewEntity(), partial);
|
||||||
this.fogColorRed += ((float)sky.xCoord - this.fogColorRed) * dist;
|
this.fogColorRed += ((float)sky.x - this.fogColorRed) * dist;
|
||||||
this.fogColorGreen += ((float)sky.yCoord - this.fogColorGreen) * dist;
|
this.fogColorGreen += ((float)sky.y - this.fogColorGreen) * dist;
|
||||||
this.fogColorBlue += ((float)sky.zCoord - this.fogColorBlue) * dist;
|
this.fogColorBlue += ((float)sky.z - this.fogColorBlue) * dist;
|
||||||
|
|
||||||
float rain = world.getRainStrength();
|
float rain = world.getRainStrength();
|
||||||
if (rain > 0.0F)
|
if (rain > 0.0F)
|
||||||
|
@ -2241,7 +2241,7 @@ public class Renderer {
|
||||||
|
|
||||||
// boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false;
|
// boolean flag3 = this.gm.getRenderViewEntity() instanceof EntityLivingBase ? ((EntityLivingBase)this.gm.getRenderViewEntity()).isPlayerSleeping() : false;
|
||||||
|
|
||||||
if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new BlockPos(entity2)))
|
if (entity2.posY < (double)(-World.MAX_SIZE_Y) || entity2.posY >= (double)World.MAX_SIZE_Y || this.theWorld.isBlockLoaded(new LocalPos(entity2)))
|
||||||
{
|
{
|
||||||
if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 || this.gm.showPlayerFirstPerson)) {
|
if((entity2 != this.gm.getRenderViewEntity() || this.gm.thirdPersonView != 0 || this.gm.showPlayerFirstPerson)) {
|
||||||
++this.countEntitiesRendered;
|
++this.countEntitiesRendered;
|
||||||
|
@ -2339,9 +2339,9 @@ public class Renderer {
|
||||||
double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
|
double d4 = viewEntity.lastTickPosY + (viewEntity.posY - viewEntity.lastTickPosY) * partialTicks;
|
||||||
double d5 = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
|
double d5 = viewEntity.lastTickPosZ + (viewEntity.posZ - viewEntity.lastTickPosZ) * partialTicks;
|
||||||
this.initialize(d3, d4, d5);
|
this.initialize(d3, d4, d5);
|
||||||
BlockPos blockpos1 = new BlockPos(d3, d4 + (double)viewEntity.getEyeHeight(), d5);
|
LocalPos blockpos1 = new LocalPos(d3, d4 + (double)viewEntity.getEyeHeight(), d5);
|
||||||
RenderChunk renderchunk = this.viewFrustum.getRenderChunk(blockpos1);
|
RenderChunk renderchunk = this.viewFrustum.getRenderChunk(blockpos1);
|
||||||
BlockPos blockpos = new BlockPos(ExtMath.floord(d3 / 16.0D) * 16, ExtMath.floord(d4 / 16.0D) * 16, ExtMath.floord(d5 / 16.0D) * 16);
|
LocalPos blockpos = new LocalPos(ExtMath.floord(d3 / 16.0D) * 16, ExtMath.floord(d4 / 16.0D) * 16, ExtMath.floord(d5 / 16.0D) * 16);
|
||||||
this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || viewEntity.posX != this.lastViewEntityX || viewEntity.posY != this.lastViewEntityY || viewEntity.posZ != this.lastViewEntityZ || (double)viewEntity.rotPitch != this.lastViewEntityPitch || (double)viewEntity.rotYaw != this.lastViewEntityYaw;
|
this.displayListEntitiesDirty = this.displayListEntitiesDirty || !this.chunksToUpdate.isEmpty() || viewEntity.posX != this.lastViewEntityX || viewEntity.posY != this.lastViewEntityY || viewEntity.posZ != this.lastViewEntityZ || (double)viewEntity.rotPitch != this.lastViewEntityPitch || (double)viewEntity.rotYaw != this.lastViewEntityYaw;
|
||||||
this.lastViewEntityX = viewEntity.posX;
|
this.lastViewEntityX = viewEntity.posX;
|
||||||
this.lastViewEntityY = viewEntity.posY;
|
this.lastViewEntityY = viewEntity.posY;
|
||||||
|
@ -2401,7 +2401,7 @@ public class Renderer {
|
||||||
{
|
{
|
||||||
for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i)
|
for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i)
|
||||||
{
|
{
|
||||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new LocalPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
||||||
|
|
||||||
if (renderchunk1 != null && Frustum.isInFrustum(renderchunk1.boundingBox))
|
if (renderchunk1 != null && Frustum.isInFrustum(renderchunk1.boundingBox))
|
||||||
{
|
{
|
||||||
|
@ -2421,7 +2421,7 @@ public class Renderer {
|
||||||
RenderInfo render1 = (RenderInfo)queue.poll();
|
RenderInfo render1 = (RenderInfo)queue.poll();
|
||||||
RenderChunk chunk1 = render1.chunk;
|
RenderChunk chunk1 = render1.chunk;
|
||||||
Facing face1 = this.gm.xrayActive ? null : render1.facing;
|
Facing face1 = this.gm.xrayActive ? null : render1.facing;
|
||||||
BlockPos pos1 = chunk1.getPosition();
|
LocalPos pos1 = chunk1.getPosition();
|
||||||
this.renderInfos.add(render1);
|
this.renderInfos.add(render1);
|
||||||
|
|
||||||
for (Facing face2 : Facing.values())
|
for (Facing face2 : Facing.values())
|
||||||
|
@ -2484,7 +2484,7 @@ public class Renderer {
|
||||||
{
|
{
|
||||||
for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i)
|
for (int i = -this.renderDistanceChunks; i <= this.renderDistanceChunks; ++i)
|
||||||
{
|
{
|
||||||
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new BlockPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
RenderChunk renderchunk1 = this.viewFrustum.getRenderChunk(new LocalPos((j << 4) + 8, (i << 4) + 8, (k << 4) + 8));
|
||||||
|
|
||||||
if (renderchunk1 != null)
|
if (renderchunk1 != null)
|
||||||
{
|
{
|
||||||
|
@ -2496,19 +2496,19 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isPositionInRenderChunk(BlockPos pos, RenderChunk renderChunkIn)
|
private boolean isPositionInRenderChunk(LocalPos pos, RenderChunk renderChunkIn)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = renderChunkIn.getPosition();
|
LocalPos blockpos = renderChunkIn.getPosition();
|
||||||
return ExtMath.absi(pos.getX() - blockpos.getX()) > 16 ? false : (ExtMath.absi(pos.getY() - blockpos.getY()) > 16 ? false : ExtMath.absi(pos.getZ() - blockpos.getZ()) <= 16);
|
return ExtMath.absi(pos.getX() - blockpos.getX()) > 16 ? false : (ExtMath.absi(pos.getY() - blockpos.getY()) > 16 ? false : ExtMath.absi(pos.getZ() - blockpos.getZ()) <= 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Set<Facing> getVisibleFacings(BlockPos pos)
|
private Set<Facing> getVisibleFacings(LocalPos pos)
|
||||||
{
|
{
|
||||||
VisGraph visgraph = new VisGraph();
|
VisGraph visgraph = new VisGraph();
|
||||||
BlockPos blockpos = new BlockPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4);
|
LocalPos blockpos = new LocalPos(pos.getX() >> 4 << 4, pos.getY() >> 4 << 4, pos.getZ() >> 4 << 4);
|
||||||
ChunkClient chunk = this.gm.getChunk(blockpos.getX() >> 4, blockpos.getZ() >> 4);
|
ChunkClient chunk = this.gm.getChunk(blockpos.getX() >> 4, blockpos.getZ() >> 4);
|
||||||
|
|
||||||
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos.add(15, 15, 15)))
|
for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(blockpos, blockpos.add(15, 15, 15)))
|
||||||
{
|
{
|
||||||
if (chunk.getBlock(blockpos$mutableblockpos).isOpaqueCube())
|
if (chunk.getBlock(blockpos$mutableblockpos).isOpaqueCube())
|
||||||
{
|
{
|
||||||
|
@ -2522,9 +2522,9 @@ public class Renderer {
|
||||||
* Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at
|
* Returns RenderChunk offset from given RenderChunk in given direction, or null if it can't be seen by player at
|
||||||
* given BlockPos.
|
* given BlockPos.
|
||||||
*/
|
*/
|
||||||
private RenderChunk getRenderChunkOffset(BlockPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
private RenderChunk getRenderChunkOffset(LocalPos playerPos, RenderChunk renderChunkBase, Facing facing)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
|
LocalPos blockpos = renderChunkBase.getBlockPosOffset16(facing);
|
||||||
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (ExtMath.absi(playerPos.getY() - blockpos.getY()) <= this.renderDistanceChunks * 16 ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
return ExtMath.absi(playerPos.getX() - blockpos.getX()) > this.renderDistanceChunks * 16 ? null : (ExtMath.absi(playerPos.getY() - blockpos.getY()) <= this.renderDistanceChunks * 16 ? (ExtMath.absi(playerPos.getZ() - blockpos.getZ()) > this.renderDistanceChunks * 16 ? null : this.viewFrustum.getRenderChunk(blockpos)) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2585,7 +2585,7 @@ public class Renderer {
|
||||||
{
|
{
|
||||||
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
|
VertexBuffer vertexbuffer = renderchunk.getVertexBuffer();
|
||||||
|
|
||||||
BlockPos blockpos = renderchunk.getPosition();
|
LocalPos blockpos = renderchunk.getPosition();
|
||||||
context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
|
context.vec("offset", (float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
|
||||||
context.matrix("model", renderchunk.getModelviewMatrix());
|
context.matrix("model", renderchunk.getModelviewMatrix());
|
||||||
context.integer("chunk_x", blockpos.getX());
|
context.integer("chunk_x", blockpos.getX());
|
||||||
|
@ -2697,7 +2697,7 @@ public class Renderer {
|
||||||
|
|
||||||
private void preRenderChunk(RenderChunk renderChunkIn)
|
private void preRenderChunk(RenderChunk renderChunkIn)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = renderChunkIn.getPosition();
|
LocalPos blockpos = renderChunkIn.getPosition();
|
||||||
GL15.glTranslatef((float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
|
GL15.glTranslatef((float)((double)blockpos.getX() - this.viewEntityX), (float)((double)blockpos.getY() - this.viewEntityY), (float)((double)blockpos.getZ() - this.viewEntityZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2766,9 +2766,9 @@ public class Renderer {
|
||||||
{
|
{
|
||||||
GlState.disableTexture2D();
|
GlState.disableTexture2D();
|
||||||
Vec3 vec3 = this.gm.renderer.getSkyColor(this.gm.getRenderViewEntity(), partialTicks);
|
Vec3 vec3 = this.gm.renderer.getSkyColor(this.gm.getRenderViewEntity(), partialTicks);
|
||||||
float f = (float)vec3.xCoord;
|
float f = (float)vec3.x;
|
||||||
float f1 = (float)vec3.yCoord;
|
float f1 = (float)vec3.y;
|
||||||
float f2 = (float)vec3.zCoord;
|
float f2 = (float)vec3.z;
|
||||||
|
|
||||||
// if (pass != 2)
|
// if (pass != 2)
|
||||||
// {
|
// {
|
||||||
|
@ -2861,8 +2861,8 @@ public class Renderer {
|
||||||
if(color != 0xffffffff) {
|
if(color != 0xffffffff) {
|
||||||
this.renderEngine.bindTexture((color & 0xff000000) != 0 ? EXTERMINATED_TEX : SUN_TEX);
|
this.renderEngine.bindTexture((color & 0xff000000) != 0 ? EXTERMINATED_TEX : SUN_TEX);
|
||||||
Vec3 ncolor = new Vec3(color);
|
Vec3 ncolor = new Vec3(color);
|
||||||
float mul = Math.min(1.0f / (float)ncolor.xCoord, Math.min(1.0f / (float)ncolor.yCoord, 1.0f / (float)ncolor.zCoord));
|
float mul = Math.min(1.0f / (float)ncolor.x, Math.min(1.0f / (float)ncolor.y, 1.0f / (float)ncolor.z));
|
||||||
GlState.color((float)ncolor.xCoord * mul, (float)ncolor.yCoord * mul, (float)ncolor.zCoord * mul, f16);
|
GlState.color((float)ncolor.x * mul, (float)ncolor.y * mul, (float)ncolor.z * mul, f16);
|
||||||
worldrenderer.begin(GL15.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
worldrenderer.begin(GL15.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||||
worldrenderer.pos((double)(-size), 100.0D, (double)(-size)).tex(0.0D, 0.0D).endVertex();
|
worldrenderer.pos((double)(-size), 100.0D, (double)(-size)).tex(0.0D, 0.0D).endVertex();
|
||||||
worldrenderer.pos((double)size, 100.0D, (double)(-size)).tex(1.0D, 0.0D).endVertex();
|
worldrenderer.pos((double)size, 100.0D, (double)(-size)).tex(1.0D, 0.0D).endVertex();
|
||||||
|
@ -2879,8 +2879,8 @@ public class Renderer {
|
||||||
boolean destroyed = (colors[z] & 0xff000000) != 0;
|
boolean destroyed = (colors[z] & 0xff000000) != 0;
|
||||||
this.renderEngine.bindTexture(destroyed ? EXTERMINATED_TEX : (this.gm.world.dimension.getType() == DimType.MOON ? PLANET_TEX : MOON_TEX));
|
this.renderEngine.bindTexture(destroyed ? EXTERMINATED_TEX : (this.gm.world.dimension.getType() == DimType.MOON ? PLANET_TEX : MOON_TEX));
|
||||||
Vec3 ncolor = new Vec3(colors[z]);
|
Vec3 ncolor = new Vec3(colors[z]);
|
||||||
float mul = Math.min(1.0f / (float)ncolor.xCoord, Math.min(1.0f / (float)ncolor.yCoord, 1.0f / (float)ncolor.zCoord));
|
float mul = Math.min(1.0f / (float)ncolor.x, Math.min(1.0f / (float)ncolor.y, 1.0f / (float)ncolor.z));
|
||||||
GlState.color((float)ncolor.xCoord * mul, (float)ncolor.yCoord * mul, (float)ncolor.zCoord * mul, f16);
|
GlState.color((float)ncolor.x * mul, (float)ncolor.y * mul, (float)ncolor.z * mul, f16);
|
||||||
int phase = this.theWorld.getMoonPhase(z);
|
int phase = this.theWorld.getMoonPhase(z);
|
||||||
int tx = phase % 4;
|
int tx = phase % 4;
|
||||||
int ty = phase / 4 % 2;
|
int ty = phase / 4 % 2;
|
||||||
|
@ -2909,7 +2909,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Vec3 color = new Vec3(stars);
|
Vec3 color = new Vec3(stars);
|
||||||
GlState.color((float)color.xCoord, (float)color.yCoord, (float)color.zCoord, f15);
|
GlState.color((float)color.x, (float)color.y, (float)color.z, f15);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.vboEnabled)
|
// if (this.vboEnabled)
|
||||||
|
@ -2936,7 +2936,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Vec3 color = new Vec3(stars);
|
Vec3 color = new Vec3(stars);
|
||||||
GlState.color((float)color.xCoord, (float)color.yCoord, (float)color.zCoord, f15);
|
GlState.color((float)color.x, (float)color.y, (float)color.z, f15);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this.vboEnabled)
|
// if (this.vboEnabled)
|
||||||
|
@ -2984,9 +2984,9 @@ public class Renderer {
|
||||||
GlState.enableBlend();
|
GlState.enableBlend();
|
||||||
GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ZERO);
|
GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE_MINUS_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ZERO);
|
||||||
Vec3 vec3 = this.gm.renderer.getCloudColor(this.gm.getRenderViewEntity(), partialTicks);
|
Vec3 vec3 = this.gm.renderer.getCloudColor(this.gm.getRenderViewEntity(), partialTicks);
|
||||||
float f4 = (float)vec3.xCoord;
|
float f4 = (float)vec3.x;
|
||||||
float f5 = (float)vec3.yCoord;
|
float f5 = (float)vec3.y;
|
||||||
float f6 = (float)vec3.zCoord;
|
float f6 = (float)vec3.z;
|
||||||
|
|
||||||
// if (pass != 2)
|
// if (pass != 2)
|
||||||
// {
|
// {
|
||||||
|
@ -3158,7 +3158,7 @@ public class Renderer {
|
||||||
GlState.disableTexture2D();
|
GlState.disableTexture2D();
|
||||||
GlState.depthMask(false);
|
GlState.depthMask(false);
|
||||||
float f = 0.002F;
|
float f = 0.002F;
|
||||||
BlockPos blockpos = movingObjectPositionIn.block;
|
LocalPos blockpos = movingObjectPositionIn.block;
|
||||||
Block block = this.theWorld.getState(blockpos).getBlock();
|
Block block = this.theWorld.getState(blockpos).getBlock();
|
||||||
|
|
||||||
if(block != Blocks.air) // && this.theWorld.getWorldBorder().contains(blockpos))
|
if(block != Blocks.air) // && this.theWorld.getWorldBorder().contains(blockpos))
|
||||||
|
@ -3301,7 +3301,7 @@ public class Renderer {
|
||||||
GlState.enableBlend();
|
GlState.enableBlend();
|
||||||
GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ONE, GL15.GL_ZERO);
|
GlState.tryBlendFuncSeparate(GL15.GL_SRC_ALPHA, GL15.GL_ONE, GL15.GL_ONE, GL15.GL_ZERO);
|
||||||
ItemRenderer.disableStandardItemLighting();
|
ItemRenderer.disableStandardItemLighting();
|
||||||
GlState.color((float)stars.xCoord, (float)stars.yCoord, (float)stars.zCoord, 1.0f);
|
GlState.color((float)stars.x, (float)stars.y, (float)stars.z, 1.0f);
|
||||||
this.starVBO.bindBuffer();
|
this.starVBO.bindBuffer();
|
||||||
GL15.glEnableClientState(GL15.GL_VERTEX_ARRAY);
|
GL15.glEnableClientState(GL15.GL_VERTEX_ARRAY);
|
||||||
GL15.nglVertexPointer(3, GL15.GL_FLOAT, 12, 0L);
|
GL15.nglVertexPointer(3, GL15.GL_FLOAT, 12, 0L);
|
||||||
|
@ -3345,7 +3345,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderBlockEntity(State state, BlockPos brightPos)
|
public void renderBlockEntity(State state, LocalPos brightPos)
|
||||||
{
|
{
|
||||||
if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid())
|
if (state.getBlock() != Blocks.air && !state.getBlock().getMaterial().isLiquid())
|
||||||
{
|
{
|
||||||
|
@ -3378,7 +3378,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLightColor(BlockPos pos, Facing side) {
|
public int getLightColor(LocalPos pos, Facing side) {
|
||||||
int light = this.getCombinedLight(pos);
|
int light = this.getCombinedLight(pos);
|
||||||
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
||||||
float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side);
|
float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side);
|
||||||
|
@ -3395,7 +3395,7 @@ public class Renderer {
|
||||||
return 0xff000000 | (int)(Math.min(directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(directB, 1.0f) * 255.0f);
|
return 0xff000000 | (int)(Math.min(directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(directB, 1.0f) * 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getVertexColor(BlockPos pos, Facing side, int light, boolean flip) {
|
public int getVertexColor(LocalPos pos, Facing side, int light, boolean flip) {
|
||||||
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
||||||
float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side);
|
float shading = side == null ? 1.0f : FaceBakery.getFaceBrightness(side);
|
||||||
float max = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
|
float max = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
|
||||||
|
@ -3406,7 +3406,7 @@ public class Renderer {
|
||||||
return 0xff000000 | (int)(Math.min(flip ? directB : directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(flip ? directR : directB, 1.0f) * 255.0f);
|
return 0xff000000 | (int)(Math.min(flip ? directB : directR, 1.0f) * 255.0f) << 16 | (int)(Math.min(directG, 1.0f) * 255.0f) << 8 | (int)(Math.min(flip ? directR : directB, 1.0f) * 255.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSkyBrightness(BlockPos pos) {
|
public int getSkyBrightness(LocalPos pos) {
|
||||||
int light = this.getCombinedLight(pos);
|
int light = this.getCombinedLight(pos);
|
||||||
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
float sky = this.skyLight ? pos.getY() < 0 ? 0.0f : (pos.getY() < 64 ? (float)pos.getY() / 64.0f : 1.0f) : 1.0f;
|
||||||
float block = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
|
float block = (float)Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 255.0f;
|
||||||
|
@ -3414,13 +3414,13 @@ public class Renderer {
|
||||||
return ((int)(sky * 255.0f) / 16) << 20 | ((int)(block * 255.0f) / 16) << 4;
|
return ((int)(sky * 255.0f) / 16) << 20 | ((int)(block * 255.0f) / 16) << 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCombinedBrightness(BlockPos pos) {
|
public int getCombinedBrightness(LocalPos pos) {
|
||||||
int light = this.getLightColor(pos, null);
|
int light = this.getLightColor(pos, null);
|
||||||
light = Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 16;
|
light = Math.max(Math.max((light >> 16) & 0xff, (light >> 8) & 0xff), light & 0xff) / 16;
|
||||||
return light << 20 | light << 4;
|
return light << 20 | light << 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean renderBlock(State state, BlockPos pos, IWorldAccess world, RenderBuffer rb) {
|
public boolean renderBlock(State state, LocalPos pos, IWorldAccess world, RenderBuffer rb) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if(this.gm.xrayActive && !block.isXrayVisible())
|
if(this.gm.xrayActive && !block.isXrayVisible())
|
||||||
return false;
|
return false;
|
||||||
|
@ -3446,7 +3446,7 @@ public class Renderer {
|
||||||
for(Facing side : Facing.values()) {
|
for(Facing side : Facing.values()) {
|
||||||
List<BakedQuad> list = model.getFace(side);
|
List<BakedQuad> list = model.getFace(side);
|
||||||
if(!list.isEmpty()) {
|
if(!list.isEmpty()) {
|
||||||
BlockPos bpos = pos.offset(side);
|
LocalPos bpos = pos.offset(side);
|
||||||
if(!checkSides || block.canRender(world, bpos, side)) {
|
if(!checkSides || block.canRender(world, bpos, side)) {
|
||||||
int light = this.getLightmapValue(world, bpos, side);
|
int light = this.getLightmapValue(world, bpos, side);
|
||||||
int sky = this.getSkyBrightness(bpos);
|
int sky = this.getSkyBrightness(bpos);
|
||||||
|
@ -3467,7 +3467,7 @@ public class Renderer {
|
||||||
return Math.max((lightA >> 16) & 0xff, (lightB >> 16) & 0xff) << 16 | Math.max((lightA >> 8) & 0xff, (lightB >> 8) & 0xff) << 8 | Math.max(lightA & 0xff, lightB & 0xff);
|
return Math.max((lightA >> 16) & 0xff, (lightB >> 16) & 0xff) << 16 | Math.max((lightA >> 8) & 0xff, (lightB >> 8) & 0xff) << 8 | Math.max(lightA & 0xff, lightB & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLightmapValue(IWorldAccess world, BlockPos pos, Facing side) {
|
private int getLightmapValue(IWorldAccess world, LocalPos pos, Facing side) {
|
||||||
Block block = world.getState(pos).getBlock();
|
Block block = world.getState(pos).getBlock();
|
||||||
int light = componentMax(world.getCombinedLight(pos), block.getLight());
|
int light = componentMax(world.getCombinedLight(pos), block.getLight());
|
||||||
if(light == 0 && block instanceof BlockSlab) {
|
if(light == 0 && block instanceof BlockSlab) {
|
||||||
|
@ -3478,13 +3478,13 @@ public class Renderer {
|
||||||
return getVertexColor(pos, side, light, true);
|
return getVertexColor(pos, side, light, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLightmapValueLiquid(IWorldAccess world, BlockPos pos, Facing side) {
|
private int getLightmapValueLiquid(IWorldAccess world, LocalPos pos, Facing side) {
|
||||||
int light = world.getCombinedLight(pos);
|
int light = world.getCombinedLight(pos);
|
||||||
int up = world.getCombinedLight(pos.up());
|
int up = world.getCombinedLight(pos.up());
|
||||||
return getVertexColor(pos, side, componentMax(light, up), false);
|
return getVertexColor(pos, side, componentMax(light, up), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, BlockPos blockPosIn, Facing faceIn, int light, int sky, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
|
private void renderModelStandardQuads(IWorldAccess blockAccessIn, Block blockIn, LocalPos blockPosIn, Facing faceIn, int light, int sky, boolean ownLight, RenderBuffer worldRendererIn, List<BakedQuad> listQuadsIn, BitSet boundsFlags)
|
||||||
{
|
{
|
||||||
double d0 = (double)blockPosIn.getX();
|
double d0 = (double)blockPosIn.getX();
|
||||||
double d1 = (double)blockPosIn.getY();
|
double d1 = (double)blockPosIn.getY();
|
||||||
|
@ -3580,7 +3580,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn)
|
private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, LocalPos blockPosIn, RenderBuffer worldRendererIn)
|
||||||
{
|
{
|
||||||
BlockLiquid blockliquid = (BlockLiquid)blockStateIn.getBlock();
|
BlockLiquid blockliquid = (BlockLiquid)blockStateIn.getBlock();
|
||||||
blockliquid.setBlockBounds(blockAccess, blockPosIn);
|
blockliquid.setBlockBounds(blockAccess, blockPosIn);
|
||||||
|
@ -3711,7 +3711,7 @@ public class Renderer {
|
||||||
++j1;
|
++j1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos = blockPosIn.add(j1, 0, k1);
|
LocalPos blockpos = blockPosIn.add(j1, 0, k1);
|
||||||
Sprite textureatlassprite1 = atextureatlassprite[1];
|
Sprite textureatlassprite1 = atextureatlassprite[1];
|
||||||
|
|
||||||
if (aboolean[np])
|
if (aboolean[np])
|
||||||
|
@ -3783,14 +3783,14 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn)
|
private float getFluidHeight(IBlockAccess blockAccess, LocalPos blockPosIn)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
float f = 0.0F;
|
float f = 0.0F;
|
||||||
|
|
||||||
for (int j = 0; j < 4; ++j)
|
for (int j = 0; j < 4; ++j)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
LocalPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
||||||
|
|
||||||
if (blockAccess.getState(blockpos.up()).getBlock().getMaterial().isLiquid())
|
if (blockAccess.getState(blockpos.up()).getBlock().getMaterial().isLiquid())
|
||||||
{
|
{
|
||||||
|
@ -3826,7 +3826,7 @@ public class Renderer {
|
||||||
return 1.0F - f / (float)i;
|
return 1.0F - f / (float)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean renderDynamic(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn)
|
private boolean renderDynamic(IWorldAccess blockAccess, State blockStateIn, LocalPos blockPosIn, RenderBuffer worldRendererIn)
|
||||||
{
|
{
|
||||||
Block block = blockStateIn.getBlock();
|
Block block = blockStateIn.getBlock();
|
||||||
block.setBlockBounds(blockAccess, blockPosIn);
|
block.setBlockBounds(blockAccess, blockPosIn);
|
||||||
|
@ -3933,7 +3933,7 @@ public class Renderer {
|
||||||
++j1;
|
++j1;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos = blockPosIn.add(j1, 0, k1);
|
LocalPos blockpos = blockPosIn.add(j1, 0, k1);
|
||||||
Sprite textureatlassprite1 = textureatlassprite;
|
Sprite textureatlassprite1 = textureatlassprite;
|
||||||
|
|
||||||
if (aboolean[np])
|
if (aboolean[np])
|
||||||
|
@ -4005,7 +4005,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getAdjacentHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Block block)
|
private float getAdjacentHeight(IBlockAccess blockAccess, LocalPos blockPosIn, Block block)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
float f = 0.0F;
|
float f = 0.0F;
|
||||||
|
@ -4015,7 +4015,7 @@ public class Renderer {
|
||||||
|
|
||||||
for (int j = 0; j < 4; ++j)
|
for (int j = 0; j < 4; ++j)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
LocalPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));
|
||||||
|
|
||||||
if (blockAccess.getState(blockpos.up()).getBlock() != Blocks.air)
|
if (blockAccess.getState(blockpos.up()).getBlock() != Blocks.air)
|
||||||
{
|
{
|
||||||
|
@ -4052,9 +4052,9 @@ public class Renderer {
|
||||||
return n == 4 ? 1.0f : (s + a == 4 && a > 1 ? 0.0f : 1.0F - f / (float)i);
|
return n == 4 ? 1.0f : (s + a == 4 && a > 1 ? 0.0f : 1.0F - f / (float)i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLight(BlockPos pos) {
|
private int getLight(LocalPos pos) {
|
||||||
if(pos.getY() < -World.MAX_SIZE_Y) {
|
if(pos.getY() < -World.MAX_SIZE_Y) {
|
||||||
pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
pos = new LocalPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!World.isValid(pos)) {
|
if(!World.isValid(pos)) {
|
||||||
|
@ -4066,9 +4066,9 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCombinedLight(BlockPos pos) {
|
public int getCombinedLight(LocalPos pos) {
|
||||||
if(pos.getY() < -World.MAX_SIZE_Y) {
|
if(pos.getY() < -World.MAX_SIZE_Y) {
|
||||||
pos = new BlockPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
pos = new LocalPos(pos.getX(), -World.MAX_SIZE_Y, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!World.isValid(pos) || this.gm.world == null) {
|
if(!World.isValid(pos) || this.gm.world == null) {
|
||||||
|
@ -4127,7 +4127,7 @@ public class Renderer {
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private int getRawBlockLight(BlockPos pos, int component) {
|
private int getRawBlockLight(LocalPos pos, int component) {
|
||||||
Block block = this.gm.world.getState(pos).getBlock();
|
Block block = this.gm.world.getState(pos).getBlock();
|
||||||
int light = ((block.getLight() >> ((2 - component) * 8)) & 0xff) / 16;
|
int light = ((block.getLight() >> ((2 - component) * 8)) & 0xff) / 16;
|
||||||
int opacity = block.getLightOpacity();
|
int opacity = block.getLightOpacity();
|
||||||
|
@ -4148,7 +4148,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for(Facing side : Facing.values()) {
|
for(Facing side : Facing.values()) {
|
||||||
BlockPos bpos = pos.offset(side);
|
LocalPos bpos = pos.offset(side);
|
||||||
int blight = this.getLightFor(bpos, component) - opacity;
|
int blight = this.getLightFor(bpos, component) - opacity;
|
||||||
|
|
||||||
if(blight > light) {
|
if(blight > light) {
|
||||||
|
@ -4164,11 +4164,11 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLightFor(BlockPos pos, int component) {
|
private int getLightFor(LocalPos pos, int component) {
|
||||||
return ((this.getLight(pos) >> ((2 - component) * 8)) & 0xff) / 16;
|
return ((this.getLight(pos) >> ((2 - component) * 8)) & 0xff) / 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setBlockLight(BlockPos pos, int component, int value) {
|
private void setBlockLight(LocalPos pos, int component, int value) {
|
||||||
if(World.isValid(pos)) {
|
if(World.isValid(pos)) {
|
||||||
ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
ChunkClient chunk = this.gm.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||||
int light = chunk.getLight(pos);
|
int light = chunk.getLight(pos);
|
||||||
|
@ -4180,7 +4180,7 @@ public class Renderer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkBlockLight(BlockPos pos) {
|
public boolean checkBlockLight(LocalPos pos) {
|
||||||
if(!this.gm.world.isAreaLoaded(pos, 17, false))
|
if(!this.gm.world.isAreaLoaded(pos, 17, false))
|
||||||
return false;
|
return false;
|
||||||
for(int component = 0; component < 3; component++) {
|
for(int component = 0; component < 3; component++) {
|
||||||
|
@ -4204,7 +4204,7 @@ public class Renderer {
|
||||||
int y = (p >> 6 & 63) - 32 + by;
|
int y = (p >> 6 & 63) - 32 + by;
|
||||||
int z = (p >> 12 & 63) - 32 + bz;
|
int z = (p >> 12 & 63) - 32 + bz;
|
||||||
int s = p >> 18 & 15;
|
int s = p >> 18 & 15;
|
||||||
BlockPos blk = new BlockPos(x, y, z);
|
LocalPos blk = new LocalPos(x, y, z);
|
||||||
int l = this.getLightFor(blk, component);
|
int l = this.getLightFor(blk, component);
|
||||||
|
|
||||||
if(l == s) {
|
if(l == s) {
|
||||||
|
@ -4216,7 +4216,7 @@ public class Renderer {
|
||||||
int dz = ExtMath.absi(z - bz);
|
int dz = ExtMath.absi(z - bz);
|
||||||
|
|
||||||
if(dx + dy + dz < 17) {
|
if(dx + dy + dz < 17) {
|
||||||
BlockPos.MutableBlockPos bpos = new BlockPos.MutableBlockPos();
|
MutablePos bpos = new MutablePos();
|
||||||
|
|
||||||
for(Facing dir : Facing.values()) {
|
for(Facing dir : Facing.values()) {
|
||||||
int ox = x + dir.getFrontOffsetX();
|
int ox = x + dir.getFrontOffsetX();
|
||||||
|
@ -4243,7 +4243,7 @@ public class Renderer {
|
||||||
int x = (p & 63) - 32 + bx;
|
int x = (p & 63) - 32 + bx;
|
||||||
int y = (p >> 6 & 63) - 32 + by;
|
int y = (p >> 6 & 63) - 32 + by;
|
||||||
int z = (p >> 12 & 63) - 32 + bz;
|
int z = (p >> 12 & 63) - 32 + bz;
|
||||||
BlockPos blk = new BlockPos(x, y, z);
|
LocalPos blk = new LocalPos(x, y, z);
|
||||||
int l = this.getLightFor(blk, component);
|
int l = this.getLightFor(blk, component);
|
||||||
int r = this.getRawBlockLight(blk, component);
|
int r = this.getRawBlockLight(blk, component);
|
||||||
|
|
||||||
|
|
|
@ -203,7 +203,7 @@ public class ShaderContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShaderContext vec(String name, Vec3 vec) {
|
public ShaderContext vec(String name, Vec3 vec) {
|
||||||
GL20.glUniform3f(GL20.glGetUniformLocation(this.program, name), (float)vec.xCoord, (float)vec.yCoord, (float)vec.zCoord);
|
GL20.glUniform3f(GL20.glGetUniformLocation(this.program, name), (float)vec.x, (float)vec.y, (float)vec.z);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ package client.renderer;
|
||||||
|
|
||||||
import client.renderer.chunk.RenderChunk;
|
import client.renderer.chunk.RenderChunk;
|
||||||
import client.Client;
|
import client.Client;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
|
|
||||||
public class ViewFrustum
|
public class ViewFrustum
|
||||||
|
@ -39,7 +39,7 @@ public class ViewFrustum
|
||||||
for (int i1 = 0; i1 < this.countChunksZ; ++i1)
|
for (int i1 = 0; i1 < this.countChunksZ; ++i1)
|
||||||
{
|
{
|
||||||
int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k;
|
int j1 = (i1 * this.countChunksY + l) * this.countChunksX + k;
|
||||||
BlockPos blockpos = new BlockPos(k * 16, l * 16, i1 * 16);
|
LocalPos blockpos = new LocalPos(k * 16, l * 16, i1 * 16);
|
||||||
this.renderChunks[j1] = new RenderChunk(this.gm, this.renderGlobal, blockpos, j++);
|
this.renderChunks[j1] = new RenderChunk(this.gm, this.renderGlobal, blockpos, j++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public class ViewFrustum
|
||||||
{
|
{
|
||||||
int i2 = this.func_178157_a(n, k, l1);
|
int i2 = this.func_178157_a(n, k, l1);
|
||||||
RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
|
RenderChunk renderchunk = this.renderChunks[(j1 * this.countChunksY + l1) * this.countChunksX + l];
|
||||||
BlockPos blockpos = new BlockPos(i1, i2, k1);
|
LocalPos blockpos = new LocalPos(i1, i2, k1);
|
||||||
|
|
||||||
if (!blockpos.equals(renderchunk.getPosition()))
|
if (!blockpos.equals(renderchunk.getPosition()))
|
||||||
{
|
{
|
||||||
|
@ -149,7 +149,7 @@ public class ViewFrustum
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RenderChunk getRenderChunk(BlockPos pos)
|
protected RenderChunk getRenderChunk(LocalPos pos)
|
||||||
{
|
{
|
||||||
int x = bucketInt(pos.getX());
|
int x = bucketInt(pos.getX());
|
||||||
int y = bucketInt(pos.getY());
|
int y = bucketInt(pos.getY());
|
||||||
|
|
|
@ -24,9 +24,10 @@ import common.collect.Maps;
|
||||||
import common.collect.Sets;
|
import common.collect.Sets;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
|
||||||
public class RenderChunk
|
public class RenderChunk
|
||||||
|
@ -34,7 +35,7 @@ public class RenderChunk
|
||||||
private Client gm;
|
private Client gm;
|
||||||
private final Renderer renderGlobal;
|
private final Renderer renderGlobal;
|
||||||
public static int renderChunksUpdated;
|
public static int renderChunksUpdated;
|
||||||
private BlockPos position;
|
private LocalPos position;
|
||||||
public CompiledChunk compiledChunk = CompiledChunk.DUMMY;
|
public CompiledChunk compiledChunk = CompiledChunk.DUMMY;
|
||||||
private final ReentrantLock lockCompileTask = new ReentrantLock();
|
private final ReentrantLock lockCompileTask = new ReentrantLock();
|
||||||
private final ReentrantLock lockCompiledChunk = new ReentrantLock();
|
private final ReentrantLock lockCompiledChunk = new ReentrantLock();
|
||||||
|
@ -46,9 +47,9 @@ public class RenderChunk
|
||||||
public BoundingBox boundingBox;
|
public BoundingBox boundingBox;
|
||||||
private int frameIndex = -1;
|
private int frameIndex = -1;
|
||||||
private boolean needsUpdate = true;
|
private boolean needsUpdate = true;
|
||||||
private EnumMap<Facing, BlockPos> mapEnumFacing = Maps.newEnumMap(Facing.class);
|
private EnumMap<Facing, LocalPos> mapEnumFacing = Maps.newEnumMap(Facing.class);
|
||||||
|
|
||||||
public RenderChunk(Client worldIn, Renderer renderGlobalIn, BlockPos blockPosIn, int indexIn)
|
public RenderChunk(Client worldIn, Renderer renderGlobalIn, LocalPos blockPosIn, int indexIn)
|
||||||
{
|
{
|
||||||
this.gm = worldIn;
|
this.gm = worldIn;
|
||||||
this.renderGlobal = renderGlobalIn;
|
this.renderGlobal = renderGlobalIn;
|
||||||
|
@ -80,7 +81,7 @@ public class RenderChunk
|
||||||
return this.vertexBuffer;
|
return this.vertexBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosition(BlockPos pos)
|
public void setPosition(LocalPos pos)
|
||||||
{
|
{
|
||||||
this.stopCompileTask();
|
this.stopCompileTask();
|
||||||
this.position = pos;
|
this.position = pos;
|
||||||
|
@ -98,8 +99,8 @@ public class RenderChunk
|
||||||
{
|
{
|
||||||
CompiledChunk compiledchunk = new CompiledChunk();
|
CompiledChunk compiledchunk = new CompiledChunk();
|
||||||
int i = 1;
|
int i = 1;
|
||||||
BlockPos blockpos = this.position;
|
LocalPos blockpos = this.position;
|
||||||
BlockPos blockpos1 = blockpos.add(15, 15, 15);
|
LocalPos blockpos1 = blockpos.add(15, 15, 15);
|
||||||
generator.getLock().lock();
|
generator.getLock().lock();
|
||||||
RegionRenderCache iblockaccess;
|
RegionRenderCache iblockaccess;
|
||||||
|
|
||||||
|
@ -127,7 +128,7 @@ public class RenderChunk
|
||||||
boolean aboolean = false;
|
boolean aboolean = false;
|
||||||
Renderer renderer = this.gm.renderer;
|
Renderer renderer = this.gm.renderer;
|
||||||
|
|
||||||
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(blockpos, blockpos1))
|
for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(blockpos, blockpos1))
|
||||||
{
|
{
|
||||||
State iblockstate = iblockaccess.getState(blockpos$mutableblockpos);
|
State iblockstate = iblockaccess.getState(blockpos$mutableblockpos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
|
@ -139,7 +140,7 @@ public class RenderChunk
|
||||||
|
|
||||||
if (block instanceof ITileEntityProvider)
|
if (block instanceof ITileEntityProvider)
|
||||||
{
|
{
|
||||||
TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos));
|
TileEntity tileentity = iblockaccess.getTileEntity(new LocalPos(blockpos$mutableblockpos));
|
||||||
ElementRenderer<TileEntity> tileentityspecialrenderer = SpecialRenderer.instance.<TileEntity>getRenderer(tileentity);
|
ElementRenderer<TileEntity> tileentityspecialrenderer = SpecialRenderer.instance.<TileEntity>getRenderer(tileentity);
|
||||||
|
|
||||||
if (tileentity != null && tileentityspecialrenderer != null)
|
if (tileentity != null && tileentityspecialrenderer != null)
|
||||||
|
@ -239,7 +240,7 @@ public class RenderChunk
|
||||||
return chunkcompiletaskgenerator;
|
return chunkcompiletaskgenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preRenderBlocks(RenderBuffer worldRendererIn, BlockPos pos)
|
private void preRenderBlocks(RenderBuffer worldRendererIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
worldRendererIn.begin(GL15.GL_QUADS, DefaultVertexFormats.BLOCK);
|
worldRendererIn.begin(GL15.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||||
worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
worldRendererIn.setTranslation((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
||||||
|
@ -295,7 +296,7 @@ public class RenderChunk
|
||||||
this.vertexBuffer.deleteGlBuffers();
|
this.vertexBuffer.deleteGlBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPos getPosition()
|
public LocalPos getPosition()
|
||||||
{
|
{
|
||||||
return this.position;
|
return this.position;
|
||||||
}
|
}
|
||||||
|
@ -310,8 +311,8 @@ public class RenderChunk
|
||||||
return this.needsUpdate;
|
return this.needsUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPos getBlockPosOffset16(Facing p_181701_1_)
|
public LocalPos getBlockPosOffset16(Facing p_181701_1_)
|
||||||
{
|
{
|
||||||
return (BlockPos)this.mapEnumFacing.get(p_181701_1_);
|
return (LocalPos)this.mapEnumFacing.get(p_181701_1_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import java.util.LinkedList;
|
||||||
import java.util.Queue;
|
import java.util.Queue;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
|
||||||
public class VisGraph
|
public class VisGraph
|
||||||
|
@ -26,13 +26,13 @@ public class VisGraph
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void func_178606_a(BlockPos pos)
|
public void func_178606_a(LocalPos pos)
|
||||||
{
|
{
|
||||||
this.field_178612_d.set(getIndex(pos), true);
|
this.field_178612_d.set(getIndex(pos), true);
|
||||||
--this.field_178611_f;
|
--this.field_178611_f;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getIndex(BlockPos pos)
|
private static int getIndex(LocalPos pos)
|
||||||
{
|
{
|
||||||
return getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15);
|
return getIndex(pos.getX() & 15, pos.getY() & 15, pos.getZ() & 15);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ public class VisGraph
|
||||||
return setvisibility;
|
return setvisibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<Facing> func_178609_b(BlockPos pos)
|
public Set<Facing> func_178609_b(LocalPos pos)
|
||||||
{
|
{
|
||||||
return this.func_178604_a(getIndex(pos));
|
return this.func_178604_a(getIndex(pos));
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.lwjgl.opengl.GL15;
|
||||||
import client.Client;
|
import client.Client;
|
||||||
import client.renderer.texture.TextureMap;
|
import client.renderer.texture.TextureMap;
|
||||||
import common.entity.Entity;
|
import common.entity.Entity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class RenderBlockEntity extends Render<Entity>
|
||||||
GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z);
|
GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z);
|
||||||
this.bindEntityTexture(entity);
|
this.bindEntityTexture(entity);
|
||||||
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
||||||
Client.CLIENT.renderer.renderBlockEntity(this.state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
Client.CLIENT.renderer.renderBlockEntity(this.state, new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||||
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||||
GL15.glPopMatrix();
|
GL15.glPopMatrix();
|
||||||
super.doRender(entity, x, y, z, partialTicks);
|
super.doRender(entity, x, y, z, partialTicks);
|
||||||
|
|
|
@ -7,7 +7,7 @@ import client.renderer.texture.TextureMap;
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.entity.item.EntityFalling;
|
import common.entity.item.EntityFalling;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public class RenderFallingBlock extends Render<EntityFalling> {
|
||||||
if(entity.getBlock() != null) {
|
if(entity.getBlock() != null) {
|
||||||
State state = entity.getBlock();
|
State state = entity.getBlock();
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
BlockPos pos = new BlockPos(entity);
|
LocalPos pos = new LocalPos(entity);
|
||||||
World world = entity.getWorldObj();
|
World world = entity.getWorldObj();
|
||||||
|
|
||||||
if(state != world.getState(pos) && block != Blocks.air && !block.getMaterial().isLiquid()) {
|
if(state != world.getState(pos) && block != Blocks.air && !block.getMaterial().isLiquid()) {
|
||||||
|
@ -29,7 +29,7 @@ public class RenderFallingBlock extends Render<EntityFalling> {
|
||||||
GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z);
|
GL15.glTranslatef((float)x, (float)y + 0.5F, (float)z);
|
||||||
this.bindEntityTexture(entity);
|
this.bindEntityTexture(entity);
|
||||||
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
||||||
Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
Client.CLIENT.renderer.renderBlockEntity(state, new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||||
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||||
GL15.glPopMatrix();
|
GL15.glPopMatrix();
|
||||||
super.doRender(entity, x, y, z, partialTicks);
|
super.doRender(entity, x, y, z, partialTicks);
|
||||||
|
|
|
@ -57,13 +57,13 @@ public class RenderFish extends Render<EntityHook>
|
||||||
float f7 = entity.angler.getSwingProgress(partialTicks);
|
float f7 = entity.angler.getSwingProgress(partialTicks);
|
||||||
float f8 = ExtMath.sin(ExtMath.sqrtf(f7) * (float)Math.PI);
|
float f8 = ExtMath.sin(ExtMath.sqrtf(f7) * (float)Math.PI);
|
||||||
Vec3 vec3 = new Vec3(-0.36D, 0.03D, 0.35D);
|
Vec3 vec3 = new Vec3(-0.36D, 0.03D, 0.35D);
|
||||||
vec3 = vec3.rotatePitch(-(entity.angler.prevPitch + (entity.angler.rotPitch - entity.angler.prevPitch) * partialTicks) * (float)Math.PI / 180.0F);
|
vec3 = vec3.pitch(-(entity.angler.prevPitch + (entity.angler.rotPitch - entity.angler.prevPitch) * partialTicks) * (float)Math.PI / 180.0F);
|
||||||
vec3 = vec3.rotateYaw(-(entity.angler.prevYaw + (entity.angler.rotYaw - entity.angler.prevYaw) * partialTicks) * (float)Math.PI / 180.0F);
|
vec3 = vec3.yaw(-(entity.angler.prevYaw + (entity.angler.rotYaw - entity.angler.prevYaw) * partialTicks) * (float)Math.PI / 180.0F);
|
||||||
vec3 = vec3.rotateYaw(f8 * 0.5F);
|
vec3 = vec3.yaw(f8 * 0.5F);
|
||||||
vec3 = vec3.rotatePitch(-f8 * 0.7F);
|
vec3 = vec3.pitch(-f8 * 0.7F);
|
||||||
double d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks + vec3.xCoord;
|
double d0 = entity.angler.prevX + (entity.angler.posX - entity.angler.prevX) * (double)partialTicks + vec3.x;
|
||||||
double d1 = entity.angler.prevY + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks + vec3.yCoord;
|
double d1 = entity.angler.prevY + (entity.angler.posY - entity.angler.prevY) * (double)partialTicks + vec3.y;
|
||||||
double d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks + vec3.zCoord;
|
double d2 = entity.angler.prevZ + (entity.angler.posZ - entity.angler.prevZ) * (double)partialTicks + vec3.z;
|
||||||
double d3 = (double)entity.angler.getEyeHeight();
|
double d3 = (double)entity.angler.getEyeHeight();
|
||||||
|
|
||||||
if (this.manager.gm != null && this.manager.gm.thirdPersonView > 0 || entity.angler != Client.CLIENT.player || this.manager.gm != null && this.manager.gm.showPlayerFirstPerson)
|
if (this.manager.gm != null && this.manager.gm.thirdPersonView > 0 || entity.angler != Client.CLIENT.player || this.manager.gm != null && this.manager.gm.showPlayerFirstPerson)
|
||||||
|
|
|
@ -19,7 +19,7 @@ import common.collect.Maps;
|
||||||
import common.entity.Entity;
|
import common.entity.Entity;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.init.SpeciesRegistry.ModelType;
|
import common.init.SpeciesRegistry.ModelType;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -120,7 +120,7 @@ public class RenderManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getBrightnessForRender(Entity entity) {
|
public static int getBrightnessForRender(Entity entity) {
|
||||||
BlockPos pos = new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ);
|
LocalPos pos = new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ);
|
||||||
return entity.worldObj.isBlockLoaded(pos) ? entity.worldObj.getCombinedBrightness(pos) : 0;
|
return entity.worldObj.isBlockLoaded(pos) ? entity.worldObj.getCombinedBrightness(pos) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ public class RenderManager {
|
||||||
Vec3 vec3 = entityIn.getLook(partialTicks);
|
Vec3 vec3 = entityIn.getLook(partialTicks);
|
||||||
worldrenderer.begin(GL15.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
|
worldrenderer.begin(GL15.GL_LINE_STRIP, DefaultVertexFormats.POSITION_COLOR);
|
||||||
worldrenderer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
|
worldrenderer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
|
||||||
worldrenderer.pos(x + vec3.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, z + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
|
worldrenderer.pos(x + vec3.x * 2.0D, y + (double)entityIn.getEyeHeight() + vec3.y * 2.0D, z + vec3.z * 2.0D).color(0, 0, 255, 255).endVertex();
|
||||||
Tessellator.draw();
|
Tessellator.draw();
|
||||||
GlState.enableTexture2D();
|
GlState.enableTexture2D();
|
||||||
GlState.enableLighting();
|
GlState.enableLighting();
|
||||||
|
|
|
@ -9,7 +9,7 @@ import client.renderer.model.ModelMinecart;
|
||||||
import client.renderer.texture.TextureMap;
|
import client.renderer.texture.TextureMap;
|
||||||
import common.entity.item.EntityCart;
|
import common.entity.item.EntityCart;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -63,16 +63,16 @@ public class RenderMinecart<T extends EntityCart> extends Render<T>
|
||||||
vec32 = vec3;
|
vec32 = vec3;
|
||||||
}
|
}
|
||||||
|
|
||||||
x += vec3.xCoord - d0;
|
x += vec3.x - d0;
|
||||||
y += (vec31.yCoord + vec32.yCoord) / 2.0D - d1;
|
y += (vec31.y + vec32.y) / 2.0D - d1;
|
||||||
z += vec3.zCoord - d2;
|
z += vec3.z - d2;
|
||||||
Vec3 vec33 = vec32.addVector(-vec31.xCoord, -vec31.yCoord, -vec31.zCoord);
|
Vec3 vec33 = vec32.add(-vec31.x, -vec31.y, -vec31.z);
|
||||||
|
|
||||||
if (vec33.lengthVector() != 0.0D)
|
if (vec33.length() != 0.0D)
|
||||||
{
|
{
|
||||||
vec33 = vec33.normalize();
|
vec33 = vec33.normalize();
|
||||||
entityYaw = (float)(Math.atan2(vec33.zCoord, vec33.xCoord) * 180.0D / Math.PI);
|
entityYaw = (float)(Math.atan2(vec33.z, vec33.x) * 180.0D / Math.PI);
|
||||||
f3 = (float)(Math.atan(vec33.yCoord) * 73.0D);
|
f3 = (float)(Math.atan(vec33.y) * 73.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class RenderMinecart<T extends EntityCart> extends Render<T>
|
||||||
protected void func_180560_a(T minecart, float partialTicks, State state)
|
protected void func_180560_a(T minecart, float partialTicks, State state)
|
||||||
{
|
{
|
||||||
GL15.glPushMatrix();
|
GL15.glPushMatrix();
|
||||||
Client.CLIENT.renderer.renderBlockEntity(state, new BlockPos(minecart.posX, minecart.posY + (double)minecart.getEyeHeight(), minecart.posZ));
|
Client.CLIENT.renderer.renderBlockEntity(state, new LocalPos(minecart.posX, minecart.posY + (double)minecart.getEyeHeight(), minecart.posZ));
|
||||||
GL15.glPopMatrix();
|
GL15.glPopMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import client.renderer.texture.TextureMap;
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.entity.item.EntityTnt;
|
import common.entity.item.EntityTnt;
|
||||||
import common.init.BlockRegistry;
|
import common.init.BlockRegistry;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ public class RenderTntPrimed extends Render<EntityTnt>
|
||||||
this.bindEntityTexture(entity);
|
this.bindEntityTexture(entity);
|
||||||
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
GL15.glTranslatef(-0.5F, -0.5F, 0.5F);
|
||||||
Block tnt = BlockRegistry.byName("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize));
|
Block tnt = BlockRegistry.byName("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize));
|
||||||
renderer.renderBlockEntity(tnt.getState(), new BlockPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
renderer.renderBlockEntity(tnt.getState(), new LocalPos(entity.posX, entity.posY + (double)entity.getEyeHeight(), entity.posZ));
|
||||||
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
GL15.glTranslatef(0.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
if (entity.fuse / 5 % 2 == 0)
|
if (entity.fuse / 5 % 2 == 0)
|
||||||
|
|
|
@ -2,8 +2,6 @@ package client.renderer.layers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL15;
|
|
||||||
|
|
||||||
import client.Client;
|
import client.Client;
|
||||||
import client.renderer.GlState;
|
import client.renderer.GlState;
|
||||||
import client.renderer.entity.RendererLivingEntity;
|
import client.renderer.entity.RendererLivingEntity;
|
||||||
|
@ -12,7 +10,6 @@ import common.collect.Lists;
|
||||||
import common.enchantment.Enchantment;
|
import common.enchantment.Enchantment;
|
||||||
import common.enchantment.EnchantmentHelper;
|
import common.enchantment.EnchantmentHelper;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.entity.types.EntityLiving;
|
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.item.material.ItemArmor;
|
import common.item.material.ItemArmor;
|
||||||
import common.util.Equipment;
|
import common.util.Equipment;
|
||||||
|
|
|
@ -47,12 +47,12 @@ public class TexturedQuad
|
||||||
|
|
||||||
public void addTo(RenderBuffer renderer, float scale)
|
public void addTo(RenderBuffer renderer, float scale)
|
||||||
{
|
{
|
||||||
Vec3 norma = this.vertices[1].pos.subtractReverse(this.vertices[0].pos);
|
Vec3 norma = this.vertices[1].pos.subtractRev(this.vertices[0].pos);
|
||||||
Vec3 normb = this.vertices[1].pos.subtractReverse(this.vertices[2].pos);
|
Vec3 normb = this.vertices[1].pos.subtractRev(this.vertices[2].pos);
|
||||||
Vec3 norm = normb.crossProduct(norma).normalize();
|
Vec3 norm = normb.cross(norma).normalize();
|
||||||
float nx = (float)norm.xCoord;
|
float nx = (float)norm.x;
|
||||||
float ny = (float)norm.yCoord;
|
float ny = (float)norm.y;
|
||||||
float nz = (float)norm.zCoord;
|
float nz = (float)norm.z;
|
||||||
// if (this.invNorm)
|
// if (this.invNorm)
|
||||||
// {
|
// {
|
||||||
// nx = -nx;
|
// nx = -nx;
|
||||||
|
@ -63,7 +63,7 @@ public class TexturedQuad
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
PositionTextureVertex vertex = this.vertices[i];
|
PositionTextureVertex vertex = this.vertices[i];
|
||||||
renderer.pos(vertex.pos.xCoord * (double)scale, vertex.pos.yCoord * (double)scale, vertex.pos.zCoord * (double)scale)
|
renderer.pos(vertex.pos.x * (double)scale, vertex.pos.y * (double)scale, vertex.pos.z * (double)scale)
|
||||||
.tex((double)vertex.texX, (double)vertex.texY).normal(nx, ny, nz).endVertex();
|
.tex((double)vertex.texX, (double)vertex.texY).normal(nx, ny, nz).endVertex();
|
||||||
}
|
}
|
||||||
// Tessellator.getInstance();
|
// Tessellator.getInstance();
|
||||||
|
|
|
@ -7,9 +7,6 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL15;
|
|
||||||
import org.lwjgl.opengl.GL30;
|
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import client.init.RenderRegistry;
|
import client.init.RenderRegistry;
|
||||||
|
@ -193,7 +190,7 @@ public class TextureMap extends Texture
|
||||||
return textureatlassprite;
|
return textureatlassprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(boolean mips)
|
public void update()
|
||||||
{
|
{
|
||||||
GlState.bindTexture(this.getGlTextureId());
|
GlState.bindTexture(this.getGlTextureId());
|
||||||
|
|
||||||
|
@ -201,9 +198,6 @@ public class TextureMap extends Texture
|
||||||
{
|
{
|
||||||
textureatlassprite.updateAnimation();
|
textureatlassprite.updateAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mips)
|
|
||||||
GL30.glGenerateMipmap(GL15.GL_TEXTURE_2D);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Sprite registerSprite(String location)
|
private Sprite registerSprite(String location)
|
||||||
|
|
|
@ -22,8 +22,8 @@ public class TextureUtil
|
||||||
public static final DynamicTexture MISSING = new DynamicTexture(16, 16);
|
public static final DynamicTexture MISSING = new DynamicTexture(16, 16);
|
||||||
public static final int[] MISSING_DATA = MISSING.getData();
|
public static final int[] MISSING_DATA = MISSING.getData();
|
||||||
|
|
||||||
public static void setParams(boolean mips, boolean linear) {
|
public static void setParams() {
|
||||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MIN_FILTER, mips ? (linear ? GL15.GL_NEAREST_MIPMAP_LINEAR : GL15.GL_NEAREST_MIPMAP_NEAREST) : GL15.GL_NEAREST);
|
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MIN_FILTER, GL15.GL_NEAREST);
|
||||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MAG_FILTER, GL15.GL_NEAREST);
|
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_MAG_FILTER, GL15.GL_NEAREST);
|
||||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_S, GL15.GL_REPEAT);
|
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_S, GL15.GL_REPEAT);
|
||||||
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_T, GL15.GL_REPEAT);
|
GL15.glTexParameteri(GL15.GL_TEXTURE_2D, GL15.GL_TEXTURE_WRAP_T, GL15.GL_REPEAT);
|
||||||
|
@ -33,7 +33,7 @@ public class TextureUtil
|
||||||
{
|
{
|
||||||
int i = 4194304 / w;
|
int i = 4194304 / w;
|
||||||
if(params)
|
if(params)
|
||||||
setParams(false, false);
|
setParams();
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
for (int j = 0; j < w * h; j += w * l)
|
for (int j = 0; j < w * h; j += w * l)
|
||||||
|
@ -56,7 +56,7 @@ public class TextureUtil
|
||||||
int h = img.getHeight();
|
int h = img.getHeight();
|
||||||
int k = 4194304 / w;
|
int k = 4194304 / w;
|
||||||
int[] data = new int[k * w];
|
int[] data = new int[k * w];
|
||||||
setParams(false, false);
|
setParams();
|
||||||
|
|
||||||
for (int l = 0; l < w * h; l += w * k)
|
for (int l = 0; l < w * h; l += w * k)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ import common.block.Block;
|
||||||
import common.block.tech.BlockDisplay;
|
import common.block.tech.BlockDisplay;
|
||||||
import common.collect.Maps;
|
import common.collect.Maps;
|
||||||
import common.tileentity.TileEntityDisplay;
|
import common.tileentity.TileEntityDisplay;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ public class DisplayRenderer extends ElementRenderer<TileEntityDisplay> {
|
||||||
|
|
||||||
private static final Map<String, TimedTexture> DISPLAYS = Maps.<String, TimedTexture>newHashMap();
|
private static final Map<String, TimedTexture> DISPLAYS = Maps.<String, TimedTexture>newHashMap();
|
||||||
|
|
||||||
private static String getTextureLocation(BlockPos pos) {
|
private static String getTextureLocation(LocalPos pos) {
|
||||||
return "display/" + pos.getX() + "," + pos.getY() + "," + pos.getZ();
|
return "display/" + pos.getX() + "," + pos.getY() + "," + pos.getZ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.tileentity.TileEntity;
|
||||||
import common.tileentity.TileEntityDisplay;
|
import common.tileentity.TileEntityDisplay;
|
||||||
import common.tileentity.TileEntityItemPipe;
|
import common.tileentity.TileEntityItemPipe;
|
||||||
import common.tileentity.TileEntitySign;
|
import common.tileentity.TileEntitySign;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class SpecialRenderer {
|
public class SpecialRenderer {
|
||||||
|
@ -60,7 +60,7 @@ public class SpecialRenderer {
|
||||||
int sky = light / 65536;
|
int sky = light / 65536;
|
||||||
GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F);
|
GL15.glMultiTexCoord2f(GL15.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F);
|
||||||
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
GlState.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
BlockPos pos = tile.getPos();
|
LocalPos pos = tile.getPos();
|
||||||
this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial);
|
this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import common.packet.CPacketBreak;
|
||||||
import common.packet.CPacketClick;
|
import common.packet.CPacketClick;
|
||||||
import common.packet.CPacketPlace;
|
import common.packet.CPacketPlace;
|
||||||
import common.sound.PositionedSound;
|
import common.sound.PositionedSound;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -25,7 +25,7 @@ public class PlayerController {
|
||||||
private final Client gm;
|
private final Client gm;
|
||||||
private final ClientPlayer handler;
|
private final ClientPlayer handler;
|
||||||
|
|
||||||
private BlockPos position = new BlockPos(-1, -World.MAX_SIZE_Y - 1, -1);
|
private LocalPos position = new LocalPos(-1, -World.MAX_SIZE_Y - 1, -1);
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
private float damage;
|
private float damage;
|
||||||
private float stepCounter;
|
private float stepCounter;
|
||||||
|
@ -41,7 +41,7 @@ public class PlayerController {
|
||||||
this.handler = handler;
|
this.handler = handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean destroyBlock(BlockPos pos, Facing side) {
|
public boolean destroyBlock(LocalPos pos, Facing side) {
|
||||||
World world = this.gm.world;
|
World world = this.gm.world;
|
||||||
State state = world.getState(pos);
|
State state = world.getState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
@ -57,7 +57,7 @@ public class PlayerController {
|
||||||
block.onBroken(world, pos, state);
|
block.onBroken(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.position = new BlockPos(this.position.getX(), -1, this.position.getZ());
|
this.position = new LocalPos(this.position.getX(), -1, this.position.getZ());
|
||||||
|
|
||||||
ItemStack stack = this.gm.player.getHeldItem();
|
ItemStack stack = this.gm.player.getHeldItem();
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class PlayerController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clickBlock(BlockPos pos, Facing face) {
|
public boolean clickBlock(LocalPos pos, Facing face) {
|
||||||
if(!World.isValidXZ(pos)) {
|
if(!World.isValidXZ(pos)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ public class PlayerController {
|
||||||
this.interacting = false;
|
this.interacting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean damageBlock(BlockPos pos, Facing face) {
|
public boolean damageBlock(LocalPos pos, Facing face) {
|
||||||
if(this.interacting)
|
if(this.interacting)
|
||||||
return false;
|
return false;
|
||||||
this.syncItem();
|
this.syncItem();
|
||||||
|
@ -183,7 +183,7 @@ public class PlayerController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isHitting(BlockPos pos) {
|
private boolean isHitting(LocalPos pos) {
|
||||||
ItemStack stack = this.gm.player.getHeldItem();
|
ItemStack stack = this.gm.player.getHeldItem();
|
||||||
boolean flag = this.stack == null && stack == null;
|
boolean flag = this.stack == null && stack == null;
|
||||||
|
|
||||||
|
@ -204,11 +204,11 @@ public class PlayerController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean clickRight(EntityNPC player, World world, ItemStack stack, BlockPos pos, Facing side, Vec3 hit) {
|
public boolean clickRight(EntityNPC player, World world, ItemStack stack, LocalPos pos, Facing side, Vec3 hit) {
|
||||||
this.syncItem();
|
this.syncItem();
|
||||||
float f = (float)(hit.xCoord - (double)pos.getX());
|
float f = (float)(hit.x - (double)pos.getX());
|
||||||
float f1 = (float)(hit.yCoord - (double)pos.getY());
|
float f1 = (float)(hit.y - (double)pos.getY());
|
||||||
float f2 = (float)(hit.zCoord - (double)pos.getZ());
|
float f2 = (float)(hit.z - (double)pos.getZ());
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if(!World.isValidXZ(pos)) {
|
if(!World.isValidXZ(pos)) {
|
||||||
|
@ -301,7 +301,7 @@ public class PlayerController {
|
||||||
|
|
||||||
public void stopUsing(EntityNPC player) {
|
public void stopUsing(EntityNPC player) {
|
||||||
this.syncItem();
|
this.syncItem();
|
||||||
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, Facing.DOWN));
|
this.handler.addToSendQueue(new CPacketBreak(CPacketBreak.Action.RELEASE_USE_ITEM, LocalPos.ORIGIN, Facing.DOWN));
|
||||||
player.stopUsingItem();
|
player.stopUsingItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ public class PlayerController {
|
||||||
this.itemUseCooldown = 0;
|
this.itemUseCooldown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getDamage(BlockPos pos) {
|
public float getDamage(LocalPos pos) {
|
||||||
return this.hitting && pos.equals(this.position) ? this.damage : 0.0f;
|
return this.hitting && pos.equals(this.position) ? this.damage : 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,17 @@ package client.world;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
|
|
||||||
import client.renderer.Renderer;
|
|
||||||
import common.block.Block;
|
import common.block.Block;
|
||||||
import common.block.ITileEntityProvider;
|
import common.block.ITileEntityProvider;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.BlockArray;
|
import common.world.BlockArray;
|
||||||
import common.world.Chunk;
|
import common.world.Chunk;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class ChunkClient extends Chunk {
|
public class ChunkClient extends Chunk {
|
||||||
private final ConcurrentLinkedQueue<BlockPos> tileQueue = new ConcurrentLinkedQueue<BlockPos>();
|
private final ConcurrentLinkedQueue<LocalPos> tileQueue = new ConcurrentLinkedQueue<LocalPos>();
|
||||||
private final float[] temperatures = new float[256];
|
private final float[] temperatures = new float[256];
|
||||||
private final float[] offsets = new float[256];
|
private final float[] offsets = new float[256];
|
||||||
|
|
||||||
|
@ -124,13 +123,13 @@ public class ChunkClient extends Chunk {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTemperature(BlockPos pos) {
|
public float getTemperature(LocalPos pos) {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int z = pos.getZ() & 15;
|
int z = pos.getZ() & 15;
|
||||||
return this.temperatures[z << 4 | x];
|
return this.temperatures[z << 4 | x];
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getOffset(BlockPos pos) {
|
public float getOffset(LocalPos pos) {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int z = pos.getZ() & 15;
|
int z = pos.getZ() & 15;
|
||||||
return this.offsets[z << 4 | x];
|
return this.offsets[z << 4 | x];
|
||||||
|
@ -138,7 +137,7 @@ public class ChunkClient extends Chunk {
|
||||||
|
|
||||||
public void spawnTiles() {
|
public void spawnTiles() {
|
||||||
while(!this.tileQueue.isEmpty()) {
|
while(!this.tileQueue.isEmpty()) {
|
||||||
BlockPos pos = this.tileQueue.poll();
|
LocalPos pos = this.tileQueue.poll();
|
||||||
if(this.getTileEntity(pos, TileEntity.CreateMode.CHECK) == null && this.getBlock(pos) instanceof ITileEntityProvider) {
|
if(this.getTileEntity(pos, TileEntity.CreateMode.CHECK) == null && this.getBlock(pos) instanceof ITileEntityProvider) {
|
||||||
TileEntity tile = this.createNewTileEntity(pos);
|
TileEntity tile = this.createNewTileEntity(pos);
|
||||||
this.world.setTileEntity(pos, tile);
|
this.world.setTileEntity(pos, tile);
|
||||||
|
@ -147,7 +146,7 @@ public class ChunkClient extends Chunk {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntity getTileEntity(BlockPos pos, TileEntity.CreateMode type) {
|
public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) {
|
||||||
TileEntity tile = this.tiles.get(pos);
|
TileEntity tile = this.tiles.get(pos);
|
||||||
|
|
||||||
if(tile == null) {
|
if(tile == null) {
|
||||||
|
@ -167,7 +166,7 @@ public class ChunkClient extends Chunk {
|
||||||
return tile;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLight(BlockPos pos) {
|
public int getLight(LocalPos pos) {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ() & 15;
|
int z = pos.getZ() & 15;
|
||||||
|
@ -175,7 +174,7 @@ public class ChunkClient extends Chunk {
|
||||||
return stor == null ? 0 : stor.getLight(x, y & 15, z);
|
return stor == null ? 0 : stor.getLight(x, y & 15, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLight(BlockPos pos, int value) {
|
public void setLight(LocalPos pos, int value) {
|
||||||
int x = pos.getX() & 15;
|
int x = pos.getX() & 15;
|
||||||
int y = pos.getY();
|
int y = pos.getY();
|
||||||
int z = pos.getZ() & 15;
|
int z = pos.getZ() & 15;
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.entity.Entity;
|
||||||
import common.init.BlockRegistry;
|
import common.init.BlockRegistry;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -68,15 +68,15 @@ public class ChunkEmpty extends ChunkClient {
|
||||||
return this.liquidY;
|
return this.liquidY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Block getBlock(BlockPos pos) {
|
public Block getBlock(LocalPos pos) {
|
||||||
return pos.getY() < this.liquidY ? this.dummyBlock : (pos.getY() == this.liquidY ? this.liquidBlock : Blocks.air);
|
return pos.getY() < this.liquidY ? this.dummyBlock : (pos.getY() == this.liquidY ? this.liquidBlock : Blocks.air);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getLight(BlockPos pos) {
|
public int getLight(LocalPos pos) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLight(BlockPos pos, int value) {
|
public void setLight(LocalPos pos, int value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEntity(Entity entity) {
|
public void addEntity(Entity entity) {
|
||||||
|
@ -85,14 +85,14 @@ public class ChunkEmpty extends ChunkClient {
|
||||||
public void removeEntity(Entity entity) {
|
public void removeEntity(Entity entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntity getTileEntity(BlockPos pos, TileEntity.CreateMode type) {
|
public TileEntity getTileEntity(LocalPos pos, TileEntity.CreateMode type) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTileEntity(BlockPos pos, TileEntity tile) {
|
public void addTileEntity(LocalPos pos, TileEntity tile) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTileEntity(BlockPos pos) {
|
public void removeTileEntity(LocalPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getEntities(Entity exclude, BoundingBox bb, List<Entity> list, Predicate<? super Entity> pred) {
|
public void getEntities(Entity exclude, BoundingBox bb, List<Entity> list, Predicate<? super Entity> pred) {
|
||||||
|
@ -109,7 +109,7 @@ public class ChunkEmpty extends ChunkClient {
|
||||||
return top < 0 || bottom > this.liquidY;
|
return top < 0 || bottom > this.liquidY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getState(BlockPos pos) {
|
public State getState(LocalPos pos) {
|
||||||
if(this.debug) {
|
if(this.debug) {
|
||||||
State state = pos.getY() == 1 ? getDebug(pos.getX(), pos.getZ()) : null;
|
State state = pos.getY() == 1 ? getDebug(pos.getX(), pos.getZ()) : null;
|
||||||
return state == null ? Blocks.air.getState() : state;
|
return state == null ? Blocks.air.getState() : state;
|
||||||
|
@ -117,12 +117,12 @@ public class ChunkEmpty extends ChunkClient {
|
||||||
return pos.getY() < this.liquidY ? this.dummy : (pos.getY() == this.liquidY ? this.liquid : Blocks.air.getState());
|
return pos.getY() < this.liquidY ? this.dummy : (pos.getY() == this.liquidY ? this.liquid : Blocks.air.getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public State setState(BlockPos pos, State state, boolean updateLight) {
|
public State setState(LocalPos pos, State state, boolean updateLight) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockPos getPrecipitation(BlockPos pos) {
|
public LocalPos getPrecipitation(LocalPos pos) {
|
||||||
return new BlockPos(pos.getX(), this.liquidY + 1, pos.getZ());
|
return new LocalPos(pos.getX(), this.liquidY + 1, pos.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void spawnTiles() {
|
public void spawnTiles() {
|
||||||
|
@ -134,11 +134,11 @@ public class ChunkEmpty extends ChunkClient {
|
||||||
public void setData(byte[] data, int[] extend, boolean biomes) {
|
public void setData(byte[] data, int[] extend, boolean biomes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getTemperature(BlockPos pos) {
|
public float getTemperature(LocalPos pos) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getOffset(BlockPos pos) {
|
public float getOffset(LocalPos pos) {
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common.ai;
|
||||||
import common.entity.projectile.EntityFireball;
|
import common.entity.projectile.EntityFireball;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.init.SoundEvent;
|
import common.init.SoundEvent;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
|
@ -49,16 +49,16 @@ public class AIFireAttack extends EntityAIBase
|
||||||
this.parentEntity.playSound(SoundEvent.DRAGON_GROWL, 5.0f);
|
this.parentEntity.playSound(SoundEvent.DRAGON_GROWL, 5.0f);
|
||||||
double d1 = 1.0D;
|
double d1 = 1.0D;
|
||||||
Vec3 vec3 = this.parentEntity.getLook(1.0F);
|
Vec3 vec3 = this.parentEntity.getLook(1.0F);
|
||||||
double d2 = target.posX - (this.parentEntity.posX + vec3.xCoord * d1);
|
double d2 = target.posX - (this.parentEntity.posX + vec3.x * d1);
|
||||||
double d3 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.parentEntity.posY + (double)this.parentEntity.getEyeHeight());
|
double d3 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.parentEntity.posY + (double)this.parentEntity.getEyeHeight());
|
||||||
double d4 = target.posZ - (this.parentEntity.posZ + vec3.zCoord * d1);
|
double d4 = target.posZ - (this.parentEntity.posZ + vec3.z * d1);
|
||||||
world.playEffect(1008, new BlockPos(this.parentEntity), 0);
|
world.playEffect(1008, new LocalPos(this.parentEntity), 0);
|
||||||
EntityFireball fireball = new EntityFireball(world, this.parentEntity, d2, d3, d4, this.velocity);
|
EntityFireball fireball = new EntityFireball(world, this.parentEntity, d2, d3, d4, this.velocity);
|
||||||
fireball.explosionPower = this.power;
|
fireball.explosionPower = this.power;
|
||||||
fireball.damageBlocks = true;
|
fireball.damageBlocks = true;
|
||||||
fireball.posX = this.parentEntity.posX + vec3.xCoord * d1;
|
fireball.posX = this.parentEntity.posX + vec3.x * d1;
|
||||||
fireball.posY = this.parentEntity.posY + (double)this.parentEntity.getEyeHeight();
|
fireball.posY = this.parentEntity.posY + (double)this.parentEntity.getEyeHeight();
|
||||||
fireball.posZ = this.parentEntity.posZ + vec3.zCoord * d1;
|
fireball.posZ = this.parentEntity.posZ + vec3.z * d1;
|
||||||
world.spawnEntityInWorld(fireball);
|
world.spawnEntityInWorld(fireball);
|
||||||
this.attackTimer = -this.delay * this.parentEntity.getRNG().range(1, 4);
|
this.attackTimer = -this.delay * this.parentEntity.getRNG().range(1, 4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import common.entity.projectile.EntityFireball;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.init.Items;
|
import common.init.Items;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class AIFireballAttack extends EntityAIBase
|
||||||
|
|
||||||
if (this.attackTimer == this.delay)
|
if (this.attackTimer == this.delay)
|
||||||
{
|
{
|
||||||
world.playEffect(1007, new BlockPos(this.parentEntity), 0);
|
world.playEffect(1007, new LocalPos(this.parentEntity), 0);
|
||||||
this.parentEntity.setHeldNoUpdate(new ItemStack(Items.orb));
|
this.parentEntity.setHeldNoUpdate(new ItemStack(Items.orb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,15 +64,15 @@ public class AIFireballAttack extends EntityAIBase
|
||||||
this.parentEntity.setHeldNoUpdate(null);
|
this.parentEntity.setHeldNoUpdate(null);
|
||||||
double d1 = 1.0D;
|
double d1 = 1.0D;
|
||||||
Vec3 vec3 = this.parentEntity.getLook(1.0F);
|
Vec3 vec3 = this.parentEntity.getLook(1.0F);
|
||||||
double d2 = target.posX - (this.parentEntity.posX + vec3.xCoord * d1);
|
double d2 = target.posX - (this.parentEntity.posX + vec3.x * d1);
|
||||||
double d3 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.parentEntity.posY + (double)this.parentEntity.getEyeHeight());
|
double d3 = target.getEntityBoundingBox().minY + (double)(target.height / 2.0F) - (this.parentEntity.posY + (double)this.parentEntity.getEyeHeight());
|
||||||
double d4 = target.posZ - (this.parentEntity.posZ + vec3.zCoord * d1);
|
double d4 = target.posZ - (this.parentEntity.posZ + vec3.z * d1);
|
||||||
world.playEffect(1008, new BlockPos(this.parentEntity), 0);
|
world.playEffect(1008, new LocalPos(this.parentEntity), 0);
|
||||||
EntityFireball fireball = new EntityFireball(world, this.parentEntity, d2, d3, d4, this.velocity);
|
EntityFireball fireball = new EntityFireball(world, this.parentEntity, d2, d3, d4, this.velocity);
|
||||||
fireball.explosionPower = this.power;
|
fireball.explosionPower = this.power;
|
||||||
fireball.posX = this.parentEntity.posX + vec3.xCoord * d1;
|
fireball.posX = this.parentEntity.posX + vec3.x * d1;
|
||||||
fireball.posY = this.parentEntity.posY + (double)this.parentEntity.getEyeHeight();
|
fireball.posY = this.parentEntity.posY + (double)this.parentEntity.getEyeHeight();
|
||||||
fireball.posZ = this.parentEntity.posZ + vec3.zCoord * d1;
|
fireball.posZ = this.parentEntity.posZ + vec3.z * d1;
|
||||||
world.spawnEntityInWorld(fireball);
|
world.spawnEntityInWorld(fireball);
|
||||||
this.attackTimer = -this.delay * this.parentEntity.getRNG().range(1, 4);
|
this.attackTimer = -this.delay * this.parentEntity.getRNG().range(1, 4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common.ai;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.entity.projectile.EntityBox;
|
import common.entity.projectile.EntityBox;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
|
|
||||||
public class AIFlyingBoxAttack extends EntityAIBase
|
public class AIFlyingBoxAttack extends EntityAIBase
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ public class AIFlyingBoxAttack extends EntityAIBase
|
||||||
private void launchBoxToCoords(double x, double y, double z, boolean invulnerable)
|
private void launchBoxToCoords(double x, double y, double z, boolean invulnerable)
|
||||||
{
|
{
|
||||||
this.entity.swingItem();
|
this.entity.swingItem();
|
||||||
this.entity.worldObj.playEffect(1014, new BlockPos(this.entity), 0);
|
this.entity.worldObj.playEffect(1014, new LocalPos(this.entity), 0);
|
||||||
double d0 = this.entity.posX;
|
double d0 = this.entity.posX;
|
||||||
double d1 = this.entity.posY + this.entity.height + 0.8;
|
double d1 = this.entity.posY + this.entity.height + 0.8;
|
||||||
double d2 = this.entity.posZ;
|
double d2 = this.entity.posZ;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common.ai;
|
||||||
import common.entity.npc.EntityNPC;
|
import common.entity.npc.EntityNPC;
|
||||||
import common.entity.projectile.EntityFireCharge;
|
import common.entity.projectile.EntityFireCharge;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
|
|
||||||
public class AISmallFireballAttack extends EntityAIBase
|
public class AISmallFireballAttack extends EntityAIBase
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ public class AISmallFireballAttack extends EntityAIBase
|
||||||
{
|
{
|
||||||
this.entity.swingItem();
|
this.entity.swingItem();
|
||||||
// float f = MathHelper.sqrt_float(MathHelper.sqrt_double(d0)) * 0.5F;
|
// float f = MathHelper.sqrt_float(MathHelper.sqrt_double(d0)) * 0.5F;
|
||||||
this.entity.worldObj.playEffect(1009, new BlockPos((int)this.entity.posX, (int)this.entity.posY, (int)this.entity.posZ), 0);
|
this.entity.worldObj.playEffect(1009, new LocalPos((int)this.entity.posX, (int)this.entity.posY, (int)this.entity.posZ), 0);
|
||||||
|
|
||||||
for (int i = 0; i < 1; ++i)
|
for (int i = 0; i < 1; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common.ai;
|
||||||
import common.entity.Entity;
|
import common.entity.Entity;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.pathfinding.PathEntity;
|
import common.pathfinding.PathEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class EntityAIAttackOnCollide extends EntityAIBase
|
public class EntityAIAttackOnCollide extends EntityAIBase
|
||||||
|
@ -92,7 +92,7 @@ public class EntityAIAttackOnCollide extends EntityAIBase
|
||||||
public boolean continueExecuting()
|
public boolean continueExecuting()
|
||||||
{
|
{
|
||||||
EntityLiving entitylivingbase = this.attacker.getAttackTarget();
|
EntityLiving entitylivingbase = this.attacker.getAttackTarget();
|
||||||
return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistanceFromPosition(new BlockPos(entitylivingbase))));
|
return entitylivingbase == null ? false : (!entitylivingbase.isEntityAlive() ? false : (!this.longMemory ? !this.attacker.getNavigator().noPath() : this.attacker.isWithinHomeDistanceFromPosition(new LocalPos(entitylivingbase))));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -73,13 +73,13 @@ public class EntityAIAvoidEntity<T extends Entity> extends EntityAIBase
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (this.closestLivingEntity.getDistanceSq(vec3.xCoord, vec3.yCoord, vec3.zCoord) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity))
|
else if (this.closestLivingEntity.getDistanceSq(vec3.x, vec3.y, vec3.z) < this.closestLivingEntity.getDistanceSqToEntity(this.theEntity))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.xCoord, vec3.yCoord, vec3.zCoord);
|
this.entityPathEntity = this.entityPathNavigate.getPathToXYZ(vec3.x, vec3.y, vec3.z);
|
||||||
return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(vec3);
|
return this.entityPathEntity == null ? false : this.entityPathEntity.isDestinationSame(vec3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import common.block.tech.BlockFurnace;
|
||||||
import common.entity.animal.EntityCat;
|
import common.entity.animal.EntityCat;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.tileentity.TileEntityChest;
|
import common.tileentity.TileEntityChest;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ public class EntityAICatSit extends EntityAIMoveToBlock
|
||||||
/**
|
/**
|
||||||
* Return true to set given position as destination
|
* Return true to set given position as destination
|
||||||
*/
|
*/
|
||||||
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
|
protected boolean shouldMoveTo(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
if (!worldIn.isAirBlock(pos.up()))
|
if (!worldIn.isAirBlock(pos.up()))
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ import common.init.Blocks;
|
||||||
import common.init.Items;
|
import common.init.Items;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.pathfinding.WalkNodeProcessor;
|
import common.pathfinding.WalkNodeProcessor;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
|
|
||||||
public class EntityAIControlledByPlayer extends EntityAIBase
|
public class EntityAIControlledByPlayer extends EntityAIBase
|
||||||
|
@ -111,7 +111,7 @@ public class EntityAIControlledByPlayer extends EntityAIBase
|
||||||
|
|
||||||
if (this.thisEntity.onGround)
|
if (this.thisEntity.onGround)
|
||||||
{
|
{
|
||||||
f2 = this.thisEntity.worldObj.getState(new BlockPos(ExtMath.floorf((float)i), ExtMath.floorf((float)j) - 1, ExtMath.floorf((float)k))).getBlock().getSlipperiness() * 0.91F;
|
f2 = this.thisEntity.worldObj.getState(new LocalPos(ExtMath.floorf((float)i), ExtMath.floorf((float)j) - 1, ExtMath.floorf((float)k))).getBlock().getSlipperiness() * 0.91F;
|
||||||
}
|
}
|
||||||
|
|
||||||
float f3 = 0.16277136F / (f2 * f2 * f2);
|
float f3 = 0.16277136F / (f2 * f2 * f2);
|
||||||
|
@ -161,8 +161,8 @@ public class EntityAIControlledByPlayer extends EntityAIBase
|
||||||
|
|
||||||
if (i != l || k != i1)
|
if (i != l || k != i1)
|
||||||
{
|
{
|
||||||
Block block = this.thisEntity.worldObj.getState(new BlockPos(i, j, k)).getBlock();
|
Block block = this.thisEntity.worldObj.getState(new LocalPos(i, j, k)).getBlock();
|
||||||
boolean flag = !this.isStairOrSlab(block) && (block != Blocks.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new BlockPos(i, j - 1, k)).getBlock()));
|
boolean flag = !this.isStairOrSlab(block) && (block != Blocks.air || !this.isStairOrSlab(this.thisEntity.worldObj.getState(new LocalPos(i, j - 1, k)).getBlock()));
|
||||||
|
|
||||||
if (flag && 0 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j, i1, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, i, j + 1, k, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j + 1, i1, j1, k1, l1, false, false, true))
|
if (flag && 0 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j, i1, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, i, j + 1, k, j1, k1, l1, false, false, true) && 1 == WalkNodeProcessor.getColliding(this.thisEntity.worldObj, this.thisEntity, l, j + 1, i1, j1, k1, l1, false, false, true))
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,12 +7,12 @@ import common.entity.types.EntityLiving;
|
||||||
import common.pathfinding.PathEntity;
|
import common.pathfinding.PathEntity;
|
||||||
import common.pathfinding.PathNavigateGround;
|
import common.pathfinding.PathNavigateGround;
|
||||||
import common.pathfinding.PathPoint;
|
import common.pathfinding.PathPoint;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
|
|
||||||
public abstract class EntityAIDoorInteract extends EntityAIBase
|
public abstract class EntityAIDoorInteract extends EntityAIBase
|
||||||
{
|
{
|
||||||
protected EntityLiving theEntity;
|
protected EntityLiving theEntity;
|
||||||
protected BlockPos doorPosition = BlockPos.ORIGIN;
|
protected LocalPos doorPosition = LocalPos.ORIGIN;
|
||||||
|
|
||||||
/** The wooden door block */
|
/** The wooden door block */
|
||||||
protected BlockDoor doorBlock;
|
protected BlockDoor doorBlock;
|
||||||
|
@ -53,7 +53,7 @@ public abstract class EntityAIDoorInteract extends EntityAIBase
|
||||||
for (int i = 0; i < Math.min(pathentity.getCurrentPathIndex() + 2, pathentity.getCurrentPathLength()); ++i)
|
for (int i = 0; i < Math.min(pathentity.getCurrentPathIndex() + 2, pathentity.getCurrentPathLength()); ++i)
|
||||||
{
|
{
|
||||||
PathPoint pathpoint = pathentity.getPathPointFromIndex(i);
|
PathPoint pathpoint = pathentity.getPathPointFromIndex(i);
|
||||||
this.doorPosition = new BlockPos(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord);
|
this.doorPosition = new LocalPos(pathpoint.xCoord, pathpoint.yCoord + 1, pathpoint.zCoord);
|
||||||
|
|
||||||
if (this.theEntity.getDistanceSq((double)this.doorPosition.getX(), this.theEntity.posY, (double)this.doorPosition.getZ()) <= 2.25D)
|
if (this.theEntity.getDistanceSq((double)this.doorPosition.getX(), this.theEntity.posY, (double)this.doorPosition.getZ()) <= 2.25D)
|
||||||
{
|
{
|
||||||
|
@ -66,7 +66,7 @@ public abstract class EntityAIDoorInteract extends EntityAIBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.doorPosition = (new BlockPos(this.theEntity)).up();
|
this.doorPosition = (new LocalPos(this.theEntity)).up();
|
||||||
this.doorBlock = this.getBlockDoor(this.doorPosition);
|
this.doorBlock = this.getBlockDoor(this.doorPosition);
|
||||||
return this.doorBlock != null;
|
return this.doorBlock != null;
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ public abstract class EntityAIDoorInteract extends EntityAIBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockDoor getBlockDoor(BlockPos pos)
|
private BlockDoor getBlockDoor(LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = this.theEntity.worldObj.getState(pos).getBlock();
|
Block block = this.theEntity.worldObj.getState(pos).getBlock();
|
||||||
return block instanceof BlockDoor && block.getMaterial() == Material.WOOD ? (BlockDoor)block : null;
|
return block instanceof BlockDoor && block.getMaterial() == Material.WOOD ? (BlockDoor)block : null;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package common.ai;
|
||||||
import common.entity.animal.EntitySheep;
|
import common.entity.animal.EntitySheep;
|
||||||
import common.init.BlockRegistry;
|
import common.init.BlockRegistry;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -32,7 +32,7 @@ public class EntityAIEatGrass extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ);
|
LocalPos blockpos = new LocalPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ);
|
||||||
State state = this.entityWorld.getState(blockpos);
|
State state = this.entityWorld.getState(blockpos);
|
||||||
return state.getBlock() == Blocks.tallgrass ||
|
return state.getBlock() == Blocks.tallgrass ||
|
||||||
this.entityWorld.getState(blockpos.down()).getBlock() == Blocks.grass;
|
this.entityWorld.getState(blockpos.down()).getBlock() == Blocks.grass;
|
||||||
|
@ -82,7 +82,7 @@ public class EntityAIEatGrass extends EntityAIBase
|
||||||
|
|
||||||
if (this.eatingGrassTimer == 4)
|
if (this.eatingGrassTimer == 4)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = new BlockPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ);
|
LocalPos blockpos = new LocalPos(this.grassEaterEntity.posX, this.grassEaterEntity.posY, this.grassEaterEntity.posZ);
|
||||||
|
|
||||||
State state = this.entityWorld.getState(blockpos);
|
State state = this.entityWorld.getState(blockpos);
|
||||||
if (state.getBlock() == Blocks.tallgrass)
|
if (state.getBlock() == Blocks.tallgrass)
|
||||||
|
@ -96,7 +96,7 @@ public class EntityAIEatGrass extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BlockPos blockpos1 = blockpos.down();
|
LocalPos blockpos1 = blockpos.down();
|
||||||
|
|
||||||
if (this.entityWorld.getState(blockpos1).getBlock() == Blocks.grass)
|
if (this.entityWorld.getState(blockpos1).getBlock() == Blocks.grass)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package common.ai;
|
package common.ai;
|
||||||
|
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public class EntityAIHarvestFarmland extends EntityAIMoveToBlock
|
public class EntityAIHarvestFarmland extends EntityAIMoveToBlock
|
||||||
|
@ -131,7 +131,7 @@ public class EntityAIHarvestFarmland extends EntityAIMoveToBlock
|
||||||
// /**
|
// /**
|
||||||
// * Return true to set given position as destination
|
// * Return true to set given position as destination
|
||||||
// */
|
// */
|
||||||
protected boolean shouldMoveTo(World worldIn, BlockPos pos)
|
protected boolean shouldMoveTo(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
// Block block = worldIn.getBlockState(pos).getBlock();
|
// Block block = worldIn.getBlockState(pos).getBlock();
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package common.ai;
|
package common.ai;
|
||||||
|
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
public abstract class EntityAIMoveToBlock extends EntityAIBase
|
public abstract class EntityAIMoveToBlock extends EntityAIBase
|
||||||
|
@ -15,7 +15,7 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase
|
||||||
private int field_179490_f;
|
private int field_179490_f;
|
||||||
|
|
||||||
/** Block to move to */
|
/** Block to move to */
|
||||||
protected BlockPos destinationBlock = BlockPos.ORIGIN;
|
protected LocalPos destinationBlock = LocalPos.ORIGIN;
|
||||||
private boolean isAboveDestination;
|
private boolean isAboveDestination;
|
||||||
private int searchLength;
|
private int searchLength;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase
|
||||||
{
|
{
|
||||||
int i = this.searchLength;
|
int i = this.searchLength;
|
||||||
int j = 1;
|
int j = 1;
|
||||||
BlockPos blockpos = new BlockPos(this.theEntity);
|
LocalPos blockpos = new LocalPos(this.theEntity);
|
||||||
|
|
||||||
for (int k = 0; k <= 1; k = k > 0 ? -k : 1 - k)
|
for (int k = 0; k <= 1; k = k > 0 ? -k : 1 - k)
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase
|
||||||
{
|
{
|
||||||
for (int j1 = i1 < l && i1 > -l ? l : 0; j1 <= l; j1 = j1 > 0 ? -j1 : 1 - j1)
|
for (int j1 = i1 < l && i1 > -l ? l : 0; j1 <= l; j1 = j1 > 0 ? -j1 : 1 - j1)
|
||||||
{
|
{
|
||||||
BlockPos blockpos1 = blockpos.add(i1, k - 1, j1);
|
LocalPos blockpos1 = blockpos.add(i1, k - 1, j1);
|
||||||
|
|
||||||
if (this.theEntity.isWithinHomeDistanceFromPosition(blockpos1) && this.shouldMoveTo(this.theEntity.worldObj, blockpos1))
|
if (this.theEntity.isWithinHomeDistanceFromPosition(blockpos1) && this.shouldMoveTo(this.theEntity.worldObj, blockpos1))
|
||||||
{
|
{
|
||||||
|
@ -133,5 +133,5 @@ public abstract class EntityAIMoveToBlock extends EntityAIBase
|
||||||
/**
|
/**
|
||||||
* Return true to set given position as destination
|
* Return true to set given position as destination
|
||||||
*/
|
*/
|
||||||
protected abstract boolean shouldMoveTo(World worldIn, BlockPos pos);
|
protected abstract boolean shouldMoveTo(World worldIn, LocalPos pos);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package common.ai;
|
package common.ai;
|
||||||
|
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
|
|
||||||
public class EntityAIMoveTowardsRestriction extends EntityAIBase
|
public class EntityAIMoveTowardsRestriction extends EntityAIBase
|
||||||
|
@ -30,7 +30,7 @@ public class EntityAIMoveTowardsRestriction extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
BlockPos blockpos = this.theEntity.getHomePosition();
|
LocalPos blockpos = this.theEntity.getHomePosition();
|
||||||
Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()));
|
Vec3 vec3 = RandomPositionGenerator.findRandomTargetBlockTowards(this.theEntity, 16, 7, new Vec3((double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ()));
|
||||||
|
|
||||||
if (vec3 == null)
|
if (vec3 == null)
|
||||||
|
@ -39,9 +39,9 @@ public class EntityAIMoveTowardsRestriction extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.movePosX = vec3.xCoord;
|
this.movePosX = vec3.x;
|
||||||
this.movePosY = vec3.yCoord;
|
this.movePosY = vec3.y;
|
||||||
this.movePosZ = vec3.zCoord;
|
this.movePosZ = vec3.z;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,9 +50,9 @@ public class EntityAIMoveTowardsTarget extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.movePosX = vec3.xCoord;
|
this.movePosX = vec3.x;
|
||||||
this.movePosY = vec3.yCoord;
|
this.movePosY = vec3.y;
|
||||||
this.movePosZ = vec3.zCoord;
|
this.movePosZ = vec3.z;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ public class EntityAIPanic extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.randPosX = vec3.xCoord;
|
this.randPosX = vec3.x;
|
||||||
this.randPosY = vec3.yCoord;
|
this.randPosY = vec3.y;
|
||||||
this.randPosZ = vec3.zCoord;
|
this.randPosZ = vec3.z;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class EntityAIPlay extends EntityAIBase {
|
||||||
Vec3 vec = RandomPositionGenerator.findRandomTarget(this.entity, 16, 3);
|
Vec3 vec = RandomPositionGenerator.findRandomTarget(this.entity, 16, 3);
|
||||||
if(vec == null)
|
if(vec == null)
|
||||||
return;
|
return;
|
||||||
this.entity.getNavigator().tryMoveToXYZ(vec.xCoord, vec.yCoord, vec.zCoord, this.speed);
|
this.entity.getNavigator().tryMoveToXYZ(vec.x, vec.y, vec.z, this.speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ public class EntityAIRunAroundLikeCrazy extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.targetX = vec3.xCoord;
|
this.targetX = vec3.x;
|
||||||
this.targetY = vec3.yCoord;
|
this.targetY = vec3.y;
|
||||||
this.targetZ = vec3.zCoord;
|
this.targetZ = vec3.z;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.init.Blocks;
|
||||||
import common.item.Item;
|
import common.item.Item;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -69,7 +69,7 @@ public class EntityAITakePlace extends EntityAIBase
|
||||||
int i = ExtMath.floord(this.entity.posX - (this.place ? 1.0 : 2.0) + random.doublev() * (this.place ? 2.0 : 4.0));
|
int i = ExtMath.floord(this.entity.posX - (this.place ? 1.0 : 2.0) + random.doublev() * (this.place ? 2.0 : 4.0));
|
||||||
int j = ExtMath.floord(this.entity.posY + random.doublev() * (this.place ? 2.0 : 3.0));
|
int j = ExtMath.floord(this.entity.posY + random.doublev() * (this.place ? 2.0 : 3.0));
|
||||||
int k = ExtMath.floord(this.entity.posZ - (this.place ? 1.0 : 2.0) + random.doublev() * (this.place ? 2.0 : 4.0));
|
int k = ExtMath.floord(this.entity.posZ - (this.place ? 1.0 : 2.0) + random.doublev() * (this.place ? 2.0 : 4.0));
|
||||||
BlockPos blockpos = new BlockPos(i, j, k);
|
LocalPos blockpos = new LocalPos(i, j, k);
|
||||||
if(this.place) {
|
if(this.place) {
|
||||||
ItemStack stack = this.entity.getHeldItem();
|
ItemStack stack = this.entity.getHeldItem();
|
||||||
if(stack == null || !PLACEABLE.containsKey(stack.getItem()))
|
if(stack == null || !PLACEABLE.containsKey(stack.getItem()))
|
||||||
|
|
|
@ -5,7 +5,7 @@ import common.entity.types.EntityLiving;
|
||||||
import common.entity.types.IEntityOwnable;
|
import common.entity.types.IEntityOwnable;
|
||||||
import common.pathfinding.PathEntity;
|
import common.pathfinding.PathEntity;
|
||||||
import common.pathfinding.PathPoint;
|
import common.pathfinding.PathPoint;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
|
|
||||||
|
@ -192,7 +192,7 @@ public abstract class EntityAITarget extends EntityAIBase
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (!this.taskOwner.isWithinHomeDistanceFromPosition(new BlockPos(target)))
|
else if (!this.taskOwner.isWithinHomeDistanceFromPosition(new LocalPos(target)))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,9 +52,9 @@ public class EntityAIWander extends EntityAIBase
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.xPosition = vec3.xCoord;
|
this.xPosition = vec3.x;
|
||||||
this.yPosition = vec3.yCoord;
|
this.yPosition = vec3.y;
|
||||||
this.zPosition = vec3.zCoord;
|
this.zPosition = vec3.z;
|
||||||
// this.mustUpdate = false;
|
// this.mustUpdate = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package common.ai;
|
||||||
|
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Vec3;
|
import common.util.Vec3;
|
||||||
|
|
||||||
|
@ -71,11 +71,11 @@ public class RandomPositionGenerator
|
||||||
int k1 = random.zrange(2 * y + 1) - y;
|
int k1 = random.zrange(2 * y + 1) - y;
|
||||||
int i1 = random.zrange(2 * xz + 1) - xz;
|
int i1 = random.zrange(2 * xz + 1) - xz;
|
||||||
|
|
||||||
if (targetVec3 == null || (double)l * targetVec3.xCoord + (double)i1 * targetVec3.zCoord >= 0.0D)
|
if (targetVec3 == null || (double)l * targetVec3.x + (double)i1 * targetVec3.z >= 0.0D)
|
||||||
{
|
{
|
||||||
if (entitycreatureIn.hasHome() && xz > 1)
|
if (entitycreatureIn.hasHome() && xz > 1)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = entitycreatureIn.getHomePosition();
|
LocalPos blockpos = entitycreatureIn.getHomePosition();
|
||||||
|
|
||||||
if (entitycreatureIn.posX > (double)blockpos.getX())
|
if (entitycreatureIn.posX > (double)blockpos.getX())
|
||||||
{
|
{
|
||||||
|
@ -99,7 +99,7 @@ public class RandomPositionGenerator
|
||||||
l = l + ExtMath.floord(entitycreatureIn.posX);
|
l = l + ExtMath.floord(entitycreatureIn.posX);
|
||||||
k1 = k1 + ExtMath.floord(entitycreatureIn.posY);
|
k1 = k1 + ExtMath.floord(entitycreatureIn.posY);
|
||||||
i1 = i1 + ExtMath.floord(entitycreatureIn.posZ);
|
i1 = i1 + ExtMath.floord(entitycreatureIn.posZ);
|
||||||
BlockPos blockpos1 = new BlockPos(l, k1, i1);
|
LocalPos blockpos1 = new LocalPos(l, k1, i1);
|
||||||
|
|
||||||
if (!flag1 || entitycreatureIn.isWithinHomeDistanceFromPosition(blockpos1))
|
if (!flag1 || entitycreatureIn.isWithinHomeDistanceFromPosition(blockpos1))
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@ import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Clientside;
|
import common.util.Clientside;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
@ -311,7 +311,7 @@ public class Block {
|
||||||
return ImmutableList.<State>copyOf(list);
|
return ImmutableList.<State>copyOf(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dropItem(World world, BlockPos pos, ItemStack stack) {
|
public static void dropItem(World world, LocalPos pos, ItemStack stack) {
|
||||||
if(!world.client && Vars.blockDrop) {
|
if(!world.client && Vars.blockDrop) {
|
||||||
float range = 0.5F;
|
float range = 0.5F;
|
||||||
double x = (double)(world.rand.floatv() * range) + (double)(1.0F - range) * 0.5D;
|
double x = (double)(world.rand.floatv() * range) + (double)(1.0F - range) * 0.5D;
|
||||||
|
@ -323,7 +323,7 @@ public class Block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void dropExperience(World world, BlockPos pos, int amount) {
|
public static void dropExperience(World world, LocalPos pos, int amount) {
|
||||||
if(!world.client && Vars.blockXP) {
|
if(!world.client && Vars.blockXP) {
|
||||||
while(amount > 0) {
|
while(amount > 0) {
|
||||||
int split = EntityXp.getXPSplit(amount);
|
int split = EntityXp.getXPSplit(amount);
|
||||||
|
@ -334,7 +334,7 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public static void dropItems(AWorldServer world, BlockPos pos, IInventory inventory) {
|
public static void dropItems(AWorldServer world, LocalPos pos, IInventory inventory) {
|
||||||
for(int n = 0; n < inventory.getSizeInventory(); n++) {
|
for(int n = 0; n < inventory.getSizeInventory(); n++) {
|
||||||
ItemStack stack = inventory.getStackInSlot(n);
|
ItemStack stack = inventory.getStackInSlot(n);
|
||||||
if(stack == null)
|
if(stack == null)
|
||||||
|
@ -567,7 +567,7 @@ public class Block {
|
||||||
return this.maxZ;
|
return this.maxZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final float getHardness(EntityNPC player, World world, BlockPos pos) {
|
public final float getHardness(EntityNPC player, World world, LocalPos pos) {
|
||||||
float f = this.getHardness(world, pos);
|
float f = this.getHardness(world, pos);
|
||||||
return f < 0.0F ? 0.0F
|
return f < 0.0F ? 0.0F
|
||||||
: (!player.canHarvestBlock(this) ? player.getToolDigEfficiency(this) / f / 100.0F
|
: (!player.canHarvestBlock(this) ? player.getToolDigEfficiency(this) / f / 100.0F
|
||||||
|
@ -623,7 +623,7 @@ public class Block {
|
||||||
return new Property[0];
|
return new Property[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getState(State state, IWorldAccess world, BlockPos pos) {
|
public State getState(State state, IWorldAccess world, LocalPos pos) {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -643,25 +643,25 @@ public class Block {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassable(IBlockAccess world, BlockPos pos) {
|
public boolean isPassable(IBlockAccess world, LocalPos pos) {
|
||||||
return !this.material.blocksMovement();
|
return !this.material.blocksMovement();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canReplace(World world, BlockPos pos) {
|
public boolean canReplace(World world, LocalPos pos) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHardness(World world, BlockPos pos) {
|
public float getHardness(World world, LocalPos pos) {
|
||||||
return this.hardness;
|
return this.hardness;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getCollisionBoxes(World world, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity colliding) {
|
public void getCollisionBoxes(World world, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity colliding) {
|
||||||
BoundingBox bb = this.getCollisionBox(world, pos, state);
|
BoundingBox bb = this.getCollisionBox(world, pos, state);
|
||||||
if(bb != null && mask.intersectsWith(bb))
|
if(bb != null && mask.intersectsWith(bb))
|
||||||
list.add(bb);
|
list.add(bb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World world, BlockPos pos, State state) {
|
public BoundingBox getCollisionBox(World world, LocalPos pos, State state) {
|
||||||
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ,
|
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ,
|
||||||
(double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
(double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
||||||
}
|
}
|
||||||
|
@ -670,16 +670,16 @@ public class Block {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HitPosition rayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) {
|
public HitPosition rayTrace(World world, LocalPos pos, Vec3 start, Vec3 end) {
|
||||||
this.setBlockBounds(world, pos);
|
this.setBlockBounds(world, pos);
|
||||||
start = start.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
start = start.add((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
||||||
end = end.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
end = end.add((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ()));
|
||||||
Vec3 vec3 = start.getIntermediateWithXValue(end, this.minX);
|
Vec3 vec3 = start.intermediateX(end, this.minX);
|
||||||
Vec3 vec31 = start.getIntermediateWithXValue(end, this.maxX);
|
Vec3 vec31 = start.intermediateX(end, this.maxX);
|
||||||
Vec3 vec32 = start.getIntermediateWithYValue(end, this.minY);
|
Vec3 vec32 = start.intermediateY(end, this.minY);
|
||||||
Vec3 vec33 = start.getIntermediateWithYValue(end, this.maxY);
|
Vec3 vec33 = start.intermediateY(end, this.maxY);
|
||||||
Vec3 vec34 = start.getIntermediateWithZValue(end, this.minZ);
|
Vec3 vec34 = start.intermediateZ(end, this.minZ);
|
||||||
Vec3 vec35 = start.getIntermediateWithZValue(end, this.maxZ);
|
Vec3 vec35 = start.intermediateZ(end, this.maxZ);
|
||||||
|
|
||||||
if(!this.isInsideYZ(vec3)) {
|
if(!this.isInsideYZ(vec3)) {
|
||||||
vec3 = null;
|
vec3 = null;
|
||||||
|
@ -707,27 +707,27 @@ public class Block {
|
||||||
|
|
||||||
Vec3 vec36 = null;
|
Vec3 vec36 = null;
|
||||||
|
|
||||||
if(vec3 != null && (vec36 == null || start.squareDistanceTo(vec3) < start.squareDistanceTo(vec36))) {
|
if(vec3 != null && (vec36 == null || start.distanceSq(vec3) < start.distanceSq(vec36))) {
|
||||||
vec36 = vec3;
|
vec36 = vec3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vec31 != null && (vec36 == null || start.squareDistanceTo(vec31) < start.squareDistanceTo(vec36))) {
|
if(vec31 != null && (vec36 == null || start.distanceSq(vec31) < start.distanceSq(vec36))) {
|
||||||
vec36 = vec31;
|
vec36 = vec31;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vec32 != null && (vec36 == null || start.squareDistanceTo(vec32) < start.squareDistanceTo(vec36))) {
|
if(vec32 != null && (vec36 == null || start.distanceSq(vec32) < start.distanceSq(vec36))) {
|
||||||
vec36 = vec32;
|
vec36 = vec32;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vec33 != null && (vec36 == null || start.squareDistanceTo(vec33) < start.squareDistanceTo(vec36))) {
|
if(vec33 != null && (vec36 == null || start.distanceSq(vec33) < start.distanceSq(vec36))) {
|
||||||
vec36 = vec33;
|
vec36 = vec33;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vec34 != null && (vec36 == null || start.squareDistanceTo(vec34) < start.squareDistanceTo(vec36))) {
|
if(vec34 != null && (vec36 == null || start.distanceSq(vec34) < start.distanceSq(vec36))) {
|
||||||
vec36 = vec34;
|
vec36 = vec34;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vec35 != null && (vec36 == null || start.squareDistanceTo(vec35) < start.squareDistanceTo(vec36))) {
|
if(vec35 != null && (vec36 == null || start.distanceSq(vec35) < start.distanceSq(vec36))) {
|
||||||
vec36 = vec35;
|
vec36 = vec35;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -761,26 +761,26 @@ public class Block {
|
||||||
enumfacing = Facing.SOUTH;
|
enumfacing = Facing.SOUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HitPosition(ObjectType.BLOCK, vec36.addVector((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), enumfacing, pos);
|
return new HitPosition(ObjectType.BLOCK, vec36.add((double)pos.getX(), (double)pos.getY(), (double)pos.getZ()), enumfacing, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInsideYZ(Vec3 point) {
|
private boolean isInsideYZ(Vec3 point) {
|
||||||
return point == null ? false
|
return point == null ? false
|
||||||
: point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ && point.zCoord <= this.maxZ;
|
: point.y >= this.minY && point.y <= this.maxY && point.z >= this.minZ && point.z <= this.maxZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInsideXZ(Vec3 point) {
|
private boolean isInsideXZ(Vec3 point) {
|
||||||
return point == null ? false
|
return point == null ? false
|
||||||
: point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ && point.zCoord <= this.maxZ;
|
: point.x >= this.minX && point.x <= this.maxX && point.z >= this.minZ && point.z <= this.maxZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isInsideXY(Vec3 point) {
|
private boolean isInsideXY(Vec3 point) {
|
||||||
return point == null ? false
|
return point == null ? false
|
||||||
: point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY && point.yCoord <= this.maxY;
|
: point.x >= this.minX && point.x <= this.maxX && point.y >= this.minY && point.y <= this.maxY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int tickRate(World world, BlockPos pos) {
|
public int tickRate(World world, LocalPos pos) {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,19 +788,19 @@ public class Block {
|
||||||
return this.resistance;
|
return this.resistance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World world, BlockPos pos, Facing side) {
|
public boolean canPlace(World world, LocalPos pos, Facing side) {
|
||||||
return this.canPlace(world, pos);
|
return this.canPlace(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World world, BlockPos pos) {
|
public boolean canPlace(World world, LocalPos pos) {
|
||||||
return world.getState(pos).getBlock().getMaterial().isReplaceable();
|
return world.getState(pos).getBlock().getMaterial().isReplaceable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3 getAcceleration(World world, BlockPos pos, Entity entity, Vec3 motion) {
|
public Vec3 getAcceleration(World world, LocalPos pos, Entity entity, Vec3 motion) {
|
||||||
return motion;
|
return motion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess world, BlockPos pos) {
|
public void setBlockBounds(IWorldAccess world, LocalPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSilkHarvest() {
|
public boolean canSilkHarvest() {
|
||||||
|
@ -840,7 +840,7 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public double getResistance(AWorldServer world, BlockPos pos, State state) {
|
public double getResistance(AWorldServer world, LocalPos pos, State state) {
|
||||||
return Double.POSITIVE_INFINITY;
|
return Double.POSITIVE_INFINITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -862,23 +862,23 @@ public class Block {
|
||||||
|
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public void tick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
public void tick(AWorldServer world, LocalPos pos, State state, Random rand) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
public void displayTick(World world, BlockPos pos, State state, Random rand) {
|
public void displayTick(World world, LocalPos pos, State state, Random rand) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartBreak(World world, BlockPos pos, EntityNPC player) {
|
public void onStartBreak(World world, LocalPos pos, EntityNPC player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preBroken(World world, BlockPos pos, State state, EntityNPC player) {
|
public void preBroken(World world, LocalPos pos, State state, EntityNPC player) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBroken(World world, BlockPos pos, State state) {
|
public void onBroken(World world, LocalPos pos, State state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postBroken(World world, EntityNPC player, BlockPos pos, State state, TileEntity te) {
|
public void postBroken(World world, EntityNPC player, LocalPos pos, State state, TileEntity te) {
|
||||||
if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) {
|
if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) {
|
||||||
Item item = this.getItem();
|
Item item = this.getItem();
|
||||||
if(item != null)
|
if(item != null)
|
||||||
|
@ -890,7 +890,7 @@ public class Block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drop(World world, BlockPos pos, State state, int fortune) {
|
public void drop(World world, LocalPos pos, State state, int fortune) {
|
||||||
if(!world.client) {
|
if(!world.client) {
|
||||||
int amount = this.getDropAmount(fortune, world.rand);
|
int amount = this.getDropAmount(fortune, world.rand);
|
||||||
for(int z = 0; z < amount; z++) {
|
for(int z = 0; z < amount; z++) {
|
||||||
|
@ -901,55 +901,55 @@ public class Block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroyedFire(World world, BlockPos pos, State state) {
|
public void onDestroyedFire(World world, LocalPos pos, State state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDestroyedExplosion(World world, BlockPos pos, EntityLiving source, State state) {
|
public void onDestroyedExplosion(World world, LocalPos pos, EntityLiving source, State state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) {
|
public boolean onUse(World world, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) {
|
public void onUpdate(AWorldServer world, LocalPos pos, State state, Block neighbor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAdded(AWorldServer world, BlockPos pos, State state) {
|
public void onAdded(AWorldServer world, LocalPos pos, State state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRemoved(AWorldServer world, BlockPos pos, State state) {
|
public void onRemoved(AWorldServer world, LocalPos pos, State state) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCollideMove(World world, BlockPos pos, Entity entity) {
|
public void onCollideMove(World world, LocalPos pos, Entity entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLandMove(World world, Entity entity) {
|
public void onLandMove(World world, Entity entity) {
|
||||||
entity.motionY = 0.0D;
|
entity.motionY = 0.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onCollideUpdate(World world, BlockPos pos, State state, Entity entity) {
|
public void onCollideUpdate(World world, LocalPos pos, State state, Entity entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onLandUpdate(World world, BlockPos pos, Entity entity, float distance) {
|
public void onLandUpdate(World world, LocalPos pos, Entity entity, float distance) {
|
||||||
entity.fall(distance, 1.0F);
|
entity.fall(distance, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public void onRain(AWorldServer world, BlockPos pos) {
|
public void onRain(AWorldServer world, LocalPos pos) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) {
|
||||||
return this.material.blocksMovement();
|
return this.material.blocksMovement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public double powerTick(AWorldServer world, BlockPos pos, State state, Random rand, double voltage, double currentLimit) {
|
public double powerTick(AWorldServer world, LocalPos pos, State state, Random rand, double voltage, double currentLimit) {
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
public boolean checkPlace(World world, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) {
|
public boolean checkPlace(World world, LocalPos pos, Facing side, EntityNPC player, ItemStack stack) {
|
||||||
Block block = world.getState(pos).getBlock();
|
Block block = world.getState(pos).getBlock();
|
||||||
|
|
||||||
if(block == Blocks.snow_layer) {
|
if(block == Blocks.snow_layer) {
|
||||||
|
@ -966,7 +966,7 @@ public class Block {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean place(ItemStack stack, EntityNPC player, World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
public boolean place(ItemStack stack, EntityNPC player, World world, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
||||||
State iblockstate = world.getState(pos);
|
State iblockstate = world.getState(pos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
|
|
||||||
|
@ -1003,15 +1003,15 @@ public class Block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
public State getPlacedState(World world, LocalPos pos, Facing side, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
return this.getState();
|
return this.getState();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onPlace(World world, BlockPos pos, State state, EntityLiving placer) {
|
public void onPlace(World world, LocalPos pos, State state, EntityLiving placer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, BlockPos pos, Facing side, ItemStack stack) {
|
public boolean dispense(AWorldServer world, TileEntity source, Vec3 position, LocalPos pos, Facing side, ItemStack stack) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1045,7 +1045,7 @@ public class Block {
|
||||||
// : !world.getState(pos).getBlock().isOpaqueCube())))));
|
// : !world.getState(pos).getBlock().isOpaqueCube())))));
|
||||||
// }
|
// }
|
||||||
@Clientside
|
@Clientside
|
||||||
public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) {
|
public boolean canRender(IWorldAccess world, LocalPos pos, Facing side) {
|
||||||
return side == Facing.DOWN && this.minY > 0.0D ? true
|
return side == Facing.DOWN && this.minY > 0.0D ? true
|
||||||
: (side == Facing.UP && this.maxY < 1.0D ? true
|
: (side == Facing.UP && this.maxY < 1.0D ? true
|
||||||
: (side == Facing.NORTH && this.minZ > 0.0D ? true
|
: (side == Facing.NORTH && this.minZ > 0.0D ? true
|
||||||
|
@ -1056,7 +1056,7 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
public BoundingBox getSelectionBox(World world, BlockPos pos) {
|
public BoundingBox getSelectionBox(World world, LocalPos pos) {
|
||||||
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ,
|
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ,
|
||||||
(double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
(double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
||||||
}
|
}
|
||||||
|
@ -1101,7 +1101,7 @@ public class Block {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
public String getInfo(World world, BlockPos pos, State state, EntityNPC player) {
|
public String getInfo(World world, LocalPos pos, State state, EntityNPC player) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package common.block;
|
package common.block;
|
||||||
|
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Clientside;
|
import common.util.Clientside;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -11,7 +11,7 @@ public final class BlockAir extends Block {
|
||||||
super(Material.NONE);
|
super(Material.NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World world, BlockPos pos, State state) {
|
public BoundingBox getCollisionBox(World world, LocalPos pos, State state) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,10 +23,10 @@ public final class BlockAir extends Block {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drop(World world, BlockPos pos, State state, int fortune) {
|
public void drop(World world, LocalPos pos, State state, int fortune) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canReplace(World world, BlockPos pos) {
|
public boolean canReplace(World world, LocalPos pos) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import common.block.natural.BlockFire;
|
||||||
import common.entity.item.EntityFalling;
|
import common.entity.item.EntityFalling;
|
||||||
import common.init.Blocks;
|
import common.init.Blocks;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -13,7 +13,7 @@ import common.world.AWorldServer;
|
||||||
public class BlockFalling extends Block {
|
public class BlockFalling extends Block {
|
||||||
public static boolean fallInstantly;
|
public static boolean fallInstantly;
|
||||||
|
|
||||||
public static boolean canFallInto(World world, BlockPos pos) {
|
public static boolean canFallInto(World world, LocalPos pos) {
|
||||||
Block block = world.getState(pos).getBlock();
|
Block block = world.getState(pos).getBlock();
|
||||||
return block instanceof BlockFire || block == Blocks.air || block.getMaterial().isLiquid();
|
return block instanceof BlockFire || block == Blocks.air || block.getMaterial().isLiquid();
|
||||||
}
|
}
|
||||||
|
@ -22,20 +22,20 @@ public class BlockFalling extends Block {
|
||||||
super(material);
|
super(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAdded(AWorldServer world, BlockPos pos, State state) {
|
public void onAdded(AWorldServer world, LocalPos pos, State state) {
|
||||||
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) {
|
public void onUpdate(AWorldServer world, LocalPos pos, State state, Block neighbor) {
|
||||||
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
world.scheduleUpdate(pos, this, this.tickRate(world, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer world, BlockPos pos, State state, Random rand) {
|
public void tick(AWorldServer world, LocalPos pos, State state, Random rand) {
|
||||||
if(Vars.blockGravity)
|
if(Vars.blockGravity)
|
||||||
this.checkFallable(world, pos);
|
this.checkFallable(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkFallable(AWorldServer world, BlockPos pos) {
|
private void checkFallable(AWorldServer world, LocalPos pos) {
|
||||||
if(canFallInto(world, pos.down()) && pos.getY() >= 0) {
|
if(canFallInto(world, pos.down()) && pos.getY() >= 0) {
|
||||||
int range = 32;
|
int range = 32;
|
||||||
if(!fallInstantly && world.isAreaLoaded(pos.add(-range, -range, -range), pos.add(range, range, range))) {
|
if(!fallInstantly && world.isAreaLoaded(pos.add(-range, -range, -range), pos.add(range, range, range))) {
|
||||||
|
@ -48,7 +48,7 @@ public class BlockFalling extends Block {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
world.setBlockToAir(pos);
|
world.setBlockToAir(pos);
|
||||||
BlockPos loc;
|
LocalPos loc;
|
||||||
int limit = 512;
|
int limit = 512;
|
||||||
for(loc = pos.down(); canFallInto(world, loc) && loc.getY() > -World.MAX_SIZE_Y; loc = loc.down()) {
|
for(loc = pos.down(); canFallInto(world, loc) && loc.getY() > -World.MAX_SIZE_Y; loc = loc.down()) {
|
||||||
if(--limit <= 0)
|
if(--limit <= 0)
|
||||||
|
@ -60,13 +60,13 @@ public class BlockFalling extends Block {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int tickRate(World world, BlockPos pos) {
|
public int tickRate(World world, LocalPos pos) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onStartFalling(EntityFalling entity) {
|
protected void onStartFalling(EntityFalling entity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEndFalling(World world, BlockPos pos) {
|
public void onEndFalling(World world, LocalPos pos) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,13 +14,13 @@ import common.model.ModelRotation;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyEnum;
|
import common.properties.PropertyEnum;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Clientside;
|
import common.util.Clientside;
|
||||||
import common.util.ExtMath;
|
import common.util.ExtMath;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Identifyable;
|
import common.util.Identifyable;
|
||||||
import common.util.Color;
|
import common.util.Color;
|
||||||
import common.util.WorldPos;
|
import common.util.GlobalPos;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
import common.world.IWorldAccess;
|
import common.world.IWorldAccess;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -59,7 +59,7 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
this.setBedBounds();
|
this.setBedBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side,
|
public boolean onUse(World world, LocalPos pos, State state, EntityNPC player, Facing side,
|
||||||
float hitX, float hitY, float hitZ) {
|
float hitX, float hitY, float hitZ) {
|
||||||
if(world.client)
|
if(world.client)
|
||||||
return true;
|
return true;
|
||||||
|
@ -72,7 +72,7 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
if(player.isEntityAlive() && Math.abs(player.posX - (double)pos.getX()) <= 3.0D
|
if(player.isEntityAlive() && Math.abs(player.posX - (double)pos.getX()) <= 3.0D
|
||||||
&& Math.abs(player.posY - (double)pos.getY()) <= 2.0D && Math.abs(player.posZ - (double)pos.getZ()) <= 3.0D) {
|
&& Math.abs(player.posY - (double)pos.getY()) <= 2.0D && Math.abs(player.posZ - (double)pos.getZ()) <= 3.0D) {
|
||||||
player.setSpawnPoint(new WorldPos(pos, player.worldObj));
|
player.setSpawnPoint(new GlobalPos(pos, player.worldObj));
|
||||||
player.connection.addHotbar(Color.DARK_GREEN + "Dein Einstiegspunkt wurde auf %s bei [%s, %s, %s] gesetzt",
|
player.connection.addHotbar(Color.DARK_GREEN + "Dein Einstiegspunkt wurde auf %s bei [%s, %s, %s] gesetzt",
|
||||||
player.worldObj.dimension.getDisplay(), player.getSpawnPoint().getX(),
|
player.worldObj.dimension.getDisplay(), player.getSpawnPoint().getX(),
|
||||||
player.getSpawnPoint().getY(), player.getSpawnPoint().getZ());
|
player.getSpawnPoint().getY(), player.getSpawnPoint().getZ());
|
||||||
|
@ -97,11 +97,11 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) {
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) {
|
||||||
this.setBedBounds();
|
this.setBedBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock) {
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock) {
|
||||||
Facing enumfacing = (Facing)state.getValue(FACING);
|
Facing enumfacing = (Facing)state.getValue(FACING);
|
||||||
if(state.getValue(PART) == BlockBed.EnumPartType.HEAD) {
|
if(state.getValue(PART) == BlockBed.EnumPartType.HEAD) {
|
||||||
if(worldIn.getState(pos.offset(enumfacing.getOpposite())).getBlock() != this)
|
if(worldIn.getState(pos.offset(enumfacing.getOpposite())).getBlock() != this)
|
||||||
|
@ -122,7 +122,7 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5625F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlockPos getSafeExitLocation(World worldIn, BlockPos pos, int tries) {
|
public static LocalPos getSafeExitLocation(World worldIn, LocalPos pos, int tries) {
|
||||||
Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING);
|
Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING);
|
||||||
int i = pos.getX();
|
int i = pos.getX();
|
||||||
int j = pos.getY();
|
int j = pos.getY();
|
||||||
|
@ -136,7 +136,7 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
|
|
||||||
for(int i2 = i1; i2 <= k1; ++i2) {
|
for(int i2 = i1; i2 <= k1; ++i2) {
|
||||||
for(int j2 = j1; j2 <= l1; ++j2) {
|
for(int j2 = j1; j2 <= l1; ++j2) {
|
||||||
BlockPos blockpos = new BlockPos(i2, j, j2);
|
LocalPos blockpos = new LocalPos(i2, j, j2);
|
||||||
|
|
||||||
if(hasRoomForPlayer(worldIn, blockpos)) {
|
if(hasRoomForPlayer(worldIn, blockpos)) {
|
||||||
if(tries <= 0) {
|
if(tries <= 0) {
|
||||||
|
@ -152,12 +152,12 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static boolean hasRoomForPlayer(World worldIn, BlockPos pos) {
|
protected static boolean hasRoomForPlayer(World worldIn, LocalPos pos) {
|
||||||
return worldIn.isBlockSolid(pos.down()) && !worldIn.getState(pos).getBlock().getMaterial().isSolid()
|
return worldIn.isBlockSolid(pos.down()) && !worldIn.getState(pos).getBlock().getMaterial().isSolid()
|
||||||
&& !worldIn.getState(pos.up()).getBlock().getMaterial().isSolid();
|
&& !worldIn.getState(pos.up()).getBlock().getMaterial().isSolid();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drop(World worldIn, BlockPos pos, State state, int fortune) {
|
public void drop(World worldIn, LocalPos pos, State state, int fortune) {
|
||||||
if(state.getValue(PART) == BlockBed.EnumPartType.FOOT)
|
if(state.getValue(PART) == BlockBed.EnumPartType.FOOT)
|
||||||
super.drop(worldIn, pos, state, fortune);
|
super.drop(worldIn, pos, state, fortune);
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
return StackSize.S;
|
return StackSize.S;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (worldIn.client)
|
if (worldIn.client)
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,7 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
|
|
||||||
int i = ExtMath.floord((double)(playerIn.rotYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
int i = ExtMath.floord((double)(playerIn.rotYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||||
Facing enumfacing = Facing.getHorizontal(i);
|
Facing enumfacing = Facing.getHorizontal(i);
|
||||||
BlockPos blockpos = pos.offset(enumfacing);
|
LocalPos blockpos = pos.offset(enumfacing);
|
||||||
|
|
||||||
if (playerIn.canPlayerEdit(pos, side, stack) && playerIn.canPlayerEdit(blockpos, side, stack))
|
if (playerIn.canPlayerEdit(pos, side, stack) && playerIn.canPlayerEdit(blockpos, side, stack))
|
||||||
{
|
{
|
||||||
|
@ -260,7 +260,7 @@ public class BlockBed extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
public boolean checkPlace(World worldIn, LocalPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||||
{
|
{
|
||||||
return side == Facing.UP;
|
return side == Facing.UP;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ import common.entity.npc.EntityNPC;
|
||||||
import common.init.SoundEvent;
|
import common.init.SoundEvent;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -32,30 +32,30 @@ public class BlockCake extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
this.eatCake(worldIn, pos, state, playerIn);
|
this.eatCake(worldIn, pos, state, playerIn);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartBreak(World worldIn, BlockPos pos, EntityNPC playerIn)
|
public void onStartBreak(World worldIn, LocalPos pos, EntityNPC playerIn)
|
||||||
{
|
{
|
||||||
this.eatCake(worldIn, pos, worldIn.getState(pos), playerIn);
|
this.eatCake(worldIn, pos, worldIn.getState(pos), playerIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void eatCake(World worldIn, BlockPos pos, State state, EntityNPC player)
|
private void eatCake(World worldIn, LocalPos pos, State state, EntityNPC player)
|
||||||
{
|
{
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
worldIn.playSoundAtEntity(player, SoundEvent.EAT, 0.5F);
|
worldIn.playSoundAtEntity(player, SoundEvent.EAT, 0.5F);
|
||||||
player.heal((int)((float)6 * 0.5f * (1.0f + worldIn.rand.floatv())));
|
player.heal((int)((float)6 * 0.5f * (1.0f + worldIn.rand.floatv())));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos);
|
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
if (!this.canBlockStay(worldIn, pos))
|
if (!this.canBlockStay(worldIn, pos))
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ public class BlockCake extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canBlockStay(World worldIn, BlockPos pos)
|
private boolean canBlockStay(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid();
|
return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import common.block.Material;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Color;
|
import common.util.Color;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
|
@ -51,7 +51,7 @@ public class BlockCarpet extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
this.setBlockBoundsFromMeta();
|
this.setBlockBoundsFromMeta();
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class BlockCarpet extends Block
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos);
|
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
@ -71,12 +71,12 @@ public class BlockCarpet extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
this.checkForDrop(worldIn, pos, state);
|
this.checkForDrop(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkForDrop(World worldIn, BlockPos pos, State state)
|
private boolean checkForDrop(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (!this.canBlockStay(worldIn, pos))
|
if (!this.canBlockStay(worldIn, pos))
|
||||||
{
|
{
|
||||||
|
@ -90,12 +90,12 @@ public class BlockCarpet extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canBlockStay(World worldIn, BlockPos pos)
|
private boolean canBlockStay(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return !worldIn.isAirBlock(pos.down());
|
return !worldIn.isAirBlock(pos.down());
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
return side == Facing.UP ? true : super.canRender(worldIn, pos, side);
|
return side == Facing.UP ? true : super.canRender(worldIn, pos, side);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.properties.PropertyEnum;
|
import common.properties.PropertyEnum;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Clientside;
|
import common.util.Clientside;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
@ -86,7 +86,7 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassable(IBlockAccess world, BlockPos pos) {
|
public boolean isPassable(IBlockAccess world, LocalPos pos) {
|
||||||
return world.getState(pos).getValue(OPEN);
|
return world.getState(pos).getValue(OPEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,17 +95,17 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
public BoundingBox getSelectionBox(World world, BlockPos pos) {
|
public BoundingBox getSelectionBox(World world, LocalPos pos) {
|
||||||
this.setBlockBounds(world, pos);
|
this.setBlockBounds(world, pos);
|
||||||
return super.getSelectionBox(world, pos);
|
return super.getSelectionBox(world, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World world, BlockPos pos, State state) {
|
public BoundingBox getCollisionBox(World world, LocalPos pos, State state) {
|
||||||
this.setBlockBounds(world, pos);
|
this.setBlockBounds(world, pos);
|
||||||
return super.getCollisionBox(world, pos, state);
|
return super.getCollisionBox(world, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess world, BlockPos pos) {
|
public void setBlockBounds(IWorldAccess world, LocalPos pos) {
|
||||||
float thick = 0.1875F;
|
float thick = 0.1875F;
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
|
||||||
State state = world.getState(pos);
|
State state = world.getState(pos);
|
||||||
|
@ -161,11 +161,11 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) {
|
public boolean onUse(World world, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) {
|
||||||
if(this.keyItem != null && (player.getHeldItem() == null || player.getHeldItem().getItem() != this.keyItem))
|
if(this.keyItem != null && (player.getHeldItem() == null || player.getHeldItem().getItem() != this.keyItem))
|
||||||
return true;
|
return true;
|
||||||
BlockPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down();
|
LocalPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down();
|
||||||
BlockPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up();
|
LocalPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up();
|
||||||
State bottom = pos.equals(lower) ? state : world.getState(lower);
|
State bottom = pos.equals(lower) ? state : world.getState(lower);
|
||||||
State top = pos.equals(upper) ? state : world.getState(upper);
|
State top = pos.equals(upper) ? state : world.getState(upper);
|
||||||
if(bottom.getBlock() != this || top.getBlock() != this)
|
if(bottom.getBlock() != this || top.getBlock() != this)
|
||||||
|
@ -178,11 +178,11 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleDoor(World world, BlockPos pos, boolean open) {
|
public void toggleDoor(World world, LocalPos pos, boolean open) {
|
||||||
State state = world.getState(pos);
|
State state = world.getState(pos);
|
||||||
if(state.getBlock() == this) {
|
if(state.getBlock() == this) {
|
||||||
BlockPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down();
|
LocalPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down();
|
||||||
BlockPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up();
|
LocalPos upper = state.getValue(HALF) == EnumDoorHalf.UPPER ? pos : pos.up();
|
||||||
State bottom = pos.equals(lower) ? state : world.getState(lower);
|
State bottom = pos.equals(lower) ? state : world.getState(lower);
|
||||||
State top = pos.equals(upper) ? state : world.getState(upper);
|
State top = pos.equals(upper) ? state : world.getState(upper);
|
||||||
if(bottom.getBlock() == this && top.getBlock() == this && ((open != bottom.getValue(OPEN)) || (open != top.getValue(OPEN)))) {
|
if(bottom.getBlock() == this && top.getBlock() == this && ((open != bottom.getValue(OPEN)) || (open != top.getValue(OPEN)))) {
|
||||||
|
@ -194,9 +194,9 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUpdate(AWorldServer world, BlockPos pos, State state, Block neighbor) {
|
public void onUpdate(AWorldServer world, LocalPos pos, State state, Block neighbor) {
|
||||||
if(state.getValue(HALF) == EnumDoorHalf.UPPER) {
|
if(state.getValue(HALF) == EnumDoorHalf.UPPER) {
|
||||||
BlockPos lower = pos.down();
|
LocalPos lower = pos.down();
|
||||||
State bottom = world.getState(lower);
|
State bottom = world.getState(lower);
|
||||||
|
|
||||||
if(bottom.getBlock() != this) {
|
if(bottom.getBlock() != this) {
|
||||||
|
@ -208,7 +208,7 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
boolean wrong = false;
|
boolean wrong = false;
|
||||||
BlockPos upper = pos.up();
|
LocalPos upper = pos.up();
|
||||||
State top = world.getState(upper);
|
State top = world.getState(upper);
|
||||||
|
|
||||||
if(top.getBlock() != this) {
|
if(top.getBlock() != this) {
|
||||||
|
@ -237,12 +237,12 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : super.getDrop(state, rand, fortune);
|
return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : super.getDrop(state, rand, fortune);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HitPosition rayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) {
|
public HitPosition rayTrace(World world, LocalPos pos, Vec3 start, Vec3 end) {
|
||||||
this.setBlockBounds(world, pos);
|
this.setBlockBounds(world, pos);
|
||||||
return super.rayTrace(world, pos, start, end);
|
return super.rayTrace(world, pos, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World world, BlockPos pos) {
|
public boolean canPlace(World world, LocalPos pos) {
|
||||||
return pos.getY() < World.MAX_SIZE_Y - 1 && world.isBlockSolid(pos.down()) && super.canPlace(world, pos) && super.canPlace(world, pos.up());
|
return pos.getY() < World.MAX_SIZE_Y - 1 && world.isBlockSolid(pos.down()) && super.canPlace(world, pos) && super.canPlace(world, pos.up());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Facing getFacing(IBlockAccess world, BlockPos pos) {
|
public static Facing getFacing(IBlockAccess world, LocalPos pos) {
|
||||||
return world.getState(pos).getValue(FACING);
|
return world.getState(pos).getValue(FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
return StackSize.S;
|
return StackSize.S;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ)
|
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (side != Facing.UP)
|
if (side != Facing.UP)
|
||||||
{
|
{
|
||||||
|
@ -337,15 +337,15 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Clientside
|
@Clientside
|
||||||
public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack)
|
public boolean checkPlace(World worldIn, LocalPos pos, Facing side, EntityNPC player, ItemStack stack)
|
||||||
{
|
{
|
||||||
return side == Facing.UP;
|
return side == Facing.UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void placeDoor(World worldIn, BlockPos pos, Facing facing, Block door, boolean update)
|
public static void placeDoor(World worldIn, LocalPos pos, Facing facing, Block door, boolean update)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = pos.offset(facing.rotateY());
|
LocalPos blockpos = pos.offset(facing.rotateY());
|
||||||
BlockPos blockpos1 = pos.offset(facing.rotateYCCW());
|
LocalPos blockpos1 = pos.offset(facing.rotateYCCW());
|
||||||
int i = (worldIn.getState(blockpos1).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0);
|
int i = (worldIn.getState(blockpos1).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0);
|
||||||
int j = (worldIn.getState(blockpos).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos.up()).getBlock().isNormalCube() ? 1 : 0);
|
int j = (worldIn.getState(blockpos).getBlock().isNormalCube() ? 1 : 0) + (worldIn.getState(blockpos.up()).getBlock().isNormalCube() ? 1 : 0);
|
||||||
boolean flag = worldIn.getState(blockpos1).getBlock() == door || worldIn.getState(blockpos1.up()).getBlock() == door;
|
boolean flag = worldIn.getState(blockpos1).getBlock() == door || worldIn.getState(blockpos1.up()).getBlock() == door;
|
||||||
|
@ -357,7 +357,7 @@ public class BlockDoor extends Block implements Rotatable {
|
||||||
flag2 = true;
|
flag2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos2 = pos.up();
|
LocalPos blockpos2 = pos.up();
|
||||||
State iblockstate = door.getState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, flag2 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT);
|
State iblockstate = door.getState().withProperty(BlockDoor.FACING, facing).withProperty(BlockDoor.HINGE, flag2 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT);
|
||||||
worldIn.setState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2);
|
worldIn.setState(pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2);
|
||||||
worldIn.setState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2);
|
worldIn.setState(blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2);
|
||||||
|
|
|
@ -9,7 +9,7 @@ import common.init.Blocks;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.ParticleType;
|
import common.util.ParticleType;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
|
@ -26,7 +26,7 @@ public class BlockDragonEgg extends Block
|
||||||
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
|
this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAdded(AWorldServer worldIn, BlockPos pos, State state)
|
public void onAdded(AWorldServer worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
||||||
}
|
}
|
||||||
|
@ -34,18 +34,18 @@ public class BlockDragonEgg extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if(Vars.blockGravity)
|
if(Vars.blockGravity)
|
||||||
this.checkFall(worldIn, pos);
|
this.checkFall(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkFall(AWorldServer worldIn, BlockPos pos)
|
private void checkFall(AWorldServer worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
|
if (BlockFalling.canFallInto(worldIn, pos.down()) && pos.getY() >= 0)
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ public class BlockDragonEgg extends Block
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
BlockPos blockpos;
|
LocalPos blockpos;
|
||||||
for(blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down()) {
|
for(blockpos = pos; BlockFalling.canFallInto(worldIn, blockpos) && blockpos.getY() > 0; blockpos = blockpos.down()) {
|
||||||
}
|
}
|
||||||
if(blockpos != pos)
|
if(blockpos != pos)
|
||||||
|
@ -69,18 +69,18 @@ public class BlockDragonEgg extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
this.teleport(worldIn, pos);
|
this.teleport(worldIn, pos);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartBreak(World worldIn, BlockPos pos, EntityNPC playerIn)
|
public void onStartBreak(World worldIn, LocalPos pos, EntityNPC playerIn)
|
||||||
{
|
{
|
||||||
this.teleport(worldIn, pos);
|
this.teleport(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void teleport(World worldIn, BlockPos pos)
|
private void teleport(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public class BlockDragonEgg extends Block
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 1000; ++i)
|
for (int i = 0; i < 1000; ++i)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = pos.add(worldIn.rand.zrange(16) - worldIn.rand.zrange(16), worldIn.rand.zrange(8) - worldIn.rand.zrange(8), worldIn.rand.zrange(16) - worldIn.rand.zrange(16));
|
LocalPos blockpos = pos.add(worldIn.rand.zrange(16) - worldIn.rand.zrange(16), worldIn.rand.zrange(8) - worldIn.rand.zrange(8), worldIn.rand.zrange(16) - worldIn.rand.zrange(16));
|
||||||
|
|
||||||
if (worldIn.getState(blockpos).getBlock() == Blocks.air)
|
if (worldIn.getState(blockpos).getBlock() == Blocks.air)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ public class BlockDragonEgg extends Block
|
||||||
{
|
{
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
if(!Vars.blockGravity) {
|
if(!Vars.blockGravity) {
|
||||||
BlockPos blockpos2;
|
LocalPos blockpos2;
|
||||||
for(blockpos2 = blockpos; BlockFalling.canFallInto(worldIn, blockpos2) && blockpos2.getY() > 0; blockpos2 = blockpos2.down()) {
|
for(blockpos2 = blockpos; BlockFalling.canFallInto(worldIn, blockpos2) && blockpos2.getY() > 0; blockpos2 = blockpos2.down()) {
|
||||||
}
|
}
|
||||||
if(blockpos2 != blockpos)
|
if(blockpos2 != blockpos)
|
||||||
|
@ -125,7 +125,7 @@ public class BlockDragonEgg extends Block
|
||||||
/**
|
/**
|
||||||
* How many world ticks before ticking
|
* How many world ticks before ticking
|
||||||
*/
|
*/
|
||||||
public int tickRate(World worldIn, BlockPos pos)
|
public int tickRate(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ public class BlockDragonEgg extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import common.model.ModelRotation;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.IBlockAccess;
|
import common.world.IBlockAccess;
|
||||||
|
@ -52,7 +52,7 @@ public class BlockFence extends Block
|
||||||
/**
|
/**
|
||||||
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
||||||
*/
|
*/
|
||||||
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
||||||
{
|
{
|
||||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
boolean flag = this.canConnectTo(worldIn, pos.north());
|
||||||
boolean flag1 = this.canConnectTo(worldIn, pos.south());
|
boolean flag1 = this.canConnectTo(worldIn, pos.south());
|
||||||
|
@ -111,7 +111,7 @@ public class BlockFence extends Block
|
||||||
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
boolean flag = this.canConnectTo(worldIn, pos.north());
|
||||||
boolean flag1 = this.canConnectTo(worldIn, pos.south());
|
boolean flag1 = this.canConnectTo(worldIn, pos.south());
|
||||||
|
@ -158,23 +158,23 @@ public class BlockFence extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
public boolean isPassable(IBlockAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
public boolean canConnectTo(IBlockAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = worldIn.getState(pos).getBlock();
|
Block block = worldIn.getState(pos).getBlock();
|
||||||
return ((!(block instanceof BlockFence) || block.getMaterial() != this.material) && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true);
|
return ((!(block instanceof BlockFence) || block.getMaterial() != this.material) && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
return worldIn.client ? true : ItemLead.attachToFence(playerIn, worldIn, pos);
|
return worldIn.client ? true : ItemLead.attachToFence(playerIn, worldIn, pos);
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ public class BlockFence extends Block
|
||||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||||
* metadata, such as fence connections.
|
* metadata, such as fence connections.
|
||||||
*/
|
*/
|
||||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
public State getState(State state, IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.IBlockAccess;
|
import common.world.IBlockAccess;
|
||||||
|
@ -40,7 +40,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||||
* metadata, such as fence connections.
|
* metadata, such as fence connections.
|
||||||
*/
|
*/
|
||||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
public State getState(State state, IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Facing.Axis enumfacing$axis = ((Facing)state.getValue(FACING)).getAxis();
|
Facing.Axis enumfacing$axis = ((Facing)state.getValue(FACING)).getAxis();
|
||||||
|
|
||||||
|
@ -52,12 +52,12 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlace(worldIn, pos) : false;
|
return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlace(worldIn, pos) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (((Boolean)state.getValue(OPEN)).booleanValue())
|
if (((Boolean)state.getValue(OPEN)).booleanValue())
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Facing.Axis enumfacing$axis = ((Facing)worldIn.getState(pos).getValue(FACING)).getAxis();
|
Facing.Axis enumfacing$axis = ((Facing)worldIn.getState(pos).getValue(FACING)).getAxis();
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
public boolean isPassable(IBlockAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return ((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue();
|
return ((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue();
|
||||||
}
|
}
|
||||||
|
@ -106,12 +106,12 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false));
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if (((Boolean)state.getValue(OPEN)).booleanValue())
|
if (((Boolean)state.getValue(OPEN)).booleanValue())
|
||||||
{
|
{
|
||||||
|
@ -135,7 +135,7 @@ public class BlockFenceGate extends Block implements Rotatable
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.entity.Entity;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.ParticleType;
|
import common.util.ParticleType;
|
||||||
|
@ -36,7 +36,7 @@ public class BlockFloorPortal extends Block
|
||||||
// return new TileEntityPortal();
|
// return new TileEntityPortal();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(0.0F, 0.6875F, 0.0F, 1.0F, 0.75F, 1.0F);
|
this.setBlockBounds(0.0F, 0.6875F, 0.0F, 1.0F, 0.75F, 1.0F);
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public class BlockFloorPortal extends Block
|
||||||
/**
|
/**
|
||||||
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
||||||
*/
|
*/
|
||||||
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class BlockFloorPortal extends Block
|
||||||
/**
|
/**
|
||||||
* Called When an Entity Collided with the Block
|
* Called When an Entity Collided with the Block
|
||||||
*/
|
*/
|
||||||
public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn)
|
public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn)
|
||||||
{
|
{
|
||||||
// if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null && !worldIn.client && GameServer.getServer().getAllowEnd())
|
// if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null && !worldIn.client && GameServer.getServer().getAllowEnd())
|
||||||
// {
|
// {
|
||||||
|
@ -87,7 +87,7 @@ public class BlockFloorPortal extends Block
|
||||||
entityIn.setPortal(PortalType.FLOOR);
|
entityIn.setPortal(PortalType.FLOOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
|
public void displayTick(World worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
double d0 = (double)((float)pos.getX() + rand.floatv());
|
double d0 = (double)((float)pos.getX() + rand.floatv());
|
||||||
double d1 = (double)((float)pos.getY() + 0.8F);
|
double d1 = (double)((float)pos.getY() + 0.8F);
|
||||||
|
@ -103,9 +103,9 @@ public class BlockFloorPortal extends Block
|
||||||
// return MapColor.blackColor;
|
// return MapColor.blackColor;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private void destroyRecursive(World world, Set<BlockPos> positions, BlockPos pos, int limit) {
|
private void destroyRecursive(World world, Set<LocalPos> positions, LocalPos pos, int limit) {
|
||||||
for(int n = 0; n < 4; n++) {
|
for(int n = 0; n < 4; n++) {
|
||||||
BlockPos npos = pos.offset(Facing.getHorizontal(n));
|
LocalPos npos = pos.offset(Facing.getHorizontal(n));
|
||||||
if(/* !positions.contains(npos) && */ world.getState(npos).getBlock() == this) {
|
if(/* !positions.contains(npos) && */ world.getState(npos).getBlock() == this) {
|
||||||
positions.add(npos);
|
positions.add(npos);
|
||||||
if(limit > 0)
|
if(limit > 0)
|
||||||
|
@ -114,12 +114,12 @@ public class BlockFloorPortal extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBroken(World worldIn, BlockPos pos, State state)
|
public void onBroken(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
Set<BlockPos> positions = Sets.newHashSet();
|
Set<LocalPos> positions = Sets.newHashSet();
|
||||||
positions.add(pos);
|
positions.add(pos);
|
||||||
this.destroyRecursive(worldIn, positions, pos, 10);
|
this.destroyRecursive(worldIn, positions, pos, 10);
|
||||||
for(BlockPos bpos : positions)
|
for(LocalPos bpos : positions)
|
||||||
worldIn.setBlockToAir(bpos);
|
worldIn.setBlockToAir(bpos);
|
||||||
// for(int x = -2; x <= 2; x++) {
|
// for(int x = -2; x <= 2; x++) {
|
||||||
// for(int z = -2; z <= 2; z++) {
|
// for(int z = -2; z <= 2; z++) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -51,7 +51,7 @@ public class BlockFlowerPot extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
ItemStack itemstack = playerIn.getHeldItem();
|
ItemStack itemstack = playerIn.getHeldItem();
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class BlockFlowerPot extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) && worldIn.isBlockSolid(pos.down());
|
return super.canPlace(worldIn, pos) && worldIn.isBlockSolid(pos.down());
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ public class BlockFlowerPot extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
if (!worldIn.isBlockSolid(pos.down()))
|
if (!worldIn.isBlockSolid(pos.down()))
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,7 @@ public class BlockFlowerPot extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
public void onRemoved(AWorldServer worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if(this.content != null)
|
if(this.content != null)
|
||||||
dropItem(worldIn, pos, new ItemStack(this.content.getItem()));
|
dropItem(worldIn, pos, new ItemStack(this.content.getItem()));
|
||||||
|
|
|
@ -5,8 +5,7 @@ import common.block.Material;
|
||||||
import common.entity.Entity;
|
import common.entity.Entity;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Clientside;
|
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Serverside;
|
import common.util.Serverside;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
|
@ -35,14 +34,14 @@ public class BlockGlass extends Block {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) {
|
public boolean canRender(IWorldAccess world, LocalPos pos, Facing side) {
|
||||||
State state = world.getState(pos);
|
State state = world.getState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.canRender(world, pos, side));
|
return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.canRender(world, pos, side));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) {
|
||||||
world.destroyBlock(pos, true);
|
world.destroyBlock(pos, true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import common.block.Material;
|
||||||
import common.entity.types.EntityLiving;
|
import common.entity.types.EntityLiving;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -25,7 +25,7 @@ public class BlockHay extends BlockRotatedPillar
|
||||||
return new Property[] {AXIS};
|
return new Property[] {AXIS};
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis());
|
return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
|
@ -27,19 +27,19 @@ public class BlockLadder extends Block implements Rotatable
|
||||||
this.setTab(CheatTab.WOOD);
|
this.setTab(CheatTab.WOOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(worldIn, pos);
|
this.setBlockBounds(worldIn, pos);
|
||||||
return super.getCollisionBox(worldIn, pos, state);
|
return super.getCollisionBox(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
|
public BoundingBox getSelectionBox(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(worldIn, pos);
|
this.setBlockBounds(worldIn, pos);
|
||||||
return super.getSelectionBox(worldIn, pos);
|
return super.getSelectionBox(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class BlockLadder extends Block implements Rotatable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return worldIn.getState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getState(pos.south()).getBlock().isNormalCube()));
|
return worldIn.getState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getState(pos.south()).getBlock().isNormalCube()));
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public class BlockLadder extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
if (facing.getAxis().isHorizontal() && this.canBlockStay(worldIn, pos, facing))
|
if (facing.getAxis().isHorizontal() && this.canBlockStay(worldIn, pos, facing))
|
||||||
{
|
{
|
||||||
|
@ -113,7 +113,7 @@ public class BlockLadder extends Block implements Rotatable
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
Facing enumfacing = (Facing)state.getValue(FACING);
|
Facing enumfacing = (Facing)state.getValue(FACING);
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class BlockLadder extends Block implements Rotatable
|
||||||
super.onUpdate(worldIn, pos, state, neighborBlock);
|
super.onUpdate(worldIn, pos, state, neighborBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean canBlockStay(World worldIn, BlockPos pos, Facing facing)
|
protected boolean canBlockStay(World worldIn, LocalPos pos, Facing facing)
|
||||||
{
|
{
|
||||||
return worldIn.getState(pos.offset(facing.getOpposite())).getBlock().isNormalCube();
|
return worldIn.getState(pos.offset(facing.getOpposite())).getBlock().isNormalCube();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import common.entity.npc.EntityNPC;
|
||||||
import common.init.MetalType;
|
import common.init.MetalType;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.util.Clientside;
|
|
||||||
|
|
||||||
public class BlockMetalBlock extends Block {
|
public class BlockMetalBlock extends Block {
|
||||||
private final MetalType metal;
|
private final MetalType metal;
|
||||||
|
|
|
@ -15,9 +15,8 @@ import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Clientside;
|
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Serverside;
|
import common.util.Serverside;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
|
@ -43,7 +42,7 @@ public class BlockPane extends Block
|
||||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||||
* metadata, such as fence connections.
|
* metadata, such as fence connections.
|
||||||
*/
|
*/
|
||||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
public State getState(State state, IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.east()).getBlock())));
|
return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getState(pos.east()).getBlock())));
|
||||||
}
|
}
|
||||||
|
@ -69,7 +68,7 @@ public class BlockPane extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
return worldIn.getState(pos).getBlock() == this ? false : super.canRender(worldIn, pos, side);
|
return worldIn.getState(pos).getBlock() == this ? false : super.canRender(worldIn, pos, side);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +76,7 @@ public class BlockPane extends Block
|
||||||
/**
|
/**
|
||||||
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
||||||
*/
|
*/
|
||||||
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
||||||
{
|
{
|
||||||
boolean flag = this.canPaneConnectToBlock(worldIn.getState(pos.north()).getBlock());
|
boolean flag = this.canPaneConnectToBlock(worldIn.getState(pos.north()).getBlock());
|
||||||
boolean flag1 = this.canPaneConnectToBlock(worldIn.getState(pos.south()).getBlock());
|
boolean flag1 = this.canPaneConnectToBlock(worldIn.getState(pos.south()).getBlock());
|
||||||
|
@ -123,7 +122,7 @@ public class BlockPane extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
float f = 0.4375F;
|
float f = 0.4375F;
|
||||||
float f1 = 0.5625F;
|
float f1 = 0.5625F;
|
||||||
|
@ -191,7 +190,7 @@ public class BlockPane extends Block
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) {
|
||||||
if(this.material != Material.SOLID)
|
if(this.material != Material.SOLID)
|
||||||
world.destroyBlock(pos, true);
|
world.destroyBlock(pos, true);
|
||||||
return this.material == Material.SOLID;
|
return this.material == Material.SOLID;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyEnum;
|
import common.properties.PropertyEnum;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.ParticleType;
|
import common.util.ParticleType;
|
||||||
|
@ -72,12 +72,12 @@ public class BlockPortal extends Block
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Facing.Axis enumfacing$axis = (Facing.Axis)worldIn.getState(pos).getValue(AXIS);
|
Facing.Axis enumfacing$axis = (Facing.Axis)worldIn.getState(pos).getValue(AXIS);
|
||||||
float f = 0.125F;
|
float f = 0.125F;
|
||||||
|
@ -110,7 +110,7 @@ public class BlockPortal extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryIgnitePortal(World worldIn, BlockPos pos)
|
public boolean tryIgnitePortal(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
BlockPortal.Size size = new BlockPortal.Size(worldIn, pos, Facing.Axis.X, this);
|
BlockPortal.Size size = new BlockPortal.Size(worldIn, pos, Facing.Axis.X, this);
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ public class BlockPortal extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
Facing.Axis enumfacing$axis = (Facing.Axis)state.getValue(AXIS);
|
Facing.Axis enumfacing$axis = (Facing.Axis)state.getValue(AXIS);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ public class BlockPortal extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
Facing.Axis enumfacing$axis = null;
|
Facing.Axis enumfacing$axis = null;
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
|
@ -207,7 +207,7 @@ public class BlockPortal extends Block
|
||||||
/**
|
/**
|
||||||
* Called When an Entity Collided with the Block
|
* Called When an Entity Collided with the Block
|
||||||
*/
|
*/
|
||||||
public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn)
|
public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn)
|
||||||
{
|
{
|
||||||
if (entityIn.vehicle == null && entityIn.passenger == null)
|
if (entityIn.vehicle == null && entityIn.passenger == null)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +215,7 @@ public class BlockPortal extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
|
public void displayTick(World worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
// if (rand.chance(100))
|
// if (rand.chance(100))
|
||||||
// {
|
// {
|
||||||
|
@ -327,11 +327,11 @@ public class BlockPortal extends Block
|
||||||
private final Facing field_150863_d;
|
private final Facing field_150863_d;
|
||||||
private final BlockPortal dim;
|
private final BlockPortal dim;
|
||||||
private int field_150864_e = 0;
|
private int field_150864_e = 0;
|
||||||
private BlockPos field_150861_f;
|
private LocalPos field_150861_f;
|
||||||
private int height;
|
private int height;
|
||||||
private int field_150868_h;
|
private int field_150868_h;
|
||||||
|
|
||||||
public Size(World worldIn, BlockPos p_i45694_2_, Facing.Axis p_i45694_3_, BlockPortal dim)
|
public Size(World worldIn, LocalPos p_i45694_2_, Facing.Axis p_i45694_3_, BlockPortal dim)
|
||||||
{
|
{
|
||||||
this.world = worldIn;
|
this.world = worldIn;
|
||||||
this.dim = dim;
|
this.dim = dim;
|
||||||
|
@ -348,7 +348,7 @@ public class BlockPortal extends Block
|
||||||
this.field_150866_c = Facing.SOUTH;
|
this.field_150866_c = Facing.SOUTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BlockPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down())
|
for (LocalPos blockpos = p_i45694_2_; p_i45694_2_.getY() > blockpos.getY() - 21 && p_i45694_2_.getY() > 0 && this.func_150857_a(worldIn.getState(p_i45694_2_.down()).getBlock()); p_i45694_2_ = p_i45694_2_.down())
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
@ -373,13 +373,13 @@ public class BlockPortal extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int func_180120_a(BlockPos p_180120_1_, Facing p_180120_2_)
|
protected int func_180120_a(LocalPos p_180120_1_, Facing p_180120_2_)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 22; ++i)
|
for (i = 0; i < 22; ++i)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = p_180120_1_.offset(p_180120_2_, i);
|
LocalPos blockpos = p_180120_1_.offset(p_180120_2_, i);
|
||||||
|
|
||||||
if (!this.func_150857_a(this.world.getState(blockpos).getBlock()) || this.world.getState(blockpos.down()).getBlock() != Blocks.obsidian)
|
if (!this.func_150857_a(this.world.getState(blockpos).getBlock()) || this.world.getState(blockpos.down()).getBlock() != Blocks.obsidian)
|
||||||
{
|
{
|
||||||
|
@ -409,7 +409,7 @@ public class BlockPortal extends Block
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.field_150868_h; ++i)
|
for (int i = 0; i < this.field_150868_h; ++i)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.height);
|
LocalPos blockpos = this.field_150861_f.offset(this.field_150866_c, i).up(this.height);
|
||||||
Block block = this.world.getState(blockpos).getBlock();
|
Block block = this.world.getState(blockpos).getBlock();
|
||||||
|
|
||||||
if (!this.func_150857_a(block))
|
if (!this.func_150857_a(block))
|
||||||
|
@ -479,7 +479,7 @@ public class BlockPortal extends Block
|
||||||
{
|
{
|
||||||
for (int i = 0; i < this.field_150868_h; ++i)
|
for (int i = 0; i < this.field_150868_h; ++i)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = this.field_150861_f.offset(this.field_150866_c, i);
|
LocalPos blockpos = this.field_150861_f.offset(this.field_150866_c, i);
|
||||||
State state = this.dim.getState().withProperty(BlockPortal.AXIS, this.axis);
|
State state = this.dim.getState().withProperty(BlockPortal.AXIS, this.axis);
|
||||||
|
|
||||||
for (int j = 0; j < this.height; ++j)
|
for (int j = 0; j < this.height; ++j)
|
||||||
|
|
|
@ -19,7 +19,7 @@ import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -46,7 +46,7 @@ public class BlockPortalFrame extends Block implements Rotatable
|
||||||
/**
|
/**
|
||||||
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
||||||
*/
|
*/
|
||||||
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F);
|
||||||
super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity);
|
super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity);
|
||||||
|
@ -73,7 +73,7 @@ public class BlockPortalFrame extends Block implements Rotatable
|
||||||
return 4;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te)
|
||||||
{
|
{
|
||||||
super.postBroken(worldIn, player, pos, state, te);
|
super.postBroken(worldIn, player, pos, state, te);
|
||||||
if(state.getValue(ORB))
|
if(state.getValue(ORB))
|
||||||
|
@ -84,7 +84,7 @@ public class BlockPortalFrame extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false));
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false));
|
||||||
}
|
}
|
||||||
|
@ -94,10 +94,10 @@ public class BlockPortalFrame extends Block implements Rotatable
|
||||||
return new Property[] {FACING, ORB};
|
return new Property[] {FACING, ORB};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onBroken(World worldIn, BlockPos pos, State state)
|
public void onBroken(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
for(int n = 0; n < 4; n++) {
|
for(int n = 0; n < 4; n++) {
|
||||||
BlockPos ppos = pos.offset(Facing.getHorizontal(n));
|
LocalPos ppos = pos.offset(Facing.getHorizontal(n));
|
||||||
State pstate = worldIn.getState(ppos);
|
State pstate = worldIn.getState(ppos);
|
||||||
if(pstate.getBlock() == Blocks.floor_portal)
|
if(pstate.getBlock() == Blocks.floor_portal)
|
||||||
Blocks.floor_portal.onBroken(worldIn, ppos, pstate);
|
Blocks.floor_portal.onBroken(worldIn, ppos, pstate);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -23,7 +23,7 @@ public class BlockQuartzPillar extends BlockRotatedPillar {
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
return this.getState().withProperty(AXIS, facing.getAxis());
|
return this.getState().withProperty(AXIS, facing.getAxis());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Serverside;
|
import common.util.Serverside;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
|
@ -24,11 +24,11 @@ public class BlockSkull extends Block implements Rotatable {
|
||||||
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World world, BlockPos pos) {
|
public boolean canPlace(World world, LocalPos pos) {
|
||||||
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
public State getPlacedState(World world, LocalPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class BlockSkull extends Block implements Rotatable {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serverside
|
@Serverside
|
||||||
public boolean onShot(AWorldServer world, BlockPos pos, State state, Entity projectile) {
|
public boolean onShot(AWorldServer world, LocalPos pos, State state, Entity projectile) {
|
||||||
world.destroyBlock(pos, true);
|
world.destroyBlock(pos, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import common.model.Model;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.Facing.Axis;
|
import common.util.Facing.Axis;
|
||||||
|
@ -67,12 +67,12 @@ public class BlockSlab extends Block implements Directional {
|
||||||
return new Property[] {FACING};
|
return new Property[] {FACING};
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
State iblockstate = this.getState().withProperty(FACING, Facing.DOWN);
|
State iblockstate = this.getState().withProperty(FACING, Facing.DOWN);
|
||||||
return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate : iblockstate.withProperty(FACING, Facing.UP);
|
return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate : iblockstate.withProperty(FACING, Facing.UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) {
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos) {
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
|
|
||||||
if(iblockstate.getBlock() == this) {
|
if(iblockstate.getBlock() == this) {
|
||||||
|
@ -99,7 +99,7 @@ public class BlockSlab extends Block implements Directional {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity) {
|
public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity) {
|
||||||
this.setBlockBounds(worldIn, pos);
|
this.setBlockBounds(worldIn, pos);
|
||||||
super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity);
|
super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity);
|
||||||
}
|
}
|
||||||
|
@ -116,14 +116,14 @@ public class BlockSlab extends Block implements Directional {
|
||||||
return blockIn instanceof BlockSlab;
|
return blockIn instanceof BlockSlab;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) {
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side) {
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
if(iblockstate.getBlock() == this && iblockstate.getValue(FACING).getAxis() == Axis.Y) {
|
if(iblockstate.getBlock() == this && iblockstate.getValue(FACING).getAxis() == Axis.Y) {
|
||||||
if(side != Facing.UP && side != Facing.DOWN && !super.canRender(worldIn, pos, side)) {
|
if(side != Facing.UP && side != Facing.DOWN && !super.canRender(worldIn, pos, side)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BlockPos blockpos = pos.offset(side.getOpposite());
|
LocalPos blockpos = pos.offset(side.getOpposite());
|
||||||
State iblockstate1 = worldIn.getState(blockpos);
|
State iblockstate1 = worldIn.getState(blockpos);
|
||||||
if(isSlab(iblockstate1.getBlock()) && iblockstate.getValue(FACING).getAxis() == Axis.Y)
|
if(isSlab(iblockstate1.getBlock()) && iblockstate.getValue(FACING).getAxis() == Axis.Y)
|
||||||
return true;
|
return true;
|
||||||
|
@ -178,12 +178,12 @@ public class BlockSlab extends Block implements Directional {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
||||||
return !stack.isEmpty() && playerIn.canPlayerEdit(pos.offset(side), side, stack) &&
|
return !stack.isEmpty() && playerIn.canPlayerEdit(pos.offset(side), side, stack) &&
|
||||||
(this.tryVerticalPlace(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ) || super.place(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ));
|
(this.tryVerticalPlace(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ) || super.place(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean tryVerticalPlace(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
private boolean tryVerticalPlace(ItemStack stack, EntityNPC playerIn, World worldIn, LocalPos pos, Facing side, float hitX, float hitY, float hitZ) {
|
||||||
if(hitY >= 0.34f && hitY <= 0.66f) {
|
if(hitY >= 0.34f && hitY <= 0.66f) {
|
||||||
State state = worldIn.getState(pos);
|
State state = worldIn.getState(pos);
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
|
|
|
@ -14,7 +14,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyEnum;
|
import common.properties.PropertyEnum;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.HitPosition;
|
import common.util.HitPosition;
|
||||||
|
@ -62,7 +62,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
this.sideTex = side;
|
this.sideTex = side;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
if (this.hasRaytraced)
|
if (this.hasRaytraced)
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
/**
|
/**
|
||||||
* Set the block bounds as the collision bounds for the stairs at the given position
|
* Set the block bounds as the collision bounds for the stairs at the given position
|
||||||
*/
|
*/
|
||||||
public void setBaseCollisionBounds(IBlockAccess worldIn, BlockPos pos)
|
public void setBaseCollisionBounds(IBlockAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
if (worldIn.getState(pos).getValue(HALF) == BlockStairs.EnumHalf.TOP)
|
if (worldIn.getState(pos).getValue(HALF) == BlockStairs.EnumHalf.TOP)
|
||||||
{
|
{
|
||||||
|
@ -113,14 +113,14 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
/**
|
/**
|
||||||
* Check whether there is a stair block at the given position and it has the same properties as the given BlockState
|
* Check whether there is a stair block at the given position and it has the same properties as the given BlockState
|
||||||
*/
|
*/
|
||||||
public static boolean isSameStair(IBlockAccess worldIn, BlockPos pos, State state)
|
public static boolean isSameStair(IBlockAccess worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
Block block = iblockstate.getBlock();
|
Block block = iblockstate.getBlock();
|
||||||
return isBlockStairs(block) && iblockstate.getValue(HALF) == state.getValue(HALF) && iblockstate.getValue(FACING) == state.getValue(FACING);
|
return isBlockStairs(block) && iblockstate.getValue(HALF) == state.getValue(HALF) && iblockstate.getValue(FACING) == state.getValue(FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getOuterShape(IBlockAccess blockAccess, BlockPos pos)
|
public int getOuterShape(IBlockAccess blockAccess, LocalPos pos)
|
||||||
{
|
{
|
||||||
State iblockstate = blockAccess.getState(pos);
|
State iblockstate = blockAccess.getState(pos);
|
||||||
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
||||||
|
@ -211,7 +211,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getInnerShape(IBlockAccess blockAccess, BlockPos pos)
|
public int getInnerShape(IBlockAccess blockAccess, LocalPos pos)
|
||||||
{
|
{
|
||||||
State iblockstate = blockAccess.getState(pos);
|
State iblockstate = blockAccess.getState(pos);
|
||||||
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
||||||
|
@ -302,7 +302,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setBaseBlockBounds(IBlockAccess blockAccess, BlockPos pos)
|
public boolean setBaseBlockBounds(IBlockAccess blockAccess, LocalPos pos)
|
||||||
{
|
{
|
||||||
State iblockstate = blockAccess.getState(pos);
|
State iblockstate = blockAccess.getState(pos);
|
||||||
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
||||||
|
@ -418,7 +418,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
return flag1;
|
return flag1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setCollisionBlockBounds(IBlockAccess blockAccess, BlockPos pos)
|
public boolean setCollisionBlockBounds(IBlockAccess blockAccess, LocalPos pos)
|
||||||
{
|
{
|
||||||
State iblockstate = blockAccess.getState(pos);
|
State iblockstate = blockAccess.getState(pos);
|
||||||
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
Facing enumfacing = (Facing)iblockstate.getValue(FACING);
|
||||||
|
@ -543,7 +543,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
/**
|
/**
|
||||||
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
* Add all collision boxes of this Block to the list that intersect with the given mask.
|
||||||
*/
|
*/
|
||||||
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
||||||
{
|
{
|
||||||
this.setBaseCollisionBounds(worldIn, pos);
|
this.setBaseCollisionBounds(worldIn, pos);
|
||||||
super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity);
|
super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity);
|
||||||
|
@ -562,7 +562,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer);
|
State iblockstate = super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer);
|
||||||
iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing()).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
|
iblockstate = iblockstate.withProperty(FACING, placer.getHorizontalFacing()).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT);
|
||||||
|
@ -572,7 +572,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
/**
|
/**
|
||||||
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
||||||
*/
|
*/
|
||||||
public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
|
public HitPosition rayTrace(World worldIn, LocalPos pos, Vec3 start, Vec3 end)
|
||||||
{
|
{
|
||||||
HitPosition[] amovingobjectposition = new HitPosition[8];
|
HitPosition[] amovingobjectposition = new HitPosition[8];
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
|
@ -603,7 +603,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
{
|
{
|
||||||
if (movingobjectposition != null)
|
if (movingobjectposition != null)
|
||||||
{
|
{
|
||||||
double d0 = movingobjectposition.vec.squareDistanceTo(end);
|
double d0 = movingobjectposition.vec.distanceSq(end);
|
||||||
|
|
||||||
if (d0 > d1)
|
if (d0 > d1)
|
||||||
{
|
{
|
||||||
|
@ -620,7 +620,7 @@ public class BlockStairs extends Block implements Rotatable
|
||||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||||
* metadata, such as fence connections.
|
* metadata, such as fence connections.
|
||||||
*/
|
*/
|
||||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
public State getState(State state, IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
if (this.setBaseBlockBounds(worldIn, pos))
|
if (this.setBaseBlockBounds(worldIn, pos))
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,7 +13,7 @@ import common.model.ModelRotation;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.properties.PropertyEnum;
|
import common.properties.PropertyEnum;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.HitPosition;
|
import common.util.HitPosition;
|
||||||
|
@ -62,24 +62,24 @@ public class BlockTrapDoor extends Block implements Rotatable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
public boolean isPassable(IBlockAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return !((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue();
|
return !((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
|
public BoundingBox getSelectionBox(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(worldIn, pos);
|
this.setBlockBounds(worldIn, pos);
|
||||||
return super.getSelectionBox(worldIn, pos);
|
return super.getSelectionBox(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(worldIn, pos);
|
this.setBlockBounds(worldIn, pos);
|
||||||
return super.getCollisionBox(worldIn, pos, state);
|
return super.getCollisionBox(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
this.setBounds(worldIn.getState(pos));
|
this.setBounds(worldIn.getState(pos));
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class BlockTrapDoor extends Block implements Rotatable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ)
|
public boolean onUse(World worldIn, LocalPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
if(this.keyItem != null && (player.getHeldItem() == null || player.getHeldItem().getItem() != this.keyItem))
|
if(this.keyItem != null && (player.getHeldItem() == null || player.getHeldItem().getItem() != this.keyItem))
|
||||||
return true;
|
return true;
|
||||||
|
@ -140,7 +140,7 @@ public class BlockTrapDoor extends Block implements Rotatable
|
||||||
/**
|
/**
|
||||||
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
* Ray traces through the blocks collision from start vector to end vector returning a ray trace hit.
|
||||||
*/
|
*/
|
||||||
public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
|
public HitPosition rayTrace(World worldIn, LocalPos pos, Vec3 start, Vec3 end)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(worldIn, pos);
|
this.setBlockBounds(worldIn, pos);
|
||||||
return super.rayTrace(worldIn, pos, start, end);
|
return super.rayTrace(worldIn, pos, start, end);
|
||||||
|
@ -150,7 +150,7 @@ public class BlockTrapDoor extends Block implements Rotatable
|
||||||
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
|
||||||
* IBlockstate
|
* IBlockstate
|
||||||
*/
|
*/
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
State iblockstate = this.getState();
|
State iblockstate = this.getState();
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.IBlockAccess;
|
import common.world.IBlockAccess;
|
||||||
|
@ -58,7 +58,7 @@ public class BlockWall extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
|
public boolean isPassable(IBlockAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class BlockWall extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
boolean flag = this.canConnectTo(worldIn, pos.north());
|
boolean flag = this.canConnectTo(worldIn, pos.north());
|
||||||
boolean flag1 = this.canConnectTo(worldIn, pos.south());
|
boolean flag1 = this.canConnectTo(worldIn, pos.south());
|
||||||
|
@ -119,20 +119,20 @@ public class BlockWall extends Block
|
||||||
this.setBlockBounds(f, 0.0F, f2, f1, f4, f3);
|
this.setBlockBounds(f, 0.0F, f2, f1, f4, f3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(worldIn, pos);
|
this.setBlockBounds(worldIn, pos);
|
||||||
this.maxY = 1.5D;
|
this.maxY = 1.5D;
|
||||||
return super.getCollisionBox(worldIn, pos, state);
|
return super.getCollisionBox(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
|
public boolean canConnectTo(IBlockAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = worldIn.getState(pos).getBlock();
|
Block block = worldIn.getState(pos).getBlock();
|
||||||
return (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true);
|
return (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
return side == Facing.DOWN ? super.canRender(worldIn, pos, side) : true;
|
return side == Facing.DOWN ? super.canRender(worldIn, pos, side) : true;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ public class BlockWall extends Block
|
||||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||||
* metadata, such as fence connections.
|
* metadata, such as fence connections.
|
||||||
*/
|
*/
|
||||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
public State getState(State state, IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock() != Blocks.air)).withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, pos.west())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import common.item.Item;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.AWorldServer;
|
import common.world.AWorldServer;
|
||||||
|
@ -22,7 +22,7 @@ public class BlockBlackenedSoil extends Block
|
||||||
this.setTab(CheatTab.NATURE);
|
this.setTab(CheatTab.NATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 6)
|
if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 6)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ public class BlockBlackenedSoil extends Block
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
|
LocalPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
|
||||||
Block block = worldIn.getState(blockpos.up()).getBlock();
|
Block block = worldIn.getState(blockpos.up()).getBlock();
|
||||||
State iblockstate = worldIn.getState(blockpos);
|
State iblockstate = worldIn.getState(blockpos);
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -21,14 +22,14 @@ public class BlockBlueShroom extends BlockBush
|
||||||
this.setTicked();
|
this.setTicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if (Vars.blueShroomGrowth > 0 && rand.chance(Vars.blueShroomGrowth))
|
if (Vars.blueShroomGrowth > 0 && rand.chance(Vars.blueShroomGrowth))
|
||||||
{
|
{
|
||||||
int i = 5;
|
int i = 5;
|
||||||
int j = 4;
|
int j = 4;
|
||||||
|
|
||||||
for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-4, -1, -4), pos.add(4, 1, 4)))
|
for (LocalPos blockpos : MutablePos.mutableArea(pos.add(-4, -1, -4), pos.add(4, 1, 4)))
|
||||||
{
|
{
|
||||||
if (worldIn.getState(blockpos).getBlock() == this)
|
if (worldIn.getState(blockpos).getBlock() == this)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +42,7 @@ public class BlockBlueShroom extends BlockBush
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1);
|
LocalPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1);
|
||||||
|
|
||||||
for (int k = 0; k < 4; ++k)
|
for (int k = 0; k < 4; ++k)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +61,7 @@ public class BlockBlueShroom extends BlockBush
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState());
|
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState());
|
||||||
}
|
}
|
||||||
|
@ -70,7 +71,7 @@ public class BlockBlueShroom extends BlockBush
|
||||||
return ground.isFullBlock();
|
return ground.isFullBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
public boolean canBlockStay(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ import common.init.Blocks;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Clientside;
|
import common.util.Clientside;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
@ -30,7 +30,7 @@ public class BlockBush extends Block
|
||||||
this.setTab(CheatTab.PLANTS);
|
this.setTab(CheatTab.PLANTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) && this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
return super.canPlace(worldIn, pos) && this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
||||||
}
|
}
|
||||||
|
@ -46,18 +46,18 @@ public class BlockBush extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
super.onUpdate(worldIn, pos, state, neighborBlock);
|
super.onUpdate(worldIn, pos, state, neighborBlock);
|
||||||
this.checkAndDropBlock(worldIn, pos, state);
|
this.checkAndDropBlock(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
this.checkAndDropBlock(worldIn, pos, state);
|
this.checkAndDropBlock(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkAndDropBlock(World worldIn, BlockPos pos, State state)
|
protected void checkAndDropBlock(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (!this.canBlockStay(worldIn, pos, state))
|
if (!this.canBlockStay(worldIn, pos, state))
|
||||||
{
|
{
|
||||||
|
@ -66,12 +66,12 @@ public class BlockBush extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
public boolean canBlockStay(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyInteger;
|
import common.properties.PropertyInteger;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
|
@ -31,9 +31,9 @@ public class BlockCactus extends Block
|
||||||
this.setTab(CheatTab.PLANTS);
|
this.setTab(CheatTab.PLANTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = pos.up();
|
LocalPos blockpos = pos.up();
|
||||||
|
|
||||||
if (Vars.cactusHeight > 0 && worldIn.isAirBlock(blockpos))
|
if (Vars.cactusHeight > 0 && worldIn.isAirBlock(blockpos))
|
||||||
{
|
{
|
||||||
|
@ -63,13 +63,13 @@ public class BlockCactus extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)(pos.getY() + 1) - f), (double)((float)(pos.getZ() + 1) - f));
|
return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)(pos.getY() + 1) - f), (double)((float)(pos.getZ() + 1) - f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getSelectionBox(World worldIn, BlockPos pos)
|
public BoundingBox getSelectionBox(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
float f = 0.0625F;
|
float f = 0.0625F;
|
||||||
return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)(pos.getY() + 1), (double)((float)(pos.getZ() + 1) - f));
|
return new BoundingBox((double)((float)pos.getX() + f), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)(pos.getY() + 1), (double)((float)(pos.getZ() + 1) - f));
|
||||||
|
@ -88,7 +88,7 @@ public class BlockCactus extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false;
|
return super.canPlace(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class BlockCactus extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
if (!this.canBlockStay(worldIn, pos))
|
if (!this.canBlockStay(worldIn, pos))
|
||||||
{
|
{
|
||||||
|
@ -104,7 +104,7 @@ public class BlockCactus extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos)
|
public boolean canBlockStay(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
for (Facing enumfacing : Facing.Plane.HORIZONTAL)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ public class BlockCactus extends Block
|
||||||
/**
|
/**
|
||||||
* Called When an Entity Collided with the Block
|
* Called When an Entity Collided with the Block
|
||||||
*/
|
*/
|
||||||
public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn)
|
public void onCollideUpdate(World worldIn, LocalPos pos, State state, Entity entityIn)
|
||||||
{
|
{
|
||||||
if(worldIn.client || Vars.cactusDamage)
|
if(worldIn.client || Vars.cactusDamage)
|
||||||
entityIn.attackEntityFrom(DamageSource.cactus, 1);
|
entityIn.attackEntityFrom(DamageSource.cactus, 1);
|
||||||
|
|
|
@ -12,7 +12,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyInteger;
|
import common.properties.PropertyInteger;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -42,7 +42,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
return ground == Blocks.farmland;
|
return ground == Blocks.farmland;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
super.tick(worldIn, pos, state, rand);
|
super.tick(worldIn, pos, state, rand);
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grow(World worldIn, BlockPos pos, State state)
|
public void grow(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
int i = ((Integer)state.getValue(AGE)).intValue() + worldIn.rand.range(2, 5);
|
int i = ((Integer)state.getValue(AGE)).intValue() + worldIn.rand.range(2, 5);
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
worldIn.setState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2);
|
worldIn.setState(pos, state.withProperty(AGE, Integer.valueOf(i)), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos)
|
protected static float getGrowthChance(Block blockIn, World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
float f = 1.0F;
|
float f = 1.0F;
|
||||||
BlockPos blockpos = pos.down();
|
LocalPos blockpos = pos.down();
|
||||||
|
|
||||||
for (int i = -1; i <= 1; ++i)
|
for (int i = -1; i <= 1; ++i)
|
||||||
{
|
{
|
||||||
|
@ -105,10 +105,10 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos1 = pos.north();
|
LocalPos blockpos1 = pos.north();
|
||||||
BlockPos blockpos2 = pos.south();
|
LocalPos blockpos2 = pos.south();
|
||||||
BlockPos blockpos3 = pos.west();
|
LocalPos blockpos3 = pos.west();
|
||||||
BlockPos blockpos4 = pos.east();
|
LocalPos blockpos4 = pos.east();
|
||||||
boolean flag = blockIn == worldIn.getState(blockpos3).getBlock() || blockIn == worldIn.getState(blockpos4).getBlock();
|
boolean flag = blockIn == worldIn.getState(blockpos3).getBlock() || blockIn == worldIn.getState(blockpos4).getBlock();
|
||||||
boolean flag1 = blockIn == worldIn.getState(blockpos1).getBlock() || blockIn == worldIn.getState(blockpos2).getBlock();
|
boolean flag1 = blockIn == worldIn.getState(blockpos1).getBlock() || blockIn == worldIn.getState(blockpos2).getBlock();
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
public boolean canBlockStay(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
/**
|
/**
|
||||||
* Spawns this Block's drops into the World as EntityItems.
|
* Spawns this Block's drops into the World as EntityItems.
|
||||||
*/
|
*/
|
||||||
public void drop(World worldIn, BlockPos pos, State state, int fortune)
|
public void drop(World worldIn, LocalPos pos, State state, int fortune)
|
||||||
{
|
{
|
||||||
super.drop(worldIn, pos, state, fortune);
|
super.drop(worldIn, pos, state, fortune);
|
||||||
|
|
||||||
|
@ -180,17 +180,17 @@ public class BlockCrops extends BlockBush implements IGrowable
|
||||||
/**
|
/**
|
||||||
* Whether this IGrowable can grow
|
* Whether this IGrowable can grow
|
||||||
*/
|
*/
|
||||||
public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient)
|
public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient)
|
||||||
{
|
{
|
||||||
return ((Integer)state.getValue(AGE)).intValue() < 7;
|
return ((Integer)state.getValue(AGE)).intValue() < 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state)
|
public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
this.grow(worldIn, pos, state);
|
this.grow(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Equipment;
|
import common.util.Equipment;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -48,7 +48,7 @@ public class BlockDeadBush extends BlockBush
|
||||||
/**
|
/**
|
||||||
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
|
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
|
||||||
*/
|
*/
|
||||||
public boolean canReplace(World worldIn, BlockPos pos)
|
public boolean canReplace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class BlockDeadBush extends BlockBush
|
||||||
return rand.chance(5) ? Items.stick : null;
|
return rand.chance(5) ? Items.stick : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te)
|
||||||
{
|
{
|
||||||
if (!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS)
|
if (!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,7 +18,7 @@ import common.properties.Property;
|
||||||
import common.properties.PropertyEnum;
|
import common.properties.PropertyEnum;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Equipment;
|
import common.util.Equipment;
|
||||||
import common.util.Identifyable;
|
import common.util.Identifyable;
|
||||||
import common.util.Facing.Axis;
|
import common.util.Facing.Axis;
|
||||||
|
@ -54,7 +54,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
return this.type;
|
return this.type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if(Vars.plantDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
if(Vars.plantDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
||||||
{
|
{
|
||||||
|
@ -72,12 +72,12 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
super.tick(worldIn, pos, state, rand);
|
super.tick(worldIn, pos, state, rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBlockBounds(IWorldAccess worldIn, BlockPos pos)
|
public void setBlockBounds(IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) && worldIn.isAirBlock(pos.up());
|
return super.canPlace(worldIn, pos) && worldIn.isAirBlock(pos.up());
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
/**
|
/**
|
||||||
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
|
* Whether this Block can be replaced directly by other blocks (true for e.g. tall grass)
|
||||||
*/
|
*/
|
||||||
public boolean canReplace(World worldIn, BlockPos pos)
|
public boolean canReplace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
State iblockstate = worldIn.getState(pos);
|
State iblockstate = worldIn.getState(pos);
|
||||||
|
|
||||||
|
@ -99,13 +99,13 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void checkAndDropBlock(World worldIn, BlockPos pos, State state)
|
protected void checkAndDropBlock(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (!this.canBlockStay(worldIn, pos, state))
|
if (!this.canBlockStay(worldIn, pos, state))
|
||||||
{
|
{
|
||||||
boolean flag = state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER;
|
boolean flag = state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER;
|
||||||
BlockPos blockpos = flag ? pos : pos.up();
|
LocalPos blockpos = flag ? pos : pos.up();
|
||||||
BlockPos blockpos1 = flag ? pos.down() : pos;
|
LocalPos blockpos1 = flag ? pos.down() : pos;
|
||||||
Block block = (Block)(flag ? this : worldIn.getState(blockpos).getBlock());
|
Block block = (Block)(flag ? this : worldIn.getState(blockpos).getBlock());
|
||||||
Block block1 = (Block)(flag ? worldIn.getState(blockpos1).getBlock() : this);
|
Block block1 = (Block)(flag ? worldIn.getState(blockpos1).getBlock() : this);
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
public boolean canBlockStay(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
|
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
|
||||||
{
|
{
|
||||||
|
@ -154,7 +154,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void placeAt(World worldIn, BlockPos lowerPos, int flags)
|
public void placeAt(World worldIn, LocalPos lowerPos, int flags)
|
||||||
{
|
{
|
||||||
worldIn.setState(lowerPos, this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER), flags);
|
worldIn.setState(lowerPos, this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER), flags);
|
||||||
worldIn.setState(lowerPos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags);
|
worldIn.setState(lowerPos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), flags);
|
||||||
|
@ -163,12 +163,12 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
/**
|
/**
|
||||||
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
* Called by ItemBlocks after a block is set in the world, to allow post-place logic
|
||||||
*/
|
*/
|
||||||
public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer)
|
public void onPlace(World worldIn, LocalPos pos, State state, EntityLiving placer)
|
||||||
{
|
{
|
||||||
worldIn.setState(pos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), 2);
|
worldIn.setState(pos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te)
|
public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te)
|
||||||
{
|
{
|
||||||
if (worldIn.client || player.getHeldItem() == null || !(player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player))
|
if (worldIn.client || player.getHeldItem() == null || !(player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player))
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preBroken(World worldIn, BlockPos pos, State state, EntityNPC player)
|
public void preBroken(World worldIn, LocalPos pos, State state, EntityNPC player)
|
||||||
{
|
{
|
||||||
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
|
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
|
||||||
{
|
{
|
||||||
|
@ -221,7 +221,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
super.preBroken(worldIn, pos, state, player);
|
super.preBroken(worldIn, pos, state, player);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onHarvest(World worldIn, BlockPos pos, State state, EntityNPC player)
|
private boolean onHarvest(World worldIn, LocalPos pos, State state, EntityNPC player)
|
||||||
{
|
{
|
||||||
if (this.type != BlockDoublePlant.EnumPlantType.FERN && this.type != BlockDoublePlant.EnumPlantType.GRASS)
|
if (this.type != BlockDoublePlant.EnumPlantType.FERN && this.type != BlockDoublePlant.EnumPlantType.GRASS)
|
||||||
{
|
{
|
||||||
|
@ -237,17 +237,17 @@ public class BlockDoublePlant extends BlockBush implements IGrowable
|
||||||
/**
|
/**
|
||||||
* Whether this IGrowable can grow
|
* Whether this IGrowable can grow
|
||||||
*/
|
*/
|
||||||
public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient)
|
public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient)
|
||||||
{
|
{
|
||||||
return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN;
|
return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state)
|
public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
dropItem(worldIn, pos, new ItemStack(this.getItem()));
|
dropItem(worldIn, pos, new ItemStack(this.getItem()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,10 @@ import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyInteger;
|
import common.properties.PropertyInteger;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.IWorldAccess;
|
import common.world.IWorldAccess;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -33,7 +34,7 @@ public class BlockFarmland extends Block
|
||||||
this.setOpacity(255);
|
this.setOpacity(255);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return new BoundingBox((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1));
|
return new BoundingBox((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1));
|
||||||
}
|
}
|
||||||
|
@ -51,7 +52,7 @@ public class BlockFarmland extends Block
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
int i = ((Integer)state.getValue(MOISTURE)).intValue();
|
int i = ((Integer)state.getValue(MOISTURE)).intValue();
|
||||||
|
|
||||||
|
@ -77,7 +78,7 @@ public class BlockFarmland extends Block
|
||||||
/**
|
/**
|
||||||
* Block's chance to react to a living entity falling on it.
|
* Block's chance to react to a living entity falling on it.
|
||||||
*/
|
*/
|
||||||
public void onLandUpdate(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
|
public void onLandUpdate(World worldIn, LocalPos pos, Entity entityIn, float fallDistance)
|
||||||
{
|
{
|
||||||
if (entityIn instanceof EntityLiving)
|
if (entityIn instanceof EntityLiving)
|
||||||
{
|
{
|
||||||
|
@ -91,15 +92,15 @@ public class BlockFarmland extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasCrops(World worldIn, BlockPos pos)
|
private boolean hasCrops(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = worldIn.getState(pos.up()).getBlock();
|
Block block = worldIn.getState(pos.up()).getBlock();
|
||||||
return block instanceof BlockCrops || block instanceof BlockStem;
|
return block instanceof BlockCrops || block instanceof BlockStem;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasWater(World worldIn, BlockPos pos)
|
private boolean hasWater(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
for (BlockPos.MutableBlockPos blockpos$mutableblockpos : BlockPos.getAllInBoxMutable(pos.add(-4, 0, -4), pos.add(4, 1, 4)))
|
for (MutablePos blockpos$mutableblockpos : MutablePos.mutableArea(pos.add(-4, 0, -4), pos.add(4, 1, 4)))
|
||||||
{
|
{
|
||||||
if (worldIn.getState(blockpos$mutableblockpos).getBlock().getMaterial() == Material.WATER)
|
if (worldIn.getState(blockpos$mutableblockpos).getBlock().getMaterial() == Material.WATER)
|
||||||
{
|
{
|
||||||
|
@ -113,7 +114,7 @@ public class BlockFarmland extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
super.onUpdate(worldIn, pos, state, neighborBlock);
|
super.onUpdate(worldIn, pos, state, neighborBlock);
|
||||||
|
|
||||||
|
@ -123,7 +124,7 @@ public class BlockFarmland extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side)
|
public boolean canRender(IWorldAccess worldIn, LocalPos pos, Facing side)
|
||||||
{
|
{
|
||||||
switch (side)
|
switch (side)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@ import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Identifyable;
|
import common.util.Identifyable;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -38,7 +38,7 @@ public class BlockFlower extends BlockBush
|
||||||
return super.canPlaceBlockOn(ground) || ((this.type == EnumFlowerType.BLUE_ORCHID || this.type == EnumFlowerType.BLACK_LOTUS) && ground == Blocks.swamp);
|
return super.canPlaceBlockOn(ground) || ((this.type == EnumFlowerType.BLUE_ORCHID || this.type == EnumFlowerType.BLACK_LOTUS) && ground == Blocks.swamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if(Vars.flowerDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
if(Vars.flowerDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.IWorldAccess;
|
import common.world.IWorldAccess;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -29,13 +29,13 @@ public class BlockGrass extends Block implements IGrowable
|
||||||
this.setTab(CheatTab.NATURE);
|
this.setTab(CheatTab.NATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
public State getState(State state, IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = worldIn.getState(pos.up()).getBlock();
|
Block block = worldIn.getState(pos.up()).getBlock();
|
||||||
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
|
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 2)
|
if (worldIn.getState(pos.up()).getBlock().getLightOpacity() > 2)
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ public class BlockGrass extends Block implements IGrowable
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
|
LocalPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
|
||||||
Block block = worldIn.getState(blockpos.up()).getBlock();
|
Block block = worldIn.getState(blockpos.up()).getBlock();
|
||||||
State iblockstate = worldIn.getState(blockpos);
|
State iblockstate = worldIn.getState(blockpos);
|
||||||
|
|
||||||
|
@ -71,17 +71,17 @@ public class BlockGrass extends Block implements IGrowable
|
||||||
return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune);
|
return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient)
|
public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state)
|
public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
worldIn.growGrass(pos, state, rand);
|
worldIn.growGrass(pos, state, rand);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,9 @@ import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.tileentity.TileEntity;
|
import common.tileentity.TileEntity;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.util.Equipment;
|
import common.util.Equipment;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
|
@ -63,7 +64,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
return this.subType;
|
return this.subType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
public void onRemoved(AWorldServer worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
int j = i + 1;
|
int j = i + 1;
|
||||||
|
@ -71,7 +72,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
int l = pos.getY();
|
int l = pos.getY();
|
||||||
int i1 = pos.getZ();
|
int i1 = pos.getZ();
|
||||||
|
|
||||||
if (worldIn.isAreaLoaded(new BlockPos(k - j, l - j, i1 - j), new BlockPos(k + j, l + j, i1 + j)))
|
if (worldIn.isAreaLoaded(new LocalPos(k - j, l - j, i1 - j), new LocalPos(k + j, l + j, i1 + j)))
|
||||||
{
|
{
|
||||||
for (int j1 = -i; j1 <= i; ++j1)
|
for (int j1 = -i; j1 <= i; ++j1)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +80,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
{
|
{
|
||||||
for (int l1 = -i; l1 <= i; ++l1)
|
for (int l1 = -i; l1 <= i; ++l1)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = pos.add(j1, k1, l1);
|
LocalPos blockpos = pos.add(j1, k1, l1);
|
||||||
State iblockstate = worldIn.getState(blockpos);
|
State iblockstate = worldIn.getState(blockpos);
|
||||||
|
|
||||||
if (iblockstate.getBlock().getMaterial() == Material.LEAVES && !iblockstate.getValue(BUSH) && !iblockstate.getValue(DECAY))
|
if (iblockstate.getBlock().getMaterial() == Material.LEAVES && !iblockstate.getValue(BUSH) && !iblockstate.getValue(DECAY))
|
||||||
|
@ -92,7 +93,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if(Vars.seasonLeaves && this.subType != worldIn.getLeavesGen(pos)) {
|
if(Vars.seasonLeaves && this.subType != worldIn.getLeavesGen(pos)) {
|
||||||
worldIn.setState(pos, getLeavesBlock(this.type, worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)).withProperty(BUSH, state.getValue(BUSH)), 2);
|
worldIn.setState(pos, getLeavesBlock(this.type, worldIn.getLeavesGen(pos)).getState().withProperty(DECAY, state.getValue(DECAY)).withProperty(BUSH, state.getValue(BUSH)), 2);
|
||||||
|
@ -120,9 +121,9 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
this.surroundings = new int[j1 * j1 * j1];
|
this.surroundings = new int[j1 * j1 * j1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldIn.isAreaLoaded(new BlockPos(k - j, l - j, i1 - j), new BlockPos(k + j, l + j, i1 + j)))
|
if (worldIn.isAreaLoaded(new LocalPos(k - j, l - j, i1 - j), new LocalPos(k + j, l + j, i1 + j)))
|
||||||
{
|
{
|
||||||
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
MutablePos blockpos$mutableblockpos = new MutablePos();
|
||||||
|
|
||||||
for (int i2 = -i; i2 <= i; ++i2)
|
for (int i2 = -i; i2 <= i; ++i2)
|
||||||
{
|
{
|
||||||
|
@ -211,7 +212,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroy(World worldIn, BlockPos pos)
|
private void destroy(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
this.drop(worldIn, pos, worldIn.getState(pos), 0);
|
this.drop(worldIn, pos, worldIn.getState(pos), 0);
|
||||||
worldIn.setBlockToAir(pos);
|
worldIn.setBlockToAir(pos);
|
||||||
|
@ -236,7 +237,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
/**
|
/**
|
||||||
* Spawns this Block's drops into the World as EntityItems.
|
* Spawns this Block's drops into the World as EntityItems.
|
||||||
*/
|
*/
|
||||||
public void drop(World worldIn, BlockPos pos, State state, int fortune)
|
public void drop(World worldIn, LocalPos pos, State state, int fortune)
|
||||||
{
|
{
|
||||||
if (!worldIn.client)
|
if (!worldIn.client)
|
||||||
{
|
{
|
||||||
|
@ -279,7 +280,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
return new Property[] {DECAY, BUSH};
|
return new Property[] {DECAY, BUSH};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) {
|
public void postBroken(World worldIn, EntityNPC player, LocalPos pos, State state, TileEntity te) {
|
||||||
if(!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) {
|
if(!worldIn.client && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemTool tool && tool.getToolType() == Equipment.SHEARS) {
|
||||||
dropItem(worldIn, pos, new ItemStack(this.getItem()));
|
dropItem(worldIn, pos, new ItemStack(this.getItem()));
|
||||||
}
|
}
|
||||||
|
@ -288,7 +289,7 @@ public class BlockLeaves extends BlockLeavesBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) {
|
||||||
return this.getState().withProperty(DECAY, false).withProperty(BUSH, true);
|
return this.getState().withProperty(DECAY, false).withProperty(BUSH, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.util.HitPosition;
|
import common.util.HitPosition;
|
||||||
|
@ -37,7 +37,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
||||||
this.setTab(CheatTab.PLANTS);
|
this.setTab(CheatTab.PLANTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
public void getCollisionBoxes(World worldIn, LocalPos pos, State state, BoundingBox mask, List<BoundingBox> list, Entity collidingEntity)
|
||||||
{
|
{
|
||||||
if (collidingEntity == null || !(collidingEntity instanceof EntityBoat))
|
if (collidingEntity == null || !(collidingEntity instanceof EntityBoat))
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
return new BoundingBox((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
||||||
return ground.getMaterial().isColdLiquid() && ground instanceof BlockStaticLiquid;
|
return ground.getMaterial().isColdLiquid() && ground instanceof BlockStaticLiquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
public boolean canBlockStay(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
||||||
return new Property[] {FACING};
|
return new Property[] {FACING};
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
||||||
{
|
{
|
||||||
if (movingobjectposition.type == HitPosition.ObjectType.BLOCK)
|
if (movingobjectposition.type == HitPosition.ObjectType.BLOCK)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = movingobjectposition.block;
|
LocalPos blockpos = movingobjectposition.block;
|
||||||
|
|
||||||
if (!World.isValidXZ(blockpos))
|
if (!World.isValidXZ(blockpos))
|
||||||
{
|
{
|
||||||
|
@ -115,7 +115,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos1 = blockpos.up();
|
LocalPos blockpos1 = blockpos.up();
|
||||||
State iblockstate = worldIn.getState(blockpos);
|
State iblockstate = worldIn.getState(blockpos);
|
||||||
|
|
||||||
if (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1))
|
if (iblockstate.getBlock().getMaterial().isColdLiquid() && ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue() == 0 && worldIn.isAirBlock(blockpos1))
|
||||||
|
|
|
@ -9,7 +9,7 @@ import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.model.ModelRotation;
|
import common.model.ModelRotation;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -27,14 +27,14 @@ public class BlockLog extends BlockRotatedPillar
|
||||||
this.setFlammable(5, 5);
|
this.setFlammable(5, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRemoved(AWorldServer worldIn, BlockPos pos, State state)
|
public void onRemoved(AWorldServer worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
int r = 4;
|
int r = 4;
|
||||||
int l = r + 1;
|
int l = r + 1;
|
||||||
|
|
||||||
if (worldIn.isAreaLoaded(pos.add(-l, -l, -l), pos.add(l, l, l)))
|
if (worldIn.isAreaLoaded(pos.add(-l, -l, -l), pos.add(l, l, l)))
|
||||||
{
|
{
|
||||||
for (BlockPos bpos : BlockPos.getAllInBox(pos.add(-r, -r, -r), pos.add(r, r, r)))
|
for (LocalPos bpos : LocalPos.area(pos.add(-r, -r, -r), pos.add(r, r, r)))
|
||||||
{
|
{
|
||||||
State blk = worldIn.getState(bpos);
|
State blk = worldIn.getState(bpos);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ public class BlockLog extends BlockRotatedPillar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
public State getPlacedState(World worldIn, LocalPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer)
|
||||||
{
|
{
|
||||||
return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis());
|
return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(AXIS, facing.getAxis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,8 @@ import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.model.GuiPosition;
|
import common.model.GuiPosition;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
|
import common.util.MutablePos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -21,14 +22,14 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
||||||
this.setTicked();
|
this.setTicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if (Vars.shroomGrowth > 0 && rand.chance(Vars.shroomGrowth))
|
if (Vars.shroomGrowth > 0 && rand.chance(Vars.shroomGrowth))
|
||||||
{
|
{
|
||||||
int i = 5;
|
int i = 5;
|
||||||
int j = 4;
|
int j = 4;
|
||||||
|
|
||||||
for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-4, -1, -4), pos.add(4, 1, 4)))
|
for (LocalPos blockpos : MutablePos.mutableArea(pos.add(-4, -1, -4), pos.add(4, 1, 4)))
|
||||||
{
|
{
|
||||||
if (worldIn.getState(blockpos).getBlock() == this)
|
if (worldIn.getState(blockpos).getBlock() == this)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +42,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1);
|
LocalPos blockpos1 = pos.add(rand.zrange(3) - 1, rand.zrange(2) - rand.zrange(2), rand.zrange(3) - 1);
|
||||||
|
|
||||||
for (int k = 0; k < 4; ++k)
|
for (int k = 0; k < 4; ++k)
|
||||||
{
|
{
|
||||||
|
@ -60,7 +61,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState());
|
return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState());
|
||||||
}
|
}
|
||||||
|
@ -73,7 +74,7 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
||||||
return ground.isFullBlock();
|
return ground.isFullBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state)
|
public boolean canBlockStay(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
if (pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y)
|
||||||
{
|
{
|
||||||
|
@ -89,17 +90,17 @@ public class BlockMushroom extends BlockBush implements IGrowable
|
||||||
/**
|
/**
|
||||||
* Whether this IGrowable can grow
|
* Whether this IGrowable can grow
|
||||||
*/
|
*/
|
||||||
public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient)
|
public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state)
|
public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return (double)rand.floatv() < 0.4D;
|
return (double)rand.floatv() < 0.4D;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
worldIn.generateBigMushroom(pos, state, rand);
|
worldIn.generateBigMushroom(pos, state, rand);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyBool;
|
import common.properties.PropertyBool;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.ParticleType;
|
import common.util.ParticleType;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.IWorldAccess;
|
import common.world.IWorldAccess;
|
||||||
|
@ -34,13 +34,13 @@ public class BlockMycelium extends Block
|
||||||
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
* Get the actual Block state of this Block at the given position. This applies properties not visible in the
|
||||||
* metadata, such as fence connections.
|
* metadata, such as fence connections.
|
||||||
*/
|
*/
|
||||||
public State getState(State state, IWorldAccess worldIn, BlockPos pos)
|
public State getState(State state, IWorldAccess worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = worldIn.getState(pos.up()).getBlock();
|
Block block = worldIn.getState(pos.up()).getBlock();
|
||||||
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
|
return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
// if (!worldIn.client)
|
// if (!worldIn.client)
|
||||||
// {
|
// {
|
||||||
|
@ -53,7 +53,7 @@ public class BlockMycelium extends Block
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i)
|
for (int i = 0; i < 4; ++i)
|
||||||
{
|
{
|
||||||
BlockPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
|
LocalPos blockpos = pos.add(rand.zrange(3) - 1, rand.zrange(5) - 3, rand.zrange(3) - 1);
|
||||||
State iblockstate = worldIn.getState(blockpos);
|
State iblockstate = worldIn.getState(blockpos);
|
||||||
Block block = worldIn.getState(blockpos.up()).getBlock();
|
Block block = worldIn.getState(blockpos.up()).getBlock();
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ public class BlockMycelium extends Block
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void displayTick(World worldIn, BlockPos pos, State state, Random rand)
|
public void displayTick(World worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
super.displayTick(worldIn, pos, state, rand);
|
super.displayTick(worldIn, pos, state, rand);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import common.item.Item;
|
||||||
import common.item.ItemStack;
|
import common.item.ItemStack;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ public class BlockPotato extends BlockCrops
|
||||||
/**
|
/**
|
||||||
* Spawns this Block's drops into the World as EntityItems.
|
* Spawns this Block's drops into the World as EntityItems.
|
||||||
*/
|
*/
|
||||||
public void drop(World worldIn, BlockPos pos, State state, int fortune)
|
public void drop(World worldIn, LocalPos pos, State state, int fortune)
|
||||||
{
|
{
|
||||||
super.drop(worldIn, pos, state, fortune);
|
super.drop(worldIn, pos, state, fortune);
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import common.block.Material;
|
||||||
import common.item.CheatTab;
|
import common.item.CheatTab;
|
||||||
import common.model.Model;
|
import common.model.Model;
|
||||||
import common.model.Model.ModelProvider;
|
import common.model.Model.ModelProvider;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ public class BlockPumpkin extends Block {
|
||||||
this.setTab(CheatTab.PLANTS);
|
this.setTab(CheatTab.PLANTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World world, BlockPos pos) {
|
public boolean canPlace(World world, LocalPos pos) {
|
||||||
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyInteger;
|
import common.properties.PropertyInteger;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.util.BoundingBox;
|
import common.util.BoundingBox;
|
||||||
import common.util.Facing;
|
import common.util.Facing;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
|
@ -31,7 +31,7 @@ public class BlockReed extends Block
|
||||||
this.setTicked();
|
this.setTicked();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if(Vars.reedDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
if(Vars.reedDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
||||||
{
|
{
|
||||||
|
@ -67,7 +67,7 @@ public class BlockReed extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlace(World worldIn, BlockPos pos)
|
public boolean canPlace(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
Block block = worldIn.getState(pos.down()).getBlock();
|
Block block = worldIn.getState(pos.down()).getBlock();
|
||||||
|
|
||||||
|
@ -96,12 +96,12 @@ public class BlockReed extends Block
|
||||||
/**
|
/**
|
||||||
* Called when a neighboring block changes.
|
* Called when a neighboring block changes.
|
||||||
*/
|
*/
|
||||||
public void onUpdate(AWorldServer worldIn, BlockPos pos, State state, Block neighborBlock)
|
public void onUpdate(AWorldServer worldIn, LocalPos pos, State state, Block neighborBlock)
|
||||||
{
|
{
|
||||||
this.checkForDrop(worldIn, pos, state);
|
this.checkForDrop(worldIn, pos, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected final boolean checkForDrop(World worldIn, BlockPos pos, State state)
|
protected final boolean checkForDrop(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
if (this.canBlockStay(worldIn, pos))
|
if (this.canBlockStay(worldIn, pos))
|
||||||
{
|
{
|
||||||
|
@ -115,12 +115,12 @@ public class BlockReed extends Block
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos)
|
public boolean canBlockStay(World worldIn, LocalPos pos)
|
||||||
{
|
{
|
||||||
return this.canPlace(worldIn, pos);
|
return this.canPlace(worldIn, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state)
|
public BoundingBox getCollisionBox(World worldIn, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ import common.model.GuiPosition;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyInteger;
|
import common.properties.PropertyInteger;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -51,7 +51,7 @@ public class BlockSapling extends BlockBush implements IGrowable
|
||||||
// return I18n.translate(this.getUnlocalizedName() + "." + BlockPlanks.EnumType.OAK.getUnlocalizedName() + ".name");
|
// return I18n.translate(this.getUnlocalizedName() + "." + BlockPlanks.EnumType.OAK.getUnlocalizedName() + ".name");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if(Vars.saplingDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
if(Vars.saplingDry && worldIn.getTemperatureC(pos) >= 50.0f)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ public class BlockSapling extends BlockBush implements IGrowable
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grow(AWorldServer worldIn, BlockPos pos, State state, Random rand)
|
public void grow(AWorldServer worldIn, LocalPos pos, State state, Random rand)
|
||||||
{
|
{
|
||||||
if (((Integer)state.getValue(STAGE)).intValue() == 0)
|
if (((Integer)state.getValue(STAGE)).intValue() == 0)
|
||||||
{
|
{
|
||||||
|
@ -105,17 +105,17 @@ public class BlockSapling extends BlockBush implements IGrowable
|
||||||
/**
|
/**
|
||||||
* Whether this IGrowable can grow
|
* Whether this IGrowable can grow
|
||||||
*/
|
*/
|
||||||
public boolean canGrow(World worldIn, BlockPos pos, State state, boolean isClient)
|
public boolean canGrow(World worldIn, LocalPos pos, State state, boolean isClient)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, State state)
|
public boolean canUseBonemeal(World worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
return (double)worldIn.rand.floatv() < 0.45D;
|
return (double)worldIn.rand.floatv() < 0.45D;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state)
|
public void grow(AWorldServer worldIn, Random rand, LocalPos pos, State state)
|
||||||
{
|
{
|
||||||
this.grow(worldIn, pos, state, rand);
|
this.grow(worldIn, pos, state, rand);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import common.model.Model.ModelProvider;
|
||||||
import common.properties.Property;
|
import common.properties.Property;
|
||||||
import common.properties.PropertyInteger;
|
import common.properties.PropertyInteger;
|
||||||
import common.rng.Random;
|
import common.rng.Random;
|
||||||
import common.util.BlockPos;
|
import common.util.LocalPos;
|
||||||
import common.vars.Vars;
|
import common.vars.Vars;
|
||||||
import common.world.State;
|
import common.world.State;
|
||||||
import common.world.World;
|
import common.world.World;
|
||||||
|
@ -33,11 +33,11 @@ public class BlockSoulGrass extends BlockBush {
|
||||||
return ground == Blocks.soul_sand;
|
return ground == Blocks.soul_sand;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canBlockStay(World worldIn, BlockPos pos, State state) {
|
public boolean canBlockStay(World worldIn, LocalPos pos, State state) {
|
||||||
return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) {
|
public void tick(AWorldServer worldIn, LocalPos pos, State state, Random rand) {
|
||||||
if(Vars.soulGrassGrowth > 0) {
|
if(Vars.soulGrassGrowth > 0) {
|
||||||
int i = ((Integer)state.getValue(AGE)).intValue();
|
int i = ((Integer)state.getValue(AGE)).intValue();
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ public class BlockSoulGrass extends BlockBush {
|
||||||
super.tick(worldIn, pos, state, rand);
|
super.tick(worldIn, pos, state, rand);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drop(World worldIn, BlockPos pos, State state, int fortune) {
|
public void drop(World worldIn, LocalPos pos, State state, int fortune) {
|
||||||
if(!worldIn.client) {
|
if(!worldIn.client) {
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue