net.minecraft.block.* patches

This commit is contained in:
LexManos committed 2016-03-01 00:31:58 -08:00
1 parent bf7527d3cd
commit f654157adb
103 files changed
+1167 -1167

No files matched your search

@@ -1,6 +1,18 @@
--- ../src-base/minecraft/net/minecraft/block/Block.java
+++ ../src-work/minecraft/net/minecraft/block/Block.java
@@ -70,6 +70,9 @@
@@ -46,8 +46,9 @@
public class Block
{
private static final ResourceLocation AIR_ID = new ResourceLocation("air");
- public static final RegistryNamespacedDefaultedByKey<ResourceLocation, Block> blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID);
- public static final ObjectIntIdentityMap<IBlockState> BLOCK_STATE_IDS = new ObjectIntIdentityMap();
+ public static final RegistryNamespacedDefaultedByKey<ResourceLocation, Block> blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry();
+ @Deprecated //Modders: DO NOT use this! Use GameRegistry
+ public static final ObjectIntIdentityMap<IBlockState> BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap();
public static final AxisAlignedBB field_185505_j = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D);
public static final AxisAlignedBB field_185506_k = null;
private CreativeTabs displayOnCreativeTab;
@@ -70,6 +71,9 @@
private IBlockState defaultBlockState;
private String unlocalizedName;
@@ -10,7 +22,7 @@
public static int getIdFromBlock(Block blockIn)
{
return blockRegistry.getIDForObject(blockIn);
@@ -83,7 +86,8 @@
@@ -83,7 +87,8 @@
public static Block getBlockById(int id)
{
@@ -20,7 +32,7 @@
}
public static IBlockState getStateById(int id)
@@ -268,7 +272,7 @@
@@ -268,7 +273,7 @@
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
{
@@ -29,7 +41,7 @@
}
public Block setHardness(float hardness)
@@ -305,9 +309,10 @@
@@ -305,9 +310,10 @@
return this.needsRandomTick;
}
@@ -41,7 +53,32 @@
}
public AxisAlignedBB func_185496_a(IBlockState p_185496_1_, IBlockAccess p_185496_2_, BlockPos p_185496_3_)
@@ -472,6 +477,10 @@
@@ -346,13 +352,13 @@
@SideOnly(Side.CLIENT)
public int func_185484_c(IBlockState p_185484_1_, IBlockAccess p_185484_2_, BlockPos p_185484_3_)
{
- int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d());
+ int i = p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_));
if (i == 0 && p_185484_1_.getBlock() instanceof BlockSlab)
{
p_185484_3_ = p_185484_3_.down();
p_185484_1_ = p_185484_2_.getBlockState(p_185484_3_);
- return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.func_185906_d());
+ return p_185484_2_.getCombinedLight(p_185484_3_, p_185484_1_.getLightValue(p_185484_2_, p_185484_3_));
}
else
{
@@ -415,7 +421,7 @@
}
}
- return !pos.getBlockState(side.offset(p_176225_4_)).func_185914_p();
+ return !pos.getBlockState(side.offset(p_176225_4_)).doesSideBlockRendering(pos, side, p_176225_4_);
}
@SideOnly(Side.CLIENT)
@@ -472,6 +478,10 @@
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
@@ -52,6 +89,16 @@
}
public int quantityDropped(Random random)
@@ -486,8 +496,7 @@
public float getPlayerRelativeBlockHardness(IBlockState playerIn, EntityPlayer worldIn, World pos, BlockPos p_180647_4_)
{
- float f = playerIn.func_185887_b(pos, p_180647_4_);
- return f < 0.0F ? 0.0F : (!worldIn.func_184823_b(playerIn) ? worldIn.func_184813_a(playerIn) / f / 100.0F : worldIn.func_184813_a(playerIn) / f / 30.0F);
+ return net.minecraftforge.common.ForgeHooks.blockStrength(playerIn, worldIn, pos, p_180647_4_);
}
public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture)
@@ -497,20 +506,16 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
@@ -102,7 +149,46 @@
}
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_)
@@ -844,6 +854,1147 @@
@@ -638,25 +648,35 @@
player.triggerAchievement(StatList.func_188055_a(this));
player.addExhaustion(0.025F);
- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0)
+ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0)
{
+ java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
- spawnAsEntity(worldIn, pos, itemstack);
+ items.add(itemstack);
}
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
+ for (ItemStack stack : items)
+ {
+ spawnAsEntity(worldIn, pos, stack);
+ }
}
else
{
+ harvesters.set(player);
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_);
this.dropBlockAsItem(worldIn, pos, state, i);
+ harvesters.set(null);
}
}
+ @Deprecated //Forge: State sensitive version
protected boolean canSilkHarvest()
{
- return this.getDefaultState().func_185917_h() && !this.isBlockContainer;
+ return this.getDefaultState().func_185917_h() && !this.hasTileEntity(silk_check_state.get());
}
protected ItemStack createStackedBlock(IBlockState state)
@@ -844,6 +864,1160 @@
return "Block{" + blockRegistry.getNameForObject(this) + "}";
}
@@ -114,18 +200,19 @@
+ /**
+ * Get a light value for the block at the specified coordinates, normal ranges are between 0 and 15
+ *
+ * @param state Block state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return The light value
+ */
+ public int getLightValue(IBlockAccess world, BlockPos pos)
+ public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ Block block = world.getBlockState(pos).getBlock();
+ if (block != this)
+ IBlockState other = world.getBlockState(pos);
+ if (other.getBlock() != this)
+ {
+ return block.getLightValue(world, pos);
+ return other.getLightValue(world, pos);
+ }
+ return getLightValue();
+ return state.func_185906_d();
+ }
+
+ /**
@@ -143,13 +230,15 @@
+ * determines indirect power state, entity ejection from blocks, and a few
+ * others.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return True if the block is a full cube
+ */
+ public boolean isNormalCube(IBlockAccess world, BlockPos pos)
+ public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower();
+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower();
+ return state.func_185904_a().isOpaque() && state.func_185917_h() && !state.func_185897_m();
+ }
+
+ /**
@@ -163,22 +252,26 @@
+ * @param side The side to check
+ * @return True if the block is opaque on the specified side.
+ */
+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face)
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ return isOpaqueCube();
+ return state.func_185914_p();
+ }
+
+ /**
+ * Checks if the block is a solid face on the given side, used by placement logic.
+ *
+ * @param base_state The base state, getActualState should be called first
+ * @param world The current world
+ * @param pos Block position in world
+ * @param side The side to check
+ * @return True if the block is solid on the specified side.
+ */
+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
+ public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos);
+ if (base_state.func_185896_q()) // Short circuit to vanilla function if its true
+ return true;
+
+ IBlockState state = this.getActualState(base_state, world, pos);
+
+ if (this instanceof BlockSlab)
+ {
@@ -222,7 +315,7 @@
+ {
+ return true;
+ }
+ return isNormalCube(world, pos);
+ return isNormalCube(state, world, pos);
+ }
+
+ /**
@@ -244,13 +337,14 @@
+ * useful for creating pure logic-blocks that will be invisible
+ * to the player and otherwise interact as air would.
+ *
+ * @param sata The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return True if the block considered air
+ */
+ public boolean isAir(IBlockAccess world, BlockPos pos)
+ public boolean isAir(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return getMaterial() == Material.air;
+ return state.func_185904_a() == Material.air;
+ }
+
+ /**
@@ -546,19 +640,20 @@
+ /**
+ * Called when a leaf should start its decay process.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ */
+ public void beginLeavesDecay(World world, BlockPos pos){}
+ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos){}
+
+ /**
+ * Determines if this block can prevent leaves connected to it from decaying.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return true if the presence this block can prevent leaves from decaying.
+ */
+ public boolean canSustainLeaves(IBlockAccess world, BlockPos pos)
+ public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return false;
+ }
@@ -566,13 +661,14 @@
+ /**
+ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return true if this block is considered leaves.
+ */
+ public boolean isLeaves(IBlockAccess world, BlockPos pos)
+ public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return getMaterial() == Material.leaves;
+ return state.func_185904_a() == Material.leaves;
+ }
+
+ /**
@@ -645,14 +741,15 @@
+ * Determine if this block can make a redstone connection on the side provided,
+ * Useful to control which sides are inputs and outputs for redstone wires.
+ *
+ * @param state The current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @param side The side that is trying to make the connection, CAN BE NULL
+ * @return True to make the connection
+ */
+ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side)
+ public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return canProvidePower() && side != null;
+ return state.func_185897_m() && side != null;
+ }
+
+ /**
@@ -785,15 +882,15 @@
+ * Plains check if its grass or dirt
+ * Water check if its still water
+ *
+ * @param state The Current state
+ * @param world The current world
+ * @param pos Block position in world
+ * @param direction The direction relative to the given position the plant wants to be, typically its UP
+ * @param plantable The plant that wants to check
+ * @return True to allow the plant to be planted/stay.
+ */
+ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
+ public boolean canSustainPlant(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
+ {
+ IBlockState state = world.getBlockState(pos);
+ IBlockState plant = plantable.getPlant(world, pos.offset(direction));
+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
+
@@ -880,13 +977,14 @@
+ * Recommended that you have your tile entity call relight after being placed if you
+ * rely on it for light info.
+ *
+ * @param state The Block state
+ * @param world The current world
+ * @param pos Block position in world
+ * @return The amount of light to block, 0 for air, 255 for fully opaque.
+ */
+ public int getLightOpacity(IBlockAccess world, BlockPos pos)
+ public int getLightOpacity(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return getLightOpacity();
+ return state.func_185891_c();
+ }
+
+ /**
@@ -1005,12 +1103,13 @@
+ /**
+ * Gathers how much experience this block drops when broken.
+ *
+ * @param state The current state
+ * @param world The world
+ * @param pos Block position
+ * @param fortune
+ * @return Amount of XP from breaking this block.
+ */
+ public int getExpDrop(IBlockAccess world, BlockPos pos, int fortune)
+ public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return 0;
+ }
@@ -1134,7 +1233,7 @@
+ /**
+ * Called when the entity is inside this block, may be used to determined if the entity can breathing,
+ * display material overlays, or if the entity can swim inside a block.
+ *
+ *
+ * @param world that is being tested.
+ * @param blockpos position thats being tested.
+ * @param iblockstate state at world/blockpos
@@ -1148,11 +1247,11 @@
+ {
+ return null;
+ }
+
+
+ /**
+ * Called when boats or fishing hooks are inside the block to check if they are inside
+ * the material requested.
+ *
+ *
+ * @param world world that is being tested.
+ * @param pos block thats being tested.
+ * @param boundingBox box to test, generally the bounds of an entity that are besting tested.
@@ -1,6 +1,21 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBanner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java
@@ -138,6 +138,28 @@
@@ -104,14 +104,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- ItemStack itemstack = this.func_185549_e(worldIn, pos, state);
-
- if (itemstack != null)
{
- spawnAsEntity(worldIn, pos, itemstack);
- }
- else
- {
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
}
@@ -138,6 +131,28 @@
}
}
@@ -9,7 +9,29 @@
{
protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D);
@@ -90,6 +90,35 @@
@@ -37,7 +37,8 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return super.canPlaceBlockAt(worldIn, pos) && this.func_185514_i(worldIn.getBlockState(pos.down()));
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ return super.canPlaceBlockAt(worldIn, pos) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected boolean func_185514_i(IBlockState p_185514_1_)
@@ -67,6 +68,11 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
+ if (state.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ {
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ return soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
+ }
return this.func_185514_i(worldIn.getBlockState(pos.down()));
}
@@ -90,6 +96,35 @@
return false;
}
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
@@ -89,7 +89,7 @@
protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_)
{
BlockPos blockpos = p_181088_1_.offset(p_181088_2_);
- return p_181088_2_ == EnumFacing.DOWN ? p_181088_0_.getBlockState(blockpos).func_185896_q() : p_181088_0_.getBlockState(blockpos).func_185915_l();
+ return p_181088_0_.getBlockState(blockpos).isSideSolid(p_181088_0_, blockpos, p_181088_2_.getOpposite());
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
@@ -9,6 +9,17 @@
{
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D);
@@ -110,8 +110,8 @@
}
}
- Block block = worldIn.getBlockState(pos.down()).getBlock();
- return block == Blocks.cactus || block == Blocks.sand && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid();
+ IBlockState state = worldIn.getBlockState(pos.down());
+ return state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid();
}
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
@@ -135,6 +135,18 @@
return ((Integer)state.getValue(AGE)).intValue();
}
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java
@@ -506,7 +506,7 @@
private boolean isBelowSolidBlock(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.up()).func_185915_l();
+ return worldIn.getBlockState(pos.up()).isSideSolid(worldIn, pos, EnumFacing.DOWN);
}
private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos)
@@ -5,7 +5,7 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j));
- if (iblockstate.getBlock() == Blocks.farmland)
+ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn))
+ if (iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn))
{
f1 = 1.0F;
@@ -14,7 +14,17 @@
{
f1 = 3.0F;
}
@@ -174,6 +174,28 @@
@@ -161,7 +161,8 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.func_185514_i(worldIn.getBlockState(pos.down()));
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected Item getSeed()
@@ -174,11 +175,33 @@
return Items.wheat;
}
@@ -43,3 +53,9 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0);
- if (!worldIn.isRemote)
+ if (false && !worldIn.isRemote) // Forge: NOP all this.
{
int i = this.func_185527_x(state);
@@ -9,3 +9,24 @@
{
protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
@@ -57,7 +57,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
@@ -67,4 +67,11 @@
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
}
+
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(Blocks.deadbush));
+ }
}
@@ -9,3 +9,12 @@
}
else
{
@@ -219,7 +219,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return pos.getY() >= 255 ? false : worldIn.getBlockState(pos.down()).func_185896_q() && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
+ return pos.getY() >= worldIn.getHeight() - 1 ? false : worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
}
public EnumPushReaction getMobilityFlag(IBlockState p_149656_1_)
@@ -37,7 +37,24 @@
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
return worldIn.getBlockState(pos.down()).getBlock() == this;
@@ -284,6 +282,32 @@
@@ -149,7 +147,6 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (worldIn.isRemote || p_180657_6_ == null || p_180657_6_.getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player))
{
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
@@ -212,8 +209,6 @@
else
{
player.triggerAchievement(StatList.func_188055_a(this));
- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta();
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i));
return true;
}
}
@@ -284,6 +279,32 @@
return Block.EnumOffsetType.XZ;
}
@@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java
@@ -48,7 +48,7 @@
private void checkFall(World worldIn, BlockPos pos)
{
- if (BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
+ if (worldIn.isAirBlock(pos.down()) && BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
{
int i = 32;
@@ -61,7 +61,7 @@
worldIn.setBlockToAir(pos);
BlockPos blockpos;
- for (blockpos = pos; BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
+ for (blockpos = pos; worldIn.isAirBlock(blockpos) && BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
@@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
@@ -44,7 +44,7 @@
private void checkFallable(World worldIn, BlockPos pos)
{
- if (func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
+ if (worldIn.isAirBlock(pos) && func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
{
int i = 32;
@@ -62,7 +62,7 @@
worldIn.setBlockToAir(pos);
BlockPos blockpos;
- for (blockpos = pos.down(); func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
+ for (blockpos = pos.down(); worldIn.isAirBlock(blockpos) && func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}
@@ -5,7 +5,7 @@
{
Block block = worldIn.getBlockState(pos.up()).getBlock();
- return block instanceof BlockCrops || block instanceof BlockStem;
+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block);
+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn.getBlockState(pos), worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block);
}
private boolean hasWater(World worldIn, BlockPos pos)
@@ -1,6 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -90,6 +90,7 @@
@@ -37,7 +37,15 @@
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- return !worldIn.getBlockState(pos.down()).func_185896_q() && !Blocks.fire.canCatchFire(worldIn, pos.down()) ? state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Boolean.valueOf(this.canCatchFire(worldIn, pos.up()))) : this.getDefaultState();
+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP))
+ {
+ return state.withProperty(NORTH, this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))
+ .withProperty(EAST, this.canCatchFire(worldIn, pos.east(), EnumFacing.WEST))
+ .withProperty(SOUTH, this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))
+ .withProperty(WEST, this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST))
+ .withProperty(UPPER, this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN));
+ }
+ return this.getDefaultState();
}
protected BlockFire()
@@ -90,6 +98,7 @@
public void setFireInfo(Block blockIn, int encouragement, int flammability)
{
@@ -8,7 +25,31 @@
this.encouragements.put(blockIn, Integer.valueOf(encouragement));
this.flammabilities.put(blockIn, Integer.valueOf(flammability));
}
@@ -164,7 +165,7 @@
@@ -129,13 +138,8 @@
}
Block block = worldIn.getBlockState(pos.down()).getBlock();
- boolean flag = block == Blocks.netherrack;
+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP);
- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock)
- {
- flag = true;
- }
-
int i = ((Integer)state.getValue(AGE)).intValue();
if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float)i * 0.03F)
@@ -156,7 +160,7 @@
{
if (!this.canNeighborCatchFire(worldIn, pos))
{
- if (!worldIn.getBlockState(pos.down()).func_185896_q() || i > 3)
+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3)
{
worldIn.setBlockToAir(pos);
}
@@ -164,7 +168,7 @@
return;
}
@@ -17,7 +58,7 @@
{
worldIn.setBlockToAir(pos);
return;
@@ -179,12 +180,12 @@
@@ -179,12 +183,12 @@
j = -50;
}
@@ -36,7 +77,7 @@
for (int k = -1; k <= 1; ++k)
{
@@ -243,22 +244,30 @@
@@ -243,22 +247,30 @@
return false;
}
@@ -68,7 +109,7 @@
if (random.nextInt(chance) < i)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
@@ -290,7 +299,7 @@
@@ -290,7 +302,7 @@
{
for (EnumFacing enumfacing : EnumFacing.values())
{
@@ -77,7 +118,7 @@
{
return true;
}
@@ -311,7 +320,7 @@
@@ -311,7 +323,7 @@
for (EnumFacing enumfacing : EnumFacing.values())
{
@@ -86,7 +127,7 @@
}
return i;
@@ -323,9 +332,10 @@
@@ -323,9 +335,10 @@
return false;
}
@@ -98,7 +139,55 @@
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
@@ -458,4 +468,19 @@
@@ -364,9 +377,9 @@
pos.func_184134_a((double)((float)state.getX() + 0.5F), (double)((float)state.getY() + 0.5F), (double)((float)state.getZ() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false);
}
- if (!pos.getBlockState(state.down()).func_185896_q() && !Blocks.fire.canCatchFire(pos, state.down()))
+ if (!pos.getBlockState(state.down()).isSideSolid(pos, state.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(pos, state.down(), EnumFacing.UP))
{
- if (Blocks.fire.canCatchFire(pos, state.west()))
+ if (Blocks.fire.canCatchFire(pos, state.west(), EnumFacing.EAST))
{
for (int j = 0; j < 2; ++j)
{
@@ -377,7 +390,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.east()))
+ if (Blocks.fire.canCatchFire(pos, state.east(), EnumFacing.WEST))
{
for (int k = 0; k < 2; ++k)
{
@@ -388,7 +401,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.north()))
+ if (Blocks.fire.canCatchFire(pos, state.north(), EnumFacing.SOUTH))
{
for (int l = 0; l < 2; ++l)
{
@@ -399,7 +412,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.south()))
+ if (Blocks.fire.canCatchFire(pos, state.south(), EnumFacing.NORTH))
{
for (int i1 = 0; i1 < 2; ++i1)
{
@@ -410,7 +423,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.up()))
+ if (Blocks.fire.canCatchFire(pos, state.up(), EnumFacing.DOWN))
{
for (int j1 = 0; j1 < 2; ++j1)
{
@@ -458,4 +471,19 @@
{
return new BlockStateContainer(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER});
}
@@ -36,9 +36,9 @@
+ return super.removedByPlayer(world, pos, player, willHarvest);
+ }
+ @Override
+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack tool)
+ {
+ super.harvestBlock(world, player, pos, state, te);
+ super.harvestBlock(world, player, pos, state, te, tool);
+ world.setBlockToAir(pos);
+ }
+ /*===========================FORGE END==========================================*/
@@ -1,5 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
@@ -38,7 +38,7 @@
{
if (!worldIn.isRemote)
{
- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2)
+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
}
@@ -58,7 +58,7 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos.up());
IBlockState iblockstate1 = worldIn.getBlockState(blockpos);
- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.func_185891_c() <= 2)
+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate.getLightOpacity(worldIn, pos.up()) <= 2)
{
worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState());
}
@@ -96,7 +96,7 @@
{
if (j >= i / 16)
@@ -7,7 +7,7 @@
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ for (IProperty prop : (java.util.Set<IProperty<?>>)state.getProperties().keySet())
+ {
+ if (prop.getName().equals("variant"))
+ {
@@ -0,0 +1,34 @@
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
@@ -40,14 +40,19 @@
player.triggerAchievement(StatList.func_188055_a(this));
player.addExhaustion(0.025F);
- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0)
+ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0)
{
+ java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
- spawnAsEntity(worldIn, pos, itemstack);
+ items.add(itemstack);
}
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
+ for (ItemStack is : items)
+ spawnAsEntity(worldIn, pos, is);
}
else
{
@@ -58,7 +63,9 @@
}
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_);
+ harvesters.set(player);
this.dropBlockAsItem(worldIn, pos, state, i);
+ harvesters.set(null);
Material material = worldIn.getBlockState(pos.down()).func_185904_a();
if (material.blocksMovement() || material.isLiquid())
@@ -1,6 +1,27 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java
@@ -139,4 +139,6 @@
@@ -61,7 +61,10 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.west()).func_185915_l() ? true : (worldIn.getBlockState(pos.east()).func_185915_l() ? true : (worldIn.getBlockState(pos.north()).func_185915_l() ? true : worldIn.getBlockState(pos.south()).func_185915_l()));
+ return worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.EAST) ||
+ worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.WEST) ||
+ worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.SOUTH) ||
+ worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.NORTH);
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
@@ -99,7 +102,7 @@
protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing)
{
- return worldIn.getBlockState(pos.offset(facing.getOpposite())).func_185915_l();
+ return worldIn.getBlockState(pos.offset(facing.getOpposite())).isSideSolid(worldIn, pos.offset(facing.getOpposite()), facing);
}
public IBlockState getStateFromMeta(int meta)
@@ -139,4 +142,6 @@
{
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@@ -1,5 +1,38 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -17,7 +17,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public abstract class BlockLeaves extends Block
+public abstract class BlockLeaves extends Block implements net.minecraftforge.common.IShearable
{
public static final PropertyBool DECAYABLE = PropertyBool.create("decayable");
public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay");
@@ -53,9 +53,9 @@
BlockPos blockpos = pos.add(j1, k1, l1);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue())
+ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos);
}
}
}
@@ -96,9 +96,9 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2));
Block block = iblockstate.getBlock();
- if (block != Blocks.log && block != Blocks.log2)
+ if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)))
{
- if (iblockstate.func_185904_a() == Material.leaves)
+ if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)))
{
this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2;
}
@@ -205,40 +205,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
@@ -42,17 +75,16 @@
}
protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance)
@@ -274,6 +241,50 @@
@@ -274,6 +241,49 @@
public abstract BlockPlanks.EnumType getWoodType(int meta);
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos){ return true; }
+
+ @Override
+ public void beginLeavesDecay(World world, BlockPos pos)
+ public void beginLeavesDecay(IBlockState state, World world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ if (!(Boolean)state.getValue(CHECK_DECAY))
+ {
+ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
@@ -1,10 +1,22 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLog.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java
@@ -34,9 +34,9 @@
{
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue())
+ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos);
}
}
}
@@ -69,6 +69,9 @@
}
}
+ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean canSustainLeaves(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+
public static enum EnumAxis implements IStringSerializable
@@ -1,4 +1,6 @@
++++ REJECTED PATCH 1
--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java
@@ -39,10 +39,14 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
@@ -7,12 +9,11 @@
}
+ @Override
+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
+ }
+
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState p_149662_1_)
{
return false;
++++ END PATCH
@@ -1,10 +1,11 @@
++++ REJECTED PATCH 1
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -78,7 +78,7 @@
if (pos.getY() >= 0 && pos.getY() < 256)
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock()));
+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this));
- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.func_185514_i(iblockstate));
+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(iblockstate, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this));
}
else
{
++++ END PATCH
@@ -1,20 +1,20 @@
++++ REJECTED PATCH 1
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -39,7 +39,7 @@
{
if (!worldIn.isRemote)
{
- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2)
+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2)
- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).func_185891_c() > 2)
+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getLightOpacity(worldIn, pos.up()) > 2)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
}
++++ END PATCH
++++ REJECTED PATCH 2
@@ -53,7 +53,7 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos);
Block block = worldIn.getBlockState(blockpos.up()).getBlock();
IBlockState iblockstate1 = worldIn.getBlockState(blockpos.up());
- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2)
+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2)
- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.func_185891_c() <= 2)
+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && iblockstate1.getLightOpacity(worldIn, blockpos.up()) <= 2)
{
worldIn.setBlockState(blockpos, this.getDefaultState());
}
++++ END PATCH
@@ -1,5 +1,14 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -42,7 +42,7 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.func_185514_i(worldIn.getBlockState(pos.down()));
+ return super.canBlockStay(worldIn, pos, state);
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
@@ -58,9 +58,11 @@
super.updateTick(worldIn, pos, state, rand);
}
@@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java
@@ -98,7 +98,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) //Forge: Noop this
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4));
@@ -108,4 +108,10 @@
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata() - 4));
+ }
}
@@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java
@@ -14,6 +14,7 @@
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -103,11 +104,16 @@
if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
{
player.triggerAchievement(StatList.func_188055_a(this));
- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata()));
+ }
}
@@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java
@@ -59,34 +59,40 @@
@@ -59,34 +59,39 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
@@ -8,9 +8,8 @@
- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this))
+ }
+ @Override
+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ IBlockState state = world.getBlockState(pos);
+ Random rand = world instanceof World ? ((World)world).rand : new Random();
+ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this))
{
@@ -20,7 +20,7 @@
+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir)
+ {
+ BlockPos off = pos.offset(dir);
+ Block block = world.getBlockState(off).getBlock();
+ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite());
+ IBlockState state = world.getBlockState(off);
+ return canPaneConnectToBlock(state.getBlock()) || state.isSideSolid(world, off, dir.getOpposite());
+ }
}
@@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -235,7 +235,7 @@
}
}
- if (!flag1 && iblockstate.func_185904_a() != Material.air && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston))
+ if (!flag1 && !iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos) && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston))
{
this.doMove(worldIn, pos, enumfacing, false);
}
@@ -320,7 +320,7 @@
return false;
}
- return !block.hasTileEntity();
+ return !block.hasTileEntity(p_185646_0_);
}
else
{
@@ -366,7 +366,9 @@
{
BlockPos blockpos1 = (BlockPos)list2.get(j);
IBlockState iblockstate = worldIn.getBlockState(blockpos1);
- iblockstate.getBlock().dropBlockAsItem(worldIn, blockpos1, iblockstate, 0);
+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = iblockstate.getBlock() instanceof BlockSnow ? -1.0f : 1.0f;
+ iblockstate.getBlock().dropBlockAsItemWithChance(worldIn, blockpos1, iblockstate, chance, 0);
worldIn.setBlockToAir(blockpos1);
--k;
aiblockstate[k] = iblockstate;
@@ -1,6 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java
@@ -190,4 +190,16 @@
@@ -110,7 +110,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
+ if (false && !worldIn.isRemote) // Forge: Noop this out
{
TileEntityPiston tileentitypiston = this.func_185589_c(worldIn, pos);
@@ -120,6 +120,7 @@
iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0);
}
}
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
public RayTraceResult collisionRayTrace(IBlockState worldIn, World pos, BlockPos start, Vec3d end, Vec3d p_180636_5_)
@@ -190,4 +191,16 @@
{
return new BlockStateContainer(this, new IProperty[] {FACING, TYPE});
}
@@ -8,7 +25,7 @@
+ @Override
+ public java.util.List<net.minecraft.item.ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos);
+ TileEntityPiston tileentitypiston = this.func_185589_c(world, pos);
+ if (tileentitypiston != null)
+ {
+ IBlockState pushed = tileentitypiston.getPistonState();
@@ -0,0 +1,25 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java
@@ -27,7 +27,7 @@
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
- if (!worldIn.isRemote)
+ if (false && !worldIn.isRemote) //Forge: Moved to getDrops
{
if (this.func_185525_y(state) && worldIn.rand.nextInt(50) == 0)
{
@@ -40,4 +40,13 @@
{
return field_185534_a[((Integer)p_185496_1_.getValue(this.func_185524_e())).intValue()];
}
+
+ @Override
+ public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
+ if (this.func_185525_y(state) && RANDOM.nextInt(50) == 0)
+ ret.add(new ItemStack(Items.poisonous_potato));
+ return ret;
+ }
}
@@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java
@@ -117,7 +117,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && worldIn.getBlockState(pos.down()).func_185896_q();
+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP);
}
public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_)
@@ -7,7 +7,7 @@
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ for (IProperty prop : state.getProperties().keySet())
+ {
+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class)
+ {
@@ -9,6 +9,45 @@
}
protected BlockRailBase(boolean isPowered)
@@ -65,7 +65,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.down()).func_185896_q();
+ return worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP);
}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
@@ -88,24 +88,24 @@
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty());
boolean flag = false;
- if (!worldIn.getBlockState(pos.down()).func_185896_q())
+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP))
{
flag = true;
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).func_185896_q())
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.UP))
{
flag = true;
}
@@ -160,6 +160,81 @@
public abstract IProperty<BlockRailBase.EnumRailDirection> getShapeProperty();
@@ -75,7 +114,7 @@
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ for (IProperty prop : state.getProperties().keySet())
+ {
+ if (prop.getName().equals("shape"))
+ {
@@ -99,7 +138,17 @@
public Rail(World worldIn, BlockPos pos, IBlockState state)
{
@@ -429,7 +505,7 @@
@@ -238,7 +314,8 @@
this.state = state;
this.block = (BlockRailBase)state.getBlock();
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.block.getShapeProperty());
- this.isPowered = this.block.isPowered;
+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos);
+ this.canMakeSlopes = this.block.canMakeSlopes(worldIn, pos);
this.func_180360_a(blockrailbase$enumraildirection);
}
@@ -429,7 +506,7 @@
}
}
@@ -108,7 +157,7 @@
{
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -442,7 +518,7 @@
@@ -442,7 +519,7 @@
}
}
@@ -117,7 +166,7 @@
{
if (BlockRailBase.isRailBlock(this.world, blockpos3.up()))
{
@@ -585,7 +661,7 @@
@@ -585,7 +662,7 @@
}
}
@@ -126,7 +175,7 @@
{
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -598,7 +674,7 @@
@@ -598,7 +675,7 @@
}
}
@@ -8,9 +8,9 @@
- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this))
+ @Override
+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this))
+ if (this.getItemDropped(state, RANDOM, fortune) != Item.getItemFromBlock(this))
{
- int i = 1 + worldIn.rand.nextInt(5);
- this.dropXpOnBlockBreak(worldIn, pos, i);
@@ -0,0 +1,55 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -97,15 +97,15 @@
BlockPos blockpos = pos.offset(direction);
IBlockState iblockstate = worldIn.getBlockState(pos.offset(direction));
- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down()))))
+ if (!canConnectTo(worldIn.getBlockState(blockpos), direction, worldIn, blockpos) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn, blockpos.down())))
{
IBlockState iblockstate1 = worldIn.getBlockState(pos.up());
if (!iblockstate1.func_185915_l())
{
- boolean flag = worldIn.getBlockState(blockpos).func_185896_q() || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone;
+ boolean flag = worldIn.getBlockState(blockpos).isSideSolid(worldIn, blockpos, EnumFacing.UP) || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone;
- if (flag && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())))
+ if (flag && canConnectUpwardsTo(worldIn, blockpos.up()))
{
if (iblockstate.func_185898_k())
{
@@ -406,21 +406,16 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos);
boolean flag = iblockstate.func_185915_l();
boolean flag1 = worldIn.getBlockState(pos.up()).func_185915_l();
- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
+ return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side, worldIn, pos) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
}
protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos)
{
- return canConnectUpwardsTo(worldIn.getBlockState(pos));
+ return canConnectTo(worldIn.getBlockState(pos), null, worldIn, pos);
}
- protected static boolean canConnectUpwardsTo(IBlockState state)
+ protected static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos)
{
- return canConnectTo(state, (EnumFacing)null);
- }
-
- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side)
- {
Block block = blockState.getBlock();
if (block == Blocks.redstone_wire)
@@ -434,7 +429,7 @@
}
else
{
- return blockState.func_185897_m() && side != null;
+ return blockState.getBlock().canConnectRedstone(blockState, world, pos, side);
}
}
@@ -9,15 +9,18 @@
{
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D);
@@ -70,6 +70,7 @@
@@ -69,7 +69,9 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
Block block = worldIn.getBlockState(pos.down()).getBlock();
+ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true;
- Block block = worldIn.getBlockState(pos.down()).getBlock();
+ IBlockState state = worldIn.getBlockState(pos.down());
+ Block block = state.getBlock();
+ if (block.canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this)) return true;
if (block == this)
{
@@ -162,6 +163,17 @@
@@ -162,6 +164,17 @@
return ((Integer)state.getValue(AGE)).intValue();
}
@@ -1,10 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java
@@ -28,6 +28,20 @@
@@ -28,6 +28,21 @@
super(p_i46385_1_, p_i46385_2_);
}
+ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis)
+ @Override
+ public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis)
+ {
+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos);
+ for (net.minecraft.block.properties.IProperty<?> prop : state.getProperties().keySet())
@@ -31,6 +31,15 @@
{
if (!((Boolean)state.getValue(NODROP)).booleanValue())
{
@@ -142,7 +143,7 @@
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
- ItemStack itemstack = this.func_185473_a(worldIn, pos, state);
+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType());
if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
{
@@ -152,12 +153,11 @@
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
@@ -5,11 +5,11 @@
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if ( isOpaqueCube() )
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if ( state.func_185914_p() )
+ return true;
+
+
+ // face is on the block being rendered, not this block.
+ EnumBlockHalf side = world.getBlockState(pos).getValue(HALF);
+ return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP);
@@ -18,3 +18,19 @@
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
@@ -77,13 +88,14 @@
{
return false;
}
- else
+ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful.
{
IBlockState iblockstate = pos.getBlockState(side.offset(p_176225_4_));
boolean flag = func_185675_i(iblockstate) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
boolean flag1 = func_185675_i(worldIn) && worldIn.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
return flag1 ? (p_176225_4_ == EnumFacing.DOWN ? true : (p_176225_4_ == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || !flag)) : (p_176225_4_ == EnumFacing.UP ? true : (p_176225_4_ == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || flag));
}
+ return super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_);
}
@SideOnly(Side.CLIENT)
@@ -1,5 +1,14 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
@@ -73,7 +73,7 @@
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
Block block = iblockstate.getBlock();
- return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.func_185904_a() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false;
+ return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false;
}
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
@@ -85,7 +85,6 @@
{
if (!this.canPlaceBlockAt(worldIn, pos))
@@ -8,7 +17,18 @@
worldIn.setBlockToAir(pos);
return false;
}
@@ -109,14 +108,13 @@
@@ -97,9 +96,8 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0));
+ super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
worldIn.setBlockToAir(pos);
- player.triggerAchievement(StatList.func_188055_a(this));
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -109,14 +107,13 @@
public int quantityDropped(Random random)
{
@@ -24,7 +44,7 @@
worldIn.setBlockToAir(pos);
}
}
@@ -150,6 +148,8 @@
@@ -150,6 +147,8 @@
return ((Integer)state.getValue(LAYERS)).intValue() - 1;
}
@@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStairs.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java
@@ -443,6 +443,19 @@
return new BlockStateContainer(this, new IProperty[] {FACING, HALF, SHAPE});
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if ( state.func_185914_p() )
+ return true;
+
+ // face is on the block being rendered, not this block.
+ IBlockState iblockstate = world.getBlockState(pos);
+ EnumHalf half = iblockstate.getValue(HALF);
+ EnumFacing side = iblockstate.getValue(FACING);
+ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP);
+ }
+
public static enum EnumHalf implements IStringSerializable
{
TOP("top"),
@@ -1,15 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
@@ -91,7 +91,7 @@
@@ -89,9 +89,10 @@
}
pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand));
Block block = worldIn.getBlockState(pos.down()).getBlock();
- Block block = worldIn.getBlockState(pos.down()).getBlock();
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ Block block = soil.getBlock();
- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass))
+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(soil, worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass))
{
worldIn.setBlockState(pos, this.crop.getDefaultState());
}
@@ -109,8 +109,12 @@
@@ -109,8 +110,12 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
@@ -23,7 +27,7 @@
{
Item item = this.getSeedItem();
@@ -120,13 +124,14 @@
@@ -120,13 +125,14 @@
for (int j = 0; j < 3; ++j)
{
@@ -9,6 +9,15 @@
{
public static final PropertyEnum<BlockTallGrass.EnumType> TYPE = PropertyEnum.<BlockTallGrass.EnumType>create("type", BlockTallGrass.EnumType.class);
protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
@@ -41,7 +41,7 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.func_185514_i(worldIn.getBlockState(pos.down()));
+ return super.canBlockStay(worldIn, pos, state);
}
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
@@ -51,7 +51,7 @@
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -18,6 +27,15 @@
}
public int quantityDroppedWithBonus(int fortune, Random random)
@@ -61,7 +61,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop Taken care of by IShearable
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta()));
@@ -181,4 +181,22 @@
}
}
@@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java
@@ -77,14 +77,14 @@
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).func_185915_l();
+ return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).isSideSolid(worldIn, pos.offset(side.getOpposite()), side);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
- if (worldIn.getBlockState(pos.offset(enumfacing)).func_185915_l())
+ if (worldIn.getBlockState(pos.offset(enumfacing)).isSideSolid(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()))
{
return true;
}
@@ -118,7 +118,7 @@
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).func_185915_l())
+ if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).isSideSolid(worldIn, pos.offset(enumfacing.getOpposite()), enumfacing))
{
this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockToAir(pos);
@@ -9,6 +9,15 @@
{
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool NORTH = PropertyBool.create("north");
@@ -342,7 +342,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop, Covered by IShearable
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0));
@@ -457,4 +457,14 @@
return i;
@@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java
+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java
@@ -80,7 +80,7 @@
IBlockState iblockstate = this.world.getBlockState(origin);
Block block = iblockstate.getBlock();
- if (iblockstate.func_185904_a() == Material.air)
+ if (iblockstate.getBlock().isAir(iblockstate, this.world, origin))
{
return true;
}
@@ -112,7 +112,7 @@
iblockstate = this.world.getBlockState(blockpos);
block = iblockstate.getBlock();
- if (iblockstate.func_185904_a() == Material.air || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos) || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
{
break;
}
@@ -159,7 +159,7 @@
iblockstate = this.world.getBlockState(blockpos1);
- if (iblockstate.func_185904_a() == Material.air)
+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos1))
{
return true;
}
@@ -4,8 +4,8 @@
return stringbuilder.toString();
}
+
+ public com.google.common.collect.ImmutableTable<IProperty, Comparable, IBlockState> getPropertyValueTable()
+
+ public com.google.common.collect.ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> getPropertyValueTable()
+ {
+ return null;
+ }
@@ -0,0 +1,77 @@
--- ../src-base/minecraft/net/minecraft/block/state/BlockStateContainer.java
+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateContainer.java
@@ -55,6 +55,16 @@
public BlockStateContainer(Block blockIn, IProperty<?>... properties)
{
+ this(blockIn, properties, null);
+ }
+
+ protected StateImplementation createState(Block block, ImmutableMap<IProperty<?>, Comparable<?>> properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
+ return new StateImplementation(block, properties);
+ }
+
+ protected BlockStateContainer(Block blockIn, IProperty[] properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
this.block = blockIn;
Map < String, IProperty<? >> map = Maps. < String, IProperty<? >> newHashMap();
@@ -71,7 +81,7 @@
for (List < Comparable<? >> list : Cartesian.cartesianProduct(this.getAllowedValues()))
{
Map < IProperty<?>, Comparable<? >> map1 = MapPopulator. < IProperty<?>, Comparable<? >> createMap(this.properties.values(), list);
- BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = new BlockStateContainer.StateImplementation(blockIn, ImmutableMap.copyOf(map1));
+ BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties);
map2.put(map1, blockstatecontainer$stateimplementation);
list1.add(blockstatecontainer$stateimplementation);
}
@@ -163,6 +173,13 @@
this.properties = propertiesIn;
}
+ protected StateImplementation(Block blockIn, ImmutableMap<IProperty<?>, Comparable<?>> propertiesIn, ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> propertyValueTable)
+ {
+ this.block = blockIn;
+ this.properties = propertiesIn;
+ this.propertyValueTable = propertyValueTable;
+ }
+
public Collection < IProperty<? >> getPropertyNames()
{
return Collections. < IProperty<? >> unmodifiableCollection(this.properties.keySet());
@@ -414,5 +431,34 @@
{
return this.block.func_185481_k(this);
}
+
+ //Forge Start
+ public ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> getPropertyValueTable()
+ {
+ return propertyValueTable;
+ }
+
+ @Override
+ public int getLightOpacity(IBlockAccess world, BlockPos pos)
+ {
+ return this.block.getLightOpacity(this, world, pos);
+ }
+
+ @Override
+ public int getLightValue(IBlockAccess world, BlockPos pos)
+ {
+ return this.block.getLightValue(this, world, pos);
+ }
+
+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return this.block.isSideSolid(this, world, pos, side);
+ }
+
+ @Override
+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return this.block.doesSideBlockRendering(this, world, pos, side);
+ }
}
}
@@ -0,0 +1,27 @@
--- ../src-base/minecraft/net/minecraft/block/state/IBlockProperties.java
+++ ../src-work/minecraft/net/minecraft/block/state/IBlockProperties.java
@@ -25,9 +25,13 @@
boolean func_185913_b();
+ @Deprecated //Forge location aware version below
int func_185891_c();
+ int getLightOpacity(IBlockAccess world, BlockPos pos);
+ @Deprecated //Forge location aware version below
int func_185906_d();
+ int getLightValue(IBlockAccess world, BlockPos pos);
@SideOnly(Side.CLIENT)
boolean func_185895_e();
@@ -88,5 +92,10 @@
RayTraceResult func_185910_a(World p_185910_1_, BlockPos p_185910_2_, Vec3d p_185910_3_, Vec3d p_185910_4_);
+ @Deprecated // Forge: Use isSideSolid(IBlockAccess, BlockPos, EnumFacing.UP) instead
boolean func_185896_q();
+
+ //Forge added functions
+ boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side);
+ boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side);
}
@@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/entity/item/EntityFallingBlock.java
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityFallingBlock.java
@@ -129,6 +129,7 @@
{
IBlockState iblockstate = this.worldObj.getBlockState(blockpos1);
+ if (this.worldObj.isAirBlock(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) //Forge: Don't indent below.
if (BlockFalling.func_185759_i(this.worldObj.getBlockState(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))))
{
this.onGround = false;
@@ -87,7 +87,33 @@
}
public EntityItem dropItem(ItemStack droppedItem, boolean dropAround, boolean traceItem)
@@ -845,6 +868,16 @@
@@ -746,15 +769,24 @@
protected ItemStack func_184816_a(EntityItem p_184816_1_)
{
+ if (captureDrops) capturedDrops.add(p_184816_1_);
+ else // Forge: Don't indent to keep patch smaller.
this.worldObj.spawnEntityInWorld(p_184816_1_);
ItemStack itemstack = p_184816_1_.getEntityItem();
return itemstack;
}
+ @Deprecated //Use location sensitive version below
public float func_184813_a(IBlockState p_184813_1_)
{
- float f = this.inventory.func_184438_a(p_184813_1_);
+ return getBreakSpeed(p_184813_1_, new BlockPos(0, -1, 0));
+ }
+ public float getBreakSpeed(IBlockState state, BlockPos pos)
+ {
+ ItemStack stack = this.inventory.getCurrentItem();
+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state));
+
if (f > 1.0F)
{
int i = EnchantmentHelper.func_185293_e(this);
@@ -845,6 +877,16 @@
this.spawnForced = tagCompund.getBoolean("SpawnForced");
}
@@ -104,7 +130,7 @@
this.foodStats.readNBT(tagCompund);
this.capabilities.readCapabilitiesFromNBT(tagCompund);
@@ -877,6 +910,23 @@
@@ -877,6 +919,23 @@
tagCompound.setBoolean("SpawnForced", this.spawnForced);
}
@@ -128,7 +154,7 @@
this.foodStats.writeNBT(tagCompound);
this.capabilities.writeCapabilitiesToNBT(tagCompound);
tagCompound.setTag("EnderItems", this.theInventoryEnderChest.saveInventoryToNBT());
@@ -884,6 +934,7 @@
@@ -884,6 +943,7 @@
public boolean attackEntityFrom(DamageSource source, float amount)
{
@@ -136,7 +162,7 @@
if (this.isEntityInvulnerable(source))
{
return false;
@@ -1123,6 +1174,7 @@
@@ -1123,6 +1183,7 @@
public void attackTargetEntityWithCurrentItem(Entity targetEntity)
{
@@ -144,7 +170,7 @@
if (targetEntity.canAttackWithItem())
{
if (!targetEntity.hitByEntity(this))
@@ -1410,6 +1462,8 @@
@@ -1410,6 +1471,8 @@
public EntityPlayer.EnumStatus trySleep(BlockPos bedLocation)
{
@@ -153,7 +179,7 @@
if (!this.worldObj.isRemote)
{
if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1514,13 +1568,14 @@
@@ -1514,13 +1577,14 @@
public void wakeUpPlayer(boolean p_70999_1_, boolean updateWorldFlag, boolean setSpawn)
{
@@ -171,7 +197,7 @@
if (blockpos == null)
{
@@ -1529,6 +1584,10 @@
@@ -1529,6 +1593,10 @@
this.setPosition((double)((float)blockpos.getX() + 0.5F), (double)((float)blockpos.getY() + 0.1F), (double)((float)blockpos.getZ() + 0.5F));
}
@@ -182,7 +208,7 @@
this.sleeping = false;
@@ -1547,14 +1606,14 @@
@@ -1547,14 +1615,14 @@
private boolean isInBed()
{
@@ -199,7 +225,7 @@
{
if (!forceSpawn)
{
@@ -1618,16 +1677,24 @@
@@ -1618,16 +1686,24 @@
public BlockPos getBedLocation()
{
@@ -226,7 +252,7 @@
if (pos != null)
{
this.spawnChunk = pos;
@@ -1822,6 +1889,10 @@
@@ -1822,6 +1898,10 @@
super.fall(distance, damageMultiplier);
}
@@ -237,7 +263,7 @@
}
protected void resetHeight()
@@ -2009,6 +2080,10 @@
@@ -2009,6 +2089,10 @@
this.field_181016_an = oldPlayer.field_181016_an;
this.field_181017_ao = oldPlayer.field_181017_ao;
this.field_181018_ap = oldPlayer.field_181018_ap;
@@ -248,7 +274,7 @@
}
else if (this.worldObj.getGameRules().getBoolean("keepInventory") || oldPlayer.isSpectator())
{
@@ -2129,7 +2204,7 @@
@@ -2129,7 +2213,7 @@
public float getEyeHeight()
{
@@ -257,7 +283,7 @@
if (this.isPlayerSleeping())
{
@@ -2340,6 +2415,136 @@
@@ -2340,6 +2424,136 @@
return (float)this.getEntityAttribute(SharedMonsterAttributes.field_188792_h).getAttributeValue();
}
@@ -1,91 +0,0 @@
++++ REJECTED PATCH 1
public class Block
{
private static final ResourceLocation AIR_ID = new ResourceLocation("air");
- public static final RegistryNamespacedDefaultedByKey<ResourceLocation, Block> blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID);
- public static final ObjectIntIdentityMap<IBlockState> BLOCK_STATE_IDS = new ObjectIntIdentityMap();
+ public static final RegistryNamespacedDefaultedByKey<ResourceLocation,Block> blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry();
+ @Deprecated //Modders: DO NOT use this! Use GameRegistry
+ public static final ObjectIntIdentityMap<IBlockState> BLOCK_STATE_IDS = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap();
private CreativeTabs displayOnCreativeTab;
public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F);
public static final Block.SoundType soundTypeWood = new Block.SoundType("wood", 1.0F, 1.0F);
++++ END PATCH
++++ REJECTED PATCH 6
public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos)
{
Block block = worldIn.getBlockState(pos).getBlock();
- int i = worldIn.getCombinedLight(pos, block.getLightValue());
+ int i = worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos));
if (i == 0 && block instanceof BlockSlab)
{
pos = pos.down();
block = worldIn.getBlockState(pos).getBlock();
- return worldIn.getCombinedLight(pos, block.getLightValue());
+ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos));
}
else
{
++++ END PATCH
++++ REJECTED PATCH 7
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
- return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().isOpaqueCube())))));
+ return side == EnumFacing.DOWN && this.minY > 0.0D ? true : (side == EnumFacing.UP && this.maxY < 1.0D ? true : (side == EnumFacing.NORTH && this.minZ > 0.0D ? true : (side == EnumFacing.SOUTH && this.maxZ < 1.0D ? true : (side == EnumFacing.WEST && this.minX > 0.0D ? true : (side == EnumFacing.EAST && this.maxX < 1.0D ? true : !worldIn.getBlockState(pos).getBlock().doesSideBlockRendering(worldIn, pos, side))))));
}
public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
++++ END PATCH
++++ REJECTED PATCH 9
public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos)
{
- float f = this.getBlockHardness(worldIn, pos);
- return f < 0.0F ? 0.0F : (!playerIn.canHarvestBlock(this) ? playerIn.getToolDigEfficiency(this) / f / 100.0F : playerIn.getToolDigEfficiency(this) / f / 30.0F);
+ return net.minecraftforge.common.ForgeHooks.blockStrength(worldIn.getBlockState(pos), playerIn, worldIn, pos);
}
public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture)
++++ END PATCH
++++ REJECTED PATCH 13
player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]);
player.addExhaustion(0.025F);
- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))
{
+ java.util.ArrayList<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
- spawnAsEntity(worldIn, pos, itemstack);
+ items.add(itemstack);
}
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player);
+ for (ItemStack stack : items)
+ {
+ spawnAsEntity(worldIn, pos, stack);
+ }
}
else
{
+ harvesters.set(player);
int i = EnchantmentHelper.getFortuneModifier(player);
this.dropBlockAsItem(worldIn, pos, state, i);
+ harvesters.set(null);
}
}
+ @Deprecated //Forge: State sensitive version
protected boolean canSilkHarvest()
{
- return this.isFullCube() && !this.isBlockContainer;
+ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get());
}
protected ItemStack createStackedBlock(IBlockState state)
++++ END PATCH
@@ -1,24 +0,0 @@
++++ REJECTED PATCH 1
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- TileEntity tileentity = worldIn.getTileEntity(pos);
-
- if (tileentity instanceof TileEntityBanner)
{
- ItemStack itemstack = new ItemStack(Items.banner, 1, ((TileEntityBanner)tileentity).getBaseColor());
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- tileentity.writeToNBT(nbttagcompound);
- nbttagcompound.removeTag("x");
- nbttagcompound.removeTag("y");
- nbttagcompound.removeTag("z");
- nbttagcompound.removeTag("id");
- itemstack.setTagInfo("BlockEntityTag", nbttagcompound);
- spawnAsEntity(worldIn, pos, itemstack);
- }
- else
- {
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
}
++++ END PATCH
@@ -1,23 +0,0 @@
++++ REJECTED PATCH 2
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected boolean canPlaceBlockOn(Block ground)
++++ END PATCH
++++ REJECTED PATCH 3
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ BlockPos down = pos.down();
+ Block soil = worldIn.getBlockState(down).getBlock();
+ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this);
}
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
++++ END PATCH
@@ -1,11 +0,0 @@
++++ REJECTED PATCH 1
protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_)
{
- BlockPos blockpos = p_181088_1_.offset(p_181088_2_);
- return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube();
+ return p_181088_2_ == EnumFacing.DOWN && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_), p_181088_2_.getOpposite());
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
++++ END PATCH
@@ -1,10 +0,0 @@
++++ REJECTED PATCH 2
}
Block block = worldIn.getBlockState(pos.down()).getBlock();
- return block == Blocks.cactus || block == Blocks.sand;
+ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this);
}
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
++++ END PATCH
@@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
private boolean isBelowSolidBlock(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube();
+ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false);
}
private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos)
++++ END PATCH
@@ -1,36 +0,0 @@
++++ REJECTED PATCH 2
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected Item getSeed()
++++ END PATCH
++++ REJECTED PATCH 3
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0);
-
- if (!worldIn.isRemote)
- {
- int i = ((Integer)state.getValue(AGE)).intValue();
-
- if (i >= 7)
- {
- int j = 3 + fortune;
-
- for (int k = 0; k < j; ++k)
- {
- if (worldIn.rand.nextInt(15) <= i)
- {
- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0));
- }
- }
- }
- }
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
++++ END PATCH
@@ -1,23 +0,0 @@
++++ REJECTED PATCH 2
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
- }
- else
- {
super.harvestBlock(worldIn, player, pos, state, te);
}
}
+
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return new java.util.ArrayList<ItemStack>(java.util.Arrays.asList(new ItemStack(Blocks.deadbush)));
+ }
}
++++ END PATCH
@@ -1,10 +0,0 @@
++++ REJECTED PATCH 2
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
+ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
}
public int getMobilityFlag()
++++ END PATCH
@@ -1,19 +0,0 @@
++++ REJECTED PATCH 4
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player))
{
super.harvestBlock(worldIn, player, pos, state, te);
}
++++ END PATCH
++++ REJECTED PATCH 5
else
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta();
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i));
return true;
}
}
++++ END PATCH
@@ -1,9 +0,0 @@
++++ REJECTED PATCH 1
public static boolean canFallInto(World worldIn, BlockPos pos)
{
+ if (worldIn.isAirBlock(pos)) return true;
Block block = worldIn.getBlockState(pos).getBlock();
Material material = block.blockMaterial;
return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava;
++++ END PATCH
@@ -1,98 +0,0 @@
++++ REJECTED PATCH 1
int j = pos.getY();
int k = pos.getZ();
- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down()))
+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP))
{
boolean flag = (i + j + k & 1) == 1;
boolean flag1 = (i / 2 + j / 2 + k / 2 & 1) == 1;
int l = 0;
- if (this.canCatchFire(worldIn, pos.up()))
+ if (this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN))
{
l = flag ? 1 : 2;
}
- return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Integer.valueOf(l)).withProperty(FLIP, Boolean.valueOf(flag1)).withProperty(ALT, Boolean.valueOf(flag));
+ return state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH)))
+ .withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east(), EnumFacing.EAST )))
+ .withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH)))
+ .withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST )))
+ .withProperty(UPPER, Integer.valueOf(l))
+ .withProperty(FLIP, Boolean.valueOf(flag1))
+ .withProperty(ALT, Boolean.valueOf(flag));
}
else
{
++++ END PATCH
++++ REJECTED PATCH 3
}
Block block = worldIn.getBlockState(pos.down()).getBlock();
- boolean flag = block == Blocks.netherrack;
+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP);
- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock)
- {
- flag = true;
- }
-
if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos))
{
worldIn.setBlockToAir(pos);
++++ END PATCH
++++ REJECTED PATCH 10
worldIn.playSound((double)((float)pos.getX() + 0.5F), (double)((float)pos.getY() + 0.5F), (double)((float)pos.getZ() + 0.5F), "fire.fire", 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false);
}
- if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down()))
+ if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP))
{
- if (Blocks.fire.canCatchFire(worldIn, pos.west()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.west(), EnumFacing.EAST))
{
for (int j = 0; j < 2; ++j)
{
++++ END PATCH
++++ REJECTED PATCH 11
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.east()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST))
{
for (int k = 0; k < 2; ++k)
{
++++ END PATCH
++++ REJECTED PATCH 12
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.north()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))
{
for (int l = 0; l < 2; ++l)
{
++++ END PATCH
++++ REJECTED PATCH 13
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.south()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))
{
for (int i1 = 0; i1 < 2; ++i1)
{
++++ END PATCH
++++ REJECTED PATCH 14
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.up()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN))
{
for (int j1 = 0; j1 < 2; ++j1)
{
++++ END PATCH
@@ -1,20 +0,0 @@
++++ REJECTED PATCH 1
{
if (!worldIn.isRemote)
{
- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2)
+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
}
++++ END PATCH
++++ REJECTED PATCH 2
Block block = worldIn.getBlockState(blockpos.up()).getBlock();
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2)
+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2)
{
worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState());
}
++++ END PATCH
@@ -1,35 +0,0 @@
++++ REJECTED PATCH 1
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
player.addExhaustion(0.025F);
- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))
{
+ java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
- if (itemstack != null)
- {
- spawnAsEntity(worldIn, pos, itemstack);
- }
+ if (itemstack != null) items.add(itemstack);
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player);
+
+ for (ItemStack is : items)
+ spawnAsEntity(worldIn, pos, is);
}
else
{
++++ END PATCH
++++ REJECTED PATCH 2
}
int i = EnchantmentHelper.getFortuneModifier(player);
+ harvesters.set(player);
this.dropBlockAsItem(worldIn, pos, state, i);
+ harvesters.set(null);
Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial();
if (material.blocksMovement() || material.isLiquid())
++++ END PATCH
@@ -1,23 +0,0 @@
++++ REJECTED PATCH 1
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube()));
+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) ||
+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) ||
+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) ||
+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true);
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
++++ END PATCH
++++ REJECTED PATCH 2
protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing)
{
- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube();
+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true);
}
public IBlockState getStateFromMeta(int meta)
++++ END PATCH
@@ -1,36 +0,0 @@
++++ REJECTED PATCH 1
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public abstract class BlockLeaves extends BlockLeavesBase
+public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable
{
public static final PropertyBool DECAYABLE = PropertyBool.create("decayable");
public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay");
++++ END PATCH
++++ REJECTED PATCH 2
BlockPos blockpos = pos.add(j1, k1, l1);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue())
+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos);
}
}
}
++++ END PATCH
++++ REJECTED PATCH 3
{
Block block = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)).getBlock();
- if (block != Blocks.log && block != Blocks.log2)
+ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)))
{
- if (block.getMaterial() == Material.leaves)
+ if (block.isLeaves(worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)))
{
this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2;
}
++++ END PATCH
@@ -1,13 +0,0 @@
++++ REJECTED PATCH 1
{
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue())
+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos);
}
}
}
++++ END PATCH
@@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ return super.canBlockStay(worldIn, pos, state);
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
++++ END PATCH
@@ -1,23 +0,0 @@
++++ REJECTED PATCH 1
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4));
- }
- else
- {
super.harvestBlock(worldIn, player, pos, state, te);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ IBlockState state = world.getBlockState(pos);
+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)));
+ }
}
++++ END PATCH
@@ -1,20 +0,0 @@
++++ REJECTED PATCH 1
if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ IBlockState state = world.getBlockState(pos);
+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())));
+ }
}
++++ END PATCH
@@ -1,16 +0,0 @@
++++ REJECTED PATCH 2
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
{
- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock());
- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock());
- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock());
- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock());
+ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH);
+ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH);
+ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST);
+ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST);
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
{
++++ END PATCH
@@ -1,32 +0,0 @@
++++ REJECTED PATCH 1
}
}
- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
+ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
{
this.doMove(worldIn, pos, enumfacing, false);
}
++++ END PATCH
++++ REJECTED PATCH 2
return false;
}
- return !(blockIn instanceof ITileEntityProvider);
+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos)));
}
else
{
++++ END PATCH
++++ REJECTED PATCH 3
{
BlockPos blockpos = (BlockPos)list1.get(j);
Block block = worldIn.getBlockState(blockpos).getBlock();
- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0);
+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f;
+ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0);
worldIn.setBlockToAir(blockpos);
--i;
ablock[i] = block;
++++ END PATCH
@@ -1,19 +0,0 @@
++++ REJECTED PATCH 1
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
- {
- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);
-
- if (tileentitypiston != null)
- {
- IBlockState iblockstate = tileentitypiston.getPistonState();
- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0);
- }
- }
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
++++ END PATCH
@@ -1,24 +0,0 @@
++++ REJECTED PATCH 1
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
-
- if (!worldIn.isRemote)
- {
- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0)
- {
- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato));
- }
- }
}
+ @Override
+ public java.util.List<net.minecraft.item.ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
+ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random();
+ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0)
+ ret.add(new ItemStack(Items.poisonous_potato));
+ return ret;
+ }
}
++++ END PATCH
@@ -1,10 +0,0 @@
++++ REJECTED PATCH 1
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
++++ END PATCH
@@ -1,11 +0,0 @@
++++ REJECTED PATCH 4
this.state = state;
this.block = (BlockRailBase)state.getBlock();
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(BlockRailBase.this.getShapeProperty());
- this.isPowered = this.block.isPowered;
+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos);
+ canMakeSlopes = this.block.canMakeSlopes(worldIn, pos);
this.func_180360_a(blockrailbase$enumraildirection);
}
++++ END PATCH
@@ -1,59 +0,0 @@
++++ REJECTED PATCH 1
BlockPos blockpos = pos.offset(direction);
Block block = worldIn.getBlockState(pos.offset(direction)).getBlock();
- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isBlockNormalCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down()))))
+ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isBlockNormalCube() || !canRestoneConnect(worldIn, blockpos.down(), null)))
{
Block block1 = worldIn.getBlockState(pos.up()).getBlock();
- return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
+ return !block1.isBlockNormalCube() && block.isBlockNormalCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
}
else
{
++++ END PATCH
++++ REJECTED PATCH 2
Block block = iblockstate.getBlock();
boolean flag = block.isNormalCube();
boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube();
- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null)));
}
- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos)
+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side)
{
- return canConnectUpwardsTo(worldIn.getBlockState(pos));
- }
-
- protected static boolean canConnectUpwardsTo(IBlockState state)
- {
- return canConnectTo(state, (EnumFacing)null);
- }
-
- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side)
- {
- Block block = blockState.getBlock();
-
- if (block == Blocks.redstone_wire)
+ IBlockState state = world.getBlockState(pos);
+ if (state.getBlock() == Blocks.redstone_wire)
{
return true;
}
- else if (Blocks.unpowered_repeater.isAssociated(block))
+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock()))
{
- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING);
- return enumfacing == side || enumfacing.getOpposite() == side;
+ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING);
+ return direction == side || direction.getOpposite() == side;
}
else
{
- return block.canProvidePower() && side != null;
+ return state.getBlock().canConnectRedstone(world, pos, side);
}
}
++++ END PATCH
@@ -1,10 +0,0 @@
++++ REJECTED PATCH 3
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
- ItemStack itemstack = new ItemStack(Items.skull, 1, this.getDamageValue(worldIn, pos));
+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType());
if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
{
++++ END PATCH
@@ -1,19 +0,0 @@
++++ REJECTED PATCH 2
{
return false;
}
- else
- {
- BlockPos blockpos = pos.offset(side.getOpposite());
- IBlockState iblockstate = worldIn.getBlockState(pos);
- IBlockState iblockstate1 = worldIn.getBlockState(blockpos);
- boolean flag = isSlab(iblockstate.getBlock()) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
- boolean flag1 = isSlab(iblockstate1.getBlock()) && iblockstate1.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
- return flag1 ? (side == EnumFacing.DOWN ? true : (side == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || !flag)) : (side == EnumFacing.UP ? true : (side == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side) ? true : !isSlab(iblockstate.getBlock()) || flag));
- }
+ // additional logic breaks doesSideBlockRendering and is no longer useful.
+ return super.shouldSideBeRendered(worldIn, pos, side);
}
@SideOnly(Side.CLIENT)
++++ END PATCH
@@ -1,22 +0,0 @@
++++ REJECTED PATCH 1
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
Block block = iblockstate.getBlock();
- return block != Blocks.ice && block != Blocks.packed_ice ? (block.getMaterial() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false;
+ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : block.isOpaqueCube() && block.blockMaterial.blocksMovement())) : false;
}
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
++++ END PATCH
++++ REJECTED PATCH 3
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0));
+ super.harvestBlock(worldIn, player, pos, state, te);
worldIn.setBlockToAir(pos);
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
++++ END PATCH
@@ -1,21 +0,0 @@
++++ REJECTED PATCH 1
return false;
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if ( isOpaqueCube() )
+ return true;
+
+ // face is on the block being rendered, not this block.
+ IBlockState iblockstate = world.getBlockState(pos);
+ EnumHalf half = iblockstate.getValue(HALF);
+ EnumFacing side = iblockstate.getValue(FACING);
+ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP);
+ }
+
public boolean isFullCube()
{
return false;
++++ END PATCH
@@ -1,25 +0,0 @@
++++ REJECTED PATCH 2
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ return super.canBlockStay(worldIn, pos, state);
}
public boolean isReplaceable(World worldIn, BlockPos pos)
++++ END PATCH
++++ REJECTED PATCH 4
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta()));
- }
- else
- {
super.harvestBlock(worldIn, player, pos, state, te);
}
}
++++ END PATCH
@@ -1,45 +0,0 @@
++++ REJECTED PATCH 1
public class BlockTrapDoor extends Block
{
+ /** Set this to allow trapdoors to remain free-floating */
+ public static boolean disableValidation = false;
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
public static final PropertyBool OPEN = PropertyBool.create("open");
public static final PropertyEnum<BlockTrapDoor.DoorHalf> HALF = PropertyEnum.<BlockTrapDoor.DoorHalf>create("half", BlockTrapDoor.DoorHalf.class);
++++ END PATCH
++++ REJECTED PATCH 2
{
if (!worldIn.isRemote)
{
+ EnumFacing direction = (EnumFacing)state.getValue(FACING);
BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());
- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()))
+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true)))
{
worldIn.setBlockToAir(pos);
this.dropBlockAsItem(worldIn, pos, state, 0);
++++ END PATCH
++++ REJECTED PATCH 3
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
- return !side.getAxis().isVertical() && isValidSupportBlock(worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock());
+ if (disableValidation) return true;
+ EnumFacing dir = side.getOpposite();
+ pos = pos.offset(dir);
+ return !side.getAxis().isVertical() && (isValidSupportBlock(worldIn.getBlockState(pos).getBlock()) || worldIn.isSideSolid(pos, side, true));
}
protected static EnumFacing getFacing(int meta)
++++ END PATCH
++++ REJECTED PATCH 4
private static boolean isValidSupportBlock(Block blockIn)
{
+ if (disableValidation) return true;
return blockIn.blockMaterial.isOpaque() && blockIn.isFullCube() || blockIn == Blocks.glowstone || blockIn instanceof BlockSlab || blockIn instanceof BlockStairs;
}
++++ END PATCH
@@ -1,28 +0,0 @@
++++ REJECTED PATCH 1
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube();
+ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube())
+ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true))
{
return true;
}
++++ END PATCH
++++ REJECTED PATCH 2
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock().isNormalCube())
+ if (!worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true))
{
this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockToAir(pos);
++++ END PATCH
@@ -1,15 +0,0 @@
++++ REJECTED PATCH 2
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0));
- }
- else
- {
super.harvestBlock(worldIn, player, pos, state, te);
}
}
++++ END PATCH
@@ -1,30 +0,0 @@
++++ REJECTED PATCH 1
{
Block block = this.world.getBlockState(origin).getBlock();
- if (block.getMaterial() == Material.air)
+ if (block.isAir(world, origin))
{
return true;
}
++++ END PATCH
++++ REJECTED PATCH 2
BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i);
block = this.world.getBlockState(blockpos).getBlock();
- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
+ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
{
break;
}
++++ END PATCH
++++ REJECTED PATCH 3
block = this.world.getBlockState(blockpos1).getBlock();
- if (block.getMaterial() == Material.air)
+ if (block.isAir(world, blockpos1))
{
return true;
}
++++ END PATCH
@@ -1,55 +0,0 @@
++++ REJECTED PATCH 1
public BlockState(Block blockIn, IProperty... properties)
{
+ this(blockIn, properties, null);
+ }
+
+ protected StateImplementation createState(Block block, ImmutableMap<IProperty, Comparable> properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
+ return new StateImplementation(block, properties);
+ }
+
+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
this.block = blockIn;
Arrays.sort(properties, new Comparator<IProperty>()
{
++++ END PATCH
++++ REJECTED PATCH 2
for (List<Comparable> list1 : Cartesian.cartesianProduct(this.getAllowedValues()))
{
Map<IProperty, Comparable> map1 = MapPopulator.<IProperty, Comparable>createMap(this.properties, list1);
- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1));
+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties);
map.put(map1, blockstate$stateimplementation);
list.add(blockstate$stateimplementation);
}
++++ END PATCH
++++ REJECTED PATCH 3
}
}
+ protected StateImplementation(Block blockIn, ImmutableMap<IProperty, Comparable> propertiesIn, ImmutableTable<IProperty, Comparable, IBlockState> propertyValueTable)
+ {
+ this.block = blockIn;
+ this.properties = propertiesIn;
+ this.propertyValueTable = propertyValueTable;
+ }
+
public <T extends Comparable<T>, V extends T> IBlockState withProperty(IProperty<T> property, V value)
{
if (!this.properties.containsKey(property))
++++ END PATCH
++++ REJECTED PATCH 4
map.put(property, value);
return map;
}
+
+ public ImmutableTable<IProperty, Comparable, IBlockState> getPropertyValueTable()
+ {
+ return propertyValueTable;
+ }
}
}
++++ END PATCH
@@ -68,34 +68,6 @@
}
}
++++ END PATCH
++++ REJECTED PATCH 13
public void joinEntityItemWithWorld(EntityItem itemIn)
{
+ if (captureDrops)
+ {
+ capturedDrops.add(itemIn);
+ return;
+ }
+
this.worldObj.spawnEntityInWorld(itemIn);
}
+ @Deprecated //Use location sensitive version below
public float getToolDigEfficiency(Block p_180471_1_)
{
- float f = this.inventory.getStrVsBlock(p_180471_1_);
+ return getBreakSpeed(p_180471_1_.getDefaultState(), new BlockPos(0, -1, 0));
+ }
+ public float getBreakSpeed(IBlockState state, BlockPos pos)
+ {
+ ItemStack stack = inventory.getCurrentItem();
+ float f = (stack == null ? 1.0F : stack.getItem().getDigSpeed(stack, state));
if (f > 1.0F)
{
int i = EnchantmentHelper.getEfficiencyModifier(this);
++++ END PATCH
++++ REJECTED PATCH 14
f /= 5.0F;
}
@@ -29,7 +29,6 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityMinecartContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.event.ClickEvent;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
@@ -49,23 +48,13 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.network.NetHandlerPlayServer;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityNote;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.util.Vec3;
import net.minecraft.util.WeightedRandom;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
@@ -157,7 +146,7 @@ public class ForgeHooks
public static float blockStrength(IBlockState state, EntityPlayer player, World world, BlockPos pos)
{
float hardness = state.getBlock().getBlockHardness(world, pos);
float hardness = state.func_185887_b(world, pos);
if (hardness < 0.0F)
{
return 0.0F;
@@ -1,7 +1,7 @@
package net.minecraftforge.common;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
public interface IPlantable
@@ -3,7 +3,7 @@ package net.minecraftforge.common;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
/**
@@ -19,12 +19,9 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -3,7 +3,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**DecorateBiomeEvent is fired when a BiomeDecorator is created.
@@ -3,7 +3,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
@@ -2,7 +2,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.event.world.WorldEvent;
@@ -2,7 +2,7 @@ package net.minecraftforge.event.terraingen;
import java.util.Random;
import net.minecraftforge.fml.common.eventhandler.Event.*;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.MapGenBase;
@@ -7,7 +7,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
@@ -177,29 +177,29 @@ public class BlockEvent extends Event
return blockSnapshots;
}
}
/**
* Fired when a physics update occurs on a block. This event acts as
* a way for mods to detect physics updates, in the same way a BUD switch
* does. This event is only called on the server.
*/
@Cancelable
public static class NeighborNotifyEvent extends BlockEvent
public static class NeighborNotifyEvent extends BlockEvent
{
private final EnumSet<EnumFacing> notifiedSides;
public NeighborNotifyEvent(World world, BlockPos pos, IBlockState state, EnumSet<EnumFacing> notifiedSides)
{
super(world, pos, state);
this.notifiedSides = notifiedSides;
}
/**
* Gets a list of directions from the base block that updates will occur upon.
*
*
* @return list of notified directions
*/
public EnumSet<EnumFacing> getNotifiedSides()
public EnumSet<EnumFacing> getNotifiedSides()
{
return notifiedSides;
}
Loaded 100 of 103 files, more files were not shown because too many files have changed in this diff. Show more