block base class cleanup

This commit is contained in:
Sen 2025-07-20 14:20:55 +02:00
parent 346937ba4a
commit 828d215048
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
161 changed files with 1832 additions and 2044 deletions

View file

@ -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(

View file

@ -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;

View file

@ -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) {

View file

@ -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)

View file

@ -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<Entity> 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);

View file

@ -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));
}

View file

@ -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<TileEntity> tileentityspecialrenderer = TileEntityRendererDispatcher.instance.<TileEntity>getSpecialRenderer(tileentity);
TileRenderer<TileEntity> tileentityspecialrenderer = TileEntityRendererDispatcher.instance.<TileEntity>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<TileEntity> set = Sets.newHashSet(lvt_11_1_);
Set<TileEntity> set = Sets.newHashSet(forced);
Set<TileEntity> 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

View file

@ -45,7 +45,7 @@ public class RenderBlockEntity extends Render<Entity>
// 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)

View file

@ -37,29 +37,26 @@ public class RenderFallingBlock extends Render<EntityFalling>
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);
}
}
}

View file

@ -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);

View file

@ -123,7 +123,7 @@ public class RenderMinecart<T extends EntityCart> extends Render<T>
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();
}
}

View file

@ -42,7 +42,7 @@ public class RenderTntMinecart extends RenderMinecart<EntityTntCart>
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();

View file

@ -39,7 +39,7 @@ public class RenderTntPrimed extends Render<EntityTnt>
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<EntityTnt>
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);

View file

@ -54,15 +54,6 @@ public class LayerHeldItem implements LayerRenderer<EntityLiving>
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);

View file

@ -11,9 +11,13 @@ import common.tileentity.TileEntityChest;
import common.world.State;
public class TileEntityChestRenderer extends TileEntitySpecialRenderer<TileEntityChest>
public class ChestRenderer extends TileRenderer<TileEntityChest>
{
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)
{

View file

@ -17,7 +17,7 @@ import common.util.BlockPos;
import common.util.Facing;
import common.world.State;
public class TileEntityDisplayRenderer extends TileEntitySpecialRenderer<TileEntityDisplay> {
public class DisplayRenderer extends TileRenderer<TileEntityDisplay> {
private static class TimedTexture {
public long time;
public long updated;
@ -78,6 +78,10 @@ public class TileEntityDisplayRenderer extends TileEntitySpecialRenderer<TileEnt
tex.time = System.currentTimeMillis();
return tex.texture;
}
public DisplayRenderer(TileEntityRendererDispatcher renderer) {
super(renderer);
}
public void renderTileEntityAt(TileEntityDisplay te, double x, double y, double z, float partialTicks, int destroyStage) {
Block block = te.getBlockType();

View file

@ -12,12 +12,15 @@ import common.tileentity.TileEntitySign;
import common.world.State;
public class TileEntitySignRenderer extends TileEntitySpecialRenderer<TileEntitySign>
public class SignRenderer extends TileRenderer<TileEntitySign>
{
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<TileEntity
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
}
// private void drawdString(String text, int x, int y) {
// Drawing.drawText(text, x, y, 0xff000000, false);
// }
// private int getdStringWidth(String text) {
// Vec2i size = Drawing.getTextSize(text);
// return size.xpos;
// }
}

View file

@ -1,108 +0,0 @@
package client.renderer.tileentity;
import org.lwjgl.opengl.GL11;
import client.Client;
import client.renderer.GlState;
import client.renderer.layers.LayerArmor;
import client.renderer.model.ModelHorse;
import common.block.tech.BlockChest;
import common.block.tile.BlockStandingSign;
import common.entity.types.EntityLiving;
import common.item.ItemStack;
import common.item.material.ItemArmor;
import common.item.material.ItemHorseArmor;
import common.tileentity.TileEntityChest;
import common.tileentity.TileEntitySign;
import common.util.Facing;
import common.world.State;
public class TileEntityItemStackRenderer {
public static TileEntityItemStackRenderer instance = new TileEntityItemStackRenderer();
private State state;
private ItemStack stack;
private final TileEntityChest chest = new TileEntityChest(0) {
public boolean hasWorldObj() {
return true;
}
public State getBlockState() {
return TileEntityItemStackRenderer.this.state;
}
};
private final TileEntitySign sign = new TileEntitySign() {
public boolean hasWorldObj() {
return true;
}
public State getBlockState() {
return TileEntityItemStackRenderer.this.state;
}
};
private final LayerArmor armor = new LayerArmor(null, 12, 12) {
public ItemStack getCurrentArmor(EntityLiving entitylivingbaseIn, int armorSlot) {
return ((ItemArmor)TileEntityItemStackRenderer.this.stack.getItem()).armorType.getIndex() == armorSlot ? TileEntityItemStackRenderer.this.stack : null;
}
};
private final ModelHorse horse = new ModelHorse();
public void renderByItem(ItemStack stack) {
if(stack.getItem().getBlock() instanceof BlockChest chest) {
this.state = chest.getState().withProperty(BlockChest.FACING, Facing.SOUTH);
TileEntityRendererDispatcher.instance.renderTileEntityAt(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.renderTileEntityAt(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();
Client.CLIENT.getTextureManager().bindTexture("textures/armor/" + horseArmor.getArmorTexture() + "_horse.png");
this.horse.render(null, 0, 0, 0, 0, 0, 0.0625F);
if(cull)
GlState.enableCull();
GL11.glPopMatrix();
}
}
}

View file

@ -6,6 +6,7 @@ import org.lwjgl.opengl.GL13;
import client.renderer.GlState;
import client.renderer.texture.TextureManager;
import client.world.WorldClient;
import common.collect.Maps;
import common.entity.Entity;
import common.tileentity.TileEntity;
@ -13,121 +14,67 @@ import common.tileentity.TileEntityChest;
import common.tileentity.TileEntityDisplay;
import common.tileentity.TileEntitySign;
import common.util.BlockPos;
import common.world.World;
public class TileEntityRendererDispatcher
{
private Map < Class <? extends TileEntity > , TileEntitySpecialRenderer <? extends TileEntity >> mapSpecialRenderers = Maps. < Class <? extends TileEntity > , TileEntitySpecialRenderer <? extends TileEntity >> 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<Class<? extends TileEntity>, TileRenderer<? extends TileEntity>> renderers = Maps.<Class<? extends TileEntity>, TileRenderer<? extends TileEntity>>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 <T extends TileEntity> TileRenderer<T> getRenderer(Class<? extends TileEntity> clazz) {
TileRenderer<? extends TileEntity> renderer = (TileRenderer)this.renderers.get(clazz);
if(renderer == null && clazz != TileEntity.class) {
renderer = this.<TileEntity>getRenderer((Class<? extends TileEntity>)clazz.getSuperclass());
this.renderers.put(clazz, renderer);
}
return (TileRenderer<T>)renderer;
}
for (TileEntitySpecialRenderer<?> tileentityspecialrenderer : this.mapSpecialRenderers.values())
{
tileentityspecialrenderer.setRendererDispatcher(this);
}
}
public <T extends TileEntity> TileRenderer<T> getRenderer(TileEntity tile) {
return (TileRenderer<T>)(tile == null ? null : this.getRenderer(tile.getClass()));
}
public <T extends TileEntity> TileEntitySpecialRenderer<T> getSpecialRendererByClass(Class <? extends TileEntity > teClass)
{
TileEntitySpecialRenderer <? extends TileEntity > 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.<TileEntity>getSpecialRendererByClass((Class <? extends TileEntity >)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<T>)tileentityspecialrenderer;
}
public void renderItem(TileEntity tile, double x, double y, double z, float partial) {
this.render(tile, x, y, z, partial, -1);
}
public <T extends TileEntity> TileEntitySpecialRenderer<T> getSpecialRenderer(TileEntity tileEntityIn)
{
return (TileEntitySpecialRenderer<T>)(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<TileEntity> tileentityspecialrenderer = this.<TileEntity>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<TileEntity> renderer = this.<TileEntity>getRenderer(tile);
if(renderer != null)
renderer.renderTileEntityAt(tile, x, y, z, partial, destroy);
}
}

View file

@ -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<T extends TileEntity>
{
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;
}
}

View file

@ -0,0 +1,30 @@
package client.renderer.tileentity;
import client.renderer.texture.TextureManager;
import common.tileentity.TileEntity;
public abstract class TileRenderer<T extends TileEntity> {
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;
}
}

View file

@ -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 {

View file

@ -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);

View file

@ -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);

View file

@ -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,

File diff suppressed because it is too large Load diff

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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) {

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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<BoundingBox> list, Entity collidingEntity)
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> 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};
}
}

View file

@ -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};
}
}

View file

@ -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<BoundingBox> list, Entity collidingEntity)
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> 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<BlockPos> positions = Sets.newHashSet();
positions.add(pos);

View file

@ -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;
}

View file

@ -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) {

View file

@ -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());
}
}

View file

@ -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)

View file

@ -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<String> tooltip)
public void getTooltips(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
{
tooltip.add(this.metal.formatSymbol());
if(this.metal.radioactivity > 0.0f) {

View file

@ -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<BoundingBox> list, Entity collidingEntity)
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> 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};
}

View file

@ -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))
// {

View file

@ -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<BoundingBox> list, Entity collidingEntity)
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> 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);
}
}

View file

@ -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());
}

View file

@ -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());
}

View file

@ -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<BoundingBox> 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<BoundingBox> 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();
}

View file

@ -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<BoundingBox> list, Entity collidingEntity)
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> 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};
}

View file

@ -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();

View file

@ -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};
}
}

View file

@ -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) {

View file

@ -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)

View file

@ -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;
}

View file

@ -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);

View file

@ -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);
}
/**

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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()

View file

@ -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) {

View file

@ -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};
}
}

View file

@ -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() {

View file

@ -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);
}

View file

@ -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<BoundingBox> list, Entity collidingEntity)
public void getCollisionBoxes(World worldIn, BlockPos pos, State state, BoundingBox mask, List<BoundingBox> 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());
}

View file

@ -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) {

View file

@ -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) {

View file

@ -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());
}
/**

View file

@ -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};
}
}

View file

@ -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));
}
}
}

View file

@ -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());
}

View file

@ -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;
}

View file

@ -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))
{

View file

@ -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));
}
}
}

View file

@ -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);
}

View file

@ -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};
}
}

View file

@ -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};
}
}

View file

@ -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;
}

View file

@ -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))
{

View file

@ -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);
}

View file

@ -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)
{

View file

@ -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),

View file

@ -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)
{

View file

@ -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;
}
}

View file

@ -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;
}

View file

@ -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};
}
}

View file

@ -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;
}

View file

@ -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)

View file

@ -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());
}
}

View file

@ -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<String> tooltip)
public void getTooltips(ItemStack stack, EntityNPC playerIn, List<String> tooltip)
{
tooltip.add(this.metal.formatSymbol());
if(this.metal.radioactivity > 0.0f) {

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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};
}
}

View file

@ -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) {

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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;
}
}

Some files were not shown because too many files have changed in this diff Show more