From 828d215048a0aedf65a115f855a78a8e70695068 Mon Sep 17 00:00:00 2001 From: Sen Date: Sun, 20 Jul 2025 14:20:55 +0200 Subject: [PATCH] block base class cleanup --- client/src/main/java/client/Client.java | 2 +- .../java/client/renderer/BlockRenderer.java | 68 +- .../java/client/renderer/EffectRenderer.java | 6 +- .../java/client/renderer/EntityRenderer.java | 2 +- .../java/client/renderer/RenderGlobal.java | 18 +- .../renderer/blockmodel/ModelBakery.java | 2 +- .../client/renderer/chunk/RenderChunk.java | 16 +- .../renderer/entity/RenderBlockEntity.java | 2 +- .../renderer/entity/RenderFallingBlock.java | 39 +- .../client/renderer/entity/RenderItem.java | 100 +- .../renderer/entity/RenderMinecart.java | 2 +- .../renderer/entity/RenderTntMinecart.java | 2 +- .../renderer/entity/RenderTntPrimed.java | 4 +- .../client/renderer/layers/LayerHeldItem.java | 9 - ...yChestRenderer.java => ChestRenderer.java} | 8 +- ...playRenderer.java => DisplayRenderer.java} | 6 +- ...itySignRenderer.java => SignRenderer.java} | 16 +- .../TileEntityItemStackRenderer.java | 108 -- .../TileEntityRendererDispatcher.java | 161 +-- .../tileentity/TileEntitySpecialRenderer.java | 60 - .../renderer/tileentity/TileRenderer.java | 30 + .../java/client/util/PlayerController.java | 16 +- .../main/java/client/world/WorldClient.java | 4 +- .../common/ai/EntityAIControlledByPlayer.java | 2 +- .../java/common/ai/EntityAITakePlace.java | 2 +- common/src/main/java/common/block/Block.java | 1012 ++++++++--------- .../src/main/java/common/block/BlockAir.java | 8 +- .../main/java/common/block/BlockFalling.java | 6 +- .../java/common/block/BlockTranslucent.java | 4 +- .../common/block/artificial/BlockBed.java | 24 +- .../block/artificial/BlockBookshelf.java | 4 +- .../common/block/artificial/BlockCake.java | 24 +- .../common/block/artificial/BlockCarpet.java | 16 +- .../common/block/artificial/BlockDoor.java | 44 +- .../block/artificial/BlockDragonEgg.java | 12 +- .../common/block/artificial/BlockFence.java | 16 +- .../block/artificial/BlockFenceGate.java | 18 +- .../block/artificial/BlockFloorPortal.java | 16 +- .../block/artificial/BlockFlowerPot.java | 22 +- .../common/block/artificial/BlockGlass.java | 6 +- .../common/block/artificial/BlockHay.java | 4 +- .../common/block/artificial/BlockLadder.java | 25 +- .../block/artificial/BlockMetalBlock.java | 6 +- .../common/block/artificial/BlockPane.java | 31 +- .../common/block/artificial/BlockPortal.java | 14 +- .../block/artificial/BlockPortalFrame.java | 26 +- .../block/artificial/BlockQuartzPillar.java | 2 +- .../common/block/artificial/BlockSkull.java | 4 +- .../common/block/artificial/BlockSlab.java | 32 +- .../common/block/artificial/BlockStairs.java | 96 +- .../block/artificial/BlockTrapDoor.java | 26 +- .../common/block/artificial/BlockWall.java | 18 +- .../block/foliage/BlockBlackenedSoil.java | 8 +- .../common/block/foliage/BlockBlueShroom.java | 8 +- .../java/common/block/foliage/BlockBush.java | 17 +- .../common/block/foliage/BlockCactus.java | 18 +- .../java/common/block/foliage/BlockCrops.java | 18 +- .../common/block/foliage/BlockDeadBush.java | 10 +- .../block/foliage/BlockDoublePlant.java | 43 +- .../common/block/foliage/BlockDryLeaves.java | 8 +- .../common/block/foliage/BlockFarmland.java | 24 +- .../common/block/foliage/BlockFlower.java | 4 +- .../java/common/block/foliage/BlockGrass.java | 17 +- .../block/foliage/BlockHugeMushroom.java | 6 +- .../common/block/foliage/BlockLeaves.java | 37 +- .../common/block/foliage/BlockLilyPad.java | 14 +- .../java/common/block/foliage/BlockLog.java | 8 +- .../java/common/block/foliage/BlockMelon.java | 8 +- .../common/block/foliage/BlockMushroom.java | 8 +- .../common/block/foliage/BlockMycelium.java | 16 +- .../common/block/foliage/BlockPotato.java | 6 +- .../common/block/foliage/BlockPumpkin.java | 2 +- .../java/common/block/foliage/BlockReed.java | 16 +- .../common/block/foliage/BlockSapling.java | 4 +- .../java/common/block/foliage/BlockStem.java | 16 +- .../common/block/foliage/BlockTallGrass.java | 24 +- .../common/block/foliage/BlockTianSoil.java | 8 +- .../java/common/block/foliage/BlockVine.java | 42 +- .../java/common/block/foliage/BlockWart.java | 12 +- .../block/liquid/BlockDynamicLiquid.java | 6 +- .../java/common/block/liquid/BlockLiquid.java | 24 +- .../block/liquid/BlockStaticLiquid.java | 4 +- .../common/block/natural/BlockBedrock.java | 2 +- .../block/natural/BlockBlackenedDirt.java | 4 +- .../block/natural/BlockBlackenedStone.java | 2 +- .../java/common/block/natural/BlockClay.java | 4 +- .../java/common/block/natural/BlockFire.java | 36 +- .../common/block/natural/BlockGlowstone.java | 8 +- .../common/block/natural/BlockGravel.java | 6 +- .../java/common/block/natural/BlockIce.java | 16 +- .../common/block/natural/BlockMetalOre.java | 6 +- .../common/block/natural/BlockObsidian.java | 2 +- .../java/common/block/natural/BlockOre.java | 24 +- .../common/block/natural/BlockPackedIce.java | 4 +- .../common/block/natural/BlockPodzol.java | 6 +- .../java/common/block/natural/BlockSlime.java | 14 +- .../java/common/block/natural/BlockSnow.java | 42 +- .../common/block/natural/BlockSnowBlock.java | 10 +- .../common/block/natural/BlockSoulSand.java | 4 +- .../java/common/block/natural/BlockStone.java | 2 +- .../java/common/block/natural/BlockWeb.java | 7 +- .../common/block/tech/BlockActiveDisplay.java | 8 +- .../java/common/block/tech/BlockAnvil.java | 14 +- .../block/tech/BlockBasePressurePlate.java | 28 +- .../common/block/tech/BlockBrewingStand.java | 18 +- .../java/common/block/tech/BlockButton.java | 38 +- .../java/common/block/tech/BlockCauldron.java | 25 +- .../java/common/block/tech/BlockChest.java | 12 +- .../java/common/block/tech/BlockCore.java | 4 +- .../common/block/tech/BlockDispenser.java | 14 +- .../java/common/block/tech/BlockDisplay.java | 18 +- .../block/tech/BlockEnchantmentTable.java | 4 +- .../java/common/block/tech/BlockFurnace.java | 14 +- .../java/common/block/tech/BlockHopper.java | 24 +- .../block/tech/BlockInactiveDisplay.java | 2 +- .../java/common/block/tech/BlockLever.java | 25 +- .../java/common/block/tech/BlockLitTorch.java | 8 +- .../java/common/block/tech/BlockMachine.java | 12 +- .../java/common/block/tech/BlockNuke.java | 4 +- .../common/block/tech/BlockPistonBase.java | 32 +- .../common/block/tech/BlockPistonHead.java | 28 +- .../java/common/block/tech/BlockRail.java | 23 +- .../main/java/common/block/tech/BlockTNT.java | 16 +- .../block/tech/BlockToggleableLight.java | 8 +- .../java/common/block/tech/BlockTorch.java | 19 +- .../java/common/block/tech/BlockTripWire.java | 34 +- .../common/block/tech/BlockTripWireHook.java | 39 +- .../common/block/tech/BlockUnlitTorch.java | 4 +- .../common/block/tech/BlockWarpChest.java | 10 +- .../java/common/block/tech/BlockWire.java | 8 +- .../common/block/tech/BlockWorkbench.java | 2 +- .../java/common/block/tile/BlockSign.java | 14 +- .../common/block/tile/BlockStandingSign.java | 10 +- .../java/common/block/tile/BlockWallSign.java | 8 +- .../src/main/java/common/entity/Entity.java | 16 +- .../common/entity/animal/EntityHorse.java | 6 +- .../common/entity/effect/EntityLightning.java | 2 +- .../java/common/entity/item/EntityItem.java | 2 +- .../java/common/entity/item/EntityXp.java | 2 +- .../common/entity/npc/EntityFlyingNPC.java | 4 +- .../common/entity/projectile/EntityArrow.java | 6 +- .../common/entity/types/EntityLiving.java | 6 +- .../main/java/common/init/BlockRegistry.java | 320 +++--- common/src/main/java/common/item/Item.java | 6 +- .../java/common/item/material/ItemDye.java | 2 +- .../main/java/common/item/tool/ItemFire.java | 2 +- .../main/java/common/item/tool/ItemHoe.java | 4 +- .../main/java/common/item/tool/ItemTool.java | 2 +- .../java/common/item/weapon/ItemSword.java | 2 +- .../main/java/common/world/BlockArray.java | 8 +- common/src/main/java/common/world/Chunk.java | 8 +- .../src/main/java/common/world/Explosion.java | 12 +- common/src/main/java/common/world/World.java | 34 +- .../src/main/java/server/network/Player.java | 18 +- .../java/server/world/NextTickListEntry.java | 2 +- .../main/java/server/world/WorldServer.java | 39 +- .../worldgen/foliage/FeatureDoublePlant.java | 2 +- .../worldgen/foliage/WorldGenMelon.java | 2 +- .../worldgen/foliage/WorldGenPumpkin.java | 2 +- .../worldgen/foliage/WorldGenVines.java | 2 +- .../worldgen/foliage/WorldGenWaterlily.java | 2 +- 161 files changed, 1832 insertions(+), 2044 deletions(-) rename client/src/main/java/client/renderer/tileentity/{TileEntityChestRenderer.java => ChestRenderer.java} (92%) rename client/src/main/java/client/renderer/tileentity/{TileEntityDisplayRenderer.java => DisplayRenderer.java} (95%) rename client/src/main/java/client/renderer/tileentity/{TileEntitySignRenderer.java => SignRenderer.java} (91%) delete mode 100755 client/src/main/java/client/renderer/tileentity/TileEntityItemStackRenderer.java delete mode 100755 client/src/main/java/client/renderer/tileentity/TileEntitySpecialRenderer.java create mode 100755 client/src/main/java/client/renderer/tileentity/TileRenderer.java diff --git a/client/src/main/java/client/Client.java b/client/src/main/java/client/Client.java index b9e63626..a71cfc8c 100755 --- a/client/src/main/java/client/Client.java +++ b/client/src/main/java/client/Client.java @@ -1809,7 +1809,7 @@ public class Client implements IThreadListener { State block = this.world.getState(pos); if(!this.debugWorld) { - block = block.getBlock().getActualState(block, this.world, pos); + block = block.getBlock().getState(block, this.world, pos); } StringBuilder str = new StringBuilder( diff --git a/client/src/main/java/client/renderer/BlockRenderer.java b/client/src/main/java/client/renderer/BlockRenderer.java index df5c9d6f..4c3d10d6 100755 --- a/client/src/main/java/client/renderer/BlockRenderer.java +++ b/client/src/main/java/client/renderer/BlockRenderer.java @@ -13,7 +13,6 @@ import client.renderer.blockmodel.IBakedModel; import client.renderer.blockmodel.ModelManager; import client.renderer.texture.TextureAtlasSprite; import client.renderer.texture.TextureMap; -import client.renderer.tileentity.TileEntityItemStackRenderer; import common.block.Block; import common.block.Material; import common.block.liquid.BlockDynamicLiquid; @@ -21,7 +20,6 @@ import common.block.liquid.BlockLiquid; import common.block.liquid.BlockStaticLiquid; import common.collect.Maps; import common.init.BlockRegistry; -import common.item.ItemStack; import common.util.BlockPos; import common.util.ExtMath; import common.util.Facing; @@ -52,11 +50,9 @@ public class BlockRenderer public void renderBlockDamage(State state, BlockPos pos, TextureAtlasSprite texture, IWorldAccess blockAccess) { Block block = state.getBlock(); - int i = block.getRenderType(); - - if (i == 3) + if (block.getRenderType() == 3) { - state = block.getActualState(state, blockAccess, pos); + state = block.getState(state, blockAccess, pos); IBakedModel ibakedmodel = this.manager.getModelForState(state); IBakedModel ibakedmodel1 = (new BakedModel.Builder(ibakedmodel, texture)).makeBakedModel(); // Tessellator.getInstance(); @@ -81,9 +77,6 @@ public class BlockRenderer case 1: return this.renderFluid(blockAccess, state, pos, worldRendererIn); - case 2: - return false; - case 3: IBakedModel ibakedmodel = this.getModelFromBlockState(state, blockAccess, pos); return this.renderBase(blockAccess, ibakedmodel, state, pos, worldRendererIn, !this.gm.xrayActive); @@ -102,7 +95,7 @@ public class BlockRenderer { try { - state = block.getActualState(state, worldIn, pos); + state = block.getState(state, worldIn, pos); } catch (Exception var6) { @@ -120,29 +113,12 @@ public class BlockRenderer // return ibakedmodel; } - public void renderBlockBrightness(State state, float brightness) + public void renderBlockEntity(State state, float brightness) { - int i = state.getBlock().getRenderType(); - - if (i != -1) + if (state.getBlock().getRenderType() == 3) { - switch (i) - { - case 1: - default: - break; - - case 2: -// this.chestRenderer.renderChestBrightness(state.getBlock(), brightness); - GlState.color(brightness, brightness, brightness, 1.0F); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - TileEntityItemStackRenderer.instance.renderByItem(new ItemStack(state.getBlock().getItem())); - break; - - case 3: - IBakedModel ibakedmodel = this.manager.getModelForState(state); - this.renderModelBrightness(ibakedmodel, state, brightness, true); - } + IBakedModel model = this.manager.getModelForState(state); + this.renderModelBrightness(model, state, brightness, true); } } @@ -167,14 +143,14 @@ public class BlockRenderer private boolean renderBase(IWorldAccess blockAccessIn, IBakedModel modelIn, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn, boolean checkSides) { Block block = blockStateIn.getBlock(); - block.setBlockBoundsBasedOnState(blockAccessIn, blockPosIn); + block.setBlockBounds(blockAccessIn, blockPosIn); return this.renderModel(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn, checkSides); } private boolean renderModel(IWorldAccess blockAccessIn, IBakedModel modelIn, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn) { Block block = blockStateIn.getBlock(); - block.setBlockBoundsBasedOnState(blockAccessIn, blockPosIn); + block.setBlockBounds(blockAccessIn, blockPosIn); return this.renderModel(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn, true); } @@ -197,9 +173,9 @@ public class BlockRenderer { BlockPos blockpos = blockPosIn.offset(enumfacing); - if (!checkSides || blockIn.shouldSideBeRendered(blockAccessIn, blockpos, enumfacing)) + if (!checkSides || blockIn.canRender(blockAccessIn, blockpos, enumfacing)) { - int i = blockIn.getMixedBrightnessForBlock(blockAccessIn, blockpos); + int i = blockIn.getLightmapValue(blockAccessIn, blockpos); this.renderModelStandardQuads(blockAccessIn, blockIn, blockPosIn, enumfacing, i, false, worldRendererIn, list, bitset); flag = true; } @@ -318,7 +294,7 @@ public class BlockRenderer if (ownBrightness) { this.fillQuadBounds(blockIn, bakedquad.getVertexData(), bakedquad.getFace(), (float[])null, boundsFlags); - brightnessIn = boundsFlags.get(0) ? blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : blockIn.getMixedBrightnessForBlock(blockAccessIn, blockPosIn); + brightnessIn = boundsFlags.get(0) ? blockIn.getLightmapValue(blockAccessIn, blockPosIn.offset(bakedquad.getFace())) : blockIn.getLightmapValue(blockAccessIn, blockPosIn); } worldRendererIn.addVertexData(bakedquad.getVertexData()); @@ -359,9 +335,9 @@ public class BlockRenderer private void renderModelBrightness(IBakedModel model, State p_178266_2_, float brightness, boolean p_178266_4_) { Block block = p_178266_2_.getBlock(); - block.setBlockBoundsForItemRender(); + block.setItemBounds(); GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - int i = block.getRenderColor(block.getStateForEntityRender(p_178266_2_)); + int i = block.getRenderColor(block.getEntityState(p_178266_2_)); // if (EntityRenderer.anaglyphEnable) // { @@ -419,15 +395,15 @@ public class BlockRenderer private boolean renderFluid(IWorldAccess blockAccess, State blockStateIn, BlockPos blockPosIn, RenderBuffer worldRendererIn) { BlockLiquid blockliquid = (BlockLiquid)blockStateIn.getBlock(); - blockliquid.setBlockBoundsBasedOnState(blockAccess, blockPosIn); + blockliquid.setBlockBounds(blockAccess, blockPosIn); TextureAtlasSprite[] atextureatlassprite = this.fluids.get(blockliquid); - int i = blockliquid.colorMultiplier(blockAccess, blockPosIn); + int i = blockliquid.colorMultiplier(blockAccess, blockPosIn, 0); float f = (float)(i >> 16 & 255) / 255.0F; float f1 = (float)(i >> 8 & 255) / 255.0F; float f2 = (float)(i & 255) / 255.0F; - boolean flag = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.up(), Facing.UP); - boolean flag1 = blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.down(), Facing.DOWN); - boolean[] aboolean = new boolean[] {blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.north(), Facing.NORTH), blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.south(), Facing.SOUTH), blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.west(), Facing.WEST), blockliquid.shouldSideBeRendered(blockAccess, blockPosIn.east(), Facing.EAST)}; + boolean flag = blockliquid.canRender(blockAccess, blockPosIn.up(), Facing.UP); + boolean flag1 = blockliquid.canRender(blockAccess, blockPosIn.down(), Facing.DOWN); + boolean[] aboolean = new boolean[] {blockliquid.canRender(blockAccess, blockPosIn.north(), Facing.NORTH), blockliquid.canRender(blockAccess, blockPosIn.south(), Facing.SOUTH), blockliquid.canRender(blockAccess, blockPosIn.west(), Facing.WEST), blockliquid.canRender(blockAccess, blockPosIn.east(), Facing.EAST)}; if (!flag && !flag1 && !aboolean[0] && !aboolean[1] && !aboolean[2] && !aboolean[3]) { @@ -500,7 +476,7 @@ public class BlockRenderer f20 = textureatlassprite.getInterpolatedV((double)(8.0F + (-f22 - f21) * 16.0F)); } - int k2 = blockliquid.getMixedBrightnessForBlock(blockAccess, blockPosIn); + int k2 = blockliquid.getLightmapValue(blockAccess, blockPosIn); int l2 = k2 >> 16 & 65535; int i3 = k2 & 65535; float f24 = f4 * f; @@ -526,7 +502,7 @@ public class BlockRenderer float f36 = atextureatlassprite[0].getMaxU(); float f37 = atextureatlassprite[0].getMinV(); float f38 = atextureatlassprite[0].getMaxV(); - int l1 = blockliquid.getMixedBrightnessForBlock(blockAccess, blockPosIn.down()); + int l1 = blockliquid.getLightmapValue(blockAccess, blockPosIn.down()); int i2 = l1 >> 16 & 65535; int j2 = l1 & 65535; worldRendererIn.pos(d0, d1, d2 + 1.0D).color(f3, f3, f3, 1.0F).tex((double)f35, (double)f38).lightmap(i2, j2).endVertex(); @@ -616,7 +592,7 @@ public class BlockRenderer float f28 = textureatlassprite1.getInterpolatedV((double)((1.0F - f39) * 16.0F * 0.5F)); float f29 = textureatlassprite1.getInterpolatedV((double)((1.0F - f40) * 16.0F * 0.5F)); float f30 = textureatlassprite1.getInterpolatedV(8.0D); - int j = blockliquid.getMixedBrightnessForBlock(blockAccess, blockpos); + int j = blockliquid.getLightmapValue(blockAccess, blockpos); int k = j >> 16 & 65535; int l = j & 65535; float f31 = i1 < 2 ? f5 : f6; diff --git a/client/src/main/java/client/renderer/EffectRenderer.java b/client/src/main/java/client/renderer/EffectRenderer.java index 87c4ee5f..123beef7 100755 --- a/client/src/main/java/client/renderer/EffectRenderer.java +++ b/client/src/main/java/client/renderer/EffectRenderer.java @@ -255,7 +255,7 @@ public class EffectRenderer { BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ); State iblockstate = world.getState(blockpos); Block block = iblockstate.getBlock(); - block.setBlockBoundsBasedOnState(world, blockpos); + block.setBlockBounds(world, blockpos); Material material = iblockstate.getBlock().getMaterial(); if(material.isLiquid() || material.isSolid()) { @@ -720,7 +720,7 @@ public class EffectRenderer { Block block = state.getBlock(); if(block == Blocks.grass) return; - int color = pos == null ? block.getRenderColor(state) : block.colorMultiplier(world, pos); + int color = pos == null ? block.getRenderColor(state) : block.colorMultiplier(world, pos, 0); this.red *= (float)(color >> 16 & 255) / 255.0F; this.green *= (float)(color >> 8 & 255) / 255.0F; this.blue *= (float)(color & 255) / 255.0F; @@ -1080,7 +1080,7 @@ public class EffectRenderer { public void destroyBlock(BlockPos pos, State state) { if(state.getBlock() != Blocks.air) { - state = state.getBlock().getActualState(state, this.world, pos); + state = state.getBlock().getState(state, this.world, pos); int i = 4; for(int j = 0; j < i; ++j) { diff --git a/client/src/main/java/client/renderer/EntityRenderer.java b/client/src/main/java/client/renderer/EntityRenderer.java index bf574fca..4663864b 100755 --- a/client/src/main/java/client/renderer/EntityRenderer.java +++ b/client/src/main/java/client/renderer/EntityRenderer.java @@ -1166,7 +1166,7 @@ public class EntityRenderer { } else if (block != Blocks.air) { - block.setBlockBoundsBasedOnState(world, blockpos2); + block.setBlockBounds(world, blockpos2); ++j; if (this.random.zrange(j) == 0) diff --git a/client/src/main/java/client/renderer/RenderGlobal.java b/client/src/main/java/client/renderer/RenderGlobal.java index 2e7c28c7..28ad9f82 100755 --- a/client/src/main/java/client/renderer/RenderGlobal.java +++ b/client/src/main/java/client/renderer/RenderGlobal.java @@ -495,7 +495,7 @@ public class RenderGlobal double d0 = renderViewEntity.prevX + (renderViewEntity.posX - renderViewEntity.prevX) * (double)partialTicks; double d1 = renderViewEntity.prevY + (renderViewEntity.posY - renderViewEntity.prevY) * (double)partialTicks; double d2 = renderViewEntity.prevZ + (renderViewEntity.posZ - renderViewEntity.prevZ) * (double)partialTicks; - TileEntityRendererDispatcher.instance.cacheActiveRenderInfo(this.theWorld, this.gm.getTextureManager(), this.gm.getRenderViewEntity(), partialTicks); + TileEntityRendererDispatcher.instance.setPosition(this.theWorld, this.gm.getTextureManager(), this.gm.getRenderViewEntity(), partialTicks); this.renderManager.cacheActiveRenderInfo(this.theWorld, this.gm.getRenderViewEntity(), this.gm.getPointedEntity(), this.gm, partialTicks); this.countEntitiesTotal = 0; this.countEntitiesRendered = 0; @@ -504,9 +504,9 @@ public class RenderGlobal double d3 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; double d4 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; double d5 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; - TileEntityRendererDispatcher.staticPlayerX = d3; - TileEntityRendererDispatcher.staticPlayerY = d4; - TileEntityRendererDispatcher.staticPlayerZ = d5; + TileEntityRendererDispatcher.entityX = d3; + TileEntityRendererDispatcher.entityY = d4; + TileEntityRendererDispatcher.entityZ = d5; this.renderManager.setRenderPosition(d3, d4, d5); this.gm.entityRenderer.enableLightmap(); List list = this.theWorld.getLoadedEntityList(); @@ -661,7 +661,7 @@ public class RenderGlobal { for (TileEntity tileentity2 : list1) { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity2, partialTicks, -1); + TileEntityRendererDispatcher.instance.renderTile(tileentity2, partialTicks, -1); } } } @@ -670,7 +670,7 @@ public class RenderGlobal { for (TileEntity tileentity : this.setTileEntities) { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1); + TileEntityRendererDispatcher.instance.renderTile(tileentity, partialTicks, -1); } } @@ -684,7 +684,7 @@ public class RenderGlobal if (tileentity1 != null && (block instanceof BlockChest || block instanceof BlockSign)) { - TileEntityRendererDispatcher.instance.renderTileEntity(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); + TileEntityRendererDispatcher.instance.renderTile(tileentity1, partialTicks, destroyblockprogress.getPartialBlockDamage()); } } @@ -1613,11 +1613,11 @@ public class RenderGlobal if (block != Blocks.air) // && this.theWorld.getWorldBorder().contains(blockpos)) { - block.setBlockBoundsBasedOnState(this.theWorld, blockpos); + block.setBlockBounds(this.theWorld, blockpos); double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks; double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks; double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks; - drawSelectionBoundingBox(block.getSelectedBoundingBox(this.theWorld, blockpos).expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D).offset(-d0, -d1, -d2)); + drawSelectionBoundingBox(block.getSelectionBox(this.theWorld, blockpos).expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D).offset(-d0, -d1, -d2)); } GlState.depthMask(true); diff --git a/client/src/main/java/client/renderer/blockmodel/ModelBakery.java b/client/src/main/java/client/renderer/blockmodel/ModelBakery.java index 71b7b693..0433e5aa 100755 --- a/client/src/main/java/client/renderer/blockmodel/ModelBakery.java +++ b/client/src/main/java/client/renderer/blockmodel/ModelBakery.java @@ -219,7 +219,7 @@ public abstract class ModelBakery return new ModelBlock(MODEL_ENTITY, Transform.IDENTITY); State state = block == null ? null : block.getItemState(); if(state != null) - return state.getBlock().hasBlockFlatTexture() ? new ModelBlock(state.getBlock().getTransform(), "blocks/" + name) : new ModelBlock((ModelBlock)state.getBlock().getModel(provider, BlockRegistry.getName(state.getBlock()), state), state.getBlock().getTransform()); + return new ModelBlock((ModelBlock)state.getBlock().getModel(provider, BlockRegistry.getName(state.getBlock()), state), state.getBlock().getTransform()); return new ModelBlock(Transform.IDENTITY, item.getTextures(name)); } diff --git a/client/src/main/java/client/renderer/chunk/RenderChunk.java b/client/src/main/java/client/renderer/chunk/RenderChunk.java index cd311095..5c276083 100755 --- a/client/src/main/java/client/renderer/chunk/RenderChunk.java +++ b/client/src/main/java/client/renderer/chunk/RenderChunk.java @@ -18,7 +18,7 @@ import client.renderer.RenderBuffer; import client.renderer.RenderGlobal; import client.renderer.VertexBuffer; import client.renderer.tileentity.TileEntityRendererDispatcher; -import client.renderer.tileentity.TileEntitySpecialRenderer; +import client.renderer.tileentity.TileRenderer; import client.world.WorldClient; import common.block.Block; import common.block.ITileEntityProvider; @@ -136,7 +136,7 @@ public class RenderChunk } VisGraph lvt_10_1_ = new VisGraph(); - HashSet lvt_11_1_ = Sets.newHashSet(); + HashSet forced = Sets.newHashSet(); if (!iblockaccess.isEmpty()) { @@ -157,15 +157,15 @@ public class RenderChunk if (block instanceof ITileEntityProvider) { TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos)); - TileEntitySpecialRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getSpecialRenderer(tileentity); + TileRenderer tileentityspecialrenderer = TileEntityRendererDispatcher.instance.getRenderer(tileentity); if (tileentity != null && tileentityspecialrenderer != null) { compiledchunk.addTileEntity(tileentity); - if (tileentityspecialrenderer.forceTileEntityRender()) + if (tileentityspecialrenderer.isAlwaysRendered()) { - lvt_11_1_.add(tileentity); + forced.add(tileentity); } } } @@ -206,12 +206,12 @@ public class RenderChunk try { - Set set = Sets.newHashSet(lvt_11_1_); + Set set = Sets.newHashSet(forced); Set set1 = Sets.newHashSet(this.setTileEntities); set.removeAll(this.setTileEntities); - set1.removeAll(lvt_11_1_); + set1.removeAll(forced); this.setTileEntities.clear(); - this.setTileEntities.addAll(lvt_11_1_); + this.setTileEntities.addAll(forced); this.renderGlobal.updateTileEntities(set1, set); } finally diff --git a/client/src/main/java/client/renderer/entity/RenderBlockEntity.java b/client/src/main/java/client/renderer/entity/RenderBlockEntity.java index 064c2099..60a4f397 100755 --- a/client/src/main/java/client/renderer/entity/RenderBlockEntity.java +++ b/client/src/main/java/client/renderer/entity/RenderBlockEntity.java @@ -45,7 +45,7 @@ public class RenderBlockEntity extends Render // float f2 = (1.0F - ((float)entity.fuse - partialTicks + 1.0F) / 100.0F) * 0.8F; this.bindEntityTexture(entity); GL11.glTranslatef(-0.5F, -0.5F, 0.5F); - blockrendererdispatcher.renderBlockBrightness(state, entity.getBrightness(partialTicks)); + blockrendererdispatcher.renderBlockEntity(state, entity.getBrightness(partialTicks)); GL11.glTranslatef(0.0F, 0.0F, 1.0F); // if (entity.fuse / 5 % 2 == 0) diff --git a/client/src/main/java/client/renderer/entity/RenderFallingBlock.java b/client/src/main/java/client/renderer/entity/RenderFallingBlock.java index 4583e519..efad9b45 100755 --- a/client/src/main/java/client/renderer/entity/RenderFallingBlock.java +++ b/client/src/main/java/client/renderer/entity/RenderFallingBlock.java @@ -37,29 +37,26 @@ public class RenderFallingBlock extends Render BlockPos blockpos = new BlockPos(entity); World world = entity.getWorldObj(); - if (iblockstate != world.getState(blockpos) && block.getRenderType() != -1) + if (iblockstate != world.getState(blockpos) && block.getRenderType() == 3) { - if (block.getRenderType() == 3) - { - GL11.glPushMatrix(); - GL11.glTranslatef((float)x, (float)y, (float)z); - GlState.disableLighting(); + GL11.glPushMatrix(); + GL11.glTranslatef((float)x, (float)y, (float)z); + GlState.disableLighting(); // Tessellator tessellator = Tessellator.getInstance(); - RenderBuffer worldrenderer = Tessellator.getBuffer(); - worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - int i = blockpos.getX(); - int j = blockpos.getY(); - int k = blockpos.getZ(); - worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F)); - BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher(); - IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null); - blockrendererdispatcher.renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false); - worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); - Tessellator.draw(); - GlState.enableLighting(); - GL11.glPopMatrix(); - super.doRender(entity, x, y, z, partialTicks); - } + RenderBuffer worldrenderer = Tessellator.getBuffer(); + worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); + int i = blockpos.getX(); + int j = blockpos.getY(); + int k = blockpos.getZ(); + worldrenderer.setTranslation((double)((float)(-i) - 0.5F), (double)(-j), (double)((float)(-k) - 0.5F)); + BlockRenderer blockrendererdispatcher = Client.CLIENT.getBlockRendererDispatcher(); + IBakedModel ibakedmodel = blockrendererdispatcher.getModelFromBlockState(iblockstate, world, (BlockPos)null); + blockrendererdispatcher.renderModel(world, ibakedmodel, iblockstate, blockpos, worldrenderer, false); + worldrenderer.setTranslation(0.0D, 0.0D, 0.0D); + Tessellator.draw(); + GlState.enableLighting(); + GL11.glPopMatrix(); + super.doRender(entity, x, y, z, partialTicks); } } } diff --git a/client/src/main/java/client/renderer/entity/RenderItem.java b/client/src/main/java/client/renderer/entity/RenderItem.java index 4d2dcb3f..679718ad 100755 --- a/client/src/main/java/client/renderer/entity/RenderItem.java +++ b/client/src/main/java/client/renderer/entity/RenderItem.java @@ -4,6 +4,7 @@ import java.util.List; import org.lwjgl.opengl.GL11; +import client.Client; import client.renderer.DefaultVertexFormats; import client.renderer.GlState; import client.renderer.ItemModelMesher; @@ -12,17 +13,26 @@ import client.renderer.Tessellator; import client.renderer.blockmodel.BakedQuad; import client.renderer.blockmodel.IBakedModel; import client.renderer.blockmodel.ModelManager; +import client.renderer.layers.LayerArmor; +import client.renderer.model.ModelHorse; import client.renderer.texture.TextureManager; import client.renderer.texture.TextureMap; -import client.renderer.tileentity.TileEntityItemStackRenderer; +import client.renderer.tileentity.TileEntityRendererDispatcher; +import common.block.tech.BlockChest; +import common.block.tile.BlockStandingSign; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; import common.item.Item; import common.item.ItemStack; import common.item.WieldType; +import common.item.material.ItemArmor; +import common.item.material.ItemHorseArmor; import common.model.Transform; +import common.tileentity.TileEntityChest; +import common.tileentity.TileEntitySign; import common.util.Facing; import common.util.Vec3i; +import common.world.State; public class RenderItem { @@ -30,7 +40,34 @@ public class RenderItem private final ItemModelMesher mesher; private final TextureManager manager; + private final TileEntityChest chest = new TileEntityChest(0) { + public boolean hasWorldObj() { + return true; + } + + public State getBlockState() { + return RenderItem.this.state; + } + }; + private final TileEntitySign sign = new TileEntitySign() { + public boolean hasWorldObj() { + return true; + } + + public State getBlockState() { + return RenderItem.this.state; + } + }; + private final LayerArmor armor = new LayerArmor(null, 12, 12) { + public ItemStack getCurrentArmor(EntityLiving entitylivingbaseIn, int armorSlot) { + return ((ItemArmor)RenderItem.this.stack.getItem()).armorType.getIndex() == armorSlot ? RenderItem.this.stack : null; + } + }; + private final ModelHorse horse = new ModelHorse(); + + private State state; + private ItemStack stack; public float zLevel; public RenderItem(TextureManager textureManager, ModelManager modelManager) @@ -81,7 +118,7 @@ public class RenderItem GL11.glTranslatef(-0.5F, -0.5F, -0.5F); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); GlState.enableRescaleNormal(); - TileEntityItemStackRenderer.instance.renderByItem(stack); + this.renderBuiltin(stack); } else { @@ -98,6 +135,63 @@ public class RenderItem } } + private void renderBuiltin(ItemStack stack) { + if(stack.getItem().getBlock() instanceof BlockChest chest) { + this.state = chest.getState().withProperty(BlockChest.FACING, Facing.SOUTH); + TileEntityRendererDispatcher.instance.renderItem(this.chest, 0.0D, 0.0D, 0.0D, 0.0F); + this.state = null; + } + else if(stack.getItem().getBlock() instanceof BlockStandingSign sign) { + this.state = sign.getState().withProperty(BlockStandingSign.ROTATION, 8); + TileEntityRendererDispatcher.instance.renderItem(this.sign, 0.0D, 0.0D, 0.0D, 0.0F); + this.state = null; + } + else if(stack.getItem() instanceof ItemArmor armor) { + this.stack = stack; + GL11.glPushMatrix(); + float offset = 0.0f; + switch(armor.armorType) { + case HEAD: + offset = -0.15f; + break; + case BODY: + offset = 0.45f; + break; + case LEGS: + offset = 1.35f; + break; + case FEET: + offset = 1.7f; + break; + } + GL11.glTranslatef(1.0f, offset, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL11.glScalef(1.4f, -1.4f, 1.4f); + boolean cull = GlState.isCullEnabled(); + if(cull) + GlState.disableCull(); + this.armor.doRenderLayer(null, 0.0f, 0.0f, 0.0f, 0, 0, 0.0f, 0.0625F); + if(cull) + GlState.enableCull(); + GL11.glPopMatrix(); + this.stack = null; + } + else if(stack.getItem() instanceof ItemHorseArmor horseArmor) { + GL11.glPushMatrix(); + GL11.glTranslatef(0.9f, 0.5f, 0.0f); + GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); + GL11.glScalef(0.85f, -0.85f, 0.85f); + boolean cull = GlState.isCullEnabled(); + if(cull) + GlState.disableCull(); + this.manager.bindTexture("textures/armor/" + horseArmor.getArmorTexture() + "_horse.png"); + this.horse.render(null, 0, 0, 0, 0, 0, 0.0625F); + if(cull) + GlState.enableCull(); + GL11.glPopMatrix(); + } + } + private void renderEffect(IBakedModel model) { GlState.depthMask(false); @@ -213,7 +307,7 @@ public class RenderItem } } - protected void renderItemModelTransform(ItemStack stack, IBakedModel model, boolean transform, boolean third) + private void renderItemModelTransform(ItemStack stack, IBakedModel model, boolean transform, boolean third) { this.manager.bindTexture(TextureMap.BLOCKS); this.preTransform(stack); diff --git a/client/src/main/java/client/renderer/entity/RenderMinecart.java b/client/src/main/java/client/renderer/entity/RenderMinecart.java index 02a765c9..c5e604ed 100755 --- a/client/src/main/java/client/renderer/entity/RenderMinecart.java +++ b/client/src/main/java/client/renderer/entity/RenderMinecart.java @@ -123,7 +123,7 @@ public class RenderMinecart extends Render protected void func_180560_a(T minecart, float partialTicks, State state) { GL11.glPushMatrix(); - Client.CLIENT.getBlockRendererDispatcher().renderBlockBrightness(state, minecart.getBrightness(partialTicks)); + Client.CLIENT.getBlockRendererDispatcher().renderBlockEntity(state, minecart.getBrightness(partialTicks)); GL11.glPopMatrix(); } } diff --git a/client/src/main/java/client/renderer/entity/RenderTntMinecart.java b/client/src/main/java/client/renderer/entity/RenderTntMinecart.java index 9e48e448..84da4f0b 100755 --- a/client/src/main/java/client/renderer/entity/RenderTntMinecart.java +++ b/client/src/main/java/client/renderer/entity/RenderTntMinecart.java @@ -42,7 +42,7 @@ public class RenderTntMinecart extends RenderMinecart GlState.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_DST_ALPHA); GlState.color(1.0F, 1.0F, 1.0F, (1.0F - ((float)i - partialTicks + 1.0F) / 100.0F) * 0.8F); GL11.glPushMatrix(); - blockrendererdispatcher.renderBlockBrightness(Blocks.tnt.getState(), 1.0F); + blockrendererdispatcher.renderBlockEntity(Blocks.tnt.getState(), 1.0F); GL11.glPopMatrix(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); GlState.disableBlend(); diff --git a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java index e606e5ea..07fcd41d 100755 --- a/client/src/main/java/client/renderer/entity/RenderTntPrimed.java +++ b/client/src/main/java/client/renderer/entity/RenderTntPrimed.java @@ -39,7 +39,7 @@ public class RenderTntPrimed extends Render this.bindEntityTexture(entity); GL11.glTranslatef(-0.5F, -0.5F, 0.5F); Block tnt = BlockRegistry.byName("tnt" + (entity.explosionSize <= 0 || entity.explosionSize >= 8 ? "" : "_" + entity.explosionSize)); - blockrendererdispatcher.renderBlockBrightness(tnt.getState(), entity.getBrightness(partialTicks)); + blockrendererdispatcher.renderBlockEntity(tnt.getState(), entity.getBrightness(partialTicks)); GL11.glTranslatef(0.0F, 0.0F, 1.0F); if (entity.fuse / 5 % 2 == 0) @@ -51,7 +51,7 @@ public class RenderTntPrimed extends Render GlState.color(1.0F, 1.0F, 1.0F, f2); GlState.doPolygonOffset(-3.0F, -3.0F); GlState.enablePolygonOffset(); - blockrendererdispatcher.renderBlockBrightness(tnt.getState(), 1.0F); + blockrendererdispatcher.renderBlockEntity(tnt.getState(), 1.0F); GlState.doPolygonOffset(0.0F, 0.0F); GlState.disablePolygonOffset(); GlState.color(1.0F, 1.0F, 1.0F, 1.0F); diff --git a/client/src/main/java/client/renderer/layers/LayerHeldItem.java b/client/src/main/java/client/renderer/layers/LayerHeldItem.java index 2af5b8d2..18545f22 100755 --- a/client/src/main/java/client/renderer/layers/LayerHeldItem.java +++ b/client/src/main/java/client/renderer/layers/LayerHeldItem.java @@ -54,15 +54,6 @@ public class LayerHeldItem implements LayerRenderer Item item = itemstack.getItem(); Client gm = Client.CLIENT; - if (item.getBlock() != null && item.getBlock().getRenderType() == 2) - { - GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); - GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - float f1 = 0.375F; - GL11.glScalef(-f1, -f1, f1); - } - if (entitylivingbaseIn.isSneakingVisually()) { GL11.glTranslatef(0.0F, 0.203125F, 0.0F); diff --git a/client/src/main/java/client/renderer/tileentity/TileEntityChestRenderer.java b/client/src/main/java/client/renderer/tileentity/ChestRenderer.java similarity index 92% rename from client/src/main/java/client/renderer/tileentity/TileEntityChestRenderer.java rename to client/src/main/java/client/renderer/tileentity/ChestRenderer.java index 0ec7bed5..0f2e9eff 100755 --- a/client/src/main/java/client/renderer/tileentity/TileEntityChestRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/ChestRenderer.java @@ -11,9 +11,13 @@ import common.tileentity.TileEntityChest; import common.world.State; -public class TileEntityChestRenderer extends TileEntitySpecialRenderer +public class ChestRenderer extends TileRenderer { - private final ModelChest model = new ModelChest(); + private final ModelChest model = new ModelChest(); + + public ChestRenderer(TileEntityRendererDispatcher renderer) { + super(renderer); + } public void renderTileEntityAt(TileEntityChest te, double x, double y, double z, float partialTicks, int destroyStage) { diff --git a/client/src/main/java/client/renderer/tileentity/TileEntityDisplayRenderer.java b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java similarity index 95% rename from client/src/main/java/client/renderer/tileentity/TileEntityDisplayRenderer.java rename to client/src/main/java/client/renderer/tileentity/DisplayRenderer.java index 1a0c1976..395236a3 100644 --- a/client/src/main/java/client/renderer/tileentity/TileEntityDisplayRenderer.java +++ b/client/src/main/java/client/renderer/tileentity/DisplayRenderer.java @@ -17,7 +17,7 @@ import common.util.BlockPos; import common.util.Facing; import common.world.State; -public class TileEntityDisplayRenderer extends TileEntitySpecialRenderer { +public class DisplayRenderer extends TileRenderer { private static class TimedTexture { public long time; public long updated; @@ -78,6 +78,10 @@ public class TileEntityDisplayRenderer extends TileEntitySpecialRenderer +public class SignRenderer extends TileRenderer { private static final String SIGN_TEXTURE = "textures/blocks/sign.png"; - /** The ModelSign instance for use in this renderer */ private final ModelSign model = new ModelSign(); + + public SignRenderer(TileEntityRendererDispatcher renderer) { + super(renderer); + } public void renderTileEntityAt(TileEntitySign te, double x, double y, double z, float partialTicks, int destroyStage) { @@ -122,13 +125,4 @@ public class TileEntitySignRenderer extends TileEntitySpecialRenderer , TileEntitySpecialRenderer > mapSpecialRenderers = Maps. < Class , TileEntitySpecialRenderer > newHashMap(); - public static TileEntityRendererDispatcher instance = new TileEntityRendererDispatcher(); -// private FontRenderer fontRenderer; +public class TileEntityRendererDispatcher { + public static TileEntityRendererDispatcher instance = new TileEntityRendererDispatcher(); + public static double entityX; // TODO: useless, duplicate render view entity position? + public static double entityY; + public static double entityZ; - /** The player's current X position (same as playerX) */ - public static double staticPlayerX; + private final Map, TileRenderer> renderers = Maps., TileRenderer>newHashMap(); - /** The player's current Y position (same as playerY) */ - public static double staticPlayerY; + public TextureManager manager; + private WorldClient world; + private double posX; + private double posY; + private double posZ; - /** The player's current Z position (same as playerZ) */ - public static double staticPlayerZ; - public TextureManager renderEngine; - public World worldObj; - public Entity entity; - public float entityYaw; - public float entityPitch; - public double entityX; - public double entityY; - public double entityZ; - -// public static void setChristmas(boolean xmas) { -// ((TileEntityChestRenderer)instance.mapSpecialRenderers.get(TileEntityChest.class)).setChristmas(xmas); -// } + private TileEntityRendererDispatcher() { + this.renderers.put(TileEntitySign.class, new SignRenderer(this)); + this.renderers.put(TileEntityDisplay.class, new DisplayRenderer(this)); + this.renderers.put(TileEntityChest.class, new ChestRenderer(this)); + } - private TileEntityRendererDispatcher() - { - this.mapSpecialRenderers.put(TileEntitySign.class, new TileEntitySignRenderer()); - this.mapSpecialRenderers.put(TileEntityDisplay.class, new TileEntityDisplayRenderer()); - this.mapSpecialRenderers.put(TileEntityChest.class, new TileEntityChestRenderer()); + private TileRenderer getRenderer(Class clazz) { + TileRenderer renderer = (TileRenderer)this.renderers.get(clazz); + if(renderer == null && clazz != TileEntity.class) { + renderer = this.getRenderer((Class)clazz.getSuperclass()); + this.renderers.put(clazz, renderer); + } + return (TileRenderer)renderer; + } - for (TileEntitySpecialRenderer tileentityspecialrenderer : this.mapSpecialRenderers.values()) - { - tileentityspecialrenderer.setRendererDispatcher(this); - } - } + public TileRenderer getRenderer(TileEntity tile) { + return (TileRenderer)(tile == null ? null : this.getRenderer(tile.getClass())); + } - public TileEntitySpecialRenderer getSpecialRendererByClass(Class teClass) - { - TileEntitySpecialRenderer tileentityspecialrenderer = (TileEntitySpecialRenderer)this.mapSpecialRenderers.get(teClass); + public void setPosition(WorldClient world, TextureManager manager, Entity entity, float partial) { + this.world = world; + this.manager = manager; + this.posX = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partial; + this.posY = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partial; + this.posZ = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partial; + } - if (tileentityspecialrenderer == null && teClass != TileEntity.class) - { - tileentityspecialrenderer = this.getSpecialRendererByClass((Class )teClass.getSuperclass()); - this.mapSpecialRenderers.put(teClass, tileentityspecialrenderer); - } + public void renderTile(TileEntity tile, float partial, int destroy) { + if(tile.getDistanceSq(this.posX, this.posY, this.posZ) < tile.getMaxRenderDistanceSquared()) { + int light = this.world.getCombinedLight(tile.getPos(), 0); + int block = light % 65536; + int sky = light / 65536; + GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)block / 1.0F, (float)sky / 1.0F); + GlState.color(1.0F, 1.0F, 1.0F, 1.0F); + BlockPos pos = tile.getPos(); + this.render(tile, (double)pos.getX() - entityX, (double)pos.getY() - entityY, (double)pos.getZ() - entityZ, partial, destroy); + } + } - return (TileEntitySpecialRenderer)tileentityspecialrenderer; - } + public void renderItem(TileEntity tile, double x, double y, double z, float partial) { + this.render(tile, x, y, z, partial, -1); + } - public TileEntitySpecialRenderer getSpecialRenderer(TileEntity tileEntityIn) - { - return (TileEntitySpecialRenderer)(tileEntityIn == null ? null : this.getSpecialRendererByClass(tileEntityIn.getClass())); - } - - public void cacheActiveRenderInfo(World worldIn, TextureManager textureManagerIn, Entity entityIn, float partialTicks) - { - if (this.worldObj != worldIn) - { - this.setWorld(worldIn); - } - - this.renderEngine = textureManagerIn; - this.entity = entityIn; -// this.fontRenderer = fontrendererIn; - this.entityYaw = entityIn.prevYaw + (entityIn.rotYaw - entityIn.prevYaw) * partialTicks; - this.entityPitch = entityIn.prevPitch + (entityIn.rotPitch - entityIn.prevPitch) * partialTicks; - this.entityX = entityIn.lastTickPosX + (entityIn.posX - entityIn.lastTickPosX) * (double)partialTicks; - this.entityY = entityIn.lastTickPosY + (entityIn.posY - entityIn.lastTickPosY) * (double)partialTicks; - this.entityZ = entityIn.lastTickPosZ + (entityIn.posZ - entityIn.lastTickPosZ) * (double)partialTicks; - } - - public void renderTileEntity(TileEntity tileentityIn, float partialTicks, int destroyStage) - { - if (tileentityIn.getDistanceSq(this.entityX, this.entityY, this.entityZ) < tileentityIn.getMaxRenderDistanceSquared()) - { - int i = this.worldObj.getCombinedLight(tileentityIn.getPos(), 0); - int j = i % 65536; - int k = i / 65536; - GL13.glMultiTexCoord2f(GL13.GL_TEXTURE1, (float)j / 1.0F, (float)k / 1.0F); - GlState.color(1.0F, 1.0F, 1.0F, 1.0F); - BlockPos blockpos = tileentityIn.getPos(); - this.renderTileEntityAt(tileentityIn, (double)blockpos.getX() - staticPlayerX, (double)blockpos.getY() - staticPlayerY, (double)blockpos.getZ() - staticPlayerZ, partialTicks, destroyStage); - } - } - - /** - * Render this TileEntity at a given set of coordinates - */ - public void renderTileEntityAt(TileEntity tileEntityIn, double x, double y, double z, float partialTicks) - { - this.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, -1); - } - - public void renderTileEntityAt(TileEntity tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) - { - TileEntitySpecialRenderer tileentityspecialrenderer = this.getSpecialRenderer(tileEntityIn); - - if (tileentityspecialrenderer != null) - { - tileentityspecialrenderer.renderTileEntityAt(tileEntityIn, x, y, z, partialTicks, destroyStage); - } - } - - public void setWorld(World worldIn) - { - this.worldObj = worldIn; - } - -// public FontRenderer getFontRenderer() -// { -// return this.fontRenderer; -// } + private void render(TileEntity tile, double x, double y, double z, float partial, int destroy) { + TileRenderer renderer = this.getRenderer(tile); + if(renderer != null) + renderer.renderTileEntityAt(tile, x, y, z, partial, destroy); + } } diff --git a/client/src/main/java/client/renderer/tileentity/TileEntitySpecialRenderer.java b/client/src/main/java/client/renderer/tileentity/TileEntitySpecialRenderer.java deleted file mode 100755 index fa30d2ff..00000000 --- a/client/src/main/java/client/renderer/tileentity/TileEntitySpecialRenderer.java +++ /dev/null @@ -1,60 +0,0 @@ -package client.renderer.tileentity; - -import client.renderer.texture.TextureManager; -import common.tileentity.TileEntity; -import common.world.World; - -public abstract class TileEntitySpecialRenderer -{ - protected static final String[] DESTROY_STAGES = new String[] { - "textures/blocks/destroy_stage_0.png", - "textures/blocks/destroy_stage_1.png", - "textures/blocks/destroy_stage_2.png", - "textures/blocks/destroy_stage_3.png", - "textures/blocks/destroy_stage_4.png", - "textures/blocks/destroy_stage_5.png", - "textures/blocks/destroy_stage_6.png", - "textures/blocks/destroy_stage_7.png", - "textures/blocks/destroy_stage_8.png", - "textures/blocks/destroy_stage_9.png" - }; - - protected TileEntityRendererDispatcher rendererDispatcher; - - public abstract void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage); - - protected void bindTexture(String location) - { - TextureManager texturemanager = this.rendererDispatcher.renderEngine; - - if (texturemanager != null) - { - texturemanager.bindTexture(location); - } - } - - protected World getWorld() - { - return this.rendererDispatcher.worldObj; - } - - public void setRendererDispatcher(TileEntityRendererDispatcher rendererDispatcherIn) - { - this.rendererDispatcher = rendererDispatcherIn; - } - -// public FontRenderer getFontRenderer() -// { -// return this.rendererDispatcher.getFontRenderer(); -// } - - /** - * If true the {@link TileEntitySpecialRenderer} will always be rendered while the player is in the render bounding - * box {@link TileEntity#getRenderBoundingBox()} and his squared distance with the {@link TileEntity} is smaller - * than {@link TileEntity#getMaxRenderDistanceSquared()}. - */ - public boolean forceTileEntityRender() - { - return false; - } -} diff --git a/client/src/main/java/client/renderer/tileentity/TileRenderer.java b/client/src/main/java/client/renderer/tileentity/TileRenderer.java new file mode 100755 index 00000000..ffd719a3 --- /dev/null +++ b/client/src/main/java/client/renderer/tileentity/TileRenderer.java @@ -0,0 +1,30 @@ +package client.renderer.tileentity; + +import client.renderer.texture.TextureManager; +import common.tileentity.TileEntity; + +public abstract class TileRenderer { + protected static final String[] DESTROY_STAGES = new String[] { + "textures/blocks/destroy_stage_0.png", "textures/blocks/destroy_stage_1.png", "textures/blocks/destroy_stage_2.png", "textures/blocks/destroy_stage_3.png", + "textures/blocks/destroy_stage_4.png", "textures/blocks/destroy_stage_5.png", "textures/blocks/destroy_stage_6.png", "textures/blocks/destroy_stage_7.png", + "textures/blocks/destroy_stage_8.png", "textures/blocks/destroy_stage_9.png" + }; + + private final TileEntityRendererDispatcher renderer; + + public TileRenderer(TileEntityRendererDispatcher renderer) { + this.renderer = renderer; + } + + public abstract void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage); + + protected final void bindTexture(String location) { + TextureManager manager = this.renderer.manager; + if(manager != null) + manager.bindTexture(location); + } + + public boolean isAlwaysRendered() { + return false; + } +} diff --git a/client/src/main/java/client/util/PlayerController.java b/client/src/main/java/client/util/PlayerController.java index c6655db1..ad98b1fa 100755 --- a/client/src/main/java/client/util/PlayerController.java +++ b/client/src/main/java/client/util/PlayerController.java @@ -59,7 +59,7 @@ public class PlayerController { boolean flag = world.setBlockToAir(pos); if(flag) { - block.onBlockDestroyedByPlayer(world, pos, state); + block.onBroken(world, pos, state); } this.position = new BlockPos(this.position.getX(), -1, this.position.getZ()); @@ -101,10 +101,10 @@ public class PlayerController { boolean flag = block != Blocks.air; if(flag && this.damage == 0.0F) { - block.onBlockClicked(this.gm.world, pos, this.gm.player); + block.onStartBreak(this.gm.world, pos, this.gm.player); } - if(flag && block.getPlayerRelativeBlockHardness(this.gm.player, this.gm.player.worldObj, pos) >= 1.0F) { + if(flag && block.getHardness(this.gm.player, this.gm.player.worldObj, pos) >= 1.0F) { this.destroyBlock(pos, face); this.delay = 3; } @@ -152,10 +152,10 @@ public class PlayerController { return false; } else { - this.damage += block.getPlayerRelativeBlockHardness(this.gm.player, this.gm.player.worldObj, pos); + this.damage += block.getHardness(this.gm.player, this.gm.player.worldObj, pos); - if(this.stepCounter % 4.0F == 0.0F && block.sound.getStepSound() != null) { - this.gm.getSoundManager().playSound(new PositionedSound(block.sound.getStepSound(), 0.25F, + if(this.stepCounter % 4.0F == 0.0F && block.getSound().getStepSound() != null) { + this.gm.getSoundManager().playSound(new PositionedSound(block.getSound().getStepSound(), 0.25F, (float)pos.getX() + 0.5F, (float)pos.getY() + 0.5F, (float)pos.getZ() + 0.5F)); } @@ -228,11 +228,11 @@ public class PlayerController { State iblockstate = world.getState(pos); if((!player.isSneaking() || player.getHeldItem() == null) - && iblockstate.getBlock().onBlockActivated(world, pos, iblockstate, player, side, f, f1, f2)) { + && iblockstate.getBlock().onUse(world, pos, iblockstate, player, side, f, f1, f2)) { flag = true; } - if(!flag && stack != null && stack.getItem().getBlock() != null && !stack.getItem().getBlock().canPlace(world, pos, side, player, stack)) + if(!flag && stack != null && stack.getItem().getBlock() != null && !stack.getItem().getBlock().checkPlace(world, pos, side, player, stack)) return false; } else { diff --git a/client/src/main/java/client/world/WorldClient.java b/client/src/main/java/client/world/WorldClient.java index 14d278fd..cecb5d72 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -312,7 +312,7 @@ public class WorldClient extends AWorldClient int z = posZ + rand.zrange(DISPLAY_RANGE) - rand.zrange(DISPLAY_RANGE); pos.set(x, y, z); State state = this.getState(pos); - state.getBlock().randomDisplayTick(this, pos, state, rand); + state.getBlock().displayTick(this, pos, state, rand); } if(this.dimension.hasVoidFog() && this.gm.voidParticles && posY < 32) { for(int n = 0; n < 1000; n++) { @@ -634,7 +634,7 @@ public class WorldClient extends AWorldClient if (state != null && state.getBlock() != Blocks.air) { - this.gm.getSoundManager().playSound(new PositionedSound(state.getBlock().sound.getBreakSound(), 1.0F, /* block.sound.getFrequency() * 0.8F, */ (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F)); + this.gm.getSoundManager().playSound(new PositionedSound(state.getBlock().getSound().getBreakSound(), 1.0F, /* block.sound.getFrequency() * 0.8F, */ (float)blockPosIn.getX() + 0.5F, (float)blockPosIn.getY() + 0.5F, (float)blockPosIn.getZ() + 0.5F)); } if(state != null) this.gm.effectRenderer.destroyBlock(blockPosIn, state); diff --git a/common/src/main/java/common/ai/EntityAIControlledByPlayer.java b/common/src/main/java/common/ai/EntityAIControlledByPlayer.java index e2e52ba4..0cab2f9f 100755 --- a/common/src/main/java/common/ai/EntityAIControlledByPlayer.java +++ b/common/src/main/java/common/ai/EntityAIControlledByPlayer.java @@ -111,7 +111,7 @@ public class EntityAIControlledByPlayer extends EntityAIBase 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().slipperiness * 0.91F; + f2 = this.thisEntity.worldObj.getState(new BlockPos(ExtMath.floorf((float)i), ExtMath.floorf((float)j) - 1, ExtMath.floorf((float)k))).getBlock().getSlipperiness() * 0.91F; } float f3 = 0.16277136F / (f2 * f2 * f2); diff --git a/common/src/main/java/common/ai/EntityAITakePlace.java b/common/src/main/java/common/ai/EntityAITakePlace.java index 82fe9303..c905da94 100755 --- a/common/src/main/java/common/ai/EntityAITakePlace.java +++ b/common/src/main/java/common/ai/EntityAITakePlace.java @@ -77,7 +77,7 @@ public class EntityAITakePlace extends EntityAIBase Block replace = world.getState(blockpos).getBlock(); Block below = world.getState(blockpos.down()).getBlock(); State state = PLACEABLE.get(this.entity.getHeldItem().getItem()); - if (state.getBlock().canPlaceBlockAt(world, blockpos) && replace == Blocks.air && + if (state.getBlock().canPlace(world, blockpos) && replace == Blocks.air && below != Blocks.air && below.isFullCube()) { this.entity.getLookHelper().setLookPosition((double)i + 0.5, (double)j + 0.5, (double)k + 0.5, 10.0F, diff --git a/common/src/main/java/common/block/Block.java b/common/src/main/java/common/block/Block.java index 1c4eac2b..fabfe0fb 100755 --- a/common/src/main/java/common/block/Block.java +++ b/common/src/main/java/common/block/Block.java @@ -24,7 +24,6 @@ import common.collect.Lists; import common.collect.Maps; import common.collect.Sets; import common.collect.UnmodifiableIterator; -import common.color.DyeColor; import common.color.TextColor; import common.enchantment.EnchantmentHelper; import common.entity.Entity; @@ -32,7 +31,6 @@ import common.entity.item.EntityItem; import common.entity.item.EntityXp; import common.entity.npc.EntityNPC; import common.entity.types.EntityLiving; -import common.init.BlockRegistry; import common.init.Blocks; import common.item.CheatTab; import common.item.Item; @@ -172,25 +170,23 @@ public class Block { private final ImmutableList states; private final ImmutableList saved; protected final Material material; - protected final boolean translucent; + private final boolean translucent; - protected boolean fullBlock; - protected boolean sumBrightness; - protected boolean axeHarvest; - protected boolean shovelHarvest; - protected boolean ticked; - private boolean flatBlockTexture; - private boolean itemColored; - protected int lightOpacity; - protected int lightValue; - protected int miningLevel; - protected int shearsEfficiency; - protected int encouragement; - protected int flammability; - protected float blockHardness; - protected float blockResistance; - protected float radiation; - public float slipperiness; + private boolean fullBlock; + private boolean sumBrightness; + private boolean axeHarvest; + private boolean shovelHarvest; + private boolean ticked; + private int opacity; + private int light; + private int miningLevel; + private int shearsEfficiency; + private int encouragement; + private int flammability; + private float hardness; + private float resistance; + private float radiation; + private float slipperiness; protected double minX; protected double minY; protected double minZ; @@ -200,7 +196,7 @@ public class Block { private State defaultState; private String display; private CheatTab tab; - public SoundType sound; + private SoundType sound; private Item item; private static Iterable> cartesianProduct(Iterable> sets) { @@ -318,6 +314,28 @@ public class Block { return ImmutableList.copyOf(list); } + public static void dropItem(World world, BlockPos pos, ItemStack stack) { + if(!world.client && Vars.blockDrop) { + float range = 0.5F; + double x = (double)(world.rand.floatv() * range) + (double)(1.0F - range) * 0.5D; + double y = (double)(world.rand.floatv() * range) + (double)(1.0F - range) * 0.5D; + double z = (double)(world.rand.floatv() * range) + (double)(1.0F - range) * 0.5D; + EntityItem entity = new EntityItem(world, (double)pos.getX() + x, (double)pos.getY() + y, (double)pos.getZ() + z, stack); + entity.setDefaultPickupDelay(); + world.spawnEntityInWorld(entity); + } + } + + public static void dropExperience(World world, BlockPos pos, int amount) { + if(!world.client && Vars.blockXP) { + while(amount > 0) { + int split = EntityXp.getXPSplit(amount); + amount -= split; + world.spawnEntityInWorld(new EntityXp(world, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, split)); + } + } + } + public Block(Material material) { this.miningLevel = (material == Material.SOLID || material == Material.HEAVY) ? 0 : -1; this.axeHarvest = material == Material.WOOD || material == Material.PLANT || material == Material.BUSH || material == Material.SOFT; @@ -327,9 +345,9 @@ public class Block { this.material = material; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); this.fullBlock = this.isOpaqueCube(); - this.lightOpacity = this.isOpaqueCube() ? 255 : 0; + this.opacity = this.isOpaqueCube() ? 255 : 0; this.translucent = !material.blocksLight(); - this.sumBrightness = this.translucent || this.lightOpacity == 0; + this.sumBrightness = this.translucent || this.opacity == 0; this.properties = getPropertyList(this.getProperties()); this.states = getStateList(this.properties, this); this.setDefaultState(this.getBaseState()); @@ -337,124 +355,142 @@ public class Block { this.saved = getStateList(this.savedProps, this.states); } - public Block setStepSound(SoundType sound) { + public final Block setSound(SoundType sound) { this.sound = sound; return this; } - public Block setLightOpacity(int opacity) { - this.lightOpacity = opacity; - this.sumBrightness = this.translucent || this.lightOpacity == 0; + public final Block setOpacity(int opacity) { + this.opacity = opacity; + this.sumBrightness = this.translucent || this.opacity == 0; return this; } - public Block setLightLevel(float value) { - this.lightValue = (int)(15.0F * value); + public final Block setLight(float level) { + this.light = (int)(15.0F * level); return this; } - public Block setResistance(float resistance) { - this.blockResistance = resistance * 3.0F; + public final Block setLight(int level) { + this.light = level; return this; } - public Block setHardness(float hardness) { - this.blockHardness = hardness; - - if(this.blockResistance < hardness * 5.0F) { - this.blockResistance = hardness * 5.0F; - } - + public final Block setResistance(float resistance) { + this.resistance = resistance * 3.0F; return this; } - protected Block setTickRandomly() { + public final Block setHardness(float hardness) { + this.hardness = hardness; + if(this.resistance < hardness * 5.0F) + this.resistance = hardness * 5.0F; + return this; + } + + protected final Block setTicked() { this.ticked = true; return this; } - protected Block setFlatBlockTexture() { -// this.flatBlockTexture = true; - return this; - } - - protected Block setItemColored() { - this.itemColored = true; - return this; - } - - public Block setDisplay(String name) { + public final Block setDisplay(String name) { this.display = name; return this; } - public Block setTab(CheatTab tab) { + public final Block setTab(CheatTab tab) { this.tab = tab; return this; } - public Block setMiningLevel(int level) { + public final Block setMiningLevel(int level) { this.miningLevel = level; return this; } - public Block setAxeHarvestable() { + public final Block setAxeHarvestable() { this.axeHarvest = true; return this; } - public Block setShovelHarvestable() { + public final Block setShovelHarvestable() { this.shovelHarvest = true; return this; } - public Block setShearsEfficiency(int efficiency) { + public final Block setShearsEfficiency(int efficiency) { this.shearsEfficiency = efficiency; return this; } - public Block setRadiation(float value) { - this.radiation = value; - if(value > 0.0f) + public final Block setRadiation(float radiation) { + this.radiation = radiation; + if(radiation > 0.0f) this.ticked = true; return this; } - public Block setFlammable(int encouragement, int flammability) { + public final Block setFlammable(int encouragement, int flammability) { this.encouragement = encouragement; this.flammability = flammability; return this; } - public boolean isFullBlock() { + public final Block setSlipperiness(float slipperiness) { + this.slipperiness = slipperiness; + return this; + } + + + protected final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) { + this.minX = (double)minX; + this.minY = (double)minY; + this.minZ = (double)minZ; + this.maxX = (double)maxX; + this.maxY = (double)maxY; + this.maxZ = (double)maxZ; + } + + public final Item registerItem() { + if(!this.hasRegisteredItem()) + return null; + return this.item = new Item(this); + } + + protected final void setDefaultState(State state) { + this.defaultState = state; + } + + + public final boolean isFullBlock() { return this.fullBlock; } - public int getLightOpacity() { - return this.lightOpacity; + public final int getLightOpacity() { + return this.opacity; } - public boolean isTranslucent() { + public final boolean isTranslucent() { return this.translucent; } - public int getLightValue() { - return this.lightValue; - } - - public boolean getSumBrightness() { - return this.sumBrightness; + public final int getLight() { + return this.light; } public final Material getMaterial() { return this.material; } - public ImmutableList getValidStates() { + public final SoundType getSound() { + return this.sound; + } + + public final ImmutableList getValidStates() { return this.states; } - public ImmutableList getSavedStates() { + public final ImmutableList getSavedStates() { return this.saved; } @@ -462,22 +498,122 @@ public class Block { return this.states.get(0); } - public Collection getSavedProperties() { + public final Collection getSavedProperties() { return this.savedProps; } - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) { - return state; - } - - public boolean isBlockNormalCube() { + public final boolean isBlockingCube() { return this.material.blocksMovement() && this.isFullCube(); } - public boolean isNormalCube() { + public final boolean isNormalCube() { return this.material.isOpaque() && this.isFullCube(); } + public final float getRawHardness() { + return this.hardness; + } + + public final float getRawResistance() { + return this.resistance; + } + + public final boolean isTicked() { + return this.ticked; + } + + public final double getBlockBoundsMinX() { + return this.minX; + } + + public final double getBlockBoundsMaxX() { + return this.maxX; + } + + public final double getBlockBoundsMinY() { + return this.minY; + } + + public final double getBlockBoundsMaxY() { + return this.maxY; + } + + public final double getBlockBoundsMinZ() { + return this.minZ; + } + + public final double getBlockBoundsMaxZ() { + return this.maxZ; + } + + public final float getHardness(EntityNPC player, World world, BlockPos pos) { + float f = this.getHardness(world, pos); + return f < 0.0F ? 0.0F + : (!player.canHarvestBlock(this) ? player.getToolDigEfficiency(this) / f / 100.0F + : player.getToolDigEfficiency(this) / f / 30.0F); + } + + public final State getState() { + return this.defaultState; + } + + public final int getMiningLevel() { + return this.miningLevel; + } + + public final boolean canAxeHarvest() { + return this.axeHarvest; + } + + public final boolean canShovelHarvest() { + return this.shovelHarvest; + } + + public final int getShearsEfficiency() { + return this.shearsEfficiency; + } + + public final float getRadiation() { + return this.radiation; + } + + public final float getSlipperiness() { + return this.slipperiness; + } + + public final int getFlammability() { + return this.flammability; + } + + public final int getEncouragement() { + return this.encouragement; + } + + public final CheatTab getTab() { + return this.tab; + } + + public final String getDisplay() { + return this.display; + } + + + protected Property[] getProperties() { + return new Property[0]; + } + + protected Property[] getUnsavedProperties() { + return new Property[0]; + } + + public State getState(State state, IWorldAccess world, BlockPos pos) { + return state; + } + + public boolean getSumBrightness() { + return this.sumBrightness; + } + public boolean isVisuallyOpaque() { return this.material.blocksMovement() && this.isFullCube(); } @@ -486,154 +622,39 @@ public class Block { return true; } - public boolean isPassable(IBlockAccess worldIn, BlockPos pos) { - return !this.material.blocksMovement(); - } - - public int getRenderType() { - return 3; - } - - public boolean isXrayVisible() { - return false; - } - - public boolean isReplaceable(World worldIn, BlockPos pos) { - return false; - } - - public float getBlockHardness(World worldIn, BlockPos pos) { - return this.blockHardness; - } - - public final float getRawHardness() { - return this.blockHardness; - } - - public final float getRawResistance() { - return this.blockResistance; - } - - public boolean getTickRandomly() { - return this.ticked; - } - - protected final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ) { - this.minX = (double)minX; - this.minY = (double)minY; - this.minZ = (double)minZ; - this.maxX = (double)maxX; - this.maxY = (double)maxY; - this.maxZ = (double)maxZ; - } - - public int getMixedBrightnessForBlock(IWorldAccess worldIn, BlockPos pos) { - Block block = worldIn.getState(pos).getBlock(); - int i = worldIn.getCombinedLight(pos, block.getLightValue()); - - if(i == 0 && block instanceof BlockSlab) { - pos = pos.down(); - block = worldIn.getState(pos).getBlock(); - return worldIn.getCombinedLight(pos, block.getLightValue()); - } - else { - return i; - } - } - - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) { - return side == Facing.DOWN && this.minY > 0.0D ? true - : (side == Facing.UP && this.maxY < 1.0D ? true - : (side == Facing.NORTH && this.minZ > 0.0D ? true - : (side == Facing.SOUTH && this.maxZ < 1.0D ? true - : (side == Facing.WEST && this.minX > 0.0D ? true - : (side == Facing.EAST && this.maxX < 1.0D ? true - : !worldIn.getState(pos).getBlock().isOpaqueCube()))))); - } - - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) { - 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); - } - - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { - BoundingBox axisalignedbb = this.getCollisionBoundingBox(worldIn, pos, state); - - if(axisalignedbb != null && mask.intersectsWith(axisalignedbb)) { - list.add(axisalignedbb); - } - } - - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos 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); - } - public boolean isOpaqueCube() { return true; } - public boolean canCollideCheck(State state, boolean liquid) { - return this.isCollidable(); + public boolean isPassable(IBlockAccess world, BlockPos pos) { + return !this.material.blocksMovement(); } - public boolean isCollidable() { + public boolean canReplace(World world, BlockPos pos) { + return false; + } + + public float getHardness(World world, BlockPos pos) { + return this.hardness; + } + + public void getCollisionBoxes(World world, BlockPos pos, State state, BoundingBox mask, List list, Entity colliding) { + BoundingBox bb = this.getCollisionBox(world, pos, state); + if(bb != null && mask.intersectsWith(bb)) + list.add(bb); + } + + public BoundingBox getCollisionBox(World world, BlockPos 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); + } + + public boolean canRayTrace(State state, boolean liquid) { return true; } - public void randomTick(AWorldServer worldIn, BlockPos pos, State state, Random random) { - this.updateTick(worldIn, pos, state, random); - if(this.radiation > 0.0f) // && /* worldIn.getTime() % 5L == 0L && */ random.chance(Config.randomTick / 3)) - this.affectEntities(worldIn, pos, state, this.radiation * 8.0f * 0.25f); - } - - private void affectEntities(AWorldServer worldIn, BlockPos pos, State state, float rad) { - float r = ExtMath.clampf(rad * 2.0f, 0.0f, 25.0f); - BoundingBox box = this.getCollisionBoundingBox(worldIn, pos, state); - if(box == null) - box = new BoundingBox(pos, pos.add(1, 1, 1)); - for(EntityLiving entity : worldIn.getEntitiesWithinAABB(EntityLiving.class, box.expand(r, r, r))) { - float effect = rad * 2.0f * (r - ExtMath.sqrtf((float)entity.getDistanceSq(pos))) / r; - if(effect > 0.0f) - entity.addRadiation(effect); - } - } - - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - } - - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { - } - - public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state) { - } - - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) { - } - - public int tickRate(World worldIn, BlockPos pos) { - return 10; - } - - public void onBlockAdded(AWorldServer world, BlockPos pos, State state) { - } - - public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) { - } - - public float getPlayerRelativeBlockHardness(EntityNPC playerIn, World worldIn, BlockPos pos) { - float f = this.getBlockHardness(worldIn, pos); - return f < 0.0F ? 0.0F - : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F - : playerIn.getToolDigEfficiency(this) / f / 30.0F); - } - - public float getExplosionResistance(Entity exploder) { - return this.blockResistance / 5.0F; - } - - public HitPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { - this.setBlockBoundsBasedOnState(worldIn, pos); + public HitPosition rayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) { + this.setBlockBounds(world, pos); start = start.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); end = end.addVector((double)(-pos.getX()), (double)(-pos.getY()), (double)(-pos.getZ())); Vec3 vec3 = start.getIntermediateWithXValue(end, this.minX); @@ -643,27 +664,27 @@ public class Block { Vec3 vec34 = start.getIntermediateWithZValue(end, this.minZ); Vec3 vec35 = start.getIntermediateWithZValue(end, this.maxZ); - if(!this.isVecInsideYZBounds(vec3)) { + if(!this.isInsideYZ(vec3)) { vec3 = null; } - if(!this.isVecInsideYZBounds(vec31)) { + if(!this.isInsideYZ(vec31)) { vec31 = null; } - if(!this.isVecInsideXZBounds(vec32)) { + if(!this.isInsideXZ(vec32)) { vec32 = null; } - if(!this.isVecInsideXZBounds(vec33)) { + if(!this.isInsideXZ(vec33)) { vec33 = null; } - if(!this.isVecInsideXYBounds(vec34)) { + if(!this.isInsideXY(vec34)) { vec34 = null; } - if(!this.isVecInsideXYBounds(vec35)) { + if(!this.isInsideXY(vec35)) { vec35 = null; } @@ -727,215 +748,68 @@ public class Block { } } - private boolean isVecInsideYZBounds(Vec3 point) { + private boolean isInsideYZ(Vec3 point) { return point == null ? false : point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ && point.zCoord <= this.maxZ; } - private boolean isVecInsideXZBounds(Vec3 point) { + private boolean isInsideXZ(Vec3 point) { return point == null ? false : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ && point.zCoord <= this.maxZ; } - private boolean isVecInsideXYBounds(Vec3 point) { + private boolean isInsideXY(Vec3 point) { return point == null ? false : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY && point.yCoord <= this.maxY; } - public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState) { + public int tickRate(World world, BlockPos pos) { + return 10; } - public BlockLayer getBlockLayer() { - return BlockLayer.SOLID; + public float getResistance(Entity exploder) { + return this.resistance / 5.0F; } - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side) { - return this.canPlaceBlockAt(worldIn, pos); + public boolean canPlace(World world, BlockPos pos, Facing side) { + return this.canPlace(world, pos); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - return worldIn.getState(pos).getBlock().getMaterial().isReplaceable(); + public boolean canPlace(World world, BlockPos pos) { + return world.getState(pos).getBlock().getMaterial().isReplaceable(); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { - return false; - } - - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) { - } - - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { - return this.getState(); - } - - public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) { - } - - public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) { + public Vec3 getAcceleration(World world, BlockPos pos, Entity entity, Vec3 motion) { return motion; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) { - } - - public final double getBlockBoundsMinX() { - return this.minX; - } - - public final double getBlockBoundsMaxX() { - return this.maxX; - } - - public final double getBlockBoundsMinY() { - return this.minY; - } - - public final double getBlockBoundsMaxY() { - return this.maxY; - } - - public final double getBlockBoundsMinZ() { - return this.minZ; - } - - public final double getBlockBoundsMaxZ() { - return this.maxZ; - } - - public int getRenderColor(State state) { - return 16777215; - } - - public int colorMultiplier(IWorldAccess worldIn, BlockPos pos, int renderPass) { - return 16777215; - } - - public final int colorMultiplier(IWorldAccess worldIn, BlockPos pos) { - return this.colorMultiplier(worldIn, pos, 0); - } - - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) { - } - - public void setBlockBoundsForItemRender() { + public void setBlockBounds(IWorldAccess world, BlockPos pos) { } public boolean canSilkHarvest() { return this.isFullCube() && !(this instanceof ITileEntityProvider); } - public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer) { - } - public boolean canSpawnInBlock() { return !this.material.isSolid() && !this.material.isLiquid(); } - public final String getDisplay() { - return this.display; - } - public int getMobilityFlag() { return this.material.getMobility(); } - public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) { - entityIn.fall(fallDistance, 1.0F); - } - - public void onLanded(World worldIn, Entity entityIn) { - entityIn.motionY = 0.0D; - } - - public CheatTab getTab() { - return this.tab; - } - - public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player) { - } - - public void fillWithRain(World worldIn, BlockPos pos) { - } - - public boolean requiresUpdates() { + public boolean canTick() { return true; } - public boolean canDropFromExplosion(Explosion explosionIn) { + public boolean canDrop(Explosion explosion) { return true; } - public boolean isAssociatedBlock(Block other) { - return this == other; - } - - public static boolean isEqualTo(Block blockIn, Block other) { - return blockIn != null && other != null ? (blockIn == other ? true : blockIn.isAssociatedBlock(other)) : false; - } - - public State getStateForEntityRender(State state) { - return state; - } - - protected Property[] getProperties() { - return new Property[0]; - } - - public Property[] getUnsavedProperties() { - return new Property[0]; - } - - protected final void setDefaultState(State state) { - this.defaultState = state; - } - - public final State getState() { - return this.defaultState; - } - - public int getMiningLevel() { - return this.miningLevel; - } - - public boolean canAxeHarvest() { - return this.axeHarvest; - } - - public boolean canShovelHarvest() { - return this.shovelHarvest; - } - - public int getShearsEfficiency() { - return this.shearsEfficiency; - } - - public float getRadiation() { - return this.radiation; - } - public boolean isMagnetic() { return false; } - public Transform getTransform() { - return Transform.IDENTITY; - } - - public Model getModel(ModelProvider provider, String name, State state) { - return provider.getModel(name).add().all(); - } - - public State getItemState() { - return this.getState(); - } - - public Property[] getIgnoredProperties() { - return null; - } - - public void getAnimatedTextures(Map map) { - } - public boolean canKeepFire() { return false; } @@ -944,208 +818,280 @@ public class Block { return false; } - public void onDestroyedByFire(World world, BlockPos pos, State state) { - } - - public boolean onShot(World world, BlockPos pos, State state, Entity projectile) { - return this.material.blocksMovement(); + public boolean canConnectToWire(State state) { + return false; } - public final int getFlammability() { - return this.flammability; - } - - public final int getEncouragement() { - return this.encouragement; - } - - public String getFallbackTexture() { - return null; - } - - protected boolean hasRegisteredItem() { - return true; - } - - public final Item registerItem() { - if(!this.hasRegisteredItem()) - return null; - return this.item = new Item(this); + public double getResistance(World world, BlockPos pos, State state) { + return Double.POSITIVE_INFINITY; } public Item getItem() { return this.item; } - public Item getItemDropped(State state, Random rand, int fortune) { + public Item getDrop(State state, Random rand, int fortune) { return this.getItem(); } - protected int quantityDropped(Random random) { + protected int getDropAmount(Random rand) { return 1; } - protected int quantityDroppedWithBonus(int fortune, Random random) { - return this.quantityDropped(random); + protected int getDropAmount(int fortune, Random rand) { + return this.getDropAmount(rand); + } + + + public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { } - public void harvestBlock(World world, EntityNPC player, BlockPos pos, State state, TileEntity te) { + public void displayTick(AWorldClient world, BlockPos pos, State state, Random rand) { + } + + public void onStartBreak(World world, BlockPos pos, EntityNPC player) { + } + + public void preBroken(World world, BlockPos pos, State state, EntityNPC player) { + } + + public void onBroken(World world, BlockPos pos, State state) { + } + + public void postBroken(World world, EntityNPC player, BlockPos pos, State state, TileEntity te) { if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) { Item item = this.getItem(); if(item != null) - spawnAsEntity(world, pos, new ItemStack(item)); + dropItem(world, pos, new ItemStack(item)); } else { int fortune = EnchantmentHelper.getFortuneModifier(player); - this.dropBlockAsItem(world, pos, state, fortune); + this.drop(world, pos, state, fortune); } } - public final void dropBlockAsItem(World worldIn, BlockPos pos, State state, int fortune) { - this.dropBlockAsItemWithChance(worldIn, pos, state, 1.0F, fortune); + public final void drop(World world, BlockPos pos, State state, int fortune) { + this.drop(world, pos, state, 1.0F, fortune); } - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) { - if(!worldIn.client) { - int i = this.quantityDroppedWithBonus(fortune, worldIn.rand); - - for(int j = 0; j < i; ++j) { - if(worldIn.rand.floatv() <= chance) { - Item item = this.getItemDropped(state, worldIn.rand, fortune); - - if(item != null) { - spawnAsEntity(worldIn, pos, new ItemStack(item)); - } + public void drop(World world, BlockPos pos, State state, float chance, int fortune) { + if(!world.client) { + int amount = this.getDropAmount(fortune, world.rand); + for(int z = 0; z < amount; z++) { + if(world.rand.floatv() <= chance) { + Item item = this.getDrop(state, world.rand, fortune); + if(item != null) + dropItem(world, pos, new ItemStack(item)); } } } } - public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack) { - if(!worldIn.client && Vars.blockDrop) { - float f = 0.5F; - double d0 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D; - double d1 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D; - double d2 = (double)(worldIn.rand.floatv() * f) + (double)(1.0F - f) * 0.5D; - EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, stack); - entityitem.setDefaultPickupDelay(); - worldIn.spawnEntityInWorld(entityitem); - } + public void onDestroyedFire(World world, BlockPos pos, State state) { } - protected void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount) { - if(!worldIn.client && Vars.blockXP) { - while(amount > 0) { - int i = EntityXp.getXPSplit(amount); - amount -= i; - worldIn.spawnEntityInWorld(new EntityXp(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, i)); - } - } + public void onDestroyedExplosion(World world, BlockPos pos, Explosion explosion, State state) { } - public boolean canConnectToWire(State state) { + public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { return false; } - public double getResistance(World worldIn, BlockPos pos, State state) { - return Double.POSITIVE_INFINITY; + public void onUpdate(World world, BlockPos pos, State state, Block neighbor) { } - public double powerTick(World worldIn, BlockPos pos, State state, Random rand, double voltage, double currentLimit) { + public void onAdded(AWorldServer world, BlockPos pos, State state) { + } + + public void onRemoved(AWorldServer world, BlockPos pos, State state) { + } + + public void onCollideMove(World world, BlockPos pos, Entity entity) { + } + + public void onLandMove(World world, Entity entity) { + entity.motionY = 0.0D; + } + + public void onCollideUpdate(World world, BlockPos pos, State state, Entity entity) { + } + + public void onLandUpdate(World world, BlockPos pos, Entity entity, float distance) { + entity.fall(distance, 1.0F); + } + + public void onRain(World world, BlockPos pos) { + } + + public boolean onShot(World world, BlockPos pos, State state, Entity projectile) { + return this.material.blocksMovement(); + } + + public double powerTick(World world, BlockPos pos, State state, Random rand, double voltage, double currentLimit) { return 0.0; } - public final boolean hasBlockFlatTexture() { - return this.flatBlockTexture; + public boolean checkPlace(World world, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) { + Block block = world.getState(pos).getBlock(); + + if(block == Blocks.snow_layer) { + side = Facing.UP; + } + else if(!block.canReplace(world, pos)) { + pos = pos.offset(side); + } + + return world.canBlockBePlaced(this, pos, false, side, null, stack); + } + + public boolean prePlace(ItemStack stack, World world, EntityNPC player) { + return false; + } + + public boolean place(ItemStack stack, EntityNPC player, World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) { + State iblockstate = world.getState(pos); + Block block = iblockstate.getBlock(); + + if(block == Blocks.snow_layer && iblockstate.getValue(BlockSnow.LAYERS).intValue() < 1) + side = Facing.UP; + else if(!block.canReplace(world, pos)) { + pos = pos.offset(side); + } + + if(stack.isEmpty()) { + return false; + } + else if(!player.canPlayerEdit(pos, side, stack)) { + return false; + } + else if(world.canBlockBePlaced(this, pos, false, side, (Entity)null, stack)) { + State iblockstate1 = this.getPlacedState(world, pos, side, hitX, hitY, hitZ, player); + + if(world.setState(pos, iblockstate1, 3)) { + iblockstate1 = world.getState(pos); + + if(iblockstate1.getBlock() == this) { + this.onPlace(world, pos, iblockstate1, player); + } + + world.playSound(this.getSound().getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F); + stack.decrSize(); + } + + return true; + } + else { + return false; + } + } + + public State getPlacedState(World world, BlockPos pos, Facing side, float hitX, float hitY, float hitZ, EntityLiving placer) { + return this.getState(); + } + + public void onPlace(World world, BlockPos pos, State state, EntityLiving placer) { + } + + public boolean dispense(World world, TileEntity source, Vec3 position, BlockPos pos, Facing side, ItemStack stack) { + return false; } - public final boolean isItemColored() { - return this.itemColored; + protected boolean hasRegisteredItem() { + return true; } - public StackSize getMaxStackSize() { + public StackSize getMaxAmount() { return null; } + + public void getModifiers(Map map, UsageSlot slot) { + } + + + public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) { + return side == Facing.DOWN && this.minY > 0.0D ? true + : (side == Facing.UP && this.maxY < 1.0D ? true + : (side == Facing.NORTH && this.minZ > 0.0D ? true + : (side == Facing.SOUTH && this.maxZ < 1.0D ? true + : (side == Facing.WEST && this.minX > 0.0D ? true + : (side == Facing.EAST && this.maxX < 1.0D ? true + : !world.getState(pos).getBlock().isOpaqueCube()))))); + } + + public BoundingBox getSelectionBox(World world, BlockPos pos) { + 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); + } + + public int getLightmapValue(IWorldAccess world, BlockPos pos) { + Block block = world.getState(pos).getBlock(); + int light = world.getCombinedLight(pos, block.getLight()); + if(light == 0 && block instanceof BlockSlab) { + pos = pos.down(); + block = world.getState(pos).getBlock(); + return world.getCombinedLight(pos, block.getLight()); + } + return light; + } + + public BlockLayer getBlockLayer() { + return BlockLayer.SOLID; + } + + public int getRenderType() { + return 3; + } + + public boolean isXrayVisible() { + return false; + } + + public Property[] getIgnoredProperties() { + return null; + } + + public void getAnimatedTextures(Map map) { + } + + public int getRenderColor(State state) { + return 16777215; + } + + public int colorMultiplier(IWorldAccess world, BlockPos pos, int pass) { + return 16777215; + } + + public State getEntityState(State state) { + return state; + } + + public Model getModel(ModelProvider provider, String name, State state) { + return provider.getModel(name).add().all(); + } + + public String getFallbackTexture() { + return null; + } + + public void setItemBounds() { + } + + public Transform getTransform() { + return Transform.IDENTITY; + } + + public State getItemState() { + return this.getState(); + } + + public boolean isItemColored() { + return false; + } public TextColor getItemColor() { return this.radiation > 0.0f ? TextColor.GREEN : null; } - public boolean place(ItemStack stack, EntityNPC playerIn, World worldIn, BlockPos pos, Facing side, float hitX, float hitY, float hitZ) - { - State iblockstate = worldIn.getState(pos); - Block block = iblockstate.getBlock(); - - if(block == Blocks.snow_layer && iblockstate.getValue(BlockSnow.LAYERS).intValue() < 1) - side = Facing.UP; - else if (!block.isReplaceable(worldIn, pos)) - { - pos = pos.offset(side); - } - - if (stack.isEmpty()) - { - return false; - } - else if (!playerIn.canPlayerEdit(pos, side, stack)) - { - return false; - } - else if (worldIn.canBlockBePlaced(this, pos, false, side, (Entity)null, stack)) - { - State iblockstate1 = this.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, playerIn); - - if (worldIn.setState(pos, iblockstate1, 3)) - { - iblockstate1 = worldIn.getState(pos); - - if (iblockstate1.getBlock() == this) - { - this.onBlockPlacedBy(worldIn, pos, iblockstate1, playerIn); - } - - worldIn.playSound(this.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F); - stack.decrSize(); - } - - return true; - } - else - { - return false; - } - } - - public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) - { - Block block = worldIn.getState(pos).getBlock(); - - if (block == Blocks.snow_layer) - { - side = Facing.UP; - } - else if (!block.isReplaceable(worldIn, pos)) - { - pos = pos.offset(side); - } - - return worldIn.canBlockBePlaced(this, pos, false, side, (Entity)null, stack); - } - - public boolean prePlace(ItemStack itemStackIn, World worldIn, EntityNPC playerIn) - { - return false; - } - - public boolean dispense(World world, TileEntity source, Vec3 position, BlockPos blockpos, Facing facing, ItemStack stack) { - return false; + public void getTooltips(ItemStack stack, EntityNPC player, List tooltip) { } - - public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) - { - } - - public void getModifiers(Map map, UsageSlot slot) - { - } } diff --git a/common/src/main/java/common/block/BlockAir.java b/common/src/main/java/common/block/BlockAir.java index a058738f..d3cb81d5 100755 --- a/common/src/main/java/common/block/BlockAir.java +++ b/common/src/main/java/common/block/BlockAir.java @@ -15,7 +15,7 @@ public final class BlockAir extends Block { return -1; } - public BoundingBox getCollisionBoundingBox(World world, BlockPos pos, State state) { + public BoundingBox getCollisionBox(World world, BlockPos pos, State state) { return null; } @@ -23,14 +23,14 @@ public final class BlockAir extends Block { return false; } - public boolean canCollideCheck(State state, boolean liquid) { + public boolean canRayTrace(State state, boolean liquid) { return false; } - public void dropBlockAsItemWithChance(World world, BlockPos pos, State state, float chance, int fortune) { + public void drop(World world, BlockPos pos, State state, float chance, int fortune) { } - public boolean isReplaceable(World world, BlockPos pos) { + public boolean canReplace(World world, BlockPos pos) { return true; } diff --git a/common/src/main/java/common/block/BlockFalling.java b/common/src/main/java/common/block/BlockFalling.java index 7c793f90..e9e50e44 100755 --- a/common/src/main/java/common/block/BlockFalling.java +++ b/common/src/main/java/common/block/BlockFalling.java @@ -22,15 +22,15 @@ public class BlockFalling extends Block { super(material); } - public void onBlockAdded(AWorldServer world, BlockPos pos, State state) { + public void onAdded(AWorldServer world, BlockPos pos, State state) { world.scheduleUpdate(pos, this, this.tickRate(world, pos)); } - public void onNeighborBlockChange(World world, BlockPos pos, State state, Block neighbor) { + public void onUpdate(World world, BlockPos pos, State state, Block neighbor) { world.scheduleUpdate(pos, this, this.tickRate(world, pos)); } - public void updateTick(AWorldServer world, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { if(Vars.blockGravity) this.checkFallable(world, pos); } diff --git a/common/src/main/java/common/block/BlockTranslucent.java b/common/src/main/java/common/block/BlockTranslucent.java index e74012fa..877c6f71 100755 --- a/common/src/main/java/common/block/BlockTranslucent.java +++ b/common/src/main/java/common/block/BlockTranslucent.java @@ -19,9 +19,9 @@ public class BlockTranslucent extends Block { return BlockLayer.TRANSLUCENT; } - public boolean shouldSideBeRendered(IWorldAccess world, BlockPos pos, Facing side) { + public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) { State state = world.getState(pos); Block block = state.getBlock(); - return block != this && super.shouldSideBeRendered(world, pos, side); + return block != this && super.canRender(world, pos, side); } } diff --git a/common/src/main/java/common/block/artificial/BlockBed.java b/common/src/main/java/common/block/artificial/BlockBed.java index 741870bf..6edc3c33 100755 --- a/common/src/main/java/common/block/artificial/BlockBed.java +++ b/common/src/main/java/common/block/artificial/BlockBed.java @@ -60,7 +60,7 @@ public class BlockBed extends Block implements Rotatable { this.setBedBounds(); } - public boolean onBlockActivated(World world, BlockPos pos, State state, EntityNPC player, Facing side, + public boolean onUse(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { if(world.client) return true; @@ -98,11 +98,11 @@ public class BlockBed extends Block implements Rotatable { return false; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) { + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.setBedBounds(); } - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) { + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); if(state.getValue(PART) == BlockBed.EnumPartType.HEAD) { if(worldIn.getState(pos.offset(enumfacing.getOpposite())).getBlock() != this) @@ -111,12 +111,12 @@ public class BlockBed extends Block implements Rotatable { else if(worldIn.getState(pos.offset(enumfacing)).getBlock() != this) { worldIn.setBlockToAir(pos); if(!worldIn.client) - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); } } - public Item getItemDropped(State state, Random rand, int fortune) { - return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? null : super.getItemDropped(state, rand, fortune); + public Item getDrop(State state, Random rand, int fortune) { + return state.getValue(PART) == BlockBed.EnumPartType.HEAD ? null : super.getDrop(state, rand, fortune); } private void setBedBounds() { @@ -158,9 +158,9 @@ public class BlockBed extends Block implements Rotatable { && !worldIn.getState(pos.up()).getBlock().getMaterial().isSolid(); } - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) { + public void drop(World worldIn, BlockPos pos, State state, float chance, int fortune) { if(state.getValue(PART) == BlockBed.EnumPartType.FOOT) - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); + super.drop(worldIn, pos, state, chance, 0); } public int getMobilityFlag() { @@ -202,7 +202,7 @@ public class BlockBed extends Block implements Rotatable { return this.getState().withProperty(PART, EnumPartType.HEAD).withProperty(FACING, Facing.NORTH); } - public StackSize getMaxStackSize() { + public StackSize getMaxAmount() { return StackSize.S; } @@ -220,7 +220,7 @@ public class BlockBed extends Block implements Rotatable { { State iblockstate = worldIn.getState(pos); Block block = iblockstate.getBlock(); - boolean flag = block.isReplaceable(worldIn, pos); + boolean flag = block.canReplace(worldIn, pos); if (!flag) { @@ -233,7 +233,7 @@ public class BlockBed extends Block implements Rotatable { if (playerIn.canPlayerEdit(pos, side, stack) && playerIn.canPlayerEdit(blockpos, side, stack)) { - boolean flag1 = worldIn.getState(blockpos).getBlock().isReplaceable(worldIn, blockpos); + boolean flag1 = worldIn.getState(blockpos).getBlock().canReplace(worldIn, blockpos); boolean flag2 = flag || worldIn.isAirBlock(pos); boolean flag3 = flag1 || worldIn.isAirBlock(blockpos); @@ -262,7 +262,7 @@ public class BlockBed extends Block implements Rotatable { } } - public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) + public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) { return side == Facing.UP; } diff --git a/common/src/main/java/common/block/artificial/BlockBookshelf.java b/common/src/main/java/common/block/artificial/BlockBookshelf.java index a1517d7d..08335cb0 100755 --- a/common/src/main/java/common/block/artificial/BlockBookshelf.java +++ b/common/src/main/java/common/block/artificial/BlockBookshelf.java @@ -22,7 +22,7 @@ public class BlockBookshelf extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 3; } @@ -30,7 +30,7 @@ public class BlockBookshelf extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.book; } diff --git a/common/src/main/java/common/block/artificial/BlockCake.java b/common/src/main/java/common/block/artificial/BlockCake.java index 50ce8cab..84cef5b0 100755 --- a/common/src/main/java/common/block/artificial/BlockCake.java +++ b/common/src/main/java/common/block/artificial/BlockCake.java @@ -94,7 +94,7 @@ public class BlockCake extends Block // this.setTickRandomly(true); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { float f = 0.0625F; float f1 = (float)(1 + ((Integer)worldIn.getState(pos).getValue(BITES)).intValue() * 2) / 16.0F; @@ -105,14 +105,14 @@ public class BlockCake extends Block /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { float f = 0.0625F; float f1 = 0.5F; this.setBlockBounds(f, 0.0F, f, 1.0F - f, f1, 1.0F - f); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { float f = 0.0625F; float f1 = (float)(1 + ((Integer)state.getValue(BITES)).intValue() * 2) / 16.0F; @@ -120,9 +120,9 @@ public class BlockCake extends Block return new BoundingBox((double)((float)pos.getX() + f1), (double)pos.getY(), (double)((float)pos.getZ() + f), (double)((float)(pos.getX() + 1) - f), (double)((float)pos.getY() + f2), (double)((float)(pos.getZ() + 1) - f)); } - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, BlockPos pos) { - return this.getCollisionBoundingBox(worldIn, pos, worldIn.getState(pos)); + return this.getCollisionBox(worldIn, pos, worldIn.getState(pos)); } public boolean isFullCube() @@ -138,13 +138,13 @@ public class BlockCake extends Block return false; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { this.eatCake(worldIn, pos, state, playerIn); return true; } - public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) + public void onStartBreak(World worldIn, BlockPos pos, EntityNPC playerIn) { this.eatCake(worldIn, pos, worldIn.getState(pos), playerIn); } @@ -164,15 +164,15 @@ public class BlockCake extends Block } } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false; + return super.canPlace(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false; } /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!this.canBlockStay(worldIn, pos)) { @@ -188,7 +188,7 @@ public class BlockCake extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } @@ -196,7 +196,7 @@ public class BlockCake extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return null; } diff --git a/common/src/main/java/common/block/artificial/BlockCarpet.java b/common/src/main/java/common/block/artificial/BlockCarpet.java index b8ef5ef1..ce19450d 100755 --- a/common/src/main/java/common/block/artificial/BlockCarpet.java +++ b/common/src/main/java/common/block/artificial/BlockCarpet.java @@ -54,12 +54,12 @@ public class BlockCarpet extends Block /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.setBlockBoundsFromMeta(); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.setBlockBoundsFromMeta(); } @@ -71,15 +71,15 @@ public class BlockCarpet extends Block this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos); + return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos); } /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { this.checkForDrop(worldIn, pos, state); } @@ -88,7 +88,7 @@ public class BlockCarpet extends Block { if (!this.canBlockStay(worldIn, pos)) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); return false; } @@ -103,9 +103,9 @@ public class BlockCarpet extends Block return !worldIn.isAirBlock(pos.down()); } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { - return side == Facing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side); + return side == Facing.UP ? true : super.canRender(worldIn, pos, side); } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/artificial/BlockDoor.java b/common/src/main/java/common/block/artificial/BlockDoor.java index c0edd6a6..a4a632b4 100755 --- a/common/src/main/java/common/block/artificial/BlockDoor.java +++ b/common/src/main/java/common/block/artificial/BlockDoor.java @@ -93,17 +93,17 @@ public class BlockDoor extends Block implements Rotatable { return false; } - public BoundingBox getSelectedBoundingBox(World world, BlockPos pos) { - this.setBlockBoundsBasedOnState(world, pos); - return super.getSelectedBoundingBox(world, pos); + public BoundingBox getSelectionBox(World world, BlockPos pos) { + this.setBlockBounds(world, pos); + return super.getSelectionBox(world, pos); } - public BoundingBox getCollisionBoundingBox(World world, BlockPos pos, State state) { - this.setBlockBoundsBasedOnState(world, pos); - return super.getCollisionBoundingBox(world, pos, state); + public BoundingBox getCollisionBox(World world, BlockPos pos, State state) { + this.setBlockBounds(world, pos); + return super.getCollisionBox(world, pos, state); } - public void setBlockBoundsBasedOnState(IWorldAccess world, BlockPos pos) { + public void setBlockBounds(IWorldAccess world, BlockPos pos) { float thick = 0.1875F; this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); State state = world.getState(pos); @@ -159,7 +159,7 @@ public class BlockDoor extends Block implements Rotatable { } } - public boolean onBlockActivated(World world, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World world, BlockPos 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)) return true; BlockPos lower = state.getValue(HALF) == EnumDoorHalf.LOWER ? pos : pos.down(); @@ -192,7 +192,7 @@ public class BlockDoor extends Block implements Rotatable { } } - public void onNeighborBlockChange(World world, BlockPos pos, State state, Block neighbor) { + public void onUpdate(World world, BlockPos pos, State state, Block neighbor) { if(state.getValue(HALF) == EnumDoorHalf.UPPER) { BlockPos lower = pos.down(); State bottom = world.getState(lower); @@ -201,7 +201,7 @@ public class BlockDoor extends Block implements Rotatable { world.setBlockToAir(pos); } else if(neighbor != this) { - this.onNeighborBlockChange(world, lower, bottom, neighbor); + this.onUpdate(world, lower, bottom, neighbor); } } else { @@ -225,23 +225,23 @@ public class BlockDoor extends Block implements Rotatable { if(wrong) { if(!world.client) { - this.dropBlockAsItem(world, pos, state, 0); + this.drop(world, pos, state, 0); } } } } - public Item getItemDropped(State state, Random rand, int fortune) { - return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : super.getItemDropped(state, rand, fortune); + public Item getDrop(State state, Random rand, int fortune) { + return state.getValue(HALF) == EnumDoorHalf.UPPER ? null : super.getDrop(state, rand, fortune); } - public HitPosition collisionRayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) { - this.setBlockBoundsBasedOnState(world, pos); - return super.collisionRayTrace(world, pos, start, end); + public HitPosition rayTrace(World world, BlockPos pos, Vec3 start, Vec3 end) { + this.setBlockBounds(world, pos); + return super.rayTrace(world, pos, start, end); } - public boolean canPlaceBlockAt(World world, BlockPos pos) { - return pos.getY() < World.MAX_SIZE_Y - 1 && world.isBlockSolid(pos.down()) && super.canPlaceBlockAt(world, pos) && super.canPlaceBlockAt(world, pos.up()); + public boolean canPlace(World world, BlockPos pos) { + return pos.getY() < World.MAX_SIZE_Y - 1 && world.isBlockSolid(pos.down()) && super.canPlace(world, pos) && super.canPlace(world, pos.up()); } public int getMobilityFlag() { @@ -297,7 +297,7 @@ public class BlockDoor extends Block implements Rotatable { return this == Blocks.iron_door; } - public StackSize getMaxStackSize() { + public StackSize getMaxAmount() { return StackSize.S; } @@ -312,7 +312,7 @@ public class BlockDoor extends Block implements Rotatable { State iblockstate = worldIn.getState(pos); Block block = iblockstate.getBlock(); - if (!block.isReplaceable(worldIn, pos)) + if (!block.canReplace(worldIn, pos)) { pos = pos.offset(side); } @@ -321,7 +321,7 @@ public class BlockDoor extends Block implements Rotatable { { return false; } - else if (!this.canPlaceBlockAt(worldIn, pos)) + else if (!this.canPlace(worldIn, pos)) { return false; } @@ -334,7 +334,7 @@ public class BlockDoor extends Block implements Rotatable { } } - public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) + public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) { return side == Facing.UP; } diff --git a/common/src/main/java/common/block/artificial/BlockDragonEgg.java b/common/src/main/java/common/block/artificial/BlockDragonEgg.java index ca1841a8..9cdde0ab 100755 --- a/common/src/main/java/common/block/artificial/BlockDragonEgg.java +++ b/common/src/main/java/common/block/artificial/BlockDragonEgg.java @@ -85,7 +85,7 @@ public class BlockDragonEgg extends Block this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F); } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos)); } @@ -93,12 +93,12 @@ public class BlockDragonEgg extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn, pos)); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.blockGravity) this.checkFall(worldIn, pos); @@ -128,13 +128,13 @@ public class BlockDragonEgg extends Block } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { this.teleport(worldIn, pos); return true; } - public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) + public void onStartBreak(World worldIn, BlockPos pos, EntityNPC playerIn) { this.teleport(worldIn, pos); } @@ -202,7 +202,7 @@ public class BlockDragonEgg extends Block return false; } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/artificial/BlockFence.java b/common/src/main/java/common/block/artificial/BlockFence.java index e10e9434..a57d1897 100755 --- a/common/src/main/java/common/block/artificial/BlockFence.java +++ b/common/src/main/java/common/block/artificial/BlockFence.java @@ -53,7 +53,7 @@ public class BlockFence extends Block /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag1 = this.canConnectTo(worldIn, pos.south()); @@ -77,7 +77,7 @@ public class BlockFence extends Block if (flag || flag1) { this.setBlockBounds(f, 0.0F, f2, f1, 1.5F, f3); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } f2 = 0.375F; @@ -96,7 +96,7 @@ public class BlockFence extends Block if (flag2 || flag3 || !flag && !flag1) { this.setBlockBounds(f, 0.0F, f2, f1, 1.5F, f3); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } if (flag) @@ -112,7 +112,7 @@ public class BlockFence extends Block this.setBlockBounds(f, 0.0F, f2, f1, 1.0F, f3); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag1 = this.canConnectTo(worldIn, pos.south()); @@ -170,12 +170,12 @@ public class BlockFence extends Block return ((!(block instanceof BlockFence) || block.getMaterial() != this.material) && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true); } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { return true; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { return worldIn.client ? true : ItemLead.attachToFence(playerIn, worldIn, pos); } @@ -184,7 +184,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 * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos 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()))); } @@ -377,7 +377,7 @@ public class BlockFence extends Block return this.getState().withProperty(EAST, false).withProperty(WEST, false).withProperty(NORTH, true).withProperty(SOUTH, true); } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {NORTH, SOUTH, WEST, EAST}; } } diff --git a/common/src/main/java/common/block/artificial/BlockFenceGate.java b/common/src/main/java/common/block/artificial/BlockFenceGate.java index b52503a2..2a27857e 100755 --- a/common/src/main/java/common/block/artificial/BlockFenceGate.java +++ b/common/src/main/java/common/block/artificial/BlockFenceGate.java @@ -41,7 +41,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 * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { Facing.Axis enumfacing$axis = ((Facing)state.getValue(FACING)).getAxis(); @@ -53,12 +53,12 @@ public class BlockFenceGate extends Block implements Rotatable return state; } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlaceBlockAt(worldIn, pos) : false; + return worldIn.getState(pos.down()).getBlock().getMaterial().isSolid() ? super.canPlace(worldIn, pos) : false; } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { if (((Boolean)state.getValue(OPEN)).booleanValue()) { @@ -71,7 +71,7 @@ public class BlockFenceGate extends Block implements Rotatable } } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { Facing.Axis enumfacing$axis = ((Facing)worldIn.getState(pos).getValue(FACING)).getAxis(); @@ -107,12 +107,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 * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos 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)); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (((Boolean)state.getValue(OPEN)).booleanValue()) { @@ -136,7 +136,7 @@ public class BlockFenceGate extends Block implements Rotatable return true; } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { return true; } @@ -343,7 +343,7 @@ public class BlockFenceGate extends Block implements Rotatable .rotate(ModelRotation.getNorthRot(state.getValue(FACING).getOpposite())); } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {IN_WALL}; } } diff --git a/common/src/main/java/common/block/artificial/BlockFloorPortal.java b/common/src/main/java/common/block/artificial/BlockFloorPortal.java index 0bf62248..6c69349e 100755 --- a/common/src/main/java/common/block/artificial/BlockFloorPortal.java +++ b/common/src/main/java/common/block/artificial/BlockFloorPortal.java @@ -29,7 +29,7 @@ public class BlockFloorPortal extends Block public BlockFloorPortal(Material materialIn) { super(materialIn); - this.setLightLevel(1.0F); + this.setLight(1.0F); } // /** @@ -40,7 +40,7 @@ public class BlockFloorPortal extends Block // return new TileEntityPortal(); // } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.setBlockBounds(0.0F, 0.6875F, 0.0F, 1.0F, 0.75F, 1.0F); } @@ -53,7 +53,7 @@ public class BlockFloorPortal extends Block /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { } @@ -73,7 +73,7 @@ public class BlockFloorPortal extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } @@ -81,17 +81,17 @@ public class BlockFloorPortal extends Block /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { // if (entityIn.ridingEntity == null && entityIn.riddenByEntity == null && !worldIn.client && GameServer.getServer().getAllowEnd()) // { // entityIn.travelToDimension(entityIn.dimension == 1 ? 0 : 1, null, 0.0f, 0.0f); // } - if(entityIn.getEntityBoundingBox().intersectsWith(this.getCollisionBoundingBox(worldIn, pos, state))) + if(entityIn.getEntityBoundingBox().intersectsWith(this.getCollisionBox(worldIn, pos, state))) entityIn.setFlatPortal(); } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { double d0 = (double)((float)pos.getX() + rand.floatv()); double d1 = (double)((float)pos.getY() + 0.8F); @@ -118,7 +118,7 @@ public class BlockFloorPortal extends Block } } - public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state) + public void onBroken(World worldIn, BlockPos pos, State state) { Set positions = Sets.newHashSet(); positions.add(pos); diff --git a/common/src/main/java/common/block/artificial/BlockFlowerPot.java b/common/src/main/java/common/block/artificial/BlockFlowerPot.java index 3c2ca702..5c5895b0 100755 --- a/common/src/main/java/common/block/artificial/BlockFlowerPot.java +++ b/common/src/main/java/common/block/artificial/BlockFlowerPot.java @@ -109,14 +109,14 @@ public class BlockFlowerPot extends Block { super(Material.SMALL); this.content = content; - this.setBlockBoundsForItemRender(); + this.setItemBounds(); POTS.add(this); } /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { float f = 0.375F; float f1 = f / 2.0F; @@ -136,7 +136,7 @@ public class BlockFlowerPot extends Block return false; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { ItemStack itemstack = playerIn.inventory.getCurrentItem(); @@ -177,34 +177,34 @@ public class BlockFlowerPot extends Block } } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) && worldIn.isBlockSolid(pos.down()); + return super.canPlace(worldIn, pos) && worldIn.isBlockSolid(pos.down()); } /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!worldIn.isBlockSolid(pos.down())) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { if(this.content != null) - spawnAsEntity(worldIn, pos, new ItemStack(this.content.getItem())); - super.onBlockRemoved(worldIn, pos, state); + dropItem(worldIn, pos, new ItemStack(this.content.getItem())); + super.onRemoved(worldIn, pos, state); } /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.flowerpot; } diff --git a/common/src/main/java/common/block/artificial/BlockGlass.java b/common/src/main/java/common/block/artificial/BlockGlass.java index 1851e936..a1e45cfb 100755 --- a/common/src/main/java/common/block/artificial/BlockGlass.java +++ b/common/src/main/java/common/block/artificial/BlockGlass.java @@ -18,7 +18,7 @@ public class BlockGlass extends Block { this.setTab(CheatTab.BLOCKS); } - protected int quantityDropped(Random rand) { + protected int getDropAmount(Random rand) { return 0; } @@ -38,10 +38,10 @@ public class BlockGlass extends Block { return true; } - public boolean shouldSideBeRendered(IWorldAccess world, BlockPos pos, Facing side) { + public boolean canRender(IWorldAccess world, BlockPos pos, Facing side) { State state = world.getState(pos); Block block = state.getBlock(); - return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.shouldSideBeRendered(world, pos, side)); + return world.getState(pos.offset(side.getOpposite())) != state || (block != this && super.canRender(world, pos, side)); } public boolean onShot(World world, BlockPos pos, State state, Entity projectile) { diff --git a/common/src/main/java/common/block/artificial/BlockHay.java b/common/src/main/java/common/block/artificial/BlockHay.java index 883b0dab..7bbc87ef 100755 --- a/common/src/main/java/common/block/artificial/BlockHay.java +++ b/common/src/main/java/common/block/artificial/BlockHay.java @@ -26,8 +26,8 @@ public class BlockHay extends BlockRotatedPillar return new Property[] {AXIS}; } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { - return super.onBlockPlaced(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()); } } diff --git a/common/src/main/java/common/block/artificial/BlockLadder.java b/common/src/main/java/common/block/artificial/BlockLadder.java index 5ee085a8..1d57cc72 100755 --- a/common/src/main/java/common/block/artificial/BlockLadder.java +++ b/common/src/main/java/common/block/artificial/BlockLadder.java @@ -25,22 +25,21 @@ public class BlockLadder extends Block implements Rotatable super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); this.setTab(CheatTab.WOOD); - this.setFlatBlockTexture(); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); + this.setBlockBounds(worldIn, pos); + return super.getCollisionBox(worldIn, pos, state); } - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, BlockPos pos) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); + this.setBlockBounds(worldIn, pos); + return super.getSelectionBox(worldIn, pos); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); @@ -82,7 +81,7 @@ public class BlockLadder extends Block implements Rotatable return false; } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos 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())); } @@ -91,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 * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { if (facing.getAxis().isHorizontal() && this.canBlockStay(worldIn, pos, facing)) { @@ -114,17 +113,17 @@ public class BlockLadder extends Block implements Rotatable /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); if (!this.canBlockStay(worldIn, pos, enumfacing)) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onUpdate(worldIn, pos, state, neighborBlock); } protected boolean canBlockStay(World worldIn, BlockPos pos, Facing facing) diff --git a/common/src/main/java/common/block/artificial/BlockMetalBlock.java b/common/src/main/java/common/block/artificial/BlockMetalBlock.java index ac88f45a..f0d95f55 100644 --- a/common/src/main/java/common/block/artificial/BlockMetalBlock.java +++ b/common/src/main/java/common/block/artificial/BlockMetalBlock.java @@ -20,8 +20,8 @@ public class BlockMetalBlock extends Block { public BlockMetalBlock(MetalType metal) { super(Material.SOLID); this.metal = metal; - this.setStepSound(SoundType.STONE); - this.setLightLevel(metal.radioactivity > 0.0F ? 0.25F : 0.0F); + this.setSound(SoundType.STONE); + this.setLight(metal.radioactivity > 0.0F ? 0.25F : 0.0F); this.setRadiation(metal.radioactivity * 2.0f); this.setTab(CheatTab.GEMS); } @@ -34,7 +34,7 @@ public class BlockMetalBlock extends Block { return this.metal.isMagnetic(); } - public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) + public void getTooltips(ItemStack stack, EntityNPC playerIn, List tooltip) { tooltip.add(this.metal.formatSymbol()); if(this.metal.radioactivity > 0.0f) { diff --git a/common/src/main/java/common/block/artificial/BlockPane.java b/common/src/main/java/common/block/artificial/BlockPane.java index 1d400495..8617fc69 100755 --- a/common/src/main/java/common/block/artificial/BlockPane.java +++ b/common/src/main/java/common/block/artificial/BlockPane.java @@ -35,14 +35,13 @@ public class BlockPane extends Block super(materialIn); this.setDefaultState(this.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); this.setTab(CheatTab.BLOCKS); - this.setFlatBlockTexture(); } /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos 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()))); } @@ -50,9 +49,9 @@ public class BlockPane extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return this.material != Material.SOLID ? null : super.getItemDropped(state, rand, fortune); + return this.material != Material.SOLID ? null : super.getDrop(state, rand, fortune); } /** @@ -68,15 +67,15 @@ public class BlockPane extends Block return false; } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { - return worldIn.getState(pos).getBlock() == this ? false : super.shouldSideBeRendered(worldIn, pos, side); + return worldIn.getState(pos).getBlock() == this ? false : super.canRender(worldIn, pos, side); } /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { boolean flag = this.canPaneConnectToBlock(worldIn.getState(pos.north()).getBlock()); boolean flag1 = this.canPaneConnectToBlock(worldIn.getState(pos.south()).getBlock()); @@ -88,18 +87,18 @@ public class BlockPane extends Block if (flag2) { this.setBlockBounds(0.0F, 0.0F, 0.4375F, 0.5F, 1.0F, 0.5625F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } else if (flag3) { this.setBlockBounds(0.5F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } } else { this.setBlockBounds(0.0F, 0.0F, 0.4375F, 1.0F, 1.0F, 0.5625F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } if ((!flag || !flag1) && (flag2 || flag3 || flag || flag1)) @@ -107,30 +106,30 @@ public class BlockPane extends Block if (flag) { this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 0.5F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } else if (flag1) { this.setBlockBounds(0.4375F, 0.0F, 0.5F, 0.5625F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } } else { this.setBlockBounds(0.4375F, 0.0F, 0.0F, 0.5625F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } } /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { float f = 0.4375F; float f1 = 0.5625F; @@ -491,7 +490,7 @@ public class BlockPane extends Block } } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {NORTH, SOUTH, WEST, EAST}; } diff --git a/common/src/main/java/common/block/artificial/BlockPortal.java b/common/src/main/java/common/block/artificial/BlockPortal.java index e811097e..80c082b6 100755 --- a/common/src/main/java/common/block/artificial/BlockPortal.java +++ b/common/src/main/java/common/block/artificial/BlockPortal.java @@ -64,12 +64,12 @@ public class BlockPortal extends Block // } // } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { Facing.Axis enumfacing$axis = (Facing.Axis)worldIn.getState(pos).getValue(AXIS); float f = 0.125F; @@ -134,7 +134,7 @@ public class BlockPortal extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { Facing.Axis enumfacing$axis = (Facing.Axis)state.getValue(AXIS); int dim = state.getValue(DIM); @@ -159,7 +159,7 @@ public class BlockPortal extends Block } } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { Facing.Axis enumfacing$axis = null; State iblockstate = worldIn.getState(pos); @@ -196,7 +196,7 @@ public class BlockPortal extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } @@ -204,7 +204,7 @@ public class BlockPortal extends Block /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { if (entityIn.vehicle == null && entityIn.passenger == null) { @@ -212,7 +212,7 @@ public class BlockPortal extends Block } } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { // if (rand.chance(100)) // { diff --git a/common/src/main/java/common/block/artificial/BlockPortalFrame.java b/common/src/main/java/common/block/artificial/BlockPortalFrame.java index 99dd34eb..4dc347db 100755 --- a/common/src/main/java/common/block/artificial/BlockPortalFrame.java +++ b/common/src/main/java/common/block/artificial/BlockPortalFrame.java @@ -46,7 +46,7 @@ public class BlockPortalFrame extends Block implements Rotatable /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); } @@ -54,45 +54,45 @@ public class BlockPortalFrame extends Block implements Rotatable /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); if (((Boolean)worldIn.getState(pos).getValue(ORB)).booleanValue()) { this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } - this.setBlockBoundsForItemRender(); + this.setItemBounds(); } /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.obsidian; } - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 4; } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { - super.harvestBlock(worldIn, player, pos, state, te); + super.postBroken(worldIn, player, pos, state, te); if(state.getValue(ORB)) - spawnAsEntity(worldIn, pos, new ItemStack(Items.charged_orb)); + dropItem(worldIn, pos, new ItemStack(Items.charged_orb)); } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(ORB, Boolean.valueOf(false)); } @@ -102,13 +102,13 @@ public class BlockPortalFrame extends Block implements Rotatable return new Property[] {FACING, ORB}; } - public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state) + public void onBroken(World worldIn, BlockPos pos, State state) { for(int n = 0; n < 4; n++) { BlockPos ppos = pos.offset(Facing.getHorizontal(n)); State pstate = worldIn.getState(ppos); if(pstate.getBlock() == Blocks.floor_portal) - Blocks.floor_portal.onBlockDestroyedByPlayer(worldIn, ppos, pstate); + Blocks.floor_portal.onBroken(worldIn, ppos, pstate); } } diff --git a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java index 8a494719..3b73740f 100644 --- a/common/src/main/java/common/block/artificial/BlockQuartzPillar.java +++ b/common/src/main/java/common/block/artificial/BlockQuartzPillar.java @@ -29,7 +29,7 @@ public class BlockQuartzPillar extends BlockRotatedPillar return this.dark; } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(AXIS, facing.getAxis()); } diff --git a/common/src/main/java/common/block/artificial/BlockSkull.java b/common/src/main/java/common/block/artificial/BlockSkull.java index 48a19687..0937ae83 100755 --- a/common/src/main/java/common/block/artificial/BlockSkull.java +++ b/common/src/main/java/common/block/artificial/BlockSkull.java @@ -22,11 +22,11 @@ public class BlockSkull extends Block implements Rotatable { this.setBlockBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); } - public boolean canPlaceBlockAt(World world, BlockPos pos) { + public boolean canPlace(World world, BlockPos pos) { return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down()); } - public State onBlockPlaced(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World world, BlockPos pos, Facing face, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } diff --git a/common/src/main/java/common/block/artificial/BlockSlab.java b/common/src/main/java/common/block/artificial/BlockSlab.java index d2c2586d..5675a738 100755 --- a/common/src/main/java/common/block/artificial/BlockSlab.java +++ b/common/src/main/java/common/block/artificial/BlockSlab.java @@ -43,12 +43,12 @@ public class BlockSlab extends Block implements Directional { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); - this.setLightOpacity(255); + this.setOpacity(255); this.base = base; this.baseState = base.getState(); this.setHardness(this.base.getRawHardness()); this.setResistance(this.base.getRawResistance() / 3.0F); - this.setStepSound(this.base.sound); + this.setSound(this.base.getSound()); this.textureTop = top; this.textureBottom = bottom; SLABS.add(this); @@ -58,12 +58,12 @@ public class BlockSlab extends Block implements Directional { return new Property[] {FACING}; } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { 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); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) { + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() == this) { @@ -90,13 +90,13 @@ public class BlockSlab extends Block implements Directional { } } - public void setBlockBoundsForItemRender() { + public void setItemBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); } - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { - this.setBlockBoundsBasedOnState(worldIn, pos); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { + this.setBlockBounds(worldIn, pos); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } public boolean isOpaqueCube() { @@ -111,10 +111,10 @@ public class BlockSlab extends Block implements Directional { return blockIn instanceof BlockSlab; } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) { + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { State iblockstate = worldIn.getState(pos); if(iblockstate.getBlock() == this && iblockstate.getValue(FACING).getAxis() == Axis.Y) { - if(side != Facing.UP && side != Facing.DOWN && !super.shouldSideBeRendered(worldIn, pos, side)) { + if(side != Facing.UP && side != Facing.DOWN && !super.canRender(worldIn, pos, side)) { return false; } else { @@ -126,20 +126,20 @@ public class BlockSlab extends Block implements Directional { boolean flag1 = isSlab(iblockstate1.getBlock()) && iblockstate1.getValue(FACING) == Facing.UP; return flag1 ? (side == Facing.DOWN ? true - : (side == Facing.UP && super.shouldSideBeRendered(worldIn, pos, side) ? true + : (side == Facing.UP && super.canRender(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || !flag)) : (side == Facing.UP ? true - : (side == Facing.DOWN && super.shouldSideBeRendered(worldIn, pos, side) ? true + : (side == Facing.DOWN && super.canRender(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || flag)); } } if(side == Facing.UP || side == Facing.DOWN) { - return super.shouldSideBeRendered(worldIn, pos, side); + return super.canRender(worldIn, pos, side); } else { return (iblockstate.getBlock() == this && iblockstate.getValue(FACING) == side.getOpposite()) - || super.shouldSideBeRendered(worldIn, pos, side); + || super.canRender(worldIn, pos, side); } } @@ -164,12 +164,12 @@ public class BlockSlab extends Block implements Directional { if(hitY >= 0.34f && hitY <= 0.66f) { State state = worldIn.getState(pos); Block block = state.getBlock(); - if(!block.isReplaceable(worldIn, pos)) + if(!block.canReplace(worldIn, pos)) pos = pos.offset(side); if(worldIn.canBlockBePlaced(this, pos, false, side, null, stack)) { State place = this.getState().withProperty(BlockSlab.FACING, playerIn.getHorizontalFacing()); if(worldIn.setState(pos, place, 3)) { - worldIn.playSound(this.sound.getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), + worldIn.playSound(this.getSound().getPlaceSound(), (double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), 1.0F); stack.decrSize(); } diff --git a/common/src/main/java/common/block/artificial/BlockStairs.java b/common/src/main/java/common/block/artificial/BlockStairs.java index ab97a05c..af1a5f13 100755 --- a/common/src/main/java/common/block/artificial/BlockStairs.java +++ b/common/src/main/java/common/block/artificial/BlockStairs.java @@ -58,14 +58,14 @@ public class BlockStairs extends Block implements Rotatable this.baseState = base.getState(); this.setHardness(this.base.getRawHardness()); this.setResistance(this.base.getRawResistance() / 3.0F); - this.setStepSound(this.base.sound); - this.setLightOpacity(255); + this.setSound(this.base.getSound()); + this.setOpacity(255); this.setTab(base.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.BLOCKS); this.downTex = down; this.upTex = up; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { if (this.hasRaytraced) { @@ -546,50 +546,50 @@ public class BlockStairs extends Block implements Rotatable /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBaseCollisionBounds(worldIn, pos); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); boolean flag = this.setBaseBlockBounds(worldIn, pos); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); if (flag && this.setCollisionBlockBounds(worldIn, pos)) { - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { - this.base.randomDisplayTick(worldIn, pos, state, rand); + this.base.displayTick(worldIn, pos, state, rand); } - public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn) + public void onStartBreak(World worldIn, BlockPos pos, EntityNPC playerIn) { - this.base.onBlockClicked(worldIn, pos, playerIn); + this.base.onStartBreak(worldIn, pos, playerIn); } /** * Called when a player destroys this Block */ - public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state) + public void onBroken(World worldIn, BlockPos pos, State state) { - this.base.onBlockDestroyedByPlayer(worldIn, pos, state); + this.base.onBroken(worldIn, pos, state); } - public int getMixedBrightnessForBlock(IWorldAccess worldIn, BlockPos pos) + public int getLightmapValue(IWorldAccess worldIn, BlockPos pos) { - return this.base.getMixedBrightnessForBlock(worldIn, pos); + return this.base.getLightmapValue(worldIn, pos); } /** * Returns how much this block can resist explosions from the passed in entity. */ - public float getExplosionResistance(Entity exploder) + public float getResistance(Entity exploder) { - return this.base.getExplosionResistance(exploder); + return this.base.getResistance(exploder); } public BlockLayer getBlockLayer() @@ -605,69 +605,61 @@ public class BlockStairs extends Block implements Rotatable return this.base.tickRate(worldIn, pos); } - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, BlockPos pos) { - return this.base.getSelectedBoundingBox(worldIn, pos); + return this.base.getSelectionBox(worldIn, pos); } - public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) + public Vec3 getAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) { - return this.base.modifyAcceleration(worldIn, pos, entityIn, motion); + return this.base.getAcceleration(worldIn, pos, entityIn, motion); } - /** - * Returns if this block is collidable (only used by Fire). Args: x, y, z - */ - public boolean isCollidable() + public boolean canRayTrace(State state, boolean liquid) { - return this.base.isCollidable(); + return this.base.canRayTrace(state, liquid); } - public boolean canCollideCheck(State state, boolean liquid) + public boolean canPlace(World worldIn, BlockPos pos) { - return this.base.canCollideCheck(state, liquid); + return this.base.canPlace(worldIn, pos); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { - return this.base.canPlaceBlockAt(worldIn, pos); + this.onUpdate(worldIn, pos, this.baseState, Blocks.air); + this.base.onAdded(worldIn, pos, this.baseState); } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { - this.onNeighborBlockChange(worldIn, pos, this.baseState, Blocks.air); - this.base.onBlockAdded(worldIn, pos, this.baseState); - } - - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) - { - this.base.onBlockRemoved(worldIn, pos, this.baseState); + this.base.onRemoved(worldIn, pos, this.baseState); } /** * Triggered whenever an entity collides with this block (enters into the block) */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn) + public void onCollideMove(World worldIn, BlockPos pos, Entity entityIn) { - this.base.onEntityCollidedWithBlock(worldIn, pos, entityIn); + this.base.onCollideMove(worldIn, pos, entityIn); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - this.base.updateTick(worldIn, pos, state, rand); + this.base.tick(worldIn, pos, state, rand); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { - return this.base.onBlockActivated(worldIn, pos, this.baseState, playerIn, Facing.DOWN, 0.0F, 0.0F, 0.0F); + return this.base.onUse(worldIn, pos, this.baseState, playerIn, Facing.DOWN, 0.0F, 0.0F, 0.0F); } /** * Called when this Block is destroyed by an Explosion */ - public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState) + public void onDestroyedExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState) { - this.base.onBlockDestroyedByExplosion(worldIn, pos, explosionIn, prevState); + this.base.onDestroyedExplosion(worldIn, pos, explosionIn, prevState); } // /** @@ -682,9 +674,9 @@ 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 * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { - State iblockstate = super.onBlockPlaced(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); return facing != Facing.DOWN && (facing == Facing.UP || (double)hitY <= 0.5D) ? iblockstate.withProperty(HALF, BlockStairs.EnumHalf.BOTTOM) : iblockstate.withProperty(HALF, BlockStairs.EnumHalf.TOP); } @@ -692,7 +684,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. */ - public HitPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { HitPosition[] amovingobjectposition = new HitPosition[8]; State iblockstate = worldIn.getState(pos); @@ -707,7 +699,7 @@ public class BlockStairs extends Block implements Rotatable if (Arrays.binarySearch(aint, j) < 0) { - amovingobjectposition[j] = super.collisionRayTrace(worldIn, pos, start, end); + amovingobjectposition[j] = super.rayTrace(worldIn, pos, start, end); } } @@ -740,7 +732,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 * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { if (this.setBaseBlockBounds(worldIn, pos)) { @@ -806,7 +798,7 @@ public class BlockStairs extends Block implements Rotatable return true; } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {SHAPE}; } diff --git a/common/src/main/java/common/block/artificial/BlockTrapDoor.java b/common/src/main/java/common/block/artificial/BlockTrapDoor.java index 69731096..cba9c381 100755 --- a/common/src/main/java/common/block/artificial/BlockTrapDoor.java +++ b/common/src/main/java/common/block/artificial/BlockTrapDoor.java @@ -69,19 +69,19 @@ public class BlockTrapDoor extends Block implements Rotatable return !((Boolean)worldIn.getState(pos).getValue(OPEN)).booleanValue(); } - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, BlockPos pos) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); + this.setBlockBounds(worldIn, pos); + return super.getSelectionBox(worldIn, pos); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); + this.setBlockBounds(worldIn, pos); + return super.getCollisionBox(worldIn, pos, state); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.setBounds(worldIn.getState(pos)); } @@ -89,7 +89,7 @@ public class BlockTrapDoor extends Block implements Rotatable /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { float f = 0.1875F; this.setBlockBounds(0.0F, 0.40625F, 0.0F, 1.0F, 0.59375F, 1.0F); @@ -138,7 +138,7 @@ public class BlockTrapDoor extends Block implements Rotatable } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos 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)) return true; @@ -151,17 +151,17 @@ public class BlockTrapDoor extends Block implements Rotatable /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public HitPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.collisionRayTrace(worldIn, pos, start, end); + this.setBlockBounds(worldIn, pos); + return super.rayTrace(worldIn, pos, start, end); } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState(); diff --git a/common/src/main/java/common/block/artificial/BlockWall.java b/common/src/main/java/common/block/artificial/BlockWall.java index c5a6f199..3ea8a287 100755 --- a/common/src/main/java/common/block/artificial/BlockWall.java +++ b/common/src/main/java/common/block/artificial/BlockWall.java @@ -39,7 +39,7 @@ public class BlockWall extends Block this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); this.setHardness(modelBlock.getRawHardness()); this.setResistance(modelBlock.getRawResistance() / 3.0F); - this.setStepSound(modelBlock.sound); + this.setSound(modelBlock.getSound()); this.setTab(CheatTab.BLOCKS); WALLS.add(this); } @@ -66,7 +66,7 @@ public class BlockWall extends Block return false; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { boolean flag = this.canConnectTo(worldIn, pos.north()); boolean flag1 = this.canConnectTo(worldIn, pos.south()); @@ -114,11 +114,11 @@ public class BlockWall extends Block this.setBlockBounds(f, 0.0F, f2, f1, f4, f3); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { - this.setBlockBoundsBasedOnState(worldIn, pos); + this.setBlockBounds(worldIn, pos); this.maxY = 1.5D; - return super.getCollisionBoundingBox(worldIn, pos, state); + return super.getCollisionBox(worldIn, pos, state); } public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) @@ -127,16 +127,16 @@ public class BlockWall extends Block return (block != this && !(block instanceof BlockFenceGate) ? (block.getMaterial().isOpaque() && block.isFullCube() ? block.getMaterial() != Material.SOFT : false) : true); } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { - return side == Facing.DOWN ? super.shouldSideBeRendered(worldIn, pos, side) : true; + return side == Facing.DOWN ? super.canRender(worldIn, pos, side) : true; } /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos 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()))); } @@ -295,7 +295,7 @@ public class BlockWall extends Block return this.getState().withProperty(UP, true).withProperty(NORTH, false).withProperty(SOUTH, false).withProperty(WEST, true).withProperty(EAST, true); } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {NORTH, SOUTH, UP, WEST, EAST}; } } diff --git a/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java b/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java index e185c74e..2bfb3175 100644 --- a/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java +++ b/common/src/main/java/common/block/foliage/BlockBlackenedSoil.java @@ -19,11 +19,11 @@ public class BlockBlackenedSoil extends Block public BlockBlackenedSoil() { super(Material.LOOSE); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.NATURE); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if (worldIn.getLightFromNeighbors(pos.up()) < 2 && worldIn.getState(pos.up()).getBlock().getLightOpacity() > 6) { @@ -47,9 +47,9 @@ public class BlockBlackenedSoil extends Block } } - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return Blocks.blackened_dirt.getItemDropped(Blocks.blackened_dirt.getState(), rand, fortune); + return Blocks.blackened_dirt.getDrop(Blocks.blackened_dirt.getState(), rand, fortune); } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockBlueShroom.java b/common/src/main/java/common/block/foliage/BlockBlueShroom.java index c19e8c2a..7c1a2ed0 100755 --- a/common/src/main/java/common/block/foliage/BlockBlueShroom.java +++ b/common/src/main/java/common/block/foliage/BlockBlueShroom.java @@ -18,10 +18,10 @@ public class BlockBlueShroom extends BlockBush { float f = 0.2F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); - this.setTickRandomly(); + this.setTicked(); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if (Vars.blueShroomGrowth > 0 && rand.chance(Vars.blueShroomGrowth)) { @@ -60,9 +60,9 @@ public class BlockBlueShroom extends BlockBush } } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState()); + return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState()); } protected boolean canPlaceBlockOn(Block ground) diff --git a/common/src/main/java/common/block/foliage/BlockBush.java b/common/src/main/java/common/block/foliage/BlockBush.java index 1f027981..40a3eb96 100755 --- a/common/src/main/java/common/block/foliage/BlockBush.java +++ b/common/src/main/java/common/block/foliage/BlockBush.java @@ -22,16 +22,15 @@ public class BlockBush extends Block public BlockBush(Material p_i46452_1_) { super(p_i46452_1_); - this.setTickRandomly(); + this.setTicked(); float f = 0.2F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3.0F, 0.5F + f); this.setTab(CheatTab.PLANTS); - this.setFlatBlockTexture(); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); + return super.canPlace(worldIn, pos) && this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } /** @@ -45,13 +44,13 @@ public class BlockBush extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onUpdate(worldIn, pos, state, neighborBlock); this.checkAndDropBlock(worldIn, pos, state); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { this.checkAndDropBlock(worldIn, pos, state); } @@ -60,7 +59,7 @@ public class BlockBush extends Block { if (!this.canBlockStay(worldIn, pos, state)) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setState(pos, Blocks.air.getState(), 3); } } @@ -70,7 +69,7 @@ public class BlockBush extends Block return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } diff --git a/common/src/main/java/common/block/foliage/BlockCactus.java b/common/src/main/java/common/block/foliage/BlockCactus.java index 3613c652..962ec682 100755 --- a/common/src/main/java/common/block/foliage/BlockCactus.java +++ b/common/src/main/java/common/block/foliage/BlockCactus.java @@ -40,11 +40,11 @@ public class BlockCactus extends Block { super(Material.BLOCKING); this.setDefaultState(this.getBaseState().withProperty(AGE, Integer.valueOf(0))); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.PLANTS); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { BlockPos blockpos = pos.up(); @@ -66,7 +66,7 @@ public class BlockCactus extends Block worldIn.setState(blockpos, this.getState()); State iblockstate = state.withProperty(AGE, Integer.valueOf(0)); worldIn.setState(pos, iblockstate, 4); - this.onNeighborBlockChange(worldIn, blockpos, iblockstate, this); + this.onUpdate(worldIn, blockpos, iblockstate, this); } else { @@ -76,13 +76,13 @@ public class BlockCactus extends Block } } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { 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)); } - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, BlockPos pos) { 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)); @@ -101,15 +101,15 @@ public class BlockCactus extends Block return false; } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false; + return super.canPlace(worldIn, pos) ? this.canBlockStay(worldIn, pos) : false; } /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!this.canBlockStay(worldIn, pos)) { @@ -134,7 +134,7 @@ public class BlockCactus extends Block /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { if(worldIn.client || Vars.cactusDamage) entityIn.attackEntityFrom(DamageSource.cactus, 1); diff --git a/common/src/main/java/common/block/foliage/BlockCrops.java b/common/src/main/java/common/block/foliage/BlockCrops.java index c5449fb5..eeaef566 100755 --- a/common/src/main/java/common/block/foliage/BlockCrops.java +++ b/common/src/main/java/common/block/foliage/BlockCrops.java @@ -27,12 +27,12 @@ public class BlockCrops extends BlockBush implements IGrowable public BlockCrops() { this.setDefaultState(this.getBaseState().withProperty(AGE, Integer.valueOf(0))); - this.setTickRandomly(); + this.setTicked(); float f = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); this.setTab((CheatTab)null); this.setHardness(0.0F); - this.setStepSound(SoundType.GRASS); + this.setSound(SoundType.GRASS); // this.disableStats(); } @@ -44,9 +44,9 @@ public class BlockCrops extends BlockBush implements IGrowable return ground == Blocks.farmland; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - super.updateTick(worldIn, pos, state, rand); + super.tick(worldIn, pos, state, rand); if (Vars.cropGrowth > 0 && worldIn.getLightFromNeighbors(pos.up()) >= 9) { @@ -148,9 +148,9 @@ public class BlockCrops extends BlockBush implements IGrowable /** * Spawns this Block's drops into the World as EntityItems. */ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) + public void drop(World worldIn, BlockPos pos, State state, float chance, int fortune) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0); + super.drop(worldIn, pos, state, chance, 0); if (!worldIn.client) { @@ -164,7 +164,7 @@ public class BlockCrops extends BlockBush implements IGrowable { if (worldIn.rand.zrange(15) <= i) { - spawnAsEntity(worldIn, pos, new ItemStack(this.getDropItem())); + dropItem(worldIn, pos, new ItemStack(this.getDropItem())); } } } @@ -174,9 +174,9 @@ public class BlockCrops extends BlockBush implements IGrowable /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return ((Integer)state.getValue(AGE)).intValue() == 7 ? this.getCrop() : super.getItemDropped(state, rand, fortune); + return ((Integer)state.getValue(AGE)).intValue() == 7 ? this.getCrop() : super.getDrop(state, rand, fortune); } /** diff --git a/common/src/main/java/common/block/foliage/BlockDeadBush.java b/common/src/main/java/common/block/foliage/BlockDeadBush.java index ed11700d..fc06e31d 100755 --- a/common/src/main/java/common/block/foliage/BlockDeadBush.java +++ b/common/src/main/java/common/block/foliage/BlockDeadBush.java @@ -47,7 +47,7 @@ public class BlockDeadBush extends BlockBush /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, BlockPos pos) { return true; } @@ -55,21 +55,21 @@ public class BlockDeadBush extends BlockBush /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return rand.chance(5) ? Items.stick : null; } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { // player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); - spawnAsEntity(worldIn, pos, new ItemStack(Items.deadbush)); + dropItem(worldIn, pos, new ItemStack(Items.deadbush)); } else { - super.harvestBlock(worldIn, player, pos, state, te); + super.postBroken(worldIn, player, pos, state, te); } } diff --git a/common/src/main/java/common/block/foliage/BlockDoublePlant.java b/common/src/main/java/common/block/foliage/BlockDoublePlant.java index 5816a154..a29305c4 100755 --- a/common/src/main/java/common/block/foliage/BlockDoublePlant.java +++ b/common/src/main/java/common/block/foliage/BlockDoublePlant.java @@ -45,11 +45,8 @@ public class BlockDoublePlant extends BlockBush implements IGrowable this.type = type; this.setDefaultState(this.getBaseState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.LOWER)); this.setHardness(0.0F); - this.setStepSound(SoundType.GRASS); + this.setSound(SoundType.GRASS); this.setFlammable(60, 100); - this.setFlatBlockTexture(); - if(this.type == BlockDoublePlant.EnumPlantType.GRASS || this.type == BlockDoublePlant.EnumPlantType.FERN) - this.setItemColored(); PLANTS[type.ordinal()] = this; } @@ -57,7 +54,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable return this.type; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.plantDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -72,23 +69,23 @@ public class BlockDoublePlant extends BlockBush implements IGrowable Blocks.dead_bush.getState()); return; } - super.updateTick(worldIn, pos, state, rand); + super.tick(worldIn, pos, state, rand); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) && worldIn.isAirBlock(pos.up()); + return super.canPlace(worldIn, pos) && worldIn.isAirBlock(pos.up()); } /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); @@ -123,7 +120,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable if (!flag) { - this.dropBlockAsItem(worldIn, blockpos1, state, 0); + this.drop(worldIn, blockpos1, state, 0); } } } @@ -145,7 +142,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { @@ -153,10 +150,14 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } else { - return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat_seed : null) : super.getItemDropped(state, rand, fortune)); + return this.type == BlockDoublePlant.EnumPlantType.FERN ? null : (this.type == BlockDoublePlant.EnumPlantType.GRASS ? (rand.chance(8) ? Items.wheat_seed : null) : super.getDrop(state, rand, fortune)); } } + public boolean isItemColored() { + return this.type == BlockDoublePlant.EnumPlantType.GRASS || this.type == BlockDoublePlant.EnumPlantType.FERN; + } + public int getRenderColor(State state) { return this.type != BlockDoublePlant.EnumPlantType.GRASS && this.type != BlockDoublePlant.EnumPlantType.FERN ? 16777215 : Colorizer.getGrassColor(0.5D, 1.0D); } @@ -175,20 +176,20 @@ public class BlockDoublePlant extends BlockBush implements IGrowable /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ - public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer) + public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer) { worldIn.setState(pos.up(), this.getState().withProperty(HALF, BlockDoublePlant.EnumBlockHalf.UPPER), 2); } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { if (worldIn.client || player.getCurrentEquippedItem() == null || !(player.getCurrentEquippedItem().getItem() instanceof ItemShears) || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player)) { - super.harvestBlock(worldIn, player, pos, state, te); + super.postBroken(worldIn, player, pos, state, te); } } - public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player) + public void preBroken(World worldIn, BlockPos pos, State state, EntityNPC player) { if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER) { @@ -230,7 +231,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable // worldIn.setState(pos.up(), Blocks.air.getState(), 2); // } - super.onBlockHarvested(worldIn, pos, state, player); + super.preBroken(worldIn, pos, state, player); } private boolean onHarvest(World worldIn, BlockPos pos, State state, EntityNPC player) @@ -241,7 +242,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable } else { - spawnAsEntity(worldIn, pos, new ItemStack(this.type == BlockDoublePlant.EnumPlantType.GRASS ? Items.tallgrass : Items.fern, 2)); + dropItem(worldIn, pos, new ItemStack(this.type == BlockDoublePlant.EnumPlantType.GRASS ? Items.tallgrass : Items.fern, 2)); return true; } } @@ -261,7 +262,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable public void grow(AWorldServer worldIn, Random rand, BlockPos pos, State state) { - spawnAsEntity(worldIn, pos, new ItemStack(this.getItem())); + dropItem(worldIn, pos, new ItemStack(this.getItem())); } protected Property[] getProperties() @@ -294,7 +295,7 @@ public class BlockDoublePlant extends BlockBush implements IGrowable return this.getState().withProperty(HALF, EnumBlockHalf.UPPER); } - public StackSize getMaxStackSize() { + public StackSize getMaxAmount() { return StackSize.S; } diff --git a/common/src/main/java/common/block/foliage/BlockDryLeaves.java b/common/src/main/java/common/block/foliage/BlockDryLeaves.java index 3cf006c0..210f333d 100755 --- a/common/src/main/java/common/block/foliage/BlockDryLeaves.java +++ b/common/src/main/java/common/block/foliage/BlockDryLeaves.java @@ -17,15 +17,15 @@ public class BlockDryLeaves extends BlockLeavesBase super(Material.SOFT); this.setTab(CheatTab.PLANTS); this.setHardness(0.2F); - this.setLightOpacity(1); - this.setStepSound(SoundType.GRASS); + this.setOpacity(1); + this.setSound(SoundType.GRASS); this.setFlammable(60, 100); } /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return random.chance(0, 1, 5); } @@ -33,7 +33,7 @@ public class BlockDryLeaves extends BlockLeavesBase /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.stick; } diff --git a/common/src/main/java/common/block/foliage/BlockFarmland.java b/common/src/main/java/common/block/foliage/BlockFarmland.java index ac79f2d7..37861cb8 100755 --- a/common/src/main/java/common/block/foliage/BlockFarmland.java +++ b/common/src/main/java/common/block/foliage/BlockFarmland.java @@ -28,12 +28,12 @@ public class BlockFarmland extends Block { super(Material.LOOSE); this.setDefaultState(this.getBaseState().withProperty(MOISTURE, Integer.valueOf(0))); - this.setTickRandomly(); + this.setTicked(); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F); - this.setLightOpacity(255); + this.setOpacity(255); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos 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)); } @@ -51,7 +51,7 @@ public class BlockFarmland extends Block return false; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { int i = ((Integer)state.getValue(MOISTURE)).intValue(); @@ -77,7 +77,7 @@ public class BlockFarmland extends Block /** * Block's chance to react to a living entity falling on it. */ - public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) + public void onLandUpdate(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) { if (entityIn instanceof EntityLiving) { @@ -87,7 +87,7 @@ public class BlockFarmland extends Block worldIn.setState(pos, Blocks.dirt.getState()); } - super.onFallenUpon(worldIn, pos, entityIn, fallDistance); + super.onLandUpdate(worldIn, pos, entityIn, fallDistance); } } @@ -113,9 +113,9 @@ public class BlockFarmland extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onUpdate(worldIn, pos, state, neighborBlock); if (worldIn.getState(pos.up()).getBlock().getMaterial().isSolid()) { @@ -123,7 +123,7 @@ public class BlockFarmland extends Block } } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { switch (side) { @@ -138,16 +138,16 @@ public class BlockFarmland extends Block return !block.isOpaqueCube() && block != Blocks.farmland; default: - return super.shouldSideBeRendered(worldIn, pos, side); + return super.canRender(worldIn, pos, side); } } /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); + return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune); } protected Property[] getProperties() diff --git a/common/src/main/java/common/block/foliage/BlockFlower.java b/common/src/main/java/common/block/foliage/BlockFlower.java index 5c65d690..bfa4deea 100755 --- a/common/src/main/java/common/block/foliage/BlockFlower.java +++ b/common/src/main/java/common/block/foliage/BlockFlower.java @@ -32,7 +32,7 @@ public class BlockFlower extends BlockBush return this.type; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.flowerDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -40,7 +40,7 @@ public class BlockFlower extends BlockBush Blocks.dead_bush.getState()); return; } - super.updateTick(worldIn, pos, state, rand); + super.tick(worldIn, pos, state, rand); } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockGrass.java b/common/src/main/java/common/block/foliage/BlockGrass.java index a633dda8..f7d484a8 100755 --- a/common/src/main/java/common/block/foliage/BlockGrass.java +++ b/common/src/main/java/common/block/foliage/BlockGrass.java @@ -28,16 +28,15 @@ public class BlockGrass extends Block implements IGrowable { super(Material.LOOSE); this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false))); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.NATURE); - this.setItemColored(); } /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); @@ -47,6 +46,10 @@ public class BlockGrass extends Block implements IGrowable // { // return ColorizerFoliage.getGrassColor(0.5D, 1.0D); // } + + public boolean isItemColored() { + return true; + } public int getRenderColor(State state) { @@ -59,7 +62,7 @@ public class BlockGrass extends Block implements IGrowable return Colorizer.getGrassColor(worldIn, pos); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -96,9 +99,9 @@ public class BlockGrass extends Block implements IGrowable /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); + return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune); } /** @@ -137,7 +140,7 @@ public class BlockGrass extends Block implements IGrowable .add().nswe("grass_side_overlay").tint(); } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {SNOWY}; } } diff --git a/common/src/main/java/common/block/foliage/BlockHugeMushroom.java b/common/src/main/java/common/block/foliage/BlockHugeMushroom.java index f4e9346c..ef908761 100755 --- a/common/src/main/java/common/block/foliage/BlockHugeMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockHugeMushroom.java @@ -53,12 +53,12 @@ public class BlockHugeMushroom extends Block { this.smallBlock = smallBlock; } - protected int quantityDropped(Random random) { + protected int getDropAmount(Random random) { return Math.max(0, random.range(-7, 2)); } - public Item getItemDropped(State state, Random rand, int fortune) { - return this.smallBlock.getItemDropped(state, rand, fortune); + public Item getDrop(State state, Random rand, int fortune) { + return this.smallBlock.getDrop(state, rand, fortune); } protected Property[] getProperties() { diff --git a/common/src/main/java/common/block/foliage/BlockLeaves.java b/common/src/main/java/common/block/foliage/BlockLeaves.java index c147260b..511c6d06 100755 --- a/common/src/main/java/common/block/foliage/BlockLeaves.java +++ b/common/src/main/java/common/block/foliage/BlockLeaves.java @@ -52,13 +52,12 @@ public class BlockLeaves extends BlockLeavesBase this.type = type; this.subType = subType; this.setDefaultState(this.getBaseState().withProperty(DECAY, true).withProperty(BUSH, false)); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.PLANTS); this.setHardness(0.2F); - this.setLightOpacity(1); - this.setStepSound(SoundType.GRASS); + this.setOpacity(1); + this.setSound(SoundType.GRASS); this.setFlammable(30, 60); - this.setItemColored(); LEAVES.add(this); MAPPING[type.ordinal() * LeavesType.values().length + subType.ordinal()] = this; } @@ -67,7 +66,7 @@ public class BlockLeaves extends BlockLeavesBase return this.subType; } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { int i = 1; int j = i + 1; @@ -96,7 +95,7 @@ public class BlockLeaves extends BlockLeavesBase } } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { 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); @@ -217,14 +216,14 @@ public class BlockLeaves extends BlockLeavesBase private void destroy(World worldIn, BlockPos pos) { - this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0); + this.drop(worldIn, pos, worldIn.getState(pos), 0); worldIn.setBlockToAir(pos); } /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return random.chance(0, 1, this.type.getSaplingChance()); } @@ -232,7 +231,7 @@ public class BlockLeaves extends BlockLeavesBase /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return ItemRegistry.byName(this.type.getName() + "_sapling"); } @@ -240,7 +239,7 @@ public class BlockLeaves extends BlockLeavesBase /** * Spawns this Block's drops into the World as EntityItems. */ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) + public void drop(World worldIn, BlockPos pos, State state, float chance, int fortune) { if (!worldIn.client) { @@ -258,8 +257,8 @@ public class BlockLeaves extends BlockLeavesBase if (worldIn.rand.chance(i)) { - Item item = this.getItemDropped(state, worldIn.rand, fortune); - spawnAsEntity(worldIn, pos, new ItemStack(item)); + Item item = this.getDrop(state, worldIn.rand, fortune); + dropItem(worldIn, pos, new ItemStack(item)); } i = this.type.getDropChance(); @@ -275,9 +274,13 @@ public class BlockLeaves extends BlockLeavesBase } if(this.type.getItem() != null && worldIn.rand.chance(i)) // np - spawnAsEntity(worldIn, pos, new ItemStack(ItemRegistry.byName(this.type.getItem()))); + dropItem(worldIn, pos, new ItemStack(ItemRegistry.byName(this.type.getItem()))); } } + + public boolean isItemColored() { + return true; + } public int getRenderColor(State state) { @@ -296,16 +299,16 @@ public class BlockLeaves extends BlockLeavesBase return new Property[] {DECAY, BUSH}; } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { + public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { if(!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { - spawnAsEntity(worldIn, pos, new ItemStack(this.getItem())); + dropItem(worldIn, pos, new ItemStack(this.getItem())); } else { - super.harvestBlock(worldIn, player, pos, state, te); + super.postBroken(worldIn, player, pos, state, te); } } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(DECAY, false).withProperty(BUSH, true); } diff --git a/common/src/main/java/common/block/foliage/BlockLilyPad.java b/common/src/main/java/common/block/foliage/BlockLilyPad.java index 2b8b5950..523eb0a9 100755 --- a/common/src/main/java/common/block/foliage/BlockLilyPad.java +++ b/common/src/main/java/common/block/foliage/BlockLilyPad.java @@ -36,19 +36,17 @@ public class BlockLilyPad extends BlockBush implements Rotatable this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); this.setTab(CheatTab.PLANTS); - this.setFlatBlockTexture(); - this.setItemColored(); } - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { if (collidingEntity == null || !(collidingEntity instanceof EntityBoat)) { - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos 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); } @@ -57,6 +55,10 @@ public class BlockLilyPad extends BlockBush implements Rotatable // { // return 7455580; // } + + public boolean isItemColored() { + return true; + } public int getRenderColor(State state) { @@ -92,7 +94,7 @@ public class BlockLilyPad extends BlockBush implements Rotatable return new Property[] {FACING}; } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } diff --git a/common/src/main/java/common/block/foliage/BlockLog.java b/common/src/main/java/common/block/foliage/BlockLog.java index 8ff716f5..b210dec0 100755 --- a/common/src/main/java/common/block/foliage/BlockLog.java +++ b/common/src/main/java/common/block/foliage/BlockLog.java @@ -23,11 +23,11 @@ public class BlockLog extends BlockRotatedPillar this.setDefaultState(this.getBaseState().withProperty(AXIS, Facing.Axis.Y)); this.setTab(CheatTab.WOOD); this.setHardness(2.0F); - this.setStepSound(SoundType.WOOD); + this.setSound(SoundType.WOOD); this.setFlammable(5, 5); } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { int r = 4; int l = r + 1; @@ -46,9 +46,9 @@ public class BlockLog extends BlockRotatedPillar } } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { - return super.onBlockPlaced(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()); } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockMelon.java b/common/src/main/java/common/block/foliage/BlockMelon.java index a55fb41e..473f6cb2 100755 --- a/common/src/main/java/common/block/foliage/BlockMelon.java +++ b/common/src/main/java/common/block/foliage/BlockMelon.java @@ -16,16 +16,16 @@ public class BlockMelon extends Block { this.setTab(CheatTab.PLANTS); } - public Item getItemDropped(State state, Random rand, int fortune) { + public Item getDrop(State state, Random rand, int fortune) { return Items.melon; } - protected int quantityDropped(Random random) { + protected int getDropAmount(Random random) { return random.range(3, 7); } - protected int quantityDroppedWithBonus(int fortune, Random random) { - return Math.min(9, this.quantityDropped(random) + random.zrange(1 + fortune)); + protected int getDropAmount(int fortune, Random random) { + return Math.min(9, this.getDropAmount(random) + random.zrange(1 + fortune)); } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/foliage/BlockMushroom.java b/common/src/main/java/common/block/foliage/BlockMushroom.java index 61bf4f61..f1f7a36d 100755 --- a/common/src/main/java/common/block/foliage/BlockMushroom.java +++ b/common/src/main/java/common/block/foliage/BlockMushroom.java @@ -19,10 +19,10 @@ public class BlockMushroom extends BlockBush implements IGrowable { float f = 0.2F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); - this.setTickRandomly(); + this.setTicked(); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if (Vars.shroomGrowth > 0 && rand.chance(Vars.shroomGrowth)) { @@ -61,9 +61,9 @@ public class BlockMushroom extends BlockBush implements IGrowable } } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return super.canPlaceBlockAt(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState()); + return super.canPlace(worldIn, pos) && this.canBlockStay(worldIn, pos, this.getState()); } /** diff --git a/common/src/main/java/common/block/foliage/BlockMycelium.java b/common/src/main/java/common/block/foliage/BlockMycelium.java index e8ce8f44..39f2dd1d 100755 --- a/common/src/main/java/common/block/foliage/BlockMycelium.java +++ b/common/src/main/java/common/block/foliage/BlockMycelium.java @@ -26,7 +26,7 @@ public class BlockMycelium extends Block { super(Material.LOOSE); this.setDefaultState(this.getBaseState().withProperty(SNOWY, Boolean.valueOf(false))); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.NATURE); } @@ -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 * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -69,9 +69,9 @@ public class BlockMycelium extends Block // } } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { - super.randomDisplayTick(worldIn, pos, state, rand); + super.displayTick(worldIn, pos, state, rand); if (rand.chance(10)) { @@ -82,9 +82,9 @@ public class BlockMycelium extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return Blocks.dirt.getItemDropped(Blocks.dirt.getState(), rand, fortune); + return Blocks.dirt.getDrop(Blocks.dirt.getState(), rand, fortune); } protected Property[] getProperties() @@ -99,7 +99,7 @@ public class BlockMycelium extends Block return provider.getModel("mycelium_side").add().nswe().d("dirt").u("mycelium_top"); } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {SNOWY}; } } diff --git a/common/src/main/java/common/block/foliage/BlockPotato.java b/common/src/main/java/common/block/foliage/BlockPotato.java index 694f3d5b..f3310be5 100755 --- a/common/src/main/java/common/block/foliage/BlockPotato.java +++ b/common/src/main/java/common/block/foliage/BlockPotato.java @@ -26,15 +26,15 @@ public class BlockPotato extends BlockCrops /** * Spawns this Block's drops into the World as EntityItems. */ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) + public void drop(World worldIn, BlockPos pos, State state, float chance, int fortune) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + super.drop(worldIn, pos, state, chance, fortune); if (!worldIn.client) { if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.chance(50)) { - spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato)); + dropItem(worldIn, pos, new ItemStack(Items.poisonous_potato)); } } } diff --git a/common/src/main/java/common/block/foliage/BlockPumpkin.java b/common/src/main/java/common/block/foliage/BlockPumpkin.java index c6f572dc..06f7b1af 100755 --- a/common/src/main/java/common/block/foliage/BlockPumpkin.java +++ b/common/src/main/java/common/block/foliage/BlockPumpkin.java @@ -15,7 +15,7 @@ public class BlockPumpkin extends Block { this.setTab(CheatTab.PLANTS); } - public boolean canPlaceBlockAt(World world, BlockPos pos) { + public boolean canPlace(World world, BlockPos pos) { return world.getState(pos).getBlock().getMaterial().isReplaceable() && world.isBlockSolid(pos.down()); } diff --git a/common/src/main/java/common/block/foliage/BlockReed.java b/common/src/main/java/common/block/foliage/BlockReed.java index 08f031c8..44b50b61 100755 --- a/common/src/main/java/common/block/foliage/BlockReed.java +++ b/common/src/main/java/common/block/foliage/BlockReed.java @@ -31,10 +31,10 @@ public class BlockReed extends Block this.setDefaultState(this.getBaseState().withProperty(AGE, Integer.valueOf(0))); float f = 0.375F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f); - this.setTickRandomly(); + this.setTicked(); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.reedDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -70,7 +70,7 @@ public class BlockReed extends Block } } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { Block block = worldIn.getState(pos.down()).getBlock(); @@ -99,7 +99,7 @@ public class BlockReed extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { this.checkForDrop(worldIn, pos, state); } @@ -112,7 +112,7 @@ public class BlockReed extends Block } else { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); return false; } @@ -120,10 +120,10 @@ public class BlockReed extends Block public boolean canBlockStay(World worldIn, BlockPos pos) { - return this.canPlaceBlockAt(worldIn, pos); + return this.canPlace(worldIn, pos); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -164,7 +164,7 @@ public class BlockReed extends Block return new Property[] {AGE}; } - public StackSize getMaxStackSize() { + public StackSize getMaxAmount() { return StackSize.L; } diff --git a/common/src/main/java/common/block/foliage/BlockSapling.java b/common/src/main/java/common/block/foliage/BlockSapling.java index 1b6344e2..a25552ad 100755 --- a/common/src/main/java/common/block/foliage/BlockSapling.java +++ b/common/src/main/java/common/block/foliage/BlockSapling.java @@ -46,7 +46,7 @@ public class BlockSapling extends BlockBush implements IGrowable // return I18n.translate(this.getUnlocalizedName() + "." + BlockPlanks.EnumType.OAK.getUnlocalizedName() + ".name"); // } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.saplingDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -56,7 +56,7 @@ public class BlockSapling extends BlockBush implements IGrowable } // if (!worldIn.client) // { - super.updateTick(worldIn, pos, state, rand); + super.tick(worldIn, pos, state, rand); if (Vars.treeGrowth > 0 && worldIn.getLightFromNeighbors(pos.up()) >= 9 && rand.chance(Vars.treeGrowth)) { diff --git a/common/src/main/java/common/block/foliage/BlockStem.java b/common/src/main/java/common/block/foliage/BlockStem.java index f88c9a86..6f7f7e5f 100755 --- a/common/src/main/java/common/block/foliage/BlockStem.java +++ b/common/src/main/java/common/block/foliage/BlockStem.java @@ -31,7 +31,7 @@ public class BlockStem extends BlockBush implements IGrowable { this.setDefaultState(this.getBaseState().withProperty(AGE, 0)); this.crop = crop; - this.setTickRandomly(); + this.setTicked(); float f = 0.125F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); this.setTab((CheatTab)null); @@ -45,9 +45,9 @@ public class BlockStem extends BlockBush implements IGrowable return ground == Blocks.farmland; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { - super.updateTick(worldIn, pos, state, rand); + super.tick(worldIn, pos, state, rand); if (Vars.stemGrowth > 0 && worldIn.getLightFromNeighbors(pos.up()) >= 9) { @@ -111,13 +111,13 @@ public class BlockStem extends BlockBush implements IGrowable /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { float f = 0.125F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.maxY = (double)((float)(((Integer)worldIn.getState(pos).getValue(AGE)).intValue() * 2 + 2) / 16.0F); float f = 0.125F; @@ -127,9 +127,9 @@ public class BlockStem extends BlockBush implements IGrowable /** * Spawns this Block's drops into the World as EntityItems. */ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) + public void drop(World worldIn, BlockPos pos, State state, float chance, int fortune) { - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + super.drop(worldIn, pos, state, chance, fortune); if (!worldIn.client) { @@ -139,7 +139,7 @@ public class BlockStem extends BlockBush implements IGrowable { if (worldIn.rand.zrange(15) <= i) { - spawnAsEntity(worldIn, pos, new ItemStack(this == Blocks.melon_stem ? Items.melon_seed : Items.pumpkin_seed)); + dropItem(worldIn, pos, new ItemStack(this == Blocks.melon_stem ? Items.melon_seed : Items.pumpkin_seed)); } } } diff --git a/common/src/main/java/common/block/foliage/BlockTallGrass.java b/common/src/main/java/common/block/foliage/BlockTallGrass.java index 708ab0b2..d7d7844b 100755 --- a/common/src/main/java/common/block/foliage/BlockTallGrass.java +++ b/common/src/main/java/common/block/foliage/BlockTallGrass.java @@ -38,8 +38,6 @@ public class BlockTallGrass extends BlockBush implements IGrowable float f = 0.4F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f); this.setFlammable(60, 100); - this.setFlatBlockTexture(); - this.setItemColored(); BUSHES[type.ordinal()] = this; } @@ -47,7 +45,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable return this.type; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.tallgrassDry && worldIn.getTemperatureC(pos) >= 50.0f && this.type != EnumType.DEAD_BUSH) { @@ -55,7 +53,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable Blocks.dead_bush.getState()); return; } - super.updateTick(worldIn, pos, state, rand); + super.tick(worldIn, pos, state, rand); } public boolean canBlockStay(World worldIn, BlockPos pos, State state) @@ -66,10 +64,14 @@ public class BlockTallGrass extends BlockBush implements IGrowable /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, BlockPos pos) { return true; } + + public boolean isItemColored() { + return true; + } public int getRenderColor(State state) { @@ -91,7 +93,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return rand.chance(8) ? Items.wheat_seed : null; } @@ -99,20 +101,20 @@ public class BlockTallGrass extends BlockBush implements IGrowable /** * Get the quantity dropped based on the given fortune level */ - protected int quantityDroppedWithBonus(int fortune, Random random) + protected int getDropAmount(int fortune, Random random) { return random.roll(fortune * 2 + 1); } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { - spawnAsEntity(worldIn, pos, new ItemStack(this.getItem())); + dropItem(worldIn, pos, new ItemStack(this.getItem())); } else { - super.harvestBlock(worldIn, player, pos, state, te); + super.postBroken(worldIn, player, pos, state, te); } } @@ -138,7 +140,7 @@ public class BlockTallGrass extends BlockBush implements IGrowable block = Blocks.large_fern; } - if (block.canPlaceBlockAt(worldIn, pos)) + if (block.canPlace(worldIn, pos)) { block.placeAt(worldIn, pos, 2); } diff --git a/common/src/main/java/common/block/foliage/BlockTianSoil.java b/common/src/main/java/common/block/foliage/BlockTianSoil.java index 20bb3d2b..cbbf08bc 100755 --- a/common/src/main/java/common/block/foliage/BlockTianSoil.java +++ b/common/src/main/java/common/block/foliage/BlockTianSoil.java @@ -25,15 +25,15 @@ public class BlockTianSoil extends Block this.setTab(CheatTab.NATURE); } - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return Blocks.tian.getItemDropped(Blocks.tian.getState(), rand, fortune); + return Blocks.tian.getDrop(Blocks.tian.getState(), rand, fortune); } protected Property[] getProperties() @@ -48,7 +48,7 @@ public class BlockTianSoil extends Block return provider.getModel("tian_soil_side").add().nswe().d("tian").u("tian_soil_top"); } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {SNOWY}; } } diff --git a/common/src/main/java/common/block/foliage/BlockVine.java b/common/src/main/java/common/block/foliage/BlockVine.java index ea89fe0f..a7bffc66 100755 --- a/common/src/main/java/common/block/foliage/BlockVine.java +++ b/common/src/main/java/common/block/foliage/BlockVine.java @@ -42,26 +42,24 @@ public class BlockVine extends Block { super(Material.BUSH); this.setDefaultState(this.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.PLANTS); this.setFlammable(15, 100); - this.setFlatBlockTexture(); - this.setItemColored(); } /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { - return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock().isBlockNormalCube())); + return state.withProperty(UP, Boolean.valueOf(worldIn.getState(pos.up()).getBlock().isBlockingCube())); } /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -82,12 +80,12 @@ public class BlockVine extends Block /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, BlockPos pos) { return true; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { float f = 0.0625F; float f1 = 1.0F; @@ -155,7 +153,7 @@ public class BlockVine extends Block this.setBlockBounds(f1, f2, f3, f4, f5, f6); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -163,7 +161,7 @@ public class BlockVine extends Block /** * Check whether this Block can be placed on the given side */ - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, BlockPos pos, Facing side) { switch (side) { @@ -224,6 +222,10 @@ public class BlockVine extends Block // { // return ColorizerFoliage.getFoliageColorBasic(); // } + + public boolean isItemColored() { + return true; + } public int getRenderColor(State state) { @@ -238,16 +240,16 @@ public class BlockVine extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!worldIn.client && !this.recheckGrownSides(worldIn, pos, state)) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.vineDry && worldIn.getTemperatureC(pos) >= 50.0f) { @@ -403,7 +405,7 @@ public class BlockVine extends Block * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)); return facing.getAxis().isHorizontal() ? iblockstate.withProperty(getPropertyFor(facing.getOpposite()), Boolean.valueOf(true)) : iblockstate; @@ -412,7 +414,7 @@ public class BlockVine extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return null; } @@ -420,21 +422,21 @@ public class BlockVine extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { if (!worldIn.client && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() instanceof ItemShears) { // player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); - spawnAsEntity(worldIn, pos, new ItemStack(Items.vine)); + dropItem(worldIn, pos, new ItemStack(Items.vine)); } else { - super.harvestBlock(worldIn, player, pos, state, te); + super.postBroken(worldIn, player, pos, state, te); } } @@ -562,7 +564,7 @@ public class BlockVine extends Block return Transform.PANE_SIDE; } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {UP}; } } diff --git a/common/src/main/java/common/block/foliage/BlockWart.java b/common/src/main/java/common/block/foliage/BlockWart.java index cd30eaa2..ffb5876a 100755 --- a/common/src/main/java/common/block/foliage/BlockWart.java +++ b/common/src/main/java/common/block/foliage/BlockWart.java @@ -28,7 +28,7 @@ public class BlockWart extends BlockBush { super(Material.PLANT); this.setDefaultState(this.getBaseState().withProperty(AGE, Integer.valueOf(0))); - this.setTickRandomly(); + this.setTicked(); float f = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); this.setTab((CheatTab)null); @@ -47,7 +47,7 @@ public class BlockWart extends BlockBush return this.canPlaceBlockOn(worldIn.getState(pos.down()).getBlock()); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.wartGrowth > 0) { int i = ((Integer)state.getValue(AGE)).intValue(); @@ -59,13 +59,13 @@ public class BlockWart extends BlockBush } } - super.updateTick(worldIn, pos, state, rand); + super.tick(worldIn, pos, state, rand); } /** * Spawns this Block's drops into the World as EntityItems. */ - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) + public void drop(World worldIn, BlockPos pos, State state, float chance, int fortune) { if (!worldIn.client) { @@ -83,7 +83,7 @@ public class BlockWart extends BlockBush for (int j = 0; j < i; ++j) { - spawnAsEntity(worldIn, pos, new ItemStack(Items.soul_wart)); + dropItem(worldIn, pos, new ItemStack(Items.soul_wart)); } } } @@ -91,7 +91,7 @@ public class BlockWart extends BlockBush /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } diff --git a/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java b/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java index bec5174e..7bf0f756 100755 --- a/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockDynamicLiquid.java @@ -42,7 +42,7 @@ public class BlockDynamicLiquid extends BlockLiquid worldIn.setState(pos, this.staticBlock.getState().withProperty(LEVEL, currentState.getValue(LEVEL)), 2); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(!Vars.liquidPhysics) return; @@ -189,7 +189,7 @@ public class BlockDynamicLiquid extends BlockLiquid } else { - state.getBlock().dropBlockAsItem(worldIn, pos, state, 0); + state.getBlock().drop(worldIn, pos, state, 0); } } @@ -306,7 +306,7 @@ public class BlockDynamicLiquid extends BlockLiquid return (this.material == Material.LAVA || !(state.getBlock() instanceof BlockLiquid) || (state.getBlock() instanceof BlockStaticLiquid ? ((BlockStaticLiquid)state.getBlock()).getFlowingBlock() : state.getBlock()) == this) && material != this.material && material != Material.LAVA && !this.isBlocked(worldIn, pos, state); } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { if (!this.checkForMixing(worldIn, pos, state)) { diff --git a/common/src/main/java/common/block/liquid/BlockLiquid.java b/common/src/main/java/common/block/liquid/BlockLiquid.java index 6860e29e..117b6434 100755 --- a/common/src/main/java/common/block/liquid/BlockLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockLiquid.java @@ -46,7 +46,7 @@ public abstract class BlockLiquid extends Block this.setDefaultState(this.getBaseState().withProperty(LEVEL, Integer.valueOf(0))); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); if(tick) - this.setTickRandomly(); + this.setTicked(); this.opaque = opaque; this.flowRate = rate; this.animation = animation; @@ -103,7 +103,7 @@ public abstract class BlockLiquid extends Block return false; } - public boolean canCollideCheck(State state, boolean liquid) + public boolean canRayTrace(State state, boolean liquid) { return liquid && ((Integer)state.getValue(LEVEL)).intValue() == 0; } @@ -114,9 +114,9 @@ public abstract class BlockLiquid extends Block return block.getMaterial() == this.material ? false : (side == Facing.UP ? true : (block != Blocks.ice && worldIn.getState(pos).getBlock().getMaterial().isSolid())); } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { - return worldIn.getState(pos).getBlock().getMaterial() == this.material ? false : (side == Facing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side)); + return worldIn.getState(pos).getBlock().getMaterial() == this.material ? false : (side == Facing.UP ? true : super.canRender(worldIn, pos, side)); } public boolean shouldRenderSides(IBlockAccess blockAccess, BlockPos pos) @@ -139,7 +139,7 @@ public abstract class BlockLiquid extends Block return false; } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -155,7 +155,7 @@ public abstract class BlockLiquid extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return null; } @@ -163,7 +163,7 @@ public abstract class BlockLiquid extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } @@ -215,7 +215,7 @@ public abstract class BlockLiquid extends Block return vec3.normalize(); } - public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) + public Vec3 getAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) { return motion.add(this.getFlowVector(worldIn, pos)); } @@ -228,7 +228,7 @@ public abstract class BlockLiquid extends Block return this.flowRate >= 0 ? this.flowRate : (worldIn.isLavaFaster(pos) ? (-this.flowRate / 3) : (-this.flowRate)); } - public int getMixedBrightnessForBlock(IWorldAccess worldIn, BlockPos pos) + public int getLightmapValue(IWorldAccess worldIn, BlockPos pos) { int i = worldIn.getCombinedLight(pos, 0); int j = worldIn.getCombinedLight(pos.up(), 0); @@ -244,7 +244,7 @@ public abstract class BlockLiquid extends Block return this.opaque ? BlockLayer.SOLID : BlockLayer.TRANSLUCENT; } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { double d0 = (double)pos.getX(); double d1 = (double)pos.getY(); @@ -287,7 +287,7 @@ public abstract class BlockLiquid extends Block return vec3.xCoord == 0.0D && vec3.zCoord == 0.0D ? -1000.0D : ExtMath.atan2(vec3.zCoord, vec3.xCoord) - (Math.PI / 2D); } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { this.checkForMixing(worldIn, pos, state); } @@ -295,7 +295,7 @@ public abstract class BlockLiquid extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { this.checkForMixing(worldIn, pos, state); } diff --git a/common/src/main/java/common/block/liquid/BlockStaticLiquid.java b/common/src/main/java/common/block/liquid/BlockStaticLiquid.java index f8a74ea4..d59ecc14 100755 --- a/common/src/main/java/common/block/liquid/BlockStaticLiquid.java +++ b/common/src/main/java/common/block/liquid/BlockStaticLiquid.java @@ -34,7 +34,7 @@ public class BlockStaticLiquid extends BlockLiquid /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!this.checkForMixing(worldIn, pos, state)) { @@ -48,7 +48,7 @@ public class BlockStaticLiquid extends BlockLiquid worldIn.scheduleUpdate(pos, this.dynamicBlock, this.tickRate(worldIn, pos)); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if (Vars.lavaFire && this.material == Material.LAVA) { diff --git a/common/src/main/java/common/block/natural/BlockBedrock.java b/common/src/main/java/common/block/natural/BlockBedrock.java index 7f8b8d7a..f01d4d72 100755 --- a/common/src/main/java/common/block/natural/BlockBedrock.java +++ b/common/src/main/java/common/block/natural/BlockBedrock.java @@ -13,7 +13,7 @@ public class BlockBedrock extends Block { super(Material.SOLID); } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { if(/* worldIn.canShowVoidParticles() && */ pos.getY() <= 5 && rand.chance(8)) { worldIn.spawnParticle(ParticleType.DEPTH, (double)pos.getX() + rand.floatv(), (double)(pos.getY()+1) + (rand.floatv() * 0.5f), diff --git a/common/src/main/java/common/block/natural/BlockBlackenedDirt.java b/common/src/main/java/common/block/natural/BlockBlackenedDirt.java index c6e0fa08..26f74bf7 100644 --- a/common/src/main/java/common/block/natural/BlockBlackenedDirt.java +++ b/common/src/main/java/common/block/natural/BlockBlackenedDirt.java @@ -16,11 +16,11 @@ public class BlockBlackenedDirt extends Block public BlockBlackenedDirt() { super(Material.LOOSE); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.NATURE); } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if (Vars.darkDirtSpread) { diff --git a/common/src/main/java/common/block/natural/BlockBlackenedStone.java b/common/src/main/java/common/block/natural/BlockBlackenedStone.java index f2373c7b..03b216f5 100644 --- a/common/src/main/java/common/block/natural/BlockBlackenedStone.java +++ b/common/src/main/java/common/block/natural/BlockBlackenedStone.java @@ -14,7 +14,7 @@ public class BlockBlackenedStone extends Block { this.setTab(CheatTab.ROCK); } - public Item getItemDropped(State state, Random rand, int fortune) { + public Item getDrop(State state, Random rand, int fortune) { return Items.blackened_cobble; } } diff --git a/common/src/main/java/common/block/natural/BlockClay.java b/common/src/main/java/common/block/natural/BlockClay.java index 8eb2d534..3beac4de 100755 --- a/common/src/main/java/common/block/natural/BlockClay.java +++ b/common/src/main/java/common/block/natural/BlockClay.java @@ -19,7 +19,7 @@ public class BlockClay extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.clay_ball; } @@ -27,7 +27,7 @@ public class BlockClay extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 4; } diff --git a/common/src/main/java/common/block/natural/BlockFire.java b/common/src/main/java/common/block/natural/BlockFire.java index 819d4e11..7c8f6420 100755 --- a/common/src/main/java/common/block/natural/BlockFire.java +++ b/common/src/main/java/common/block/natural/BlockFire.java @@ -43,7 +43,7 @@ public class BlockFire extends Block * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { int i = pos.getX(); int j = pos.getY(); @@ -72,10 +72,10 @@ public class BlockFire extends Block { super(Material.FIRE); this.setDefaultState(this.getBaseState().withProperty(AGE, Integer.valueOf(0)).withProperty(FLIP, Boolean.valueOf(false)).withProperty(ALT, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false)).withProperty(UPPER, Integer.valueOf(0))); - this.setTickRandomly(); + this.setTicked(); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -96,7 +96,7 @@ public class BlockFire extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } @@ -109,11 +109,11 @@ public class BlockFire extends Block return 30; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if (Vars.fire) { - if (!this.canPlaceBlockAt(worldIn, pos)) + if (!this.canPlace(worldIn, pos)) { worldIn.setBlockToAir(pos); } @@ -231,7 +231,7 @@ public class BlockFire extends Block return world.isRaining() && (world.isRainingAt(pos, true) || world.isRainingAt(pos.west(), true) || world.isRainingAt(pos.east(), true) || world.isRainingAt(pos.north(), true) || world.isRainingAt(pos.south(), true)); } - public boolean requiresUpdates() + public boolean canTick() { return false; } @@ -260,7 +260,7 @@ public class BlockFire extends Block world.setBlockToAir(pos); } - iblockstate.getBlock().onDestroyedByFire(world, pos, iblockstate); + iblockstate.getBlock().onDestroyedFire(world, pos, iblockstate); // if (iblockstate.getBlock() == Blocks.tnt) // { // Blocks.tnt.onBlockDestroyedByPlayer(worldIn, pos, iblockstate.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); @@ -300,13 +300,9 @@ public class BlockFire extends Block } } - /** - * Returns if this block is collidable (only used by Fire). Args: x, y, z - */ - public boolean isCollidable() - { - return false; - } + public boolean canRayTrace(State state, boolean liquid) { + return false; + } /** * Checks if the block can be caught on fire @@ -316,7 +312,7 @@ public class BlockFire extends Block return worldIn.getState(pos).getBlock().getEncouragement() > 0; } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { return worldIn.isBlockSolid(pos.down()) || this.canNeighborCatchFire(worldIn, pos); } @@ -324,7 +320,7 @@ public class BlockFire extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!worldIn.isBlockSolid(pos.down()) && !this.canNeighborCatchFire(worldIn, pos)) { @@ -332,7 +328,7 @@ public class BlockFire extends Block } } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { if ( // (worldIn.dimension.getDimensionId() < -1 || worldIn.dimension.getDimensionId() > 0) || !Blocks.portal.tryIgnitePortal(worldIn, pos, worldIn.rand.zrange(8))) @@ -348,7 +344,7 @@ public class BlockFire extends Block } } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { if (rand.chance(24)) { @@ -1141,7 +1137,7 @@ public class BlockFire extends Block return false; } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {NORTH, SOUTH, UPPER, FLIP, WEST, EAST, ALT}; } } diff --git a/common/src/main/java/common/block/natural/BlockGlowstone.java b/common/src/main/java/common/block/natural/BlockGlowstone.java index 3336e7ba..1e21a395 100755 --- a/common/src/main/java/common/block/natural/BlockGlowstone.java +++ b/common/src/main/java/common/block/natural/BlockGlowstone.java @@ -23,15 +23,15 @@ public class BlockGlowstone extends Block /** * Get the quantity dropped based on the given fortune level */ - protected int quantityDroppedWithBonus(int fortune, Random random) + protected int getDropAmount(int fortune, Random random) { - return ExtMath.clampi(this.quantityDropped(random) + random.zrange(fortune + 1), 1, 4); + return ExtMath.clampi(this.getDropAmount(random) + random.zrange(fortune + 1), 1, 4); } /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return random.range(2, 4); } @@ -39,7 +39,7 @@ public class BlockGlowstone extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.glowstone_dust; } diff --git a/common/src/main/java/common/block/natural/BlockGravel.java b/common/src/main/java/common/block/natural/BlockGravel.java index 1a26a185..4686143f 100755 --- a/common/src/main/java/common/block/natural/BlockGravel.java +++ b/common/src/main/java/common/block/natural/BlockGravel.java @@ -16,15 +16,15 @@ public class BlockGravel extends BlockFalling this.setTab(CheatTab.NATURE); } - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { int chance = Vars.flintChance; if(chance <= 0) - return super.getItemDropped(state, rand, fortune); + return super.getDrop(state, rand, fortune); fortune *= 3; if(fortune >= chance) fortune = chance - 1; - return rand.chance(chance - fortune) ? Items.flint : super.getItemDropped(state, rand, fortune); + return rand.chance(chance - fortune) ? Items.flint : super.getDrop(state, rand, fortune); } // public MapColor getMapColor(IBlockState state) diff --git a/common/src/main/java/common/block/natural/BlockIce.java b/common/src/main/java/common/block/natural/BlockIce.java index 6022a08c..3fdaa8a2 100755 --- a/common/src/main/java/common/block/natural/BlockIce.java +++ b/common/src/main/java/common/block/natural/BlockIce.java @@ -18,38 +18,38 @@ import common.world.AWorldServer; public class BlockIce extends BlockTranslucent { public BlockIce() { super(Material.TRANSLUCENT); - this.slipperiness = 0.98F; - this.setTickRandomly(); + this.setSlipperiness(0.98F); + this.setTicked(); this.setTab(CheatTab.NATURE); } - public void harvestBlock(World world, EntityNPC player, BlockPos pos, State state, TileEntity tile) { + public void postBroken(World world, EntityNPC player, BlockPos pos, State state, TileEntity tile) { if(this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player)) { - super.harvestBlock(world, player, pos, state, tile); + super.postBroken(world, player, pos, state, tile); } else { if(world.doesWaterVaporize(pos)) { world.setBlockToAir(pos); return; } - super.harvestBlock(world, player, pos, state, tile); + super.postBroken(world, player, pos, state, tile); Material material = world.getState(pos.down()).getBlock().getMaterial(); if(material.blocksMovement() || material.isLiquid()) world.setState(pos, Blocks.flowing_water.getState()); } } - protected int quantityDropped(Random rand) { + protected int getDropAmount(Random rand) { return 0; } - public void updateTick(AWorldServer world, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { if(Vars.iceMelt && (world.getLightFor(LightType.BLOCK, pos) > 11 - this.getLightOpacity() || !world.canFreezeAt(pos))) { if(world.doesWaterVaporize(pos)) { world.setBlockToAir(pos); } else { - this.dropBlockAsItem(world, pos, world.getState(pos), 0); + this.drop(world, pos, world.getState(pos), 0); world.setState(pos, Blocks.water.getState()); } } diff --git a/common/src/main/java/common/block/natural/BlockMetalOre.java b/common/src/main/java/common/block/natural/BlockMetalOre.java index 1261c632..5ea107b0 100644 --- a/common/src/main/java/common/block/natural/BlockMetalOre.java +++ b/common/src/main/java/common/block/natural/BlockMetalOre.java @@ -16,8 +16,8 @@ public class BlockMetalOre extends BlockOre { public BlockMetalOre(MetalType metal) { this.metal = metal; - this.setStepSound(SoundType.STONE); - this.setLightLevel(metal.radioactivity > 0.0F ? 0.25F : 0.0F); + this.setSound(SoundType.STONE); + this.setLight(metal.radioactivity > 0.0F ? 0.25F : 0.0F); this.setRadiation(metal.radioactivity * 0.5f); } @@ -29,7 +29,7 @@ public class BlockMetalOre extends BlockOre { return this.metal.isMagnetic(); } - public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) + public void getTooltips(ItemStack stack, EntityNPC playerIn, List tooltip) { tooltip.add(this.metal.formatSymbol()); if(this.metal.radioactivity > 0.0f) { diff --git a/common/src/main/java/common/block/natural/BlockObsidian.java b/common/src/main/java/common/block/natural/BlockObsidian.java index a4b20d34..897554b5 100755 --- a/common/src/main/java/common/block/natural/BlockObsidian.java +++ b/common/src/main/java/common/block/natural/BlockObsidian.java @@ -19,7 +19,7 @@ public class BlockObsidian extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.obsidian; } diff --git a/common/src/main/java/common/block/natural/BlockOre.java b/common/src/main/java/common/block/natural/BlockOre.java index 0260eab8..2d0e2da4 100755 --- a/common/src/main/java/common/block/natural/BlockOre.java +++ b/common/src/main/java/common/block/natural/BlockOre.java @@ -46,9 +46,9 @@ public class BlockOre extends Block this.smeltItem = item; } - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { - return this.dropItem == null ? super.getItemDropped(state, rand, fortune) : this.dropItem.getItem(); + return this.dropItem == null ? super.getDrop(state, rand, fortune) : this.dropItem.getItem(); // this == Blocks.coal_ore ? Items.coal : // (this == Blocks.diamond_ore ? Items.diamond : // (this == Blocks.lapis_ore ? Items.dye : @@ -57,16 +57,16 @@ public class BlockOre extends Block // this.getItem())))); } - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return this.dropItem == null ? 1 : (this.dropItem.getSize() + (this.dropChance > 0 ? random.zrange(this.dropChance + 1) : 0)); // this == Blocks.lapis_ore ? 4 + random.nextInt(5) : 1; } - protected int quantityDroppedWithBonus(int fortune, Random random) + protected int getDropAmount(int fortune, Random random) { if (fortune > 0 && - this.getItem() != this.getItemDropped(this.getState(), random, fortune)) + this.getItem() != this.getDrop(this.getState(), random, fortune)) { int i = random.zrange(fortune + 2) - 1; @@ -75,27 +75,27 @@ public class BlockOre extends Block i = 0; } - return this.quantityDropped(random) * (i + 1); + return this.getDropAmount(random) * (i + 1); } else { - return this.quantityDropped(random); + return this.getDropAmount(random); } } - public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, State state, float chance, int fortune) + public void drop(World worldIn, BlockPos pos, State state, float chance, int fortune) { if(!worldIn.client && this.smeltItem != null && Vars.cleanCut) { if (worldIn.rand.floatv() <= chance) { - spawnAsEntity(worldIn, pos, this.smeltItem.copy()); + dropItem(worldIn, pos, this.smeltItem.copy()); } return; } - super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune); + super.drop(worldIn, pos, state, chance, fortune); - if (this.getItemDropped(state, worldIn.rand, fortune) != this.getItem()) + if (this.getDrop(state, worldIn.rand, fortune) != this.getItem()) { int i = worldIn.rand.range(this.minExperience, this.maxExperience); @@ -120,7 +120,7 @@ public class BlockOre extends Block // i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); // } - this.dropXpOnBlockBreak(worldIn, pos, i); + dropExperience(worldIn, pos, i); } } diff --git a/common/src/main/java/common/block/natural/BlockPackedIce.java b/common/src/main/java/common/block/natural/BlockPackedIce.java index 322fa2b7..b15822eb 100755 --- a/common/src/main/java/common/block/natural/BlockPackedIce.java +++ b/common/src/main/java/common/block/natural/BlockPackedIce.java @@ -10,14 +10,14 @@ public class BlockPackedIce extends Block public BlockPackedIce() { super(Material.LOOSE); - this.slipperiness = 0.98F; + this.setSlipperiness(0.98F); this.setTab(CheatTab.NATURE); } /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } diff --git a/common/src/main/java/common/block/natural/BlockPodzol.java b/common/src/main/java/common/block/natural/BlockPodzol.java index 38979a15..48319ab2 100644 --- a/common/src/main/java/common/block/natural/BlockPodzol.java +++ b/common/src/main/java/common/block/natural/BlockPodzol.java @@ -24,7 +24,7 @@ public class BlockPodzol extends Block { this.setTab(CheatTab.NATURE); } - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) { + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { Block block = worldIn.getState(pos.up()).getBlock(); return state.withProperty(SNOWY, Boolean.valueOf(block == Blocks.snow || block == Blocks.snow_layer)); } @@ -33,7 +33,7 @@ public class BlockPodzol extends Block { return new Property[] {SNOWY}; } - public Item getItemDropped(State state, Random rand, int fortune) { + public Item getDrop(State state, Random rand, int fortune) { return Items.dirt; } @@ -42,7 +42,7 @@ public class BlockPodzol extends Block { : provider.getModel("dirt_podzol_side").add().nswe().d("dirt").u("dirt_podzol_top"); } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {SNOWY}; } } diff --git a/common/src/main/java/common/block/natural/BlockSlime.java b/common/src/main/java/common/block/natural/BlockSlime.java index 1d1f6f6f..17a3b39c 100755 --- a/common/src/main/java/common/block/natural/BlockSlime.java +++ b/common/src/main/java/common/block/natural/BlockSlime.java @@ -31,30 +31,30 @@ public class BlockSlime extends BlockTranslucent { public BlockSlime() { super(Material.LOOSE); this.setTab(CheatTab.TECHNOLOGY); - this.slipperiness = 0.8F; + this.setSlipperiness(0.8F); } - public void onFallenUpon(World world, BlockPos pos, Entity entity, float distance) { + public void onLandUpdate(World world, BlockPos pos, Entity entity, float distance) { if(entity.isSneaking()) - super.onFallenUpon(world, pos, entity, distance); + super.onLandUpdate(world, pos, entity, distance); else entity.fall(distance, 0.0F); } - public void onLanded(World world, Entity entity) { + public void onLandMove(World world, Entity entity) { if(entity.isSneaking()) - super.onLanded(world, entity); + super.onLandMove(world, entity); else if(entity.motionY < 0.0D) entity.motionY = -entity.motionY; } - public void onEntityCollidedWithBlock(World world, BlockPos pos, Entity entity) { + public void onCollideMove(World world, BlockPos pos, Entity entity) { if(Math.abs(entity.motionY) < 0.1D && !entity.isSneaking()) { double friction = 0.4D + Math.abs(entity.motionY) * 0.2D; entity.motionX *= friction; entity.motionZ *= friction; } - super.onEntityCollidedWithBlock(world, pos, entity); + super.onCollideMove(world, pos, entity); } public Model getModel(ModelProvider provider, String name, State state) { diff --git a/common/src/main/java/common/block/natural/BlockSnow.java b/common/src/main/java/common/block/natural/BlockSnow.java index d69a590f..995ff950 100755 --- a/common/src/main/java/common/block/natural/BlockSnow.java +++ b/common/src/main/java/common/block/natural/BlockSnow.java @@ -35,9 +35,9 @@ public class BlockSnow extends Block super(Material.POWDER); this.setDefaultState(this.getBaseState().withProperty(LAYERS, Integer.valueOf(1))); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.DECORATION); - this.setBlockBoundsForItemRender(); + this.setItemBounds(); } public boolean isPassable(IBlockAccess worldIn, BlockPos pos) @@ -45,7 +45,7 @@ public class BlockSnow extends Block return ((Integer)worldIn.getState(pos).getValue(LAYERS)).intValue() < 5; } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { int i = ((Integer)state.getValue(LAYERS)).intValue() - 1; if(i == 0) @@ -70,12 +70,12 @@ public class BlockSnow extends Block /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.getBoundsForLayers(0); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); this.getBoundsForLayers(((Integer)iblockstate.getValue(LAYERS)).intValue()); @@ -86,7 +86,7 @@ public class BlockSnow extends Block this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, (float)p_150154_1_ / 8.0F, 1.0F); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos.down()); Block block = iblockstate.getBlock(); @@ -96,16 +96,16 @@ public class BlockSnow extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { this.checkAndDropBlock(worldIn, pos, state); } private boolean checkAndDropBlock(World worldIn, BlockPos pos, State state) { - if (!this.canPlaceBlockAt(worldIn, pos)) + if (!this.canPlace(worldIn, pos)) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); return false; } @@ -115,9 +115,9 @@ public class BlockSnow extends Block } } - public void harvestBlock(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) + public void postBroken(World worldIn, EntityNPC player, BlockPos pos, State state, TileEntity te) { - spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1)); + dropItem(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1)); worldIn.setBlockToAir(pos); // player.triggerAchievement(StatRegistry.mineBlockStatArray[BlockRegistry.getIdFromBlock(this)]); } @@ -125,7 +125,7 @@ public class BlockSnow extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.snowball; } @@ -133,29 +133,29 @@ public class BlockSnow extends Block /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if (Vars.snowMelt && (worldIn.getLightFor(LightType.BLOCK, pos) > 11 || !worldIn.canFreezeAt(pos))) { - this.dropBlockAsItem(worldIn, pos, worldIn.getState(pos), 0); + this.drop(worldIn, pos, worldIn.getState(pos), 0); worldIn.setBlockToAir(pos); } } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { - return side == Facing.UP ? true : super.shouldSideBeRendered(worldIn, pos, side); + return side == Facing.UP ? true : super.canRender(worldIn, pos, side); } /** * Whether this Block can be replaced directly by other blocks (true for e.g. tall grass) */ - public boolean isReplaceable(World worldIn, BlockPos pos) + public boolean canReplace(World worldIn, BlockPos pos) { return ((Integer)worldIn.getState(pos).getValue(LAYERS)).intValue() == 1; } @@ -187,7 +187,7 @@ public class BlockSnow extends Block Block block = iblockstate.getBlock(); BlockPos blockpos = pos; - if ((side != Facing.UP || block != this) && !block.isReplaceable(worldIn, pos)) + if ((side != Facing.UP || block != this) && !block.canReplace(worldIn, pos)) { blockpos = pos.offset(side); iblockstate = worldIn.getState(blockpos); @@ -201,11 +201,11 @@ public class BlockSnow extends Block if (i <= 7) { State iblockstate1 = iblockstate.withProperty(BlockSnow.LAYERS, Integer.valueOf(i + 1)); - BoundingBox axisalignedbb = this.getCollisionBoundingBox(worldIn, blockpos, iblockstate1); + BoundingBox axisalignedbb = this.getCollisionBox(worldIn, blockpos, iblockstate1); if (axisalignedbb != null && worldIn.checkNoEntityCollision(axisalignedbb) && worldIn.setState(blockpos, iblockstate1, 2)) { - worldIn.playSound(this.sound.getPlaceSound(), (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F), 1.0F); + worldIn.playSound(this.getSound().getPlaceSound(), (double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.5F), (double)((float)blockpos.getZ() + 0.5F), 1.0F); stack.decrSize(); return true; } diff --git a/common/src/main/java/common/block/natural/BlockSnowBlock.java b/common/src/main/java/common/block/natural/BlockSnowBlock.java index a0cbc480..16a8cf2a 100755 --- a/common/src/main/java/common/block/natural/BlockSnowBlock.java +++ b/common/src/main/java/common/block/natural/BlockSnowBlock.java @@ -15,21 +15,21 @@ import common.world.AWorldServer; public class BlockSnowBlock extends Block { public BlockSnowBlock() { super(Material.DIGGABLE); - this.setTickRandomly(); + this.setTicked(); this.setTab(CheatTab.NATURE); } - public Item getItemDropped(State state, Random rand, int fortune) { + public Item getDrop(State state, Random rand, int fortune) { return Items.snowball; } - protected int quantityDropped(Random rand) { + protected int getDropAmount(Random rand) { return rand.range(2, 4); } - public void updateTick(AWorldServer world, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer world, BlockPos pos, State state, Random rand) { if(Vars.snowFullMelt && (world.getLightFor(LightType.BLOCK, pos) > 11 || !world.canFreezeAt(pos))) { - this.dropBlockAsItem(world, pos, world.getState(pos), 0); + this.drop(world, pos, world.getState(pos), 0); world.setBlockToAir(pos); } } diff --git a/common/src/main/java/common/block/natural/BlockSoulSand.java b/common/src/main/java/common/block/natural/BlockSoulSand.java index e521c5fb..b4da5d2a 100755 --- a/common/src/main/java/common/block/natural/BlockSoulSand.java +++ b/common/src/main/java/common/block/natural/BlockSoulSand.java @@ -17,7 +17,7 @@ public class BlockSoulSand extends Block this.setTab(CheatTab.NATURE); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { float f = 0.125F; return new BoundingBox((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)((float)(pos.getY() + 1) - f), (double)(pos.getZ() + 1)); @@ -26,7 +26,7 @@ public class BlockSoulSand extends Block /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { entityIn.motionX *= 0.4D; entityIn.motionZ *= 0.4D; diff --git a/common/src/main/java/common/block/natural/BlockStone.java b/common/src/main/java/common/block/natural/BlockStone.java index 3af0083d..9ac5e0d6 100755 --- a/common/src/main/java/common/block/natural/BlockStone.java +++ b/common/src/main/java/common/block/natural/BlockStone.java @@ -14,7 +14,7 @@ public class BlockStone extends Block { this.setTab(CheatTab.ROCK); } - public Item getItemDropped(State state, Random rand, int fortune) { + public Item getDrop(State state, Random rand, int fortune) { return Items.cobblestone; } } diff --git a/common/src/main/java/common/block/natural/BlockWeb.java b/common/src/main/java/common/block/natural/BlockWeb.java index 549a02c7..5da8b30b 100755 --- a/common/src/main/java/common/block/natural/BlockWeb.java +++ b/common/src/main/java/common/block/natural/BlockWeb.java @@ -22,13 +22,12 @@ public class BlockWeb extends Block { super(Material.FLUFF); this.setTab(CheatTab.DECORATION); - this.setFlatBlockTexture(); } /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { entityIn.setInWeb(); } @@ -41,7 +40,7 @@ public class BlockWeb extends Block return false; } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -54,7 +53,7 @@ public class BlockWeb extends Block /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.string; } diff --git a/common/src/main/java/common/block/tech/BlockActiveDisplay.java b/common/src/main/java/common/block/tech/BlockActiveDisplay.java index ad379b70..af66a02b 100644 --- a/common/src/main/java/common/block/tech/BlockActiveDisplay.java +++ b/common/src/main/java/common/block/tech/BlockActiveDisplay.java @@ -19,13 +19,13 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi public BlockActiveDisplay(BlockInactiveDisplay inactive) { super(inactive.getDensity()); - this.setLightLevel(1.0f); + this.setLight(1.0f); this.inactive = inactive; inactive.setActive(this); } - public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) { - super.onBlockRemoved(world, pos, state); + public void onRemoved(AWorldServer world, BlockPos pos, State state) { + super.onRemoved(world, pos, state); Pair span = removing ? null : this.getSpan(world, pos, state.getValue(FACING)); if(span != null) { world.removeTileEntity(pos); @@ -46,7 +46,7 @@ public class BlockActiveDisplay extends BlockDisplay implements ITileEntityProvi return false; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) { Pair span = this.getSpan(worldIn, pos, state.getValue(FACING)); if(span == null) diff --git a/common/src/main/java/common/block/tech/BlockAnvil.java b/common/src/main/java/common/block/tech/BlockAnvil.java index 4cb90aac..94638dbb 100755 --- a/common/src/main/java/common/block/tech/BlockAnvil.java +++ b/common/src/main/java/common/block/tech/BlockAnvil.java @@ -38,7 +38,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable super(Material.HEAVY); this.damage = damage; this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); - this.setLightOpacity(0); + this.setOpacity(0); this.setTab(CheatTab.TECHNOLOGY); ANVILS[damage] = this; } @@ -68,13 +68,13 @@ public class BlockAnvil extends BlockFalling implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { Facing enumfacing = placer.getHorizontalFacing().rotateY(); - return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(FACING, enumfacing); + return super.getPlacedState(worldIn, pos, facing, hitX, hitY, hitZ, placer).withProperty(FACING, enumfacing); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (!worldIn.client) { @@ -84,7 +84,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable return true; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); @@ -108,7 +108,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable worldIn.playAuxSFX(1022, pos, 0); } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { return true; } @@ -116,7 +116,7 @@ public class BlockAnvil extends BlockFalling implements Rotatable /** * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) */ - public State getStateForEntityRender(State state) + public State getEntityState(State state) { return this.getState().withProperty(FACING, Facing.SOUTH); } diff --git a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java index 9880dd34..c78eaf82 100755 --- a/common/src/main/java/common/block/tech/BlockBasePressurePlate.java +++ b/common/src/main/java/common/block/tech/BlockBasePressurePlate.java @@ -25,10 +25,9 @@ public abstract class BlockBasePressurePlate extends Block { super(p_i46401_1_); this.setTab(CheatTab.TECHNOLOGY); -// this.setTickRandomly(true); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.setBlockBoundsBasedOnState0(worldIn.getState(pos)); } @@ -56,7 +55,7 @@ public abstract class BlockBasePressurePlate extends Block return 20; } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -87,7 +86,7 @@ public abstract class BlockBasePressurePlate extends Block return true; } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { return this.canBePlacedOn(worldIn, pos.down()); } @@ -95,11 +94,11 @@ public abstract class BlockBasePressurePlate extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!this.canBePlacedOn(worldIn, pos.down())) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } @@ -109,14 +108,7 @@ public abstract class BlockBasePressurePlate extends Block return worldIn.isBlockSolid(pos) || worldIn.getState(pos).getBlock() instanceof BlockFence; } - /** - * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) - */ - public void randomTick(AWorldServer worldIn, BlockPos pos, State state, Random random) - { - } - - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -132,7 +124,7 @@ public abstract class BlockBasePressurePlate extends Block /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { if (!worldIn.client) { @@ -186,14 +178,14 @@ public abstract class BlockBasePressurePlate extends Block return new BoundingBox((double)((float)pos.getX() + 0.125F), (double)pos.getY(), (double)((float)pos.getZ() + 0.125F), (double)((float)(pos.getX() + 1) - 0.125F), (double)pos.getY() + 0.25D, (double)((float)(pos.getZ() + 1) - 0.125F)); } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { if (this.getSignalStrength(state) > 0) { this.updateNeighbors(worldIn, pos); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } /** @@ -216,7 +208,7 @@ public abstract class BlockBasePressurePlate extends Block /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { float f = 0.5F; float f1 = 0.125F; diff --git a/common/src/main/java/common/block/tech/BlockBrewingStand.java b/common/src/main/java/common/block/tech/BlockBrewingStand.java index fc5d7a51..6256d61b 100755 --- a/common/src/main/java/common/block/tech/BlockBrewingStand.java +++ b/common/src/main/java/common/block/tech/BlockBrewingStand.java @@ -387,23 +387,23 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); - this.setBlockBoundsForItemRender(); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); + this.setItemBounds(); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -423,7 +423,7 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider } } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { double d0 = (double)((float)pos.getX() + 0.4F + rand.floatv() * 0.2F); double d1 = (double)((float)pos.getY() + 0.7F + rand.floatv() * 0.3F); @@ -431,7 +431,7 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider worldIn.spawnParticle(ParticleType.SMOKE, d0, d1, d2); } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); @@ -440,7 +440,7 @@ public class BlockBrewingStand extends Block implements ITileEntityProvider InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityBrewingStand)tileentity); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } public BlockLayer getBlockLayer() diff --git a/common/src/main/java/common/block/tech/BlockButton.java b/common/src/main/java/common/block/tech/BlockButton.java index 5cabf9b4..f50d95b6 100755 --- a/common/src/main/java/common/block/tech/BlockButton.java +++ b/common/src/main/java/common/block/tech/BlockButton.java @@ -41,7 +41,6 @@ public class BlockButton extends Block implements Directional { super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(POWERED, Boolean.valueOf(false))); -// this.setTickRandomly(true); this.setTab(CheatTab.TECHNOLOGY); this.checkArrows = arrows; this.onTime = onTime; @@ -49,7 +48,7 @@ public class BlockButton extends Block implements Directional BUTTONS.add(this); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -78,12 +77,12 @@ public class BlockButton extends Block implements Directional /** * Check whether this Block can be placed on the given side */ - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, BlockPos pos, Facing side) { return canPlaceButtonOn(worldIn, pos, side.getOpposite()); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { for (Facing enumfacing : Facing.values()) { @@ -106,7 +105,7 @@ public class BlockButton extends Block implements Directional * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return canPlaceButtonOn(worldIn, pos, facing.getOpposite()) ? this.getState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getState().withProperty(FACING, Facing.DOWN).withProperty(POWERED, Boolean.valueOf(false)); } @@ -114,30 +113,30 @@ public class BlockButton extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (this.checkForDrop(worldIn, pos, state) && !canPlaceButtonOn(worldIn, pos, ((Facing)state.getValue(FACING)).getOpposite())) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } private boolean checkForDrop(World worldIn, BlockPos pos, State state) { - if (this.canPlaceBlockAt(worldIn, pos)) + if (this.canPlace(worldIn, pos)) { return true; } else { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); return false; } } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.updateBlockBounds(worldIn.getState(pos)); } @@ -179,7 +178,7 @@ public class BlockButton extends Block implements Directional } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { @@ -196,14 +195,14 @@ public class BlockButton extends Block implements Directional } } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { this.notifyNeighbors(worldIn, pos, (Facing)state.getValue(FACING)); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } public double getResistance(World worldIn, BlockPos pos, State state) { @@ -218,14 +217,7 @@ public class BlockButton extends Block implements Directional return true; } - /** - * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) - */ - public void randomTick(AWorldServer worldIn, BlockPos pos, State state, Random random) - { - } - - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -249,7 +241,7 @@ public class BlockButton extends Block implements Directional /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { float f = 0.1875F; float f1 = 0.125F; @@ -260,7 +252,7 @@ public class BlockButton extends Block implements Directional /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { if (!worldIn.client) { diff --git a/common/src/main/java/common/block/tech/BlockCauldron.java b/common/src/main/java/common/block/tech/BlockCauldron.java index 5a227676..ae10f31b 100755 --- a/common/src/main/java/common/block/tech/BlockCauldron.java +++ b/common/src/main/java/common/block/tech/BlockCauldron.java @@ -417,26 +417,26 @@ public class BlockCauldron extends Block /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); float f = 0.125F; this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); - this.setBlockBoundsForItemRender(); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); + this.setItemBounds(); } /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -457,7 +457,7 @@ public class BlockCauldron extends Block /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { int i = ((Integer)state.getValue(LEVEL)).intValue(); float f = (float)pos.getY() + (6.0F + (float)(3 * i)) / 16.0F; @@ -469,7 +469,7 @@ public class BlockCauldron extends Block } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -554,10 +554,7 @@ public class BlockCauldron extends Block worldIn.setState(pos, state.withProperty(LEVEL, Integer.valueOf(ExtMath.clampi(level, 0, 3))), 2); } - /** - * Called similar to random ticks, but only when it is raining. - */ - public void fillWithRain(World worldIn, BlockPos pos) + public void onRain(World worldIn, BlockPos pos) { if (worldIn.rand.chance(20)) // == 1 { diff --git a/common/src/main/java/common/block/tech/BlockChest.java b/common/src/main/java/common/block/tech/BlockChest.java index 13a1f323..1e27ef0a 100755 --- a/common/src/main/java/common/block/tech/BlockChest.java +++ b/common/src/main/java/common/block/tech/BlockChest.java @@ -52,7 +52,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable this.setTab(CheatTab.TECHNOLOGY); this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); this.setHardness(2.5F); - this.setStepSound(SoundType.WOOD); + this.setSound(SoundType.WOOD); CHESTS.put(this.width * this.height, this); } @@ -76,10 +76,10 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable public int getRenderType() { - return 2; + return -1; } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } @@ -136,7 +136,7 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable } } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); @@ -145,10 +145,10 @@ public class BlockChest extends Block implements ITileEntityProvider, Rotatable InventoryHelper.dropInventoryItems(worldIn, pos, (IInventory)tileentity); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { diff --git a/common/src/main/java/common/block/tech/BlockCore.java b/common/src/main/java/common/block/tech/BlockCore.java index 131e2e70..3d3851a1 100755 --- a/common/src/main/java/common/block/tech/BlockCore.java +++ b/common/src/main/java/common/block/tech/BlockCore.java @@ -14,13 +14,13 @@ public class BlockCore extends Block { this.setTab(CheatTab.TECHNOLOGY); } - public void onBlockRemoved(AWorldServer world, BlockPos pos, State state) + public void onRemoved(AWorldServer world, BlockPos pos, State state) { if(Vars.loaders) world.removeLoader(pos); } - public void onBlockAdded(AWorldServer world, BlockPos pos, State state) + public void onAdded(AWorldServer world, BlockPos pos, State state) { if(Vars.loaders) world.addLoader(pos); diff --git a/common/src/main/java/common/block/tech/BlockDispenser.java b/common/src/main/java/common/block/tech/BlockDispenser.java index b408f51d..49e30ccd 100755 --- a/common/src/main/java/common/block/tech/BlockDispenser.java +++ b/common/src/main/java/common/block/tech/BlockDispenser.java @@ -53,9 +53,9 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct return 4; } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { - super.onBlockAdded(worldIn, pos, state); + super.onAdded(worldIn, pos, state); this.setDefaultDirection(worldIn, pos, state); } @@ -94,7 +94,7 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -134,12 +134,12 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, BlockPistonBase.getFacingFromEntity(worldIn, pos, placer)); } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); @@ -148,7 +148,7 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityDispenser)tileentity); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } public static Vec3 getDispensePosition(BlockPos pos, Facing facing) @@ -162,7 +162,7 @@ public class BlockDispenser extends Block implements ITileEntityProvider, Direct /** * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) */ - public State getStateForEntityRender(State state) + public State getEntityState(State state) { return this.getState().withProperty(FACING, Facing.SOUTH); } diff --git a/common/src/main/java/common/block/tech/BlockDisplay.java b/common/src/main/java/common/block/tech/BlockDisplay.java index ec1b6d53..9d6b4e47 100644 --- a/common/src/main/java/common/block/tech/BlockDisplay.java +++ b/common/src/main/java/common/block/tech/BlockDisplay.java @@ -40,7 +40,7 @@ public abstract class BlockDisplay extends Block implements Rotatable return this.density; } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); @@ -74,16 +74,16 @@ public abstract class BlockDisplay extends Block implements Rotatable return new Property[] {FACING}; } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); + this.setBlockBounds(worldIn, pos); + return super.getCollisionBox(worldIn, pos, state); } - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, BlockPos pos) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); + this.setBlockBounds(worldIn, pos); + return super.getSelectionBox(worldIn, pos); } public boolean isFullCube() @@ -106,11 +106,11 @@ public abstract class BlockDisplay extends Block implements Rotatable return true; } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, facing.getAxis().isVertical() ? placer.getHorizontalFacing().getOpposite() : facing); } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/tech/BlockEnchantmentTable.java b/common/src/main/java/common/block/tech/BlockEnchantmentTable.java index a3a6c886..9ad5ffe8 100755 --- a/common/src/main/java/common/block/tech/BlockEnchantmentTable.java +++ b/common/src/main/java/common/block/tech/BlockEnchantmentTable.java @@ -30,7 +30,7 @@ public class BlockEnchantmentTable extends Block { super(Material.SOLID); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); - this.setLightOpacity(0); + this.setOpacity(0); this.setTab(CheatTab.TECHNOLOGY); } @@ -44,7 +44,7 @@ public class BlockEnchantmentTable extends Block return false; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { diff --git a/common/src/main/java/common/block/tech/BlockFurnace.java b/common/src/main/java/common/block/tech/BlockFurnace.java index 256b866b..84df6236 100755 --- a/common/src/main/java/common/block/tech/BlockFurnace.java +++ b/common/src/main/java/common/block/tech/BlockFurnace.java @@ -37,7 +37,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl this.isBurning = isBurning; } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { this.setDefaultFacing(worldIn, pos, state); } @@ -74,7 +74,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { if (this.isBurning) { @@ -109,7 +109,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -167,12 +167,12 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { if (!keepInventory) { @@ -184,7 +184,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl } } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } public Item getItem() @@ -195,7 +195,7 @@ public class BlockFurnace extends Block implements ITileEntityProvider, Rotatabl /** * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) */ - public State getStateForEntityRender(State state) + public State getEntityState(State state) { return this.getState().withProperty(FACING, Facing.SOUTH); } diff --git a/common/src/main/java/common/block/tech/BlockHopper.java b/common/src/main/java/common/block/tech/BlockHopper.java index 10535f27..a8bf3809 100755 --- a/common/src/main/java/common/block/tech/BlockHopper.java +++ b/common/src/main/java/common/block/tech/BlockHopper.java @@ -89,7 +89,7 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -97,20 +97,20 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { boolean flip = state.getBlock() == this && state.getValue(FACING) == Facing.UP; this.setBlockBounds(0.0F, flip ? 0.375f : 0.0F, 0.0F, 1.0F, flip ? 1.0f : 0.625F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); float f = 0.125F; this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -118,7 +118,7 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, facing.getOpposite()); } @@ -131,7 +131,7 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction return new TileEntityHopper(); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -150,7 +150,7 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction } } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); @@ -159,7 +159,7 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityHopper)tileentity); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } public boolean isFullCube() @@ -175,7 +175,7 @@ public class BlockHopper extends Block implements ITileEntityProvider, Direction return false; } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/tech/BlockInactiveDisplay.java b/common/src/main/java/common/block/tech/BlockInactiveDisplay.java index eb045729..e2d1a542 100644 --- a/common/src/main/java/common/block/tech/BlockInactiveDisplay.java +++ b/common/src/main/java/common/block/tech/BlockInactiveDisplay.java @@ -22,7 +22,7 @@ public class BlockInactiveDisplay extends BlockDisplay { this.active = active; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) { Pair span = this.getSpan(worldIn, pos, state.getValue(FACING)); if(span == null) diff --git a/common/src/main/java/common/block/tech/BlockLever.java b/common/src/main/java/common/block/tech/BlockLever.java index fa562a10..43933525 100755 --- a/common/src/main/java/common/block/tech/BlockLever.java +++ b/common/src/main/java/common/block/tech/BlockLever.java @@ -34,10 +34,9 @@ public class BlockLever extends Block super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(FACING, BlockLever.EnumOrientation.NORTH).withProperty(POWERED, Boolean.valueOf(false))); this.setTab(CheatTab.TECHNOLOGY); - this.setFlatBlockTexture(); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -58,12 +57,12 @@ public class BlockLever extends Block /** * Check whether this Block can be placed on the given side */ - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, BlockPos pos, Facing side) { return canPlaceLeverOn(worldIn, pos, side.getOpposite()); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { for (Facing enumfacing : Facing.values()) { @@ -85,7 +84,7 @@ public class BlockLever extends Block * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState().withProperty(POWERED, Boolean.valueOf(false)); @@ -144,30 +143,30 @@ public class BlockLever extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (this.checkDrop(worldIn, pos, state) && !canPlaceLeverOn(worldIn, pos, ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite())) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } private boolean checkDrop(World worldIn, BlockPos pos, State state) { - if (this.canPlaceBlockAt(worldIn, pos)) + if (this.canPlace(worldIn, pos)) { return true; } else { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); return false; } } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { float f = 0.1875F; @@ -202,7 +201,7 @@ public class BlockLever extends Block } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { @@ -220,7 +219,7 @@ public class BlockLever extends Block } } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { if (((Boolean)state.getValue(POWERED)).booleanValue()) { @@ -229,7 +228,7 @@ public class BlockLever extends Block worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing.getOpposite()), this); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } public double getResistance(World worldIn, BlockPos pos, State state) { diff --git a/common/src/main/java/common/block/tech/BlockLitTorch.java b/common/src/main/java/common/block/tech/BlockLitTorch.java index a7c1d989..eba9050e 100755 --- a/common/src/main/java/common/block/tech/BlockLitTorch.java +++ b/common/src/main/java/common/block/tech/BlockLitTorch.java @@ -27,7 +27,7 @@ public class BlockLitTorch extends BlockTorch { unlit.setLitTorch(this); this.setTab(CheatTab.TECHNOLOGY); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.UP).withProperty(FUEL, 7)); - this.setTickRandomly(); + this.setTicked(); } public void extinguish(AWorldServer worldIn, BlockPos pos, State state, Random rand) { @@ -42,7 +42,7 @@ public class BlockLitTorch extends BlockTorch { } } - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { if(Vars.torchBurnout > 0 && rand.chance(Vars.torchBurnout)) { int fuel = state.getValue(FUEL); if(fuel <= 0) { @@ -54,7 +54,7 @@ public class BlockLitTorch extends BlockTorch { } } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { if(this.unlit.getParticleColor() == 0xffffffff) { Facing enumfacing = (Facing)state.getValue(FACING); double d0 = (double)pos.getX() + 0.5D; @@ -93,7 +93,7 @@ public class BlockLitTorch extends BlockTorch { } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) this.extinguish((AWorldServer)worldIn, pos, state, worldIn.rand); return true; diff --git a/common/src/main/java/common/block/tech/BlockMachine.java b/common/src/main/java/common/block/tech/BlockMachine.java index c911cff1..6505aed7 100755 --- a/common/src/main/java/common/block/tech/BlockMachine.java +++ b/common/src/main/java/common/block/tech/BlockMachine.java @@ -30,11 +30,11 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti public abstract TileEntity createNewTileEntity(); - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) { + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { this.updateState(worldIn, pos, state); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(worldIn.client) return true; @@ -44,22 +44,22 @@ public abstract class BlockMachine extends Block implements Rotatable, ITileEnti return true; } - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) { + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { this.updateState(worldIn, pos, state); } private void updateState(World worldIn, BlockPos pos, State state) { } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) { + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { TileEntity tileentity = worldIn.getTileEntity(pos); if(tileentity instanceof Device) { InventoryHelper.dropInventoryItems(worldIn, pos, (Device)tileentity); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing()); } diff --git a/common/src/main/java/common/block/tech/BlockNuke.java b/common/src/main/java/common/block/tech/BlockNuke.java index 24806dba..5f81a4b4 100755 --- a/common/src/main/java/common/block/tech/BlockNuke.java +++ b/common/src/main/java/common/block/tech/BlockNuke.java @@ -23,7 +23,7 @@ public class BlockNuke extends Block this.setTab(CheatTab.TECHNOLOGY); } - public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState) + public void onDestroyedExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState) { if (!worldIn.client) { @@ -41,7 +41,7 @@ public class BlockNuke extends Block } } - public boolean canDropFromExplosion(Explosion explosionIn) + public boolean canDrop(Explosion explosionIn) { return false; } diff --git a/common/src/main/java/common/block/tech/BlockPistonBase.java b/common/src/main/java/common/block/tech/BlockPistonBase.java index 62c8cf68..530af1ba 100755 --- a/common/src/main/java/common/block/tech/BlockPistonBase.java +++ b/common/src/main/java/common/block/tech/BlockPistonBase.java @@ -255,7 +255,7 @@ public class BlockPistonBase extends Block implements Directional super(Material.PISTON); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(EXTENDED, Boolean.valueOf(false))); this.isSticky = isSticky; - this.setStepSound(SoundType.STONE); + this.setSound(SoundType.STONE); this.setHardness(0.5F); this.setTab(CheatTab.TECHNOLOGY); } @@ -271,7 +271,7 @@ public class BlockPistonBase extends Block implements Directional /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ - public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer) + public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer) { worldIn.setState(pos, state.withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)), 2); @@ -284,7 +284,7 @@ public class BlockPistonBase extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!worldIn.client) { @@ -292,7 +292,7 @@ public class BlockPistonBase extends Block implements Directional } } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { if (!worldIn.client && worldIn.getTileEntity(pos) == null) { @@ -304,7 +304,7 @@ public class BlockPistonBase extends Block implements Directional * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, getFacingFromEntity(worldIn, pos, placer)).withProperty(EXTENDED, Boolean.valueOf(false)); } @@ -379,7 +379,7 @@ public class BlockPistonBase extends Block implements Directional // } } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); @@ -426,7 +426,7 @@ public class BlockPistonBase extends Block implements Directional /** * Sets the block's bounds for rendering it as an item */ - public void setBlockBoundsForItemRender() + public void setItemBounds() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -434,16 +434,16 @@ public class BlockPistonBase extends Block implements Directional /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getCollisionBoundingBox(worldIn, pos, state); + this.setBlockBounds(worldIn, pos); + return super.getCollisionBox(worldIn, pos, state); } public boolean isFullCube() @@ -493,7 +493,7 @@ public class BlockPistonBase extends Block implements Directional { if (blockIn != Blocks.piston && blockIn != Blocks.sticky_piston) { - if (blockIn.getBlockHardness(worldIn, pos) == -1.0F) + if (blockIn.getHardness(worldIn, pos) == -1.0F) { return false; } @@ -556,7 +556,7 @@ public class BlockPistonBase extends Block implements Directional { BlockPos blockpos = (BlockPos)list1.get(j); Block block = worldIn.getState(blockpos).getBlock(); - block.dropBlockAsItem(worldIn, blockpos, worldIn.getState(blockpos), 0); + block.drop(worldIn, blockpos, worldIn.getState(blockpos), 0); worldIn.setBlockToAir(blockpos); --i; ablock[i] = block; @@ -607,7 +607,7 @@ public class BlockPistonBase extends Block implements Directional float step = 0.25f; State state = world.getState(pos); - BoundingBox axisalignedbb = state.getBlock().getCollisionBoundingBox(world, pos, state); + BoundingBox axisalignedbb = state.getBlock().getCollisionBox(world, pos, state); if (axisalignedbb != null) { @@ -649,7 +649,7 @@ public class BlockPistonBase extends Block implements Directional /** * Possibly modify the given BlockState before rendering it on an Entity (Minecarts, Endermen, ...) */ - public State getStateForEntityRender(State state) + public State getEntityState(State state) { return this.getState().withProperty(FACING, Facing.UP); } diff --git a/common/src/main/java/common/block/tech/BlockPistonHead.java b/common/src/main/java/common/block/tech/BlockPistonHead.java index 86597acb..2428f4cf 100755 --- a/common/src/main/java/common/block/tech/BlockPistonHead.java +++ b/common/src/main/java/common/block/tech/BlockPistonHead.java @@ -31,21 +31,21 @@ public class BlockPistonHead extends Block implements Directional { super(Material.PISTON); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH)); - this.setStepSound(SoundType.STONE); + this.setSound(SoundType.STONE); this.setHardness(0.5F); this.sticky = sticky; } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); Facing enumfacing = ((Facing)state.getValue(FACING)).getOpposite(); pos = pos.offset(enumfacing); State iblockstate = worldIn.getState(pos); if ((iblockstate.getBlock() == Blocks.piston || iblockstate.getBlock() == Blocks.sticky_piston) && ((Boolean)iblockstate.getValue(BlockPistonBase.EXTENDED)).booleanValue()) { - iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0); + iblockstate.getBlock().drop(worldIn, pos, iblockstate, 0); worldIn.setBlockToAir(pos); } } @@ -63,7 +63,7 @@ public class BlockPistonHead extends Block implements Directional return false; } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { return false; } @@ -71,7 +71,7 @@ public class BlockPistonHead extends Block implements Directional /** * Check whether this Block can be placed on the given side */ - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, BlockPos pos, Facing side) { return false; } @@ -79,7 +79,7 @@ public class BlockPistonHead extends Block implements Directional /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 0; } @@ -87,12 +87,12 @@ public class BlockPistonHead extends Block implements Directional /** * Add all collision boxes of this Block to the list that intersect with the given mask. */ - public void addCollisionBoxesToList(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) + public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List list, Entity collidingEntity) { this.applyHeadBounds(state); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.applyCoreBounds(state); - super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity); + super.getCollisionBoxes(worldIn, pos, state, mask, list, collidingEntity); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -131,7 +131,7 @@ public class BlockPistonHead extends Block implements Directional } } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { this.applyHeadBounds(worldIn.getState(pos)); } @@ -174,7 +174,7 @@ public class BlockPistonHead extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); BlockPos blockpos = pos.offset(enumfacing.getOpposite()); @@ -186,11 +186,11 @@ public class BlockPistonHead extends Block implements Directional } else { - iblockstate.getBlock().onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock); + iblockstate.getBlock().onUpdate(worldIn, blockpos, iblockstate, neighborBlock); } } - public boolean shouldSideBeRendered(IWorldAccess worldIn, BlockPos pos, Facing side) + public boolean canRender(IWorldAccess worldIn, BlockPos pos, Facing side) { return true; } diff --git a/common/src/main/java/common/block/tech/BlockRail.java b/common/src/main/java/common/block/tech/BlockRail.java index b1815892..bda3af92 100755 --- a/common/src/main/java/common/block/tech/BlockRail.java +++ b/common/src/main/java/common/block/tech/BlockRail.java @@ -46,11 +46,10 @@ public class BlockRail extends Block super(Material.SMALL); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F); this.setTab(CheatTab.TECHNOLOGY); - this.setFlatBlockTexture(); this.setDefaultState(this.getBaseState().withProperty(SHAPE, BlockRail.EnumRailDirection.NORTH_SOUTH)); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -66,13 +65,13 @@ public class BlockRail extends Block /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public HitPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.collisionRayTrace(worldIn, pos, start, end); + this.setBlockBounds(worldIn, pos); + return super.rayTrace(worldIn, pos, start, end); } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); BlockRail.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() == this ? (BlockRail.EnumRailDirection)iblockstate.getValue(SHAPE) : null; @@ -92,12 +91,12 @@ public class BlockRail extends Block return false; } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { return worldIn.isBlockSolid(pos.down()); } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { if (!worldIn.client) { @@ -108,7 +107,7 @@ public class BlockRail extends Block /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!worldIn.client) { @@ -139,7 +138,7 @@ public class BlockRail extends Block if (flag) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } else @@ -164,9 +163,9 @@ public class BlockRail extends Block return BlockLayer.CUTOUT; } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); if (((BlockRail.EnumRailDirection)state.getValue(SHAPE)).isAscending()) { diff --git a/common/src/main/java/common/block/tech/BlockTNT.java b/common/src/main/java/common/block/tech/BlockTNT.java index e4dc028d..9c9a64bf 100755 --- a/common/src/main/java/common/block/tech/BlockTNT.java +++ b/common/src/main/java/common/block/tech/BlockTNT.java @@ -55,7 +55,7 @@ public class BlockTNT extends Block /** * Called when this Block is destroyed by an Explosion */ - public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState) + public void onDestroyedExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState) { if (!worldIn.client) { @@ -68,7 +68,7 @@ public class BlockTNT extends Block /** * Called when a player destroys this Block */ - public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state) + public void onBroken(World worldIn, BlockPos pos, State state) { this.explode(worldIn, pos, state, (EntityLiving)null); } @@ -86,7 +86,7 @@ public class BlockTNT extends Block } } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (playerIn.getCurrentEquippedItem() != null) { @@ -110,13 +110,13 @@ public class BlockTNT extends Block } } - return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + return super.onUse(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); } /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { if (!worldIn.client && entityIn instanceof EntityArrow) { @@ -133,7 +133,7 @@ public class BlockTNT extends Block /** * Return whether this block can drop from an explosion. */ - public boolean canDropFromExplosion(Explosion explosionIn) + public boolean canDrop(Explosion explosionIn) { return false; } @@ -157,8 +157,8 @@ public class BlockTNT extends Block return new Property[] {EXPLODE}; } - public void onDestroyedByFire(World world, BlockPos pos, State state) { - this.onBlockDestroyedByPlayer(world, pos, state.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); + public void onDestroyedFire(World world, BlockPos pos, State state) { + this.onBroken(world, pos, state.withProperty(BlockTNT.EXPLODE, Boolean.valueOf(true))); } public TextColor getItemColor() { diff --git a/common/src/main/java/common/block/tech/BlockToggleableLight.java b/common/src/main/java/common/block/tech/BlockToggleableLight.java index 6f553711..7cda9d7a 100755 --- a/common/src/main/java/common/block/tech/BlockToggleableLight.java +++ b/common/src/main/java/common/block/tech/BlockToggleableLight.java @@ -20,20 +20,20 @@ public class BlockToggleableLight extends Block { super(Material.LOOSE); this.isOn = isOn; if(isOn) - this.setLightLevel(1.0F); + this.setLight(1.0F); } public void toggle(World worldIn, BlockPos pos) { worldIn.setState(pos, this.isOn ? Blocks.lamp.getState() : Blocks.lit_lamp.getState(), 2); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC player, Facing side, float hitX, float hitY, float hitZ) { if(!this.isOn) { if(player.getCurrentEquippedItem() == null) - return super.onBlockActivated(worldIn, pos, state, player, side, hitX, hitY, hitZ); + return super.onUse(worldIn, pos, state, player, side, hitX, hitY, hitZ); Item item = player.getCurrentEquippedItem().getItem(); if(item != Items.lighter && item != Items.fireball) - return super.onBlockActivated(worldIn, pos, state, player, side, hitX, hitY, hitZ); + return super.onUse(worldIn, pos, state, player, side, hitX, hitY, hitZ); if(item == Items.lighter) player.getCurrentEquippedItem().damage(1, player); else diff --git a/common/src/main/java/common/block/tech/BlockTorch.java b/common/src/main/java/common/block/tech/BlockTorch.java index baeed07f..b72302bc 100755 --- a/common/src/main/java/common/block/tech/BlockTorch.java +++ b/common/src/main/java/common/block/tech/BlockTorch.java @@ -38,10 +38,9 @@ public abstract class BlockTorch extends Block implements Directional super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.UP)); this.setTab(CheatTab.TECHNOLOGY); - this.setFlatBlockTexture(); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -72,7 +71,7 @@ public abstract class BlockTorch extends Block implements Directional } } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { for (Facing enumfacing : Facing.values()) { @@ -96,7 +95,7 @@ public abstract class BlockTorch extends Block implements Directional * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { if (this.canPlaceAt(worldIn, pos, facing)) { @@ -116,7 +115,7 @@ public abstract class BlockTorch extends Block implements Directional } } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { this.checkForDrop(worldIn, pos, state); } @@ -124,7 +123,7 @@ public abstract class BlockTorch extends Block implements Directional /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { this.onNeighborChangeInternal(worldIn, pos, state); } @@ -153,7 +152,7 @@ public abstract class BlockTorch extends Block implements Directional if (flag) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); return true; } @@ -174,7 +173,7 @@ public abstract class BlockTorch extends Block implements Directional { if (worldIn.getState(pos).getBlock() == this) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } @@ -185,7 +184,7 @@ public abstract class BlockTorch extends Block implements Directional /** * Ray traces through the blocks collision from start vector to end vector returning a ray trace hit. */ - public HitPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) + public HitPosition rayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); float f = 0.15F; @@ -217,7 +216,7 @@ public abstract class BlockTorch extends Block implements Directional this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f); } - return super.collisionRayTrace(worldIn, pos, start, end); + return super.rayTrace(worldIn, pos, start, end); } public BlockLayer getBlockLayer() diff --git a/common/src/main/java/common/block/tech/BlockTripWire.java b/common/src/main/java/common/block/tech/BlockTripWire.java index 5691f83e..c1bfd1b0 100755 --- a/common/src/main/java/common/block/tech/BlockTripWire.java +++ b/common/src/main/java/common/block/tech/BlockTripWire.java @@ -45,19 +45,18 @@ public class BlockTripWire extends Block super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(DISARMED, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F); -// this.setTickRandomly(true); } /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { return state.withProperty(NORTH, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.NORTH))).withProperty(EAST, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.EAST))).withProperty(SOUTH, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.SOUTH))).withProperty(WEST, Boolean.valueOf(isConnectedTo(worldIn, pos, state, Facing.WEST))); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -77,25 +76,25 @@ public class BlockTripWire extends Block public BlockLayer getBlockLayer() { - return BlockLayer.TRANSLUCENT; + return BlockLayer.CUTOUT; } /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { boolean flag = ((Boolean)state.getValue(SUSPENDED)).booleanValue(); boolean flag1 = !worldIn.isBlockSolid(pos.down()); if (flag != flag1) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { State iblockstate = worldIn.getState(pos); boolean flag = ((Boolean)iblockstate.getValue(ATTACHED)).booleanValue(); @@ -115,19 +114,19 @@ public class BlockTripWire extends Block } } - public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state) + public void onAdded(AWorldServer worldIn, BlockPos pos, State state) { state = state.withProperty(SUSPENDED, Boolean.valueOf(!worldIn.isBlockSolid(pos.down()))); worldIn.setState(pos, state, 3); this.notifyHook(worldIn, pos, state); } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { this.notifyHook(worldIn, pos, state.withProperty(POWERED, Boolean.valueOf(true))); } - public void onBlockHarvested(World worldIn, BlockPos pos, State state, EntityNPC player) + public void preBroken(World worldIn, BlockPos pos, State state, EntityNPC player) { if (!worldIn.client) { @@ -168,7 +167,7 @@ public class BlockTripWire extends Block /** * Called When an Entity Collided with the Block */ - public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, State state, Entity entityIn) + public void onCollideUpdate(World worldIn, BlockPos pos, State state, Entity entityIn) { if (!worldIn.client) { @@ -179,14 +178,7 @@ public class BlockTripWire extends Block } } - /** - * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) - */ - public void randomTick(AWorldServer worldIn, BlockPos pos, State state, Random random) - { - } - - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { // if (!worldIn.client) // { @@ -649,11 +641,11 @@ public class BlockTripWire extends Block return new Property[] {DISARMED, POWERED}; } - public StackSize getMaxStackSize() { + public StackSize getMaxAmount() { return StackSize.XXXL; } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {NORTH, SOUTH, WEST, EAST}; } diff --git a/common/src/main/java/common/block/tech/BlockTripWireHook.java b/common/src/main/java/common/block/tech/BlockTripWireHook.java index b21e45bf..cb0a3bd8 100755 --- a/common/src/main/java/common/block/tech/BlockTripWireHook.java +++ b/common/src/main/java/common/block/tech/BlockTripWireHook.java @@ -35,20 +35,18 @@ public class BlockTripWireHook extends Block implements Rotatable super(Material.SMALL); this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false))); this.setTab(CheatTab.TECHNOLOGY); -// this.setTickRandomly(true); - this.setFlatBlockTexture(); } /** * Get the actual Block state of this Block at the given position. This applies properties not visible in the * metadata, such as fence connections. */ - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { return state.withProperty(SUSPENDED, Boolean.valueOf(!World.isSolidSurface(worldIn.getState(pos.down())))); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -69,12 +67,12 @@ public class BlockTripWireHook extends Block implements Rotatable /** * Check whether this Block can be placed on the given side */ - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Facing side) + public boolean canPlace(World worldIn, BlockPos pos, Facing side) { return side.getAxis().isHorizontal() && worldIn.getState(pos.offset(side.getOpposite())).getBlock().isNormalCube(); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { for (Facing enumfacing : Facing.Plane.HORIZONTAL) { @@ -91,7 +89,7 @@ public class BlockTripWireHook extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { State iblockstate = this.getState().withProperty(POWERED, Boolean.valueOf(false)).withProperty(ATTACHED, Boolean.valueOf(false)).withProperty(SUSPENDED, Boolean.valueOf(false)); @@ -106,7 +104,7 @@ public class BlockTripWireHook extends Block implements Rotatable /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ - public void onBlockPlacedBy(World worldIn, BlockPos pos, State state, EntityLiving placer) + public void onPlace(World worldIn, BlockPos pos, State state, EntityLiving placer) { this.triggerHookAt(worldIn, pos, state, false, false, -1, (State)null); } @@ -114,7 +112,7 @@ public class BlockTripWireHook extends Block implements Rotatable /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (neighborBlock != this) { @@ -124,7 +122,7 @@ public class BlockTripWireHook extends Block implements Rotatable if (!worldIn.getState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube()) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } } @@ -224,14 +222,7 @@ public class BlockTripWireHook extends Block implements Rotatable } } - /** - * Called randomly when setTickRandomly is set to true (used by e.g. crops to grow, etc.) - */ - public void randomTick(AWorldServer worldIn, BlockPos pos, State state, Random random) - { - } - - public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand) + public void tick(AWorldServer worldIn, BlockPos pos, State state, Random rand) { this.triggerHookAt(worldIn, pos, state, false, true, -1, (State)null); } @@ -264,9 +255,9 @@ public class BlockTripWireHook extends Block implements Rotatable private boolean checkForDrop(World worldIn, BlockPos pos, State state) { - if (!this.canPlaceBlockAt(worldIn, pos)) + if (!this.canPlace(worldIn, pos)) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); return false; } @@ -277,7 +268,7 @@ public class BlockTripWireHook extends Block implements Rotatable } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { float f = 0.1875F; @@ -300,7 +291,7 @@ public class BlockTripWireHook extends Block implements Rotatable } } - public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state) + public void onRemoved(AWorldServer worldIn, BlockPos pos, State state) { boolean flag = ((Boolean)state.getValue(ATTACHED)).booleanValue(); boolean flag1 = ((Boolean)state.getValue(POWERED)).booleanValue(); @@ -316,7 +307,7 @@ public class BlockTripWireHook extends Block implements Rotatable worldIn.notifyNeighborsOfStateChange(pos.offset(((Facing)state.getValue(FACING)).getOpposite()), this); } - super.onBlockRemoved(worldIn, pos, state); + super.onRemoved(worldIn, pos, state); } public double getResistance(World worldIn, BlockPos pos, State state) { @@ -560,7 +551,7 @@ public class BlockTripWireHook extends Block implements Rotatable return Transform.PANE_SIDE; } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {SUSPENDED}; } } diff --git a/common/src/main/java/common/block/tech/BlockUnlitTorch.java b/common/src/main/java/common/block/tech/BlockUnlitTorch.java index 5e0f70a7..70ed1736 100644 --- a/common/src/main/java/common/block/tech/BlockUnlitTorch.java +++ b/common/src/main/java/common/block/tech/BlockUnlitTorch.java @@ -27,7 +27,7 @@ public class BlockUnlitTorch extends BlockTorch { return this.particleColor; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(playerIn.getCurrentEquippedItem() != null) { Item item = playerIn.getCurrentEquippedItem().getItem(); @@ -46,6 +46,6 @@ public class BlockUnlitTorch extends BlockTorch { } } - return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); + return super.onUse(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ); } } diff --git a/common/src/main/java/common/block/tech/BlockWarpChest.java b/common/src/main/java/common/block/tech/BlockWarpChest.java index ae959565..6130a377 100755 --- a/common/src/main/java/common/block/tech/BlockWarpChest.java +++ b/common/src/main/java/common/block/tech/BlockWarpChest.java @@ -62,7 +62,7 @@ public class BlockWarpChest extends Block implements Rotatable /** * Get the Item that this Block should drop when harvested. */ - public Item getItemDropped(State state, Random rand, int fortune) + public Item getDrop(State state, Random rand, int fortune) { return Items.obsidian; } @@ -70,7 +70,7 @@ public class BlockWarpChest extends Block implements Rotatable /** * Returns the quantity of items to drop on block destruction. */ - protected int quantityDropped(Random random) + protected int getDropAmount(Random random) { return 8; } @@ -84,12 +84,12 @@ public class BlockWarpChest extends Block implements Rotatable * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ - public State onBlockPlaced(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) + public State getPlacedState(World worldIn, BlockPos pos, Facing facing, float hitX, float hitY, float hitZ, EntityLiving placer) { return this.getState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if(!worldIn.client) { playerIn.getWarpChest().setWarpChest(pos); @@ -106,7 +106,7 @@ public class BlockWarpChest extends Block implements Rotatable // return new TileEntityWarpChest(); // } - public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) + public void displayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand) { for (int i = 0; i < 3; ++i) { diff --git a/common/src/main/java/common/block/tech/BlockWire.java b/common/src/main/java/common/block/tech/BlockWire.java index 474f49d8..014abbe7 100755 --- a/common/src/main/java/common/block/tech/BlockWire.java +++ b/common/src/main/java/common/block/tech/BlockWire.java @@ -251,7 +251,7 @@ public class BlockWire extends Block this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F); } - public State getActualState(State state, IWorldAccess worldIn, BlockPos pos) + public State getState(State state, IWorldAccess worldIn, BlockPos pos) { state = state.withProperty(DOWN, this.canConnect(worldIn, pos, Facing.DOWN)); state = state.withProperty(UP, this.canConnect(worldIn, pos, Facing.UP)); @@ -267,7 +267,7 @@ public class BlockWire extends Block return worldIn.getState(pos.offset(direction)).getBlock().canConnectToWire(this.getState()); } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } @@ -535,11 +535,11 @@ public class BlockWire extends Block return wire_none; } - public StackSize getMaxStackSize() { + public StackSize getMaxAmount() { return StackSize.XL; } - public Property[] getUnsavedProperties() { + protected Property[] getUnsavedProperties() { return new Property[] {DOWN, UP, EAST, NORTH, SOUTH, WEST}; } diff --git a/common/src/main/java/common/block/tech/BlockWorkbench.java b/common/src/main/java/common/block/tech/BlockWorkbench.java index 6dc32b32..b2d58ff5 100755 --- a/common/src/main/java/common/block/tech/BlockWorkbench.java +++ b/common/src/main/java/common/block/tech/BlockWorkbench.java @@ -29,7 +29,7 @@ public class BlockWorkbench extends Block return this.size; } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (worldIn.client) { diff --git a/common/src/main/java/common/block/tile/BlockSign.java b/common/src/main/java/common/block/tile/BlockSign.java index 046fb7ef..2c87aaf8 100755 --- a/common/src/main/java/common/block/tile/BlockSign.java +++ b/common/src/main/java/common/block/tile/BlockSign.java @@ -26,7 +26,7 @@ public class BlockSign extends Block implements ITileEntityProvider this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f); } - public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) + public boolean onUse(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ) { if (!worldIn.client && Vars.editSigns) { @@ -40,15 +40,15 @@ public class BlockSign extends Block implements ITileEntityProvider return true; } - public BoundingBox getCollisionBoundingBox(World worldIn, BlockPos pos, State state) + public BoundingBox getCollisionBox(World worldIn, BlockPos pos, State state) { return null; } - public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos) + public BoundingBox getSelectionBox(World worldIn, BlockPos pos) { - this.setBlockBoundsBasedOnState(worldIn, pos); - return super.getSelectedBoundingBox(worldIn, pos); + this.setBlockBounds(worldIn, pos); + return super.getSelectionBox(worldIn, pos); } public boolean isFullCube() @@ -123,9 +123,9 @@ public class BlockSign extends Block implements ITileEntityProvider || this.isInvalidNeighbor(world, pos, Facing.WEST) || this.isInvalidNeighbor(world, pos, Facing.EAST); } - public boolean canPlaceBlockAt(World worldIn, BlockPos pos) + public boolean canPlace(World worldIn, BlockPos pos) { - return !this.hasInvalidNeighbor(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos); + return !this.hasInvalidNeighbor(worldIn, pos) && super.canPlace(worldIn, pos); } public boolean isXrayVisible() diff --git a/common/src/main/java/common/block/tile/BlockStandingSign.java b/common/src/main/java/common/block/tile/BlockStandingSign.java index f1d8a776..8ca42cf9 100755 --- a/common/src/main/java/common/block/tile/BlockStandingSign.java +++ b/common/src/main/java/common/block/tile/BlockStandingSign.java @@ -29,15 +29,15 @@ public class BlockStandingSign extends BlockSign /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { if (!worldIn.getState(pos.down()).getBlock().getMaterial().isSolid()) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onUpdate(worldIn, pos, state, neighborBlock); } protected Property[] getProperties() @@ -63,7 +63,7 @@ public class BlockStandingSign extends BlockSign { return false; } - else if (!this.canPlaceBlockAt(worldIn, pos)) + else if (!this.canPlace(worldIn, pos)) { return false; } @@ -96,7 +96,7 @@ public class BlockStandingSign extends BlockSign } } - public boolean canPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) + public boolean checkPlace(World worldIn, BlockPos pos, Facing side, EntityNPC player, ItemStack stack) { return side != Facing.DOWN && worldIn.getState(pos).getBlock().getMaterial().isSolid(); } diff --git a/common/src/main/java/common/block/tile/BlockWallSign.java b/common/src/main/java/common/block/tile/BlockWallSign.java index 0728c9c1..8c957e4a 100755 --- a/common/src/main/java/common/block/tile/BlockWallSign.java +++ b/common/src/main/java/common/block/tile/BlockWallSign.java @@ -18,7 +18,7 @@ public class BlockWallSign extends BlockSign implements Rotatable } - public void setBlockBoundsBasedOnState(IWorldAccess worldIn, BlockPos pos) + public void setBlockBounds(IWorldAccess worldIn, BlockPos pos) { Facing enumfacing = (Facing)worldIn.getState(pos).getValue(FACING); float f = 0.28125F; @@ -50,17 +50,17 @@ public class BlockWallSign extends BlockSign implements Rotatable /** * Called when a neighboring block changes. */ - public void onNeighborBlockChange(World worldIn, BlockPos pos, State state, Block neighborBlock) + public void onUpdate(World worldIn, BlockPos pos, State state, Block neighborBlock) { Facing enumfacing = (Facing)state.getValue(FACING); if (!worldIn.getState(pos.offset(enumfacing.getOpposite())).getBlock().getMaterial().isSolid()) { - this.dropBlockAsItem(worldIn, pos, state, 0); + this.drop(worldIn, pos, state, 0); worldIn.setBlockToAir(pos); } - super.onNeighborBlockChange(worldIn, pos, state, neighborBlock); + super.onUpdate(worldIn, pos, state, neighborBlock); } protected Property[] getProperties() diff --git a/common/src/main/java/common/entity/Entity.java b/common/src/main/java/common/entity/Entity.java index c062bcb4..0fd725cf 100755 --- a/common/src/main/java/common/entity/Entity.java +++ b/common/src/main/java/common/entity/Entity.java @@ -725,7 +725,7 @@ public abstract class Entity if (d4 != y) { - block1.onLanded(this.worldObj, this); + block1.onLandMove(this.worldObj, this); } if (this.canTriggerWalking() && !flag && this.vehicle == null) @@ -741,7 +741,7 @@ public abstract class Entity if (block1 != null && this.onGround) { - block1.onEntityCollidedWithBlock(this.worldObj, blockpos, this); + block1.onCollideMove(this.worldObj, blockpos, this); } this.walkDistMod = (float)((double)this.walkDistMod + (double)ExtMath.sqrtd(d12 * d12 + d14 * d14) * 0.6D); @@ -831,7 +831,7 @@ public abstract class Entity BlockPos blockpos2 = new BlockPos(i, j, k); State iblockstate = this.worldObj.getState(blockpos2); - iblockstate.getBlock().onEntityCollidedWithBlock(this.worldObj, blockpos2, iblockstate, this); + iblockstate.getBlock().onCollideUpdate(this.worldObj, blockpos2, iblockstate, this); } } } @@ -840,11 +840,11 @@ public abstract class Entity protected void playStepSound(BlockPos pos, Block blockIn) { - SoundType block$soundtype = blockIn.sound; + SoundType block$soundtype = blockIn.getSound(); if (this.worldObj.getState(pos.up()).getBlock() == Blocks.snow_layer) { - block$soundtype = Blocks.snow_layer.sound; + block$soundtype = Blocks.snow_layer.getSound(); if(block$soundtype.getStepSound() != null) this.playSound(block$soundtype.getStepSound(), 0.15F); } @@ -898,7 +898,7 @@ public abstract class Entity } else if (blockIn != null) { - blockIn.onFallenUpon(this.worldObj, pos, this, this.fallDistance); + blockIn.onLandUpdate(this.worldObj, pos, this, this.fallDistance); } else { @@ -2140,7 +2140,7 @@ public abstract class Entity private boolean isBlockFullCube(BlockPos pos) { State state = this.worldObj.getState(pos); - BoundingBox bb = state.getBlock().getCollisionBoundingBox(this.worldObj, pos, state); + BoundingBox bb = state.getBlock().getCollisionBox(this.worldObj, pos, state); return bb != null && bb.getAverageEdgeLength() >= 1.0D; } @@ -2398,7 +2398,7 @@ public abstract class Entity */ public float getExplosionResistance(Explosion explosionIn, World worldIn, BlockPos pos, State blockStateIn) { - return blockStateIn.getBlock().getExplosionResistance(this); + return blockStateIn.getBlock().getResistance(this); } public boolean verifyExplosion(Explosion explosionIn, World worldIn, BlockPos pos, State blockStateIn, float p_174816_5_) diff --git a/common/src/main/java/common/entity/animal/EntityHorse.java b/common/src/main/java/common/entity/animal/EntityHorse.java index d504a4c0..96099311 100755 --- a/common/src/main/java/common/entity/animal/EntityHorse.java +++ b/common/src/main/java/common/entity/animal/EntityHorse.java @@ -408,7 +408,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic if (block != Blocks.air) // && !this.isSilent()) { - SoundType block$soundtype = block.sound; + SoundType block$soundtype = block.getSound(); if(block$soundtype.getStepSound() != null) this.worldObj.playSoundAtEntity(this, block$soundtype.getStepSound(), 0.5F); } @@ -592,11 +592,11 @@ public class EntityHorse extends EntityAnimal implements IInvBasic protected void playStepSound(BlockPos pos, Block blockIn) { - SoundType block$soundtype = blockIn.sound; + SoundType block$soundtype = blockIn.getSound(); if (this.worldObj.getState(pos.up()).getBlock() == Blocks.snow_layer) { - block$soundtype = Blocks.snow_layer.sound; + block$soundtype = Blocks.snow_layer.getSound(); } if (!blockIn.getMaterial().isLiquid()) diff --git a/common/src/main/java/common/entity/effect/EntityLightning.java b/common/src/main/java/common/entity/effect/EntityLightning.java index 04176fcc..379fd02e 100755 --- a/common/src/main/java/common/entity/effect/EntityLightning.java +++ b/common/src/main/java/common/entity/effect/EntityLightning.java @@ -65,7 +65,7 @@ public class EntityLightning extends EntityWeatherEffect this.boltVertex = this.rand.longv(); BlockPos blockpos = new BlockPos(this); - if (!this.worldObj.client && this.fire && Vars.fire && this.worldObj.isAreaLoaded(blockpos, 10) && this.worldObj.getState(blockpos).getBlock() == Blocks.air && Blocks.fire.canPlaceBlockAt(this.worldObj, blockpos)) + if (!this.worldObj.client && this.fire && Vars.fire && this.worldObj.isAreaLoaded(blockpos, 10) && this.worldObj.getState(blockpos).getBlock() == Blocks.air && Blocks.fire.canPlace(this.worldObj, blockpos)) { this.worldObj.setState(blockpos, Blocks.fire.getState()); } diff --git a/common/src/main/java/common/entity/item/EntityItem.java b/common/src/main/java/common/entity/item/EntityItem.java index e6494dd6..0e7b393f 100755 --- a/common/src/main/java/common/entity/item/EntityItem.java +++ b/common/src/main/java/common/entity/item/EntityItem.java @@ -151,7 +151,7 @@ public class EntityItem extends Entity if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().slipperiness * 0.98F; + f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.98F; } this.motionX *= (double)f; diff --git a/common/src/main/java/common/entity/item/EntityXp.java b/common/src/main/java/common/entity/item/EntityXp.java index e9edd9fc..6ceeb0fa 100755 --- a/common/src/main/java/common/entity/item/EntityXp.java +++ b/common/src/main/java/common/entity/item/EntityXp.java @@ -176,7 +176,7 @@ public class EntityXp extends Entity implements IObjectData if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().slipperiness * 0.98F; + f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.98F; } this.motionX *= (double)f; diff --git a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java index 40a73e12..f50bb14e 100755 --- a/common/src/main/java/common/entity/npc/EntityFlyingNPC.java +++ b/common/src/main/java/common/entity/npc/EntityFlyingNPC.java @@ -89,7 +89,7 @@ public abstract class EntityFlyingNPC extends EntityNPC if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().slipperiness * 0.91F; + f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } float f1 = 0.16277136F / (f * f * f); @@ -98,7 +98,7 @@ public abstract class EntityFlyingNPC extends EntityNPC if (this.onGround) { - f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().slipperiness * 0.91F; + f = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } this.moveEntity(this.motionX, this.motionY, this.motionZ); diff --git a/common/src/main/java/common/entity/projectile/EntityArrow.java b/common/src/main/java/common/entity/projectile/EntityArrow.java index b3f9a031..64f8554b 100755 --- a/common/src/main/java/common/entity/projectile/EntityArrow.java +++ b/common/src/main/java/common/entity/projectile/EntityArrow.java @@ -202,8 +202,8 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData if (block != Blocks.air) { - block.setBlockBoundsBasedOnState(this.worldObj, blockpos); - BoundingBox axisalignedbb = block.getCollisionBoundingBox(this.worldObj, blockpos, iblockstate); + block.setBlockBounds(this.worldObj, blockpos); + BoundingBox axisalignedbb = block.getCollisionBox(this.worldObj, blockpos, iblockstate); if (axisalignedbb != null && axisalignedbb.isVecInside(new Vec3(this.posX, this.posY, this.posZ))) { @@ -395,7 +395,7 @@ public class EntityArrow extends Entity implements IProjectile, IObjectData if (this.inTile.getBlock() != Blocks.air) { - this.inTile.getBlock().onEntityCollidedWithBlock(this.worldObj, blockpos1, iblockstate1, this); + this.inTile.getBlock().onCollideUpdate(this.worldObj, blockpos1, iblockstate1, this); } } } diff --git a/common/src/main/java/common/entity/types/EntityLiving.java b/common/src/main/java/common/entity/types/EntityLiving.java index 4014fbdf..83f50957 100755 --- a/common/src/main/java/common/entity/types/EntityLiving.java +++ b/common/src/main/java/common/entity/types/EntityLiving.java @@ -1130,7 +1130,7 @@ public abstract class EntityLiving extends Entity if (block != Blocks.air) { - SoundType block$soundtype = block.sound; + SoundType block$soundtype = block.getSound(); if(block$soundtype.getStepSound() != null) this.playSound(block$soundtype.getStepSound(), 0.5F); } @@ -1539,7 +1539,7 @@ public abstract class EntityLiving extends Entity if (this.onGround) { - f4 = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().slipperiness * 0.91F; + f4 = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } float f = 0.16277136F / (f4 * f4 * f4); @@ -1559,7 +1559,7 @@ public abstract class EntityLiving extends Entity if (this.onGround) { - f4 = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().slipperiness * 0.91F; + f4 = this.worldObj.getState(new BlockPos(ExtMath.floord(this.posX), ExtMath.floord(this.getEntityBoundingBox().minY) - 1, ExtMath.floord(this.posZ))).getBlock().getSlipperiness() * 0.91F; } if (this.isOnLadder()) diff --git a/common/src/main/java/common/init/BlockRegistry.java b/common/src/main/java/common/init/BlockRegistry.java index a6204592..af7ea4b2 100755 --- a/common/src/main/java/common/init/BlockRegistry.java +++ b/common/src/main/java/common/init/BlockRegistry.java @@ -227,10 +227,10 @@ public abstract class BlockRegistry { private static void registerFluid(String name, String display, boolean infinite, LiquidType type, boolean opaque, int light, int rate, float radiation, Object still, Object flowing) { BlockDynamicLiquid dy = (BlockDynamicLiquid)(new BlockDynamicLiquid(type.material, infinite, opaque, rate, flowing)).setHardness(100.0F) - .setLightOpacity(opaque ? 0 : 3).setLightLevel((float)light / 15.0f).setDisplay(display) + .setOpacity(opaque ? 0 : 3).setLight((float)light / 15.0f).setDisplay(display) .setRadiation(radiation); BlockStaticLiquid st = (BlockStaticLiquid)(new BlockStaticLiquid(type.material, opaque, rate, still, dy)).setHardness(100.0F) - .setLightOpacity(opaque ? 0 : 3).setLightLevel((float)light / 15.0f).setDisplay(display) + .setOpacity(opaque ? 0 : 3).setLight((float)light / 15.0f).setDisplay(display) .setRadiation(radiation); register("flowing_" + name, dy); register(name, st); @@ -238,52 +238,52 @@ public abstract class BlockRegistry { static void register() { register("air", air = (new BlockAir()).setDisplay("Luft")); - Block stone = (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Stein"); + Block stone = (new BlockStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Stein"); register("stone", stone); - register("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setStepSound(SoundType.STONE) + register("bedrock", (new BlockBedrock()).setHardness(1000.0F).setResistance(100000.0F).setSound(SoundType.STONE) .setDisplay("Grundgestein").setTab(CheatTab.ROCK).setMiningLevel(6)); - register("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.ROCK)); - register("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.ROCK)); - register("hellrock", (new BlockHellRock()).setHardness(0.4F).setStepSound(SoundType.STONE).setDisplay("Höllenstein")); + register("rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Felsen").setTab(CheatTab.ROCK)); + register("smooth_rock", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE).setDisplay("Glatter Felsen").setTab(CheatTab.ROCK)); + register("hellrock", (new BlockHellRock()).setHardness(0.4F).setSound(SoundType.STONE).setDisplay("Höllenstein")); register("cell_rock", (new Block(Material.LOOSE)).setHardness(1.0F).setResistance(3.0F) - .setStepSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.ROCK)); + .setSound(SoundType.SLIME).setDisplay("Zellstein").setTab(CheatTab.ROCK)); register("moon_rock", (new Block(Material.SOLID)).setHardness(2.5F).setResistance(10.0F) - .setStepSound(SoundType.STONE).setDisplay("Mondgestein").setTab(CheatTab.ROCK)); - Block cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + .setSound(SoundType.STONE).setDisplay("Mondgestein").setTab(CheatTab.ROCK)); + Block cobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Bruchstein").setTab(CheatTab.ROCK); register("cobblestone", cobblestone); - Block mossyCobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + Block mossyCobblestone = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Bemooster Bruchstein").setTab(CheatTab.ROCK); register("mossy_cobblestone", mossyCobblestone); - Block sandstone = (new BlockSandStone("normal")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein"); + Block sandstone = (new BlockSandStone("normal")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Sandstein"); register("sandstone", sandstone); - register("smooth_sandstone", (new BlockSandStone("smooth")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein")); - register("carved_sandstone", (new BlockSandStone("carved")).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein")); - register("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setStepSound(SoundType.STONE) + register("smooth_sandstone", (new BlockSandStone("smooth")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Glatter Sandstein")); + register("carved_sandstone", (new BlockSandStone("carved")).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Sandstein")); + register("obsidian", (new BlockObsidian()).setHardness(50.0F).setResistance(2000.0F).setSound(SoundType.STONE) .setDisplay("Obsidian").setMiningLevel(3)); - register("clay", (new BlockClay()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable()); - register("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setStepSound(SoundType.STONE).setDisplay("Gebrannter Ton")); + register("clay", (new BlockClay()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ton").setShovelHarvestable()); + register("hardened_clay", (new BlockHardenedClay()).setHardness(1.25F).setResistance(7.0F).setSound(SoundType.STONE).setDisplay("Gebrannter Ton")); for(DyeColor color : DyeColor.values()) { register(color.getName() + "_clay", (new BlockColoredClay(color)).setHardness(1.25F).setResistance(7.0F) - .setStepSound(SoundType.STONE).setDisplay(color.getDisplay() + " gefärbter Ton")); + .setSound(SoundType.STONE).setDisplay(color.getDisplay() + " gefärbter Ton")); } register("coal_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) - .setStepSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE).setFlammable(5, 5)); - register("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); - register("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Roter Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); - register("gravel", (new BlockGravel()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable()); - register("ash", (new BlockFalling(Material.LOOSE)).setHardness(0.2F).setStepSound(SoundType.SAND).setDisplay("Asche") + .setSound(SoundType.STONE).setDisplay("Kohleblock").setTab(CheatTab.NATURE).setFlammable(5, 5)); + register("sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); + register("red_sand", (new BlockFalling(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Roter Sand").setShovelHarvestable().setTab(CheatTab.NATURE)); + register("gravel", (new BlockGravel()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Kies").setShovelHarvestable()); + register("ash", (new BlockFalling(Material.LOOSE)).setHardness(0.2F).setSound(SoundType.SAND).setDisplay("Asche") .setTab(CheatTab.NATURE).setShovelHarvestable()); - register("snow_layer", (new BlockSnow()).setHardness(0.1F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setLightOpacity(0) + register("snow_layer", (new BlockSnow()).setHardness(0.1F).setSound(SoundType.SNOW).setDisplay("Schnee").setOpacity(0) .setShovelHarvestable()); - register("snow", (new BlockSnowBlock()).setHardness(0.2F).setStepSound(SoundType.SNOW).setDisplay("Schnee").setShovelHarvestable()); - register("ice", (new BlockIce()).setHardness(0.5F).setLightOpacity(3).setStepSound(SoundType.GLASS).setDisplay("Eis").setMiningLevel(0)); - register("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setStepSound(SoundType.GLASS).setDisplay("Packeis").setMiningLevel(0)); - register("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setStepSound(SoundType.SAND).setDisplay("Seelensand").setShovelHarvestable()); - register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setStepSound(SoundType.GLASS).setLightLevel(1.0F) + register("snow", (new BlockSnowBlock()).setHardness(0.2F).setSound(SoundType.SNOW).setDisplay("Schnee").setShovelHarvestable()); + register("ice", (new BlockIce()).setHardness(0.5F).setOpacity(3).setSound(SoundType.GLASS).setDisplay("Eis").setMiningLevel(0)); + register("packed_ice", (new BlockPackedIce()).setHardness(0.5F).setSound(SoundType.GLASS).setDisplay("Packeis").setMiningLevel(0)); + register("soul_sand", (new BlockSoulSand()).setHardness(0.5F).setSound(SoundType.SAND).setDisplay("Seelensand").setShovelHarvestable()); + register("glowstone", (new BlockGlowstone(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setLight(1.0F) .setDisplay("Glowstone")); - register("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarzstein")); - register("blackened_cobble", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + register("blackened_stone", (new BlockBlackenedStone()).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Schwarzstein")); + register("blackened_cobble", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Schwarzbruchstein").setTab(CheatTab.ROCK)); @@ -301,16 +301,16 @@ public abstract class BlockRegistry { registerFluid("springwater", "Klares Wasser", true, LiquidType.COLD, false, 0, 5, 0.0f, 1, 1); - register("coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE).setDisplay("Steinkohle")); - register("lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) + register("coal_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE).setDisplay("Steinkohle")); + register("lapis_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) .setDisplay("Lapislazulierz").setMiningLevel(1)); - register("emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) + register("emerald_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) .setDisplay("Smaragderz").setMiningLevel(2)); - register("quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) + register("quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) .setDisplay("Quarzerz")); - register("black_quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) + register("black_quartz_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) .setDisplay("Schwarzes Quarzerz")); - register("charge_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) + register("charge_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) .setDisplay("Geladenes Erz").setMiningLevel(2)); for(MetalType metal : MetalType.values()) { @@ -320,67 +320,67 @@ public abstract class BlockRegistry { } for(OreType ore : OreType.values()) { // String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1); - register(ore.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setStepSound(SoundType.STONE) + register(ore.name + "_ore", (new BlockOre()).setHardness(3.0F).setResistance(5.0F).setSound(SoundType.STONE) .setDisplay(ore.display + "erz").setMiningLevel(ore.material.getHarvestLevel() - 1)); } - register("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); - register("grass", (new BlockGrass()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Gras").setShovelHarvestable()); - register("coarse_dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); - register("podzol", (new BlockPodzol()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Podsol").setShovelHarvestable()); - register("mycelium", (new BlockMycelium()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Myzel").setShovelHarvestable()); - register("tian", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE) + register("dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); + register("grass", (new BlockGrass()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Gras").setShovelHarvestable()); + register("coarse_dirt", (new Block(Material.LOOSE)).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Grobe Erde").setShovelHarvestable().setTab(CheatTab.NATURE)); + register("podzol", (new BlockPodzol()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Podsol").setShovelHarvestable()); + register("mycelium", (new BlockMycelium()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Myzel").setShovelHarvestable()); + register("tian", (new Block(Material.SOLID)).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE) .setDisplay("Tian").setTab(CheatTab.NATURE)); - register("tian_soil", (new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setStepSound(SoundType.STONE) + register("tian_soil", (new BlockTianSoil()).setHardness(2.0F).setResistance(15.0F).setSound(SoundType.STONE) .setDisplay("Tianerde").setTab(CheatTab.NATURE)); register("moon_cheese", (new BlockTreasure(Material.SOFT)).setHardness(1.5F).setResistance(5.0F) - .setStepSound(SoundType.CLOTH).setDisplay("Mondkäse").setTab(CheatTab.NATURE)); - register("slime_block", (new BlockSlime()).setDisplay("Schleimblock").setStepSound(SoundType.SLIME)); - register("blackened_dirt", (new BlockBlackenedDirt()).setHardness(0.5F).setStepSound(SoundType.GRAVEL).setDisplay("Schwarzerde").setShovelHarvestable()); - register("blackened_soil", (new BlockBlackenedSoil()).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwarzgrund").setShovelHarvestable()); + .setSound(SoundType.CLOTH).setDisplay("Mondkäse").setTab(CheatTab.NATURE)); + register("slime_block", (new BlockSlime()).setDisplay("Schleimblock").setSound(SoundType.SLIME)); + register("blackened_dirt", (new BlockBlackenedDirt()).setHardness(0.5F).setSound(SoundType.GRAVEL).setDisplay("Schwarzerde").setShovelHarvestable()); + register("blackened_soil", (new BlockBlackenedSoil()).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Schwarzgrund").setShovelHarvestable()); for(BlockTallGrass.EnumType type : BlockTallGrass.EnumType.values()) { - register(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsEfficiency(0)); + register(type.getName(), (new BlockTallGrass(type)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay(type.getDisplay()).setShearsEfficiency(0)); } - register("deadbush", (new BlockDeadBush()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Toter Busch")); + register("deadbush", (new BlockDeadBush()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Toter Busch")); for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { - register(type.getName(), (new BlockFlower(type)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay(type.getDisplay())); + register(type.getName(), (new BlockFlower(type)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay(type.getDisplay())); } for(BlockDoublePlant.EnumPlantType type : BlockDoublePlant.EnumPlantType.values()) { register(type.getName(), new BlockDoublePlant(type).setDisplay(type.getDisplay())); } - Block cactus = (new BlockCactus()).setHardness(0.4F).setStepSound(SoundType.CLOTH).setDisplay("Kaktus"); + Block cactus = (new BlockCactus()).setHardness(0.4F).setSound(SoundType.CLOTH).setDisplay("Kaktus"); register("cactus", cactus); - register("reeds", (new BlockReed()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS)); - register("vine", (new BlockVine()).setHardness(0.2F).setStepSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0)); - register("waterlily", (new BlockLilyPad()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Seerosenblatt")); + register("reeds", (new BlockReed()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Zuckerrohr").setTab(CheatTab.PLANTS)); + register("vine", (new BlockVine()).setHardness(0.2F).setSound(SoundType.GRASS).setDisplay("Ranken").setShearsEfficiency(0)); + register("waterlily", (new BlockLilyPad()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Seerosenblatt")); - Block brownMushroom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.125F) + Block brownMushroom = (new BlockMushroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0.125F) .setDisplay("Pilz"); register("brown_mushroom", brownMushroom); register("brown_mushroom_block", (new BlockHugeMushroom(brownMushroom)).setHardness(0.2F) - .setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS)); - Block redMushrooom = (new BlockMushroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("Pilz"); + .setSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS)); + Block redMushrooom = (new BlockMushroom()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("Pilz"); register("red_mushroom", redMushrooom); register("red_mushroom_block", (new BlockHugeMushroom(redMushrooom)).setHardness(0.2F) - .setStepSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS)); - register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setStepSound(SoundType.GRASS).setLightLevel(0.5F) + .setSound(SoundType.WOOD).setDisplay("Pilzblock").setTab(CheatTab.PLANTS)); + register("blue_mushroom", (new BlockBlueShroom()).setHardness(0.0F).setSound(SoundType.GRASS).setLight(0.5F) .setDisplay("Tianpilz")); - Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbis"); + Block pumpkin = (new BlockPumpkin()).setHardness(1.0F).setSound(SoundType.WOOD).setDisplay("Kürbis"); register("pumpkin", pumpkin); - register("pumpkin_stem", (new BlockStem(pumpkin)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Kürbisstamm")); - Block melon = (new BlockMelon()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Melone"); + register("pumpkin_stem", (new BlockStem(pumpkin)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Kürbisstamm")); + Block melon = (new BlockMelon()).setHardness(1.0F).setSound(SoundType.WOOD).setDisplay("Melone"); register("melon_block", melon); - register("melon_stem", (new BlockStem(melon)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Melonenstamm")); + register("melon_stem", (new BlockStem(melon)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Melonenstamm")); register("dry_leaves", (new BlockDryLeaves()).setDisplay("Vertrocknetes Laub")); @@ -389,76 +389,76 @@ public abstract class BlockRegistry { for(LeavesType type : LeavesType.values()) { register(wood.getName() + "_leaves_" + type.getName(), (new BlockLeaves(wood, type)).setDisplay(wood.getDisplay() + "laub (" + type.getDisplayName() + ")")); } - register(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F).setStepSound(SoundType.GRASS) + register(wood.getName() + "_sapling", (new BlockSapling(wood)).setHardness(0.0F).setSound(SoundType.GRASS) .setDisplay(wood.getDisplay() + "setzling")); } - register("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Feuer der Seelen")); - register("black_fire", (new BlockTintedFire(0x202020)).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Dunkles Feuer")); - register("web", (new BlockWeb()).setLightOpacity(1).setHardness(4.0F).setDisplay("Spinnennetz")); - register("fire", (new BlockFire()).setHardness(0.0F).setLightLevel(1.0F).setStepSound(SoundType.CLOTH).setDisplay("Feuer")); + register("soul_fire", (new BlockSoulFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Feuer der Seelen")); + register("black_fire", (new BlockTintedFire(0x202020)).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Dunkles Feuer")); + register("web", (new BlockWeb()).setOpacity(1).setHardness(4.0F).setDisplay("Spinnennetz")); + register("fire", (new BlockFire()).setHardness(0.0F).setLight(1.0F).setSound(SoundType.CLOTH).setDisplay("Feuer")); register("lapis_block", (new Block(Material.SOLID)).setHardness(3.0F).setResistance(5.0F) - .setStepSound(SoundType.STONE).setDisplay("Lapislazuliblock").setTab(CheatTab.GEMS).setMiningLevel(1)); + .setSound(SoundType.STONE).setDisplay("Lapislazuliblock").setTab(CheatTab.GEMS).setMiningLevel(1)); register("emerald_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) - .setStepSound(SoundType.STONE).setDisplay("Smaragdblock").setTab(CheatTab.GEMS).setMiningLevel(2)); + .setSound(SoundType.STONE).setDisplay("Smaragdblock").setTab(CheatTab.GEMS).setMiningLevel(2)); register("charged_block", (new BlockMagnetic(Material.SOLID)).setHardness(5.0F).setResistance(10.0F) - .setStepSound(SoundType.STONE).setDisplay("Geladener Block").setTab(CheatTab.GEMS)); + .setSound(SoundType.STONE).setDisplay("Geladener Block").setTab(CheatTab.GEMS)); - register("glass", (new BlockGlass()).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glas")); + register("glass", (new BlockGlass()).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Glas")); for(DyeColor color : DyeColor.values()) { - register(color.getName() + "_glass", (new BlockStainedGlass(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbtes Glas")); + register(color.getName() + "_glass", (new BlockStainedGlass(color)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbtes Glas")); } - register("glass_pane", (new BlockPane(Material.TRANSLUCENT)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Glasscheibe")); + register("glass_pane", (new BlockPane(Material.TRANSLUCENT)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Glasscheibe")); for(DyeColor color : DyeColor.values()) { - register(color.getName() + "_glass_pane", (new BlockStainedGlassPane(color)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbte Glasscheibe")); + register(color.getName() + "_glass_pane", (new BlockStainedGlassPane(color)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay(color.getDisplay() + " gefärbte Glasscheibe")); } for(DyeColor color : DyeColor.values()) { - register(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle") + register(color.getName() + "_wool", (new BlockWool(color)).setHardness(0.8F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(-1) + " Wolle") .setShearsEfficiency(1)); } for(DyeColor color : DyeColor.values()) { - register(color.getName() + "_carpet", (new BlockCarpet(color)).setHardness(0.1F).setStepSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setLightOpacity(0)); + register(color.getName() + "_carpet", (new BlockCarpet(color)).setHardness(0.1F).setSound(SoundType.CLOTH).setDisplay(color.getSubject(1) + " Teppich").setOpacity(0)); } for(DyeColor color : BlockBed.COLORS) { - register(color.getName() + "_bed", (new BlockBed(color)).setStepSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett")); + register(color.getName() + "_bed", (new BlockBed(color)).setSound(SoundType.WOOD).setHardness(0.2F).setDisplay(color.getSubject(0) + " Bett")); } - register("ladder", (new BlockLadder()).setHardness(0.4F).setStepSound(SoundType.LADDER).setDisplay("Leiter").setAxeHarvestable()); - register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setStepSound(SoundType.WOOD).setDisplay("Bücherregal")); - register("cake", (new BlockCake()).setHardness(0.5F).setStepSound(SoundType.CLOTH).setDisplay("Kuchen").setTab(CheatTab.DECORATION)); - register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setStepSound(SoundType.STONE) - .setLightLevel(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION)); - register("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf").setTab(CheatTab.DECORATION)); - register("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay())); + register("ladder", (new BlockLadder()).setHardness(0.4F).setSound(SoundType.LADDER).setDisplay("Leiter").setAxeHarvestable()); + register("bookshelf", (new BlockBookshelf()).setHardness(1.5F).setSound(SoundType.WOOD).setDisplay("Bücherregal")); + register("cake", (new BlockCake()).setHardness(0.5F).setSound(SoundType.CLOTH).setDisplay("Kuchen").setTab(CheatTab.DECORATION)); + register("dragon_egg", (new BlockDragonEgg()).setHardness(3.0F).setResistance(15.0F).setSound(SoundType.STONE) + .setLight(0.125F).setDisplay("Drachenei").setTab(CheatTab.DECORATION)); + register("flowerpot", (new BlockFlowerPot(null)).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Blumentopf").setTab(CheatTab.DECORATION)); + register("flowerpot_cactus", (new BlockFlowerPot(cactus)).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Blumentopf mit " + cactus.getDisplay())); for(BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) { - register("flowerpot_" + type.getName(), (new BlockFlowerPot(BlockFlower.getByType(type))).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Blumentopf mit " + type.getDisplay())); + register("flowerpot_" + type.getName(), (new BlockFlowerPot(BlockFlower.getByType(type))).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Blumentopf mit " + type.getDisplay())); } - register("sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setStepSound(SoundType.GRASS).setDisplay("Schwamm") + register("sponge", (new Block(Material.LOOSE)).setHardness(0.6F).setSound(SoundType.GRASS).setDisplay("Schwamm") .setTab(CheatTab.DECORATION)); - register("skull", (new BlockSkull()).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION)); - register("hay_block", (new BlockHay()).setHardness(0.5F).setStepSound(SoundType.GRASS).setDisplay("Strohballen") + register("skull", (new BlockSkull()).setHardness(1.0F).setSound(SoundType.STONE).setDisplay("Schädel").setTab(CheatTab.DECORATION)); + register("hay_block", (new BlockHay()).setHardness(0.5F).setSound(SoundType.GRASS).setDisplay("Strohballen") .setTab(CheatTab.DECORATION)); - register("sign", (new BlockStandingSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild")); - register("wall_sign", (new BlockWallSign()).setHardness(1.0F).setStepSound(SoundType.WOOD).setDisplay("Schild")); + register("sign", (new BlockStandingSign()).setHardness(1.0F).setSound(SoundType.WOOD).setDisplay("Schild")); + register("wall_sign", (new BlockWallSign()).setHardness(1.0F).setSound(SoundType.WOOD).setDisplay("Schild")); for(int density : new int[] {1, 2, 4}) { - BlockInactiveDisplay display = (BlockInactiveDisplay)new BlockInactiveDisplay(density).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Displaymodul (" + (density * 16) + + BlockInactiveDisplay display = (BlockInactiveDisplay)new BlockInactiveDisplay(density).setHardness(1.0F).setSound(SoundType.STONE).setDisplay("Displaymodul (" + (density * 16) + "x" + (density * 16) + ")"); register("display" + (density == 1 ? "" : density), display); - register("display" + (density == 1 ? "" : density) + "_on", new BlockActiveDisplay(display).setHardness(1.0F).setStepSound(SoundType.STONE).setDisplay("Displaymodul (" + (density * 16) + + register("display" + (density == 1 ? "" : density) + "_on", new BlockActiveDisplay(display).setHardness(1.0F).setSound(SoundType.STONE).setDisplay("Displaymodul (" + (density * 16) + "x" + (density * 16) + ")")); } - register("portal", (new BlockPortal()).setHardness(0.0F).setStepSound(SoundType.GLASS).setLightLevel(0.75F).setDisplay("Portal")); + register("portal", (new BlockPortal()).setHardness(0.0F).setSound(SoundType.GLASS).setLight(0.75F).setDisplay("Portal")); register("floor_portal", (new BlockFloorPortal(Material.PORTAL)).setHardness(0.0F).setDisplay("Portal")); - register("portal_frame", (new BlockPortalFrame()).setStepSound(SoundType.GLASS).setLightLevel(0.125F).setHardness(5.0F) + register("portal_frame", (new BlockPortalFrame()).setSound(SoundType.GLASS).setLight(0.125F).setHardness(5.0F) .setDisplay("Portalrahmen").setResistance(2000.0F).setTab(CheatTab.TECHNOLOGY)); - register("farmland", (new BlockFarmland()).setHardness(0.6F).setStepSound(SoundType.GRAVEL).setDisplay("Ackerboden") + register("farmland", (new BlockFarmland()).setHardness(0.6F).setSound(SoundType.GRAVEL).setDisplay("Ackerboden") .setShovelHarvestable().setTab(CheatTab.PLANTS)); register("wheats", (new BlockCrops()).setDisplay("Getreide")); register("carrots", (new BlockCarrot()).setDisplay("Karotten")); @@ -475,7 +475,7 @@ public abstract class BlockRegistry { } for(OreType ore : OreType.values()) { // String loc = ore.name.substring(0, 1).toUpperCase() + ore.name.substring(1); - register(ore.name + "_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + register(ore.name + "_block", (new Block(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay(ore.display + "block").setTab(CheatTab.GEMS) .setMiningLevel(ore.material.getHarvestLevel() - 1)); } @@ -497,73 +497,73 @@ public abstract class BlockRegistry { "sandstone_bottom", "sandstone_all")) // fix type .setDisplay("Sandsteintreppe")); - Block quartz = (new BlockQuartz(false, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzblock"); + Block quartz = (new BlockQuartz(false, false)).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzblock"); register("quartz_block", quartz); - register("quartz_ornaments", (new BlockQuartz(false, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Quarzblock")); - register("quartz_pillar", (new BlockQuartzPillar(false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzsäule")); + register("quartz_ornaments", (new BlockQuartz(false, true)).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Quarzblock")); + register("quartz_pillar", (new BlockQuartzPillar(false)).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzsäule")); register("quartz_slab", (new BlockSlab(quartz, "quartz_block_bottom", "quartz_top")).setDisplay("Quarzstufe")); register("quartz_stairs", (new BlockStairs(quartz, "quartz_block_bottom", "quartz_top")) .setDisplay("Quarztreppe")); - register("iron_bars", (new BlockPane(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + register("iron_bars", (new BlockPane(Material.SOLID)).setHardness(5.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Eisengitter")); - register("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisenfalltür")); + register("iron_trapdoor", (new BlockTrapDoor(Material.SOLID)).setHardness(5.0F).setSound(SoundType.STONE).setDisplay("Eisenfalltür")); - Block brick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + Block brick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Ziegelsteine").setTab(CheatTab.BLOCKS); register("brick_block", brick); register("brick_slab", (new BlockSlab(brick)).setDisplay("Ziegelstufe")); register("brick_stairs", (new BlockStairs(brick)).setDisplay("Ziegeltreppe")); - Block stonebrick = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + Block stonebrick = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Steinziegel").setTab(CheatTab.BLOCKS); register("stonebrick", stonebrick); - register("mossy_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + register("mossy_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Bemooste Steinziegel").setTab(CheatTab.BLOCKS)); - register("cracked_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + register("cracked_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Rissige Steinziegel").setTab(CheatTab.BLOCKS)); - register("carved_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + register("carved_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Gemeißelte Steinziegel").setTab(CheatTab.BLOCKS)); register("stonebrick_slab", (new BlockSlab(stonebrick)).setDisplay("Steinziegelstufe")); register("stonebrick_stairs", (new BlockStairs(stonebrick)) .setDisplay("Steinziegeltreppe")); - Block bloodBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + Block bloodBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Blutrote Ziegel").setTab(CheatTab.BLOCKS); register("blood_brick", bloodBrick); register("blood_brick_slab", (new BlockSlab(bloodBrick)).setDisplay("Blutrote Ziegelstufe")); register("blood_brick_fence", (new BlockFence(Material.SOLID, "blood_brick")).setHardness(2.0F).setResistance(10.0F) - .setStepSound(SoundType.STONE).setDisplay("Blutroter Ziegelzaun")); + .setSound(SoundType.STONE).setDisplay("Blutroter Ziegelzaun")); register("blood_brick_stairs", (new BlockStairs(bloodBrick)).setDisplay("Blutrote Ziegeltreppe")); - Block blackBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE) + Block blackBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Schwarze Ziegel").setTab(CheatTab.BLOCKS); register("black_brick", blackBrick); register("black_brick_slab", (new BlockSlab(blackBrick)).setDisplay("Schwarze Ziegelstufe")); register("black_brick_stairs", (new BlockStairs(blackBrick)).setDisplay("Schwarze Ziegeltreppe")); register("black_brick_fence", (new BlockFence(Material.SOLID, "black_brick")).setHardness(2.0F).setResistance(10.0F) - .setStepSound(SoundType.STONE).setDisplay("Schwarzer Ziegelzaun")); + .setSound(SoundType.STONE).setDisplay("Schwarzer Ziegelzaun")); - Block bquartz = (new BlockQuartz(true, false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer Quarzblock"); + Block bquartz = (new BlockQuartz(true, false)).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer Quarzblock"); register("black_quartz_block", bquartz); - register("black_quartz_ornaments", (new BlockQuartz(true, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer gemeißelter Quarzblock")); - register("black_quartz_pillar", (new BlockQuartzPillar(true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarze Quarzsäule")); + register("black_quartz_ornaments", (new BlockQuartz(true, true)).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer gemeißelter Quarzblock")); + register("black_quartz_pillar", (new BlockQuartzPillar(true)).setSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarze Quarzsäule")); register("black_quartz_slab", (new BlockSlab(bquartz, "black_quartz_block_bottom", "black_quartz_top")).setDisplay("Schwarze Quarzstufe")); register("black_quartz_stairs", (new BlockStairs(bquartz, "black_quartz_block_bottom", "black_quartz_top")) .setDisplay("Schwarze Quarztreppe")); - Block concrete = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Beton").setTab(CheatTab.BLOCKS); + Block concrete = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setSound(SoundType.STONE).setDisplay("Beton").setTab(CheatTab.BLOCKS); register("concrete", concrete); register("concrete_slab", (new BlockSlab(concrete)).setDisplay("Betonstufe")); register("concrete_stairs", (new BlockStairs(concrete)).setDisplay("Betontreppe")); for(DecoType deco : DecoType.values()) { Block block = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F) - .setStepSound(SoundType.STONE).setDisplay(deco.display).setTab(CheatTab.BLOCKS); + .setSound(SoundType.STONE).setDisplay(deco.display).setTab(CheatTab.BLOCKS); register(deco.name, block); register(deco.name + "_slab", (new BlockSlab(block)).setDisplay(deco.display + " - Stufe")); register(deco.name + "_stairs", (new BlockStairs(block)).setDisplay(deco.display + " - Treppe")); @@ -572,38 +572,38 @@ public abstract class BlockRegistry { - register("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD).setDisplay("Holzfalltür").setFlammable(5, 20)); + register("trapdoor", (new BlockTrapDoor(Material.WOOD)).setHardness(3.0F).setSound(SoundType.WOOD).setDisplay("Holzfalltür").setFlammable(5, 20)); for(WoodType wood : WoodType.values()) { - Block planks = (new Block(Material.WOOD)).setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD) + Block planks = (new Block(Material.WOOD)).setHardness(2.0F).setResistance(5.0F).setSound(SoundType.WOOD) .setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20); register(wood.getName() + "_planks", planks); register(wood.getName() + "_stairs", (new BlockStairs(planks)) .setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20)); register(wood.getName() + "_slab", (new BlockSlab(planks)).setDisplay(wood.getDisplay() + "holzstufe").setFlammable(5, 20)); register(wood.getName() + "_fence", (new BlockFence(Material.WOOD, wood.getName() + "_planks")) - .setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20)); + .setHardness(2.0F).setResistance(5.0F).setSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20)); register(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F).setResistance(5.0F) - .setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20)); + .setSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzauntor").setFlammable(5, 20)); } - register("core", new BlockCore().setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE) + register("core", new BlockCore().setHardness(1.5F).setResistance(10.0F).setSound(SoundType.STONE) .setDisplay("Chunk-Lade-Kern")); - register("mob_spawner", (new BlockMobSpawner()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Mob-Spawner")); - register("workbench", (new BlockWorkbench(3)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Werkbank")); - register("furnace", (new BlockFurnace(false)).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Ofen") + register("mob_spawner", (new BlockMobSpawner()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Mob-Spawner")); + register("workbench", (new BlockWorkbench(3)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Werkbank")); + register("furnace", (new BlockFurnace(false)).setHardness(3.5F).setSound(SoundType.STONE).setDisplay("Ofen") .setTab(CheatTab.TECHNOLOGY)); - register("lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setStepSound(SoundType.STONE).setLightLevel(0.875F) + register("lit_furnace", (new BlockFurnace(true)).setHardness(3.5F).setSound(SoundType.STONE).setLight(0.875F) .setDisplay("Ofen (Gefeuert)").setTab(CheatTab.TECHNOLOGY)); for(int z = 0; z < BlockAnvil.ANVILS.length; z++) { - register("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setStepSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss")); + register("anvil" + (z == 0 ? "" : "_damaged_" + z), (new BlockAnvil(z)).setHardness(5.0F).setSound(SoundType.ANVIL).setResistance(2000.0F).setDisplay((z == 0 ? "" : (z == 1 ? "Leicht beschädigter " : "Stark beschädigter ")) + "Amboss")); } register("enchanting_table", (new BlockEnchantmentTable()).setHardness(5.0F).setResistance(2000.0F).setDisplay("Zaubertisch")); - register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLightLevel(0.125F).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY)); + register("brewing_stand", (new BlockBrewingStand()).setHardness(0.5F).setLight(0.125F).setDisplay("Braustand").setTab(CheatTab.TECHNOLOGY)); register("cauldron", (new BlockCauldron()).setHardness(2.0F).setDisplay("Kessel").setTab(CheatTab.TECHNOLOGY)); - register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLightLevel(1.0F)); - register("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Konstruktionstisch")); - register("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setStepSound(SoundType.WOOD).setDisplay("Fertigungseinheit")); + register("effect_generator", (new BlockEffectGenerator()).setDisplay("Effektgenerator").setLight(1.0F)); + register("construction_table", (new BlockWorkbench(4)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Konstruktionstisch")); + register("assembly_unit", (new BlockWorkbench(5)).setHardness(2.5F).setSound(SoundType.WOOD).setDisplay("Fertigungseinheit")); register("chest", new BlockChest(9, 3).setDisplay("Truhe")); register("large_chest", new BlockChest(9, 6).setDisplay("Große Truhe")); @@ -613,61 +613,61 @@ public abstract class BlockRegistry { register("huge_chest", new BlockChest(22, 18).setDisplay("Große Truhe")); register("giant_chest", new BlockChest(28, 18).setDisplay("Große Truhe")); register("toolarge_chest", new BlockChest(32, 18).setDisplay("Große Truhe")); - register("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setStepSound(SoundType.STONE) - .setDisplay("Warptruhe").setLightLevel(0.5F)); + register("warp_chest", (new BlockWarpChest()).setHardness(22.5F).setResistance(1000.0F).setSound(SoundType.STONE) + .setDisplay("Warptruhe").setLight(0.5F)); for(int z = 0; z < BlockTNT.TNTS.length; z++) { - register("tnt" + (z == 0 ? "" : "_" + z), (new BlockTNT(z)).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("TNT" + Util.getTierSuffix(z))); + register("tnt" + (z == 0 ? "" : "_" + z), (new BlockTNT(z)).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("TNT" + Util.getTierSuffix(z))); } - register("nuke", (new BlockNuke()).setHardness(0.0F).setStepSound(SoundType.GRASS).setDisplay("T-17")); + register("nuke", (new BlockNuke()).setHardness(0.0F).setSound(SoundType.GRASS).setDisplay("T-17")); register("piston", (new BlockPistonBase(false)).setDisplay("Kolben")); register("sticky_piston", (new BlockPistonBase(true)).setDisplay("Klebriger Kolben")); register("piston_head", (new BlockPistonHead(false)).setDisplay("Kolben")); register("sticky_piston_head", (new BlockPistonHead(true)).setDisplay("Klebriger Kolben")); - register("dispenser", (new BlockDispenser()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Werfer")); - register("dropper", (new BlockDropper()).setHardness(3.5F).setStepSound(SoundType.STONE).setDisplay("Spender")); - register("hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Trichter")); - register("tian_reactor", (new BlockTianReactor()).setHardness(3.0F).setResistance(8.0F).setStepSound(SoundType.STONE).setDisplay("Tianreaktor")); + register("dispenser", (new BlockDispenser()).setHardness(3.5F).setSound(SoundType.STONE).setDisplay("Werfer")); + register("dropper", (new BlockDropper()).setHardness(3.5F).setSound(SoundType.STONE).setDisplay("Spender")); + register("hopper", (new BlockHopper()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Trichter")); + register("tian_reactor", (new BlockTianReactor()).setHardness(3.0F).setResistance(8.0F).setSound(SoundType.STONE).setDisplay("Tianreaktor")); - register("rail", (new BlockRail()).setHardness(0.7F).setStepSound(SoundType.STONE).setDisplay("Schiene").setMiningLevel(0)); + register("rail", (new BlockRail()).setHardness(0.7F).setSound(SoundType.STONE).setDisplay("Schiene").setMiningLevel(0)); - register("lever", (new BlockLever()).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Hebel")); + register("lever", (new BlockLever()).setHardness(0.5F).setSound(SoundType.WOOD).setDisplay("Hebel")); register("stone_pressure_plate", (new BlockPressurePlate(Material.SOLID, BlockPressurePlate.Sensitivity.MOBS)).setHardness(0.5F) - .setStepSound(SoundType.STONE).setDisplay("Steindruckplatte")); + .setSound(SoundType.STONE).setDisplay("Steindruckplatte")); register("wooden_pressure_plate", (new BlockPressurePlate(Material.WOOD, BlockPressurePlate.Sensitivity.EVERYTHING)) - .setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Holzdruckplatte")); + .setHardness(0.5F).setSound(SoundType.WOOD).setDisplay("Holzdruckplatte")); register("light_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 15)).setHardness(0.5F) - .setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (niedrige Gewichte)")); + .setSound(SoundType.WOOD).setDisplay("Wägeplatte (niedrige Gewichte)")); register("heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted(Material.SOLID, 150)).setHardness(0.5F) - .setStepSound(SoundType.WOOD).setDisplay("Wägeplatte (hohe Gewichte)")); + .setSound(SoundType.WOOD).setDisplay("Wägeplatte (hohe Gewichte)")); - register("stone_button", (new BlockButton(false, 20, "stone")).setHardness(0.5F).setStepSound(SoundType.STONE).setDisplay("Knopf")); - register("wooden_button", (new BlockButton(true, 30, "oak_planks")).setHardness(0.5F).setStepSound(SoundType.WOOD).setDisplay("Knopf")); - register("red_button", (new BlockButton(true, 10, "red_button")).setHardness(0.5F).setStepSound(SoundType.STONE).setDisplay("Knopf")); + register("stone_button", (new BlockButton(false, 20, "stone")).setHardness(0.5F).setSound(SoundType.STONE).setDisplay("Knopf")); + register("wooden_button", (new BlockButton(true, 30, "oak_planks")).setHardness(0.5F).setSound(SoundType.WOOD).setDisplay("Knopf")); + register("red_button", (new BlockButton(true, 10, "red_button")).setHardness(0.5F).setSound(SoundType.STONE).setDisplay("Knopf")); - register("wire", (new BlockWire()).setHardness(0.0F).setStepSound(SoundType.STONE).setDisplay("Kabel").setTab(CheatTab.TECHNOLOGY)); + register("wire", (new BlockWire()).setHardness(0.0F).setSound(SoundType.STONE).setDisplay("Kabel").setTab(CheatTab.TECHNOLOGY)); BlockUnlitTorch torch; - register("torch", (torch = new BlockUnlitTorch(0xffffffff)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Fackel")); - register("lit_torch", (new BlockLitTorch(torch)).setHardness(0.0F).setLightLevel(0.9375F).setStepSound(SoundType.WOOD).setDisplay("Fackel")); + register("torch", (torch = new BlockUnlitTorch(0xffffffff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Fackel")); + register("lit_torch", (new BlockLitTorch(torch)).setHardness(0.0F).setLight(0.9375F).setSound(SoundType.WOOD).setDisplay("Fackel")); BlockUnlitTorch tianTorch; - register("tian_torch", (tianTorch = new BlockUnlitTorch(0x7f00ff)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Tian-Fackel")); - register("lit_tian_torch", (new BlockLitTorch(tianTorch)).setHardness(0.0F).setLightLevel(0.5F).setStepSound(SoundType.WOOD) + register("tian_torch", (tianTorch = new BlockUnlitTorch(0x7f00ff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Tian-Fackel")); + register("lit_tian_torch", (new BlockLitTorch(tianTorch)).setHardness(0.0F).setLight(0.5F).setSound(SoundType.WOOD) .setDisplay("Tian-Fackel")); BlockUnlitTorch soulTorch; - register("soul_torch", (soulTorch = new BlockUnlitTorch(0x1f1fff)).setHardness(0.0F).setStepSound(SoundType.WOOD).setDisplay("Seelenfackel")); - register("lit_soul_torch", (new BlockLitTorch(soulTorch)).setHardness(0.0F).setLightLevel(0.75F).setStepSound(SoundType.WOOD) + register("soul_torch", (soulTorch = new BlockUnlitTorch(0x1f1fff)).setHardness(0.0F).setSound(SoundType.WOOD).setDisplay("Seelenfackel")); + register("lit_soul_torch", (new BlockLitTorch(soulTorch)).setHardness(0.0F).setLight(0.75F).setSound(SoundType.WOOD) .setDisplay("Seelenfackel")); - register("lamp", (new BlockToggleableLight(false)).setHardness(0.3F).setStepSound(SoundType.GLASS) + register("lamp", (new BlockToggleableLight(false)).setHardness(0.3F).setSound(SoundType.GLASS) .setDisplay("Lampe").setTab(CheatTab.TECHNOLOGY)); - register("lit_lamp", (new BlockToggleableLight(true)).setHardness(0.3F).setStepSound(SoundType.GLASS).setDisplay("Lampe")); + register("lit_lamp", (new BlockToggleableLight(true)).setHardness(0.3F).setSound(SoundType.GLASS).setDisplay("Lampe")); register("tripwire_hook", (new BlockTripWireHook()).setDisplay("Haken")); register("string", (new BlockTripWire()).setDisplay("Stolperdraht").setShearsEfficiency(0).setTab(CheatTab.TECHNOLOGY)); - register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setStepSound(SoundType.STONE).setDisplay("Eisentür")); + register("iron_door", (new BlockDoor(Material.SOLID)).setHardness(5.0F).setSound(SoundType.STONE).setDisplay("Eisentür")); for(WoodType wood : WoodType.values()) { - register(wood.getName() + "_door", (new BlockDoor(Material.WOOD)).setHardness(3.0F).setStepSound(SoundType.WOOD) + register(wood.getName() + "_door", (new BlockDoor(Material.WOOD)).setHardness(3.0F).setSound(SoundType.WOOD) .setDisplay(wood.getDisplay() + "holztür").setFlammable(5, 20)); } diff --git a/common/src/main/java/common/item/Item.java b/common/src/main/java/common/item/Item.java index b63058df..785b7395 100755 --- a/common/src/main/java/common/item/Item.java +++ b/common/src/main/java/common/item/Item.java @@ -46,8 +46,8 @@ public class Item { this.setTab(this.block.getTab()); if(this.block.isMagnetic()) this.setMagnetic(); - if(this.block.getMaxStackSize() != null) - this.setMaxAmount(this.block.getMaxStackSize()); + if(this.block.getMaxAmount() != null) + this.setMaxAmount(this.block.getMaxAmount()); if(this.block.getItemColor() != null) this.setColor(this.block.getItemColor()); } @@ -242,7 +242,7 @@ public class Item { public void addInformation(ItemStack stack, EntityNPC playerIn, List tooltip) { if(this.block != null) - this.block.addInformation(stack, playerIn, tooltip); + this.block.getTooltips(stack, playerIn, tooltip); } public boolean canEnchant(ItemStack stack) { diff --git a/common/src/main/java/common/item/material/ItemDye.java b/common/src/main/java/common/item/material/ItemDye.java index dfc3acde..2829ef95 100755 --- a/common/src/main/java/common/item/material/ItemDye.java +++ b/common/src/main/java/common/item/material/ItemDye.java @@ -140,7 +140,7 @@ public class ItemDye extends Item { if (block != Blocks.air) { - block.setBlockBoundsBasedOnState(worldIn, pos); + block.setBlockBounds(worldIn, pos); for (int i = 0; i < amount; ++i) { diff --git a/common/src/main/java/common/item/tool/ItemFire.java b/common/src/main/java/common/item/tool/ItemFire.java index a1917b84..eeac54fc 100755 --- a/common/src/main/java/common/item/tool/ItemFire.java +++ b/common/src/main/java/common/item/tool/ItemFire.java @@ -62,7 +62,7 @@ public class ItemFire extends Item } else if (world.getState(pos).getBlock() instanceof BlockTNT tnt) { - tnt.onBlockDestroyedByPlayer(world, pos, tnt.getState().withProperty(BlockTNT.EXPLODE, true)); + tnt.onBroken(world, pos, tnt.getState().withProperty(BlockTNT.EXPLODE, true)); world.setBlockToAir(pos); world.playAuxSFX(1000, blockpos, 0); } diff --git a/common/src/main/java/common/item/tool/ItemHoe.java b/common/src/main/java/common/item/tool/ItemHoe.java index e712e9e4..0bd395e7 100755 --- a/common/src/main/java/common/item/tool/ItemHoe.java +++ b/common/src/main/java/common/item/tool/ItemHoe.java @@ -67,8 +67,8 @@ public class ItemHoe extends Item protected boolean useHoe(ItemStack stack, EntityNPC player, World worldIn, BlockPos target, State newState) { - if(newState.getBlock().sound.getStepSound() != null) - worldIn.playSound(newState.getBlock().sound.getStepSound(), (double)((float)target.getX() + 0.5F), (double)((float)target.getY() + 0.5F), (double)((float)target.getZ() + 0.5F), 1.0F); + if(newState.getBlock().getSound().getStepSound() != null) + worldIn.playSound(newState.getBlock().getSound().getStepSound(), (double)((float)target.getX() + 0.5F), (double)((float)target.getY() + 0.5F), (double)((float)target.getZ() + 0.5F), 1.0F); if (worldIn.client) { diff --git a/common/src/main/java/common/item/tool/ItemTool.java b/common/src/main/java/common/item/tool/ItemTool.java index 1283d2e1..578a9f10 100755 --- a/common/src/main/java/common/item/tool/ItemTool.java +++ b/common/src/main/java/common/item/tool/ItemTool.java @@ -38,7 +38,7 @@ public abstract class ItemTool extends Item { } public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLiving player) { - if(block.getBlockHardness(world, pos) != 0.0f) + if(block.getHardness(world, pos) != 0.0f) stack.damage(1, player); return true; } diff --git a/common/src/main/java/common/item/weapon/ItemSword.java b/common/src/main/java/common/item/weapon/ItemSword.java index 1b3bf96b..7a3b3f43 100755 --- a/common/src/main/java/common/item/weapon/ItemSword.java +++ b/common/src/main/java/common/item/weapon/ItemSword.java @@ -71,7 +71,7 @@ public class ItemSword extends Item */ public boolean onBlockDestroyed(ItemStack stack, World worldIn, Block blockIn, BlockPos pos, EntityLiving playerIn) { - if ((double)blockIn.getBlockHardness(worldIn, pos) != 0.0D) + if ((double)blockIn.getHardness(worldIn, pos) != 0.0D) { stack.damage(2, playerIn); } diff --git a/common/src/main/java/common/world/BlockArray.java b/common/src/main/java/common/world/BlockArray.java index e0368b89..584b1a4f 100755 --- a/common/src/main/java/common/world/BlockArray.java +++ b/common/src/main/java/common/world/BlockArray.java @@ -28,7 +28,7 @@ public class BlockArray { if(filler != null && filler.getBlock() != Blocks.air) { Arrays.fill(this.data, (char)BlockRegistry.getId(filler)); this.blocks = this.data.length; - this.ticked = filler.getBlock().getTickRandomly() ? this.data.length : 0; + this.ticked = filler.getBlock().isTicked() ? this.data.length : 0; } } @@ -43,12 +43,12 @@ public class BlockArray { Block block = state.getBlock(); if(oblock != Blocks.air) { --this.blocks; - if(oblock.getTickRandomly()) + if(oblock.isTicked()) --this.ticked; } if(block != Blocks.air) { ++this.blocks; - if(block.getTickRandomly()) + if(block.isTicked()) ++this.ticked; } if(ostate == this.filler) @@ -105,7 +105,7 @@ public class BlockArray { Block block = state.getBlock(); if(block != Blocks.air) { ++this.blocks; - if(block.getTickRandomly()) + if(block.isTicked()) ++this.ticked; } if(this.filler != null && state != this.filler) diff --git a/common/src/main/java/common/world/Chunk.java b/common/src/main/java/common/world/Chunk.java index f17fbc74..7b6005b1 100755 --- a/common/src/main/java/common/world/Chunk.java +++ b/common/src/main/java/common/world/Chunk.java @@ -345,7 +345,7 @@ public abstract class Chunk { if(oldb != block) { if(!this.world.client) { - oldb.onBlockRemoved((AWorldServer)this.world, pos, old); + oldb.onRemoved((AWorldServer)this.world, pos, old); } if(oldb instanceof ITileEntityProvider) { this.world.removeTileEntity(pos); @@ -386,7 +386,7 @@ public abstract class Chunk { } if(!this.world.client && oldb != block) { - block.onBlockAdded((AWorldServer)this.world, pos, state); + block.onAdded((AWorldServer)this.world, pos, state); } if(block instanceof ITileEntityProvider) { @@ -719,7 +719,7 @@ public abstract class Chunk { for(Facing face : Facing.values()) { BlockPos side = block.offset(face); - if(this.world.getState(side).getBlock().getLightValue() > 0) { + if(this.world.getState(side).getBlock().getLight() > 0) { this.world.checkLight(side); } } @@ -822,7 +822,7 @@ public abstract class Chunk { for(int y = pos.getY(); y > bottom; --y) { pos.set(pos.getX(), y, pos.getZ()); - if(this.getBlock(pos).getLightValue() > 0) { + if(this.getBlock(pos).getLight() > 0) { this.world.checkLight(pos); } } diff --git a/common/src/main/java/common/world/Explosion.java b/common/src/main/java/common/world/Explosion.java index 7e7c7eb7..5e99a990 100755 --- a/common/src/main/java/common/world/Explosion.java +++ b/common/src/main/java/common/world/Explosion.java @@ -125,7 +125,7 @@ public class Explosion if (iblockstate.getBlock() != Blocks.air) { - float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); + float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getResistance((Entity)null); f -= (f2 + 0.3F) * 0.3F; } @@ -164,7 +164,7 @@ public class Explosion float f = this.explosionSize; // * (0.7F + this.worldObj.rand.nextFloat() * 0.6F); if (iblockstate.getBlock() != Blocks.air) { - float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getExplosionResistance((Entity)null); + float f2 = this.exploder != null ? this.exploder.getExplosionResistance(this, this.worldObj, blockpos, iblockstate) : iblockstate.getBlock().getResistance((Entity)null); f -= (f2 + 0.3F) * 0.3F; } @@ -199,7 +199,7 @@ public class Explosion (dist < explosionSize && rand.doublev() + ((dist - (explosionSize - falloff)) / falloff) < 1.0d))) { BlockPos blockpos = new BlockPos(explosionX + x, explosionY + y, explosionZ + z); State iblockstate = worldObj.getState(blockpos); - if(iblockstate.getBlock() != Blocks.air && iblockstate.getBlock().getExplosionResistance(null) < 60000.0f) { + if(iblockstate.getBlock() != Blocks.air && iblockstate.getBlock().getResistance(null) < 60000.0f) { worldObj.setState(blockpos, Blocks.air.getState(), 3); if(rand.chance(1000)) { worldObj.playSound(SoundEvent.EXPLODE, explosionX + x, explosionY + y, explosionZ + z, 4.0F); @@ -328,13 +328,13 @@ public class Explosion if (block != Blocks.air) { - if (block.canDropFromExplosion(this)) + if (block.canDrop(this)) { - block.dropBlockAsItemWithChance(this.worldObj, blockpos, this.worldObj.getState(blockpos), 1.0F / this.explosionSize, 0); + block.drop(this.worldObj, blockpos, this.worldObj.getState(blockpos), 1.0F / this.explosionSize, 0); } this.worldObj.setState(blockpos, Blocks.air.getState(), 3); - block.onBlockDestroyedByExplosion(this.worldObj, blockpos, this, state); + block.onDestroyedExplosion(this.worldObj, blockpos, this, state); } } } diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index 4fcd57ef..10d92064 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -267,7 +267,7 @@ public abstract class World implements IWorldAccess { else { Block block1 = iblockstate.getBlock(); - if(block.getLightOpacity() != block1.getLightOpacity() || block.getLightValue() != block1.getLightValue()) { + if(block.getLightOpacity() != block1.getLightOpacity() || block.getLight() != block1.getLight()) { // this.profiler.start("checkLight"); this.checkLight(pos); // this.profiler.end(); @@ -305,7 +305,7 @@ public abstract class World implements IWorldAccess { this.playAuxSFX(2001, pos, BlockRegistry.getId(iblockstate)); if(dropBlock) { - block.dropBlockAsItem(this, pos, iblockstate, 0); + block.drop(this, pos, iblockstate, 0); } return this.setState(pos, Blocks.air.getState(), 3); @@ -371,7 +371,7 @@ public abstract class World implements IWorldAccess { if(!this.client) { State iblockstate = this.getState(pos); - iblockstate.getBlock().onNeighborBlockChange(this, pos, iblockstate, blockIn); + iblockstate.getBlock().onUpdate(this, pos, iblockstate, blockIn); } } @@ -631,9 +631,9 @@ public abstract class World implements IWorldAccess { State iblockstate = this.getState(blockpos); Block block = iblockstate.getBlock(); - if((!ignoreBlockWithoutBoundingBox || block.getCollisionBoundingBox(this, blockpos, iblockstate) != null) - && block.canCollideCheck(iblockstate, stopOnLiquid)) { - HitPosition movingobjectposition = block.collisionRayTrace(this, blockpos, vec31, vec32); + if((!ignoreBlockWithoutBoundingBox || block.getCollisionBox(this, blockpos, iblockstate) != null) + && block.canRayTrace(iblockstate, stopOnLiquid)) { + HitPosition movingobjectposition = block.rayTrace(this, blockpos, vec31, vec32); if(movingobjectposition != null) { return movingobjectposition; @@ -742,9 +742,9 @@ public abstract class World implements IWorldAccess { State iblockstate1 = this.getState(blockpos); Block block1 = iblockstate1.getBlock(); - if(!ignoreBlockWithoutBoundingBox || block1.getCollisionBoundingBox(this, blockpos, iblockstate1) != null) { - if(block1.canCollideCheck(iblockstate1, stopOnLiquid)) { - HitPosition movingobjectposition1 = block1.collisionRayTrace(this, blockpos, vec31, vec32); + if(!ignoreBlockWithoutBoundingBox || block1.getCollisionBox(this, blockpos, iblockstate1) != null) { + if(block1.canRayTrace(iblockstate1, stopOnLiquid)) { + HitPosition movingobjectposition1 = block1.rayTrace(this, blockpos, vec31, vec32); if(movingobjectposition1 != null) { return movingobjectposition1; @@ -848,7 +848,7 @@ public abstract class World implements IWorldAccess { iblockstate1 = this.getState(blockpos$mutableblockpos); } - iblockstate1.getBlock().addCollisionBoxesToList(this, blockpos$mutableblockpos, iblockstate1, bb, list, entityIn); + iblockstate1.getBlock().getCollisionBoxes(this, blockpos$mutableblockpos, iblockstate1, bb, list, entityIn); } } } @@ -916,7 +916,7 @@ public abstract class World implements IWorldAccess { iblockstate = Blocks.bedrock.getState(); } - iblockstate.getBlock().addCollisionBoxesToList(this, blockpos$mutableblockpos, iblockstate, bb, list, (Entity)null); + iblockstate.getBlock().getCollisionBoxes(this, blockpos$mutableblockpos, iblockstate, bb, list, (Entity)null); } } } @@ -1309,7 +1309,7 @@ public abstract class World implements IWorldAccess { if((double)l >= d0) { flag = true; - vec3 = block.modifyAcceleration(this, blockpos$mutableblockpos, entityIn, vec3); + vec3 = block.getAcceleration(this, blockpos$mutableblockpos, entityIn, vec3); } } } @@ -1633,7 +1633,7 @@ public abstract class World implements IWorldAccess { Block block = this.getState(pos).getBlock(); if((block == Blocks.air || (allowLayers && block == Blocks.snow_layer)) - && Blocks.snow_layer.canPlaceBlockAt(this, pos)) { + && Blocks.snow_layer.canPlace(this, pos)) { return true; } } @@ -1659,10 +1659,10 @@ public abstract class World implements IWorldAccess { } else { Block block = this.getState(pos).getBlock(); - int i = lightType == LightType.SKY ? 0 : block.getLightValue(); + int i = lightType == LightType.SKY ? 0 : block.getLight(); int j = block.getLightOpacity(); - if(j >= 15 && block.getLightValue() > 0) { + if(j >= 15 && block.getLight() > 0) { j = 1; } @@ -1863,10 +1863,10 @@ public abstract class World implements IWorldAccess { public boolean canBlockBePlaced(Block blockIn, BlockPos pos, boolean p_175716_3_, Facing side, Entity entityIn, ItemStack itemStackIn) { Block block = this.getState(pos).getBlock(); - BoundingBox axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBoundingBox(this, pos, blockIn.getState()); + BoundingBox axisalignedbb = p_175716_3_ ? null : blockIn.getCollisionBox(this, pos, blockIn.getState()); return axisalignedbb != null && !this.checkNoEntityCollision(axisalignedbb, entityIn) ? false : (block.getMaterial() == Material.SMALL && blockIn instanceof BlockAnvil ? true - : block.getMaterial().isReplaceable() && blockIn.canPlaceBlockOnSide(this, pos, side)); + : block.getMaterial().isReplaceable() && blockIn.canPlace(this, pos, side)); } public int getSeaLevel() { diff --git a/server/src/main/java/server/network/Player.java b/server/src/main/java/server/network/Player.java index f431a540..7cd298cb 100755 --- a/server/src/main/java/server/network/Player.java +++ b/server/src/main/java/server/network/Player.java @@ -1029,7 +1029,7 @@ public class Player extends User implements Executor, IPlayer } else { - float f = block.getPlayerRelativeBlockHardness(this.entity, this.entity.worldObj, this.removingPos) * (float)(i + 1); + float f = block.getHardness(this.entity, this.entity.worldObj, this.removingPos) * (float)(i + 1); int j = (int)(f * 10.0F); if (j != this.durabilityRemainingOnBlock) @@ -1058,7 +1058,7 @@ public class Player extends User implements Executor, IPlayer else { int k = this.curblockDamage - this.initialDamage; - float f1 = block1.getPlayerRelativeBlockHardness(this.entity, this.entity.worldObj, this.removingPos) * (float)(k + 1); + float f1 = block1.getHardness(this.entity, this.entity.worldObj, this.removingPos) * (float)(k + 1); int l = (int)(f1 * 10.0F); if (l != this.durabilityRemainingOnBlock) @@ -1097,8 +1097,8 @@ public class Player extends User implements Executor, IPlayer if (block != Blocks.air) { - block.onBlockClicked(this.entity.worldObj, pos, this.entity); - f = block.getPlayerRelativeBlockHardness(this.entity, this.entity.worldObj, pos); + block.onStartBreak(this.entity.worldObj, pos, this.entity); + f = block.getHardness(this.entity, this.entity.worldObj, pos); } if (block != Blocks.air && f >= 1.0F) @@ -1125,7 +1125,7 @@ public class Player extends User implements Executor, IPlayer if (block != Blocks.air) { - float f = block.getPlayerRelativeBlockHardness(this.entity, this.entity.worldObj, pos) * (float)(i + 1); + float f = block.getHardness(this.entity, this.entity.worldObj, pos) * (float)(i + 1); if (f >= 0.7F) { @@ -1153,12 +1153,12 @@ public class Player extends User implements Executor, IPlayer private boolean removeBlock(BlockPos pos) { State iblockstate = this.entity.worldObj.getState(pos); - iblockstate.getBlock().onBlockHarvested(this.entity.worldObj, pos, iblockstate, this.entity); + iblockstate.getBlock().preBroken(this.entity.worldObj, pos, iblockstate, this.entity); boolean flag = this.entity.worldObj.setBlockToAir(pos); if (flag) { - iblockstate.getBlock().onBlockDestroyedByPlayer(this.entity.worldObj, pos, iblockstate); + iblockstate.getBlock().onBroken(this.entity.worldObj, pos, iblockstate); } return flag; @@ -1199,7 +1199,7 @@ public class Player extends User implements Executor, IPlayer if (flag1 && flag) { - iblockstate.getBlock().harvestBlock(this.entity.worldObj, this.entity, pos, iblockstate, tileentity); + iblockstate.getBlock().postBroken(this.entity.worldObj, this.entity, pos, iblockstate, tileentity); } // } @@ -1247,7 +1247,7 @@ public class Player extends User implements Executor, IPlayer { State iblockstate = this.entity.worldObj.getState(pos); - if (iblockstate.getBlock().onBlockActivated(this.entity.worldObj, pos, iblockstate, this.entity, side, offsetX, offsetY, offsetZ)) + if (iblockstate.getBlock().onUse(this.entity.worldObj, pos, iblockstate, this.entity, side, offsetX, offsetY, offsetZ)) { return true; } diff --git a/server/src/main/java/server/world/NextTickListEntry.java b/server/src/main/java/server/world/NextTickListEntry.java index 1f1878b7..ce04bc8f 100755 --- a/server/src/main/java/server/world/NextTickListEntry.java +++ b/server/src/main/java/server/world/NextTickListEntry.java @@ -33,7 +33,7 @@ public class NextTickListEntry implements Comparable else { NextTickListEntry nextticklistentry = (NextTickListEntry)p_equals_1_; - return this.position.equals(nextticklistentry.position) && Block.isEqualTo(this.block, nextticklistentry.block); + return this.position.equals(nextticklistentry.position) && this.block != null && this.block == nextticklistentry.block; } } diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index 25d55e54..8b563bb6 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -528,7 +528,7 @@ public final class WorldServer extends AWorldServer { } if(this.isRaining()) { // && this.getBiomeGenForCoords(blockpos1).canRain()) { - this.getState(blockpos1).getBlock().fillWithRain(this, blockpos1); + this.getState(blockpos1).getBlock().onRain(this, blockpos1); } if(SVars.igniteChance > 0 && Vars.fire && !this.isRaining() && @@ -556,10 +556,12 @@ public final class WorldServer extends AWorldServer { State state = section.get(x, y, z); Block block = state.getBlock(); - if(block.getTickRandomly()) { + if(block.isTicked()) { ++dtics; - block.randomTick(this, new BlockPos(x + cx, y + section.getY(), z + cz), state, - this.rand); + BlockPos bpos = new BlockPos(x + cx, y + section.getY(), z + cz); + block.tick(this, bpos, state, this.rand); + if(block.getRadiation() > 0.0f && this.rand.chance(tics / 3)) + this.applyRadiation(bpos, state, block); } } } @@ -571,6 +573,19 @@ public final class WorldServer extends AWorldServer { } } + private void applyRadiation(BlockPos pos, State state, Block block) { + float rad = block.getRadiation() * 8.0f * 0.25f; + float r = ExtMath.clampf(rad * 2.0f, 0.0f, 25.0f); + BoundingBox box = block.getCollisionBox(this, pos, state); + if(box == null) + box = new BoundingBox(pos, pos.add(1, 1, 1)); + for(EntityLiving entity : this.getEntitiesWithinAABB(EntityLiving.class, box.expand(r, r, r))) { + float effect = rad * 2.0f * (r - ExtMath.sqrtf((float)entity.getDistanceSq(pos))) / r; + if(effect > 0.0f) + entity.addRadiation(effect); + } + } + private BlockPos adjustPosToNearbyEntity(BlockPos pos) { BlockPos blockpos = this.getPrecipitationHeight(pos); BoundingBox axisalignedbb = (new BoundingBox(blockpos, new BlockPos(blockpos.getX(), World.MAX_SIZE_Y, blockpos.getZ()))).expand(3.0D, @@ -598,14 +613,14 @@ public final class WorldServer extends AWorldServer { if(this.updatesForced > 0 && blockIn != Blocks.air) { --this.updatesForced; - if(blockIn.requiresUpdates()) { + if(blockIn.canTick()) { i = 8; if(this.isAreaLoaded(nextticklistentry.position.add(-i, -i, -i), nextticklistentry.position.add(i, i, i))) { State iblockstate = this.getState(nextticklistentry.position); if(iblockstate.getBlock() != Blocks.air && iblockstate.getBlock() == nextticklistentry.getBlock()) { - iblockstate.getBlock().updateTick(this, nextticklistentry.position, iblockstate, this.rand); + iblockstate.getBlock().tick(this, nextticklistentry.position, iblockstate, this.rand); } } @@ -701,8 +716,8 @@ public final class WorldServer extends AWorldServer { State iblockstate = this.getState(nextticklistentry1.position); if(iblockstate.getBlock() != Blocks.air - && Block.isEqualTo(iblockstate.getBlock(), nextticklistentry1.getBlock())) { - iblockstate.getBlock().updateTick(this, nextticklistentry1.position, iblockstate, this.rand); + && iblockstate.getBlock() == nextticklistentry1.getBlock()) { + iblockstate.getBlock().tick(this, nextticklistentry1.position, iblockstate, this.rand); } } else { @@ -944,11 +959,11 @@ public final class WorldServer extends AWorldServer { if(fire && Vars.fire) { BlockPos pos = new BlockPos(entity); if(this.isAreaLoaded(pos, 10)) { - if(this.getState(pos).getBlock() == Blocks.air && Blocks.fire.canPlaceBlockAt(this, pos)) + if(this.getState(pos).getBlock() == Blocks.air && Blocks.fire.canPlace(this, pos)) this.setState(pos, Blocks.fire.getState()); for(int n = 0; n < 4; n++) { BlockPos extra = pos.add(this.rand.range(-1, 1), this.rand.range(-1, 1), this.rand.range(-1, 1)); - if(this.getState(extra).getBlock() == Blocks.air && Blocks.fire.canPlaceBlockAt(this, extra)) + if(this.getState(extra).getBlock() == Blocks.air && Blocks.fire.canPlace(this, extra)) this.setState(extra, Blocks.fire.getState()); } } @@ -1614,7 +1629,7 @@ public final class WorldServer extends AWorldServer { public void forceBlockUpdateTick(Block blockType, BlockPos pos, Random random) { this.updatesForced = 128; - blockType.updateTick(this, pos, this.getState(pos), random); + blockType.tick(this, pos, this.getState(pos), random); this.updatesForced = 0; } @@ -2165,7 +2180,7 @@ public final class WorldServer extends AWorldServer { if(pos.getY() >= -World.MAX_SIZE_Y && pos.getY() < World.MAX_SIZE_Y) { Block block = this.getState(pos).getBlock(); - if(block == Blocks.air && Blocks.fire.canPlaceBlockAt(this, pos)) { + if(block == Blocks.air && Blocks.fire.canPlace(this, pos)) { return true; } } diff --git a/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java b/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java index 82279503..db6590c2 100755 --- a/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java +++ b/server/src/main/java/server/worldgen/foliage/FeatureDoublePlant.java @@ -22,7 +22,7 @@ public class FeatureDoublePlant { BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); - if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 254) && this.type.canPlaceBlockAt(worldIn, blockpos)) + if (worldIn.isAirBlock(blockpos) && (worldIn.dimension.hasSkyLight() || blockpos.getY() < 254) && this.type.canPlace(worldIn, blockpos)) { this.type.placeAt(worldIn, blockpos, 2); flag = true; diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java b/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java index c8e73192..264c3e99 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenMelon.java @@ -14,7 +14,7 @@ public class WorldGenMelon extends FeatureGenerator { BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); - if (Blocks.melon_block.canPlaceBlockAt(worldIn, blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass) + if (Blocks.melon_block.canPlace(worldIn, blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass) { worldIn.setState(blockpos, Blocks.melon_block.getState(), 2); } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java b/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java index ff4d791a..97cd8757 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenPumpkin.java @@ -14,7 +14,7 @@ public class WorldGenPumpkin extends FeatureGenerator { BlockPos blockpos = position.add(rand.zrange(8) - rand.zrange(8), rand.zrange(4) - rand.zrange(4), rand.zrange(8) - rand.zrange(8)); - if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlaceBlockAt(worldIn, blockpos)) + if (worldIn.isAirBlock(blockpos) && worldIn.getState(blockpos.down()).getBlock() == Blocks.grass && Blocks.pumpkin.canPlace(worldIn, blockpos)) { worldIn.setState(blockpos, Blocks.pumpkin.getState(), 2); } diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenVines.java b/server/src/main/java/server/worldgen/foliage/WorldGenVines.java index 86fd3270..fe6bde54 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenVines.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenVines.java @@ -19,7 +19,7 @@ public class WorldGenVines extends FeatureGenerator { for (Facing enumfacing : Facing.Plane.HORIZONTAL.facings()) { - if (Blocks.vine.canPlaceBlockOnSide(worldIn, position, enumfacing)) + if (Blocks.vine.canPlace(worldIn, position, enumfacing)) { State iblockstate = Blocks.vine.getState().withProperty(BlockVine.NORTH, Boolean.valueOf(enumfacing == Facing.NORTH)).withProperty(BlockVine.EAST, Boolean.valueOf(enumfacing == Facing.EAST)).withProperty(BlockVine.SOUTH, Boolean.valueOf(enumfacing == Facing.SOUTH)).withProperty(BlockVine.WEST, Boolean.valueOf(enumfacing == Facing.WEST)); worldIn.setState(position, iblockstate, 2); diff --git a/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java b/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java index 9cb72a80..a9490230 100755 --- a/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java +++ b/server/src/main/java/server/worldgen/foliage/WorldGenWaterlily.java @@ -18,7 +18,7 @@ public class WorldGenWaterlily extends FeatureGenerator int k = position.getY() + rand.zrange(4) - rand.zrange(4); int l = position.getZ() + rand.zrange(8) - rand.zrange(8); - if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlaceBlockAt(worldIn, new BlockPos(j, k, l))) + if (worldIn.isAirBlock(new BlockPos(j, k, l)) && Blocks.waterlily.canPlace(worldIn, new BlockPos(j, k, l))) { worldIn.setState(new BlockPos(j, k, l), Blocks.waterlily.getState().withProperty(BlockLilyPad.FACING, Facing.randHorizontal(rand)), 2); }