Patches and rejected patches. Note: some which had imports are not listed here because they need

to be refactored not to have imports.
Progress: https://gist.github.com/cpw/29695e426e2b122cf8ff
This commit is contained in:
cpw 2015-11-09 01:50:45 -05:00
parent 1a6c816bac
commit 98125a97c9
409 changed files with 16902 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,66 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -13,7 +13,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockBush extends Block
+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable
{
private static final String __OBFID = "CL_00000208";
@@ -38,7 +38,7 @@
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)
@@ -68,7 +68,10 @@
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)
@@ -91,4 +94,33 @@
{
return EnumWorldBlockLayer.CUTOUT;
}
+
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert;
+ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water;
+ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether;
+ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains;
+ return net.minecraftforge.common.EnumPlantType.Plains;
+ }
+
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ if (state.getBlock() != this) return getDefaultState();
+ return state;
+ }
}

View File

@ -0,0 +1,12 @@
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
@@ -75,8 +75,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 ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube();
+ return p_181088_2_ == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(p_181088_0_, p_181088_1_.down()) ? true : p_181088_0_.isSideSolid(p_181088_1_.offset(p_181088_2_.getOpposite()), p_181088_2_);
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)

View File

@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
@@ -18,7 +18,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockCactus extends Block
+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable
{
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
private static final String __OBFID = "CL_00000210";
@@ -110,7 +110,7 @@
}
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)
@@ -138,4 +138,16 @@
{
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ return net.minecraftforge.common.EnumPlantType.Desert;
+ }
+
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ return getDefaultState();
+ }
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java
@@ -528,7 +528,7 @@
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)

View File

@ -0,0 +1,27 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -138,6 +138,13 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
+ }
+
+ @Override
+ public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> dropped = super.getDrops(world, pos, state, fortune);
int i = ((Integer)state.getValue(AGE)).intValue();
int j = 1;
@@ -148,8 +155,9 @@
for (int k = 0; k < j; ++k)
{
- spawnAsEntity(worldIn, pos, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage()));
+ dropped.add(new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage()));
}
+ return dropped;
}
@SideOnly(Side.CLIENT)

View File

@ -0,0 +1,77 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -82,11 +82,11 @@
float f1 = 0.0F;
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))
{
f1 = 1.0F;
- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0)
+ if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j)))
{
f1 = 3.0F;
}
@@ -127,7 +127,7 @@
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()
@@ -143,24 +143,6 @@
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)
@@ -203,4 +185,26 @@
{
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @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);
+ int age = ((Integer)state.getValue(AGE)).intValue();
+ Random rand = world instanceof World ? ((World)world).rand : new Random();
+
+ if (age >= 7)
+ {
+ int k = 3 + fortune;
+
+ for (int i = 0; i < 3 + fortune; ++i)
+ {
+ if (rand.nextInt(15) <= age)
+ {
+ ret.add(new ItemStack(this.getSeed(), 1, 0));
+ }
+ }
+ }
+ return ret;
+ }
}

View File

@ -0,0 +1,33 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java
@@ -14,7 +14,7 @@
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
-public class BlockDeadBush extends BlockBush
+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable
{
private static final String __OBFID = "CL_00000224";
@@ -47,14 +47,15 @@
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)));
+ }
}

View File

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
@@ -155,7 +155,7 @@
{
if (this.blockMaterial == Material.iron)
{
- return true;
+ return false; //Allow items to interact with the door
}
else
{
@@ -273,7 +273,7 @@
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()

View File

@ -0,0 +1,89 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java
@@ -25,7 +25,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockDoublePlant extends BlockBush implements IGrowable
+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable
{
public static final PropertyEnum<BlockDoublePlant.EnumPlantType> VARIANT = PropertyEnum.<BlockDoublePlant.EnumPlantType>create("variant", BlockDoublePlant.EnumPlantType.class);
public static final PropertyEnum<BlockDoublePlant.EnumBlockHalf> HALF = PropertyEnum.<BlockDoublePlant.EnumBlockHalf>create("half", BlockDoublePlant.EnumBlockHalf.class);
@@ -91,6 +91,8 @@
Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock());
Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this);
+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air.
+
if (block == this)
{
worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2);
@@ -99,17 +101,13 @@
if (block1 == this)
{
worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3);
-
- if (!flag)
- {
- this.dropBlockAsItem(worldIn, blockpos1, state, 0);
- }
}
}
}
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
+ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //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.
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
return worldIn.getBlockState(pos.down()).getBlock() == this;
@@ -159,7 +157,6 @@
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);
}
@@ -222,8 +219,6 @@
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;
}
}
@@ -294,6 +289,32 @@
return Block.EnumOffsetType.XZ;
}
+ @Override
+ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT);
+ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS);
+ }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT);
+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta()));
+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta()));
+ return ret;
+ }
+ @Override
+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ {
+ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames.
+ IBlockState state = world.getBlockState(pos);
+ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this)
+ world.setBlockToAir(pos.up());
+ return world.setBlockToAir(pos);
+ }
+
public static enum EnumBlockHalf implements IStringSerializable
{
UPPER,

View File

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
@@ -87,6 +87,7 @@
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;

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -90,7 +90,7 @@
private boolean hasCrops(World worldIn, BlockPos pos)
{
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);
}
private boolean hasWater(World worldIn, BlockPos pos)

View File

@ -0,0 +1,211 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -42,18 +42,24 @@
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
{
@@ -109,6 +115,7 @@
public void setFireInfo(Block blockIn, int encouragement, int flammability)
{
+ if (blockIn == Blocks.air) throw new IllegalArgumentException("Tried to set air on fire... This is bad.");
this.encouragements.put(blockIn, Integer.valueOf(encouragement));
this.flammabilities.put(blockIn, Integer.valueOf(flammability));
}
@@ -148,13 +155,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;
- }
-
if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos))
{
worldIn.setBlockToAir(pos);
@@ -183,7 +185,7 @@
return;
}
- if (!this.canCatchFire(worldIn, pos.down()) && i == 15 && rand.nextInt(4) == 0)
+ if (!this.canCatchFire(worldIn, pos.down(), EnumFacing.UP) && i == 15 && rand.nextInt(4) == 0)
{
worldIn.setBlockToAir(pos);
return;
@@ -198,12 +200,12 @@
j = -50;
}
- this.catchOnFire(worldIn, pos.east(), 300 + j, rand, i);
- this.catchOnFire(worldIn, pos.west(), 300 + j, rand, i);
- this.catchOnFire(worldIn, pos.down(), 250 + j, rand, i);
- this.catchOnFire(worldIn, pos.up(), 250 + j, rand, i);
- this.catchOnFire(worldIn, pos.north(), 300 + j, rand, i);
- this.catchOnFire(worldIn, pos.south(), 300 + j, rand, i);
+ this.tryCatchFire(worldIn, pos.east(), 300 + j, rand, i, EnumFacing.WEST);
+ this.tryCatchFire(worldIn, pos.west(), 300 + j, rand, i, EnumFacing.EAST);
+ this.tryCatchFire(worldIn, pos.down(), 250 + j, rand, i, EnumFacing.UP);
+ this.tryCatchFire(worldIn, pos.up(), 250 + j, rand, i, EnumFacing.DOWN);
+ this.tryCatchFire(worldIn, pos.north(), 300 + j, rand, i, EnumFacing.SOUTH);
+ this.tryCatchFire(worldIn, pos.south(), 300 + j, rand, i, EnumFacing.NORTH);
for (int k = -1; k <= 1; ++k)
{
@@ -262,22 +264,30 @@
return false;
}
+ @Deprecated // Use Block.getFlammability
public int getFlammability(Block blockIn)
{
Integer integer = (Integer)this.flammabilities.get(blockIn);
return integer == null ? 0 : integer.intValue();
}
+ @Deprecated // Use Block.getFlammability
public int getEncouragement(Block blockIn)
{
Integer integer = (Integer)this.encouragements.get(blockIn);
return integer == null ? 0 : integer.intValue();
}
+ @Deprecated // Use tryCatchFire with face below
private void catchOnFire(World worldIn, BlockPos pos, int chance, Random random, int age)
{
- int i = this.getFlammability(worldIn.getBlockState(pos).getBlock());
+ this.tryCatchFire(worldIn, pos, chance, random, age, EnumFacing.UP);
+ }
+ private void tryCatchFire(World worldIn, BlockPos pos, int chance, Random random, int age, EnumFacing face)
+ {
+ int i = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face);
+
if (random.nextInt(chance) < i)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
@@ -309,7 +319,7 @@
{
for (EnumFacing enumfacing : EnumFacing.values())
{
- if (this.canCatchFire(worldIn, pos.offset(enumfacing)))
+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()))
{
return true;
}
@@ -330,7 +340,7 @@
for (EnumFacing enumfacing : EnumFacing.values())
{
- i = Math.max(this.getEncouragement(worldIn.getBlockState(pos.offset(enumfacing)).getBlock()), i);
+ i = Math.max(worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getFlammability(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()), i);
}
return i;
@@ -342,9 +352,10 @@
return false;
}
+ @Deprecated // Use canCatchFire with face sensitive version below
public boolean canCatchFire(IBlockAccess worldIn, BlockPos pos)
{
- return this.getEncouragement(worldIn.getBlockState(pos).getBlock()) > 0;
+ return canCatchFire(worldIn, pos, EnumFacing.UP);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
@@ -383,9 +394,9 @@
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)
{
@@ -396,7 +407,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.east()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST))
{
for (int k = 0; k < 2; ++k)
{
@@ -407,7 +418,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.north()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))
{
for (int l = 0; l < 2; ++l)
{
@@ -418,7 +429,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.south()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))
{
for (int i1 = 0; i1 < 2; ++i1)
{
@@ -429,7 +440,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.up()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN))
{
for (int j1 = 0; j1 < 2; ++j1)
{
@@ -477,4 +488,19 @@
{
return new BlockState(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER, FLIP, ALT});
}
+
+ /*================================= Forge Start ======================================*/
+ /**
+ * Side sensitive version that calls the block function.
+ *
+ * @param world The current world
+ * @param pos Block position
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canCatchFire(IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ return world.getBlockState(pos).getBlock().isFlammable(world, pos, face);
+ }
+ /*================================= Forge Start ======================================*/
}

View File

@ -0,0 +1,48 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java
@@ -170,13 +170,6 @@
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos);
-
- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null)
- {
- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData()));
- }
-
super.breakBlock(worldIn, pos, state);
}
@@ -396,6 +389,31 @@
return EnumWorldBlockLayer.CUTOUT;
}
+
+ /*============================FORGE START=====================================*/
+ @Override
+ public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
+ TileEntityFlowerPot te = world.getTileEntity(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.getTileEntity(pos) : null;
+ if (te != null && te.getFlowerPotItem() != null)
+ ret.add(new ItemStack(te.getFlowerPotItem(), 1, te.getFlowerPotData()));
+ return ret;
+ }
+ @Override
+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ {
+ if (willHarvest) return true; //If it will harvest, delay deletion of the block until after getDrops
+ return super.removedByPlayer(world, pos, player, willHarvest);
+ }
+ @Override
+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
+ {
+ super.harvestBlock(world, player, pos, state, te);
+ world.setBlockToAir(pos);
+ }
+ /*===========================FORGE END==========================================*/
+
public static enum EnumFlowerType implements IStringSerializable
{
EMPTY("empty"),

View File

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
@@ -59,7 +59,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)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
}
@@ -73,7 +73,7 @@
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());
}
@@ -111,7 +111,7 @@
{
if (j >= i / 16)
{
- if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air)
+ if (worldIn.isAirBlock(blockpos1))
{
if (rand.nextInt(8) == 0)
{

View File

@ -0,0 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java
@@ -80,6 +80,20 @@
return new BlockState(this, new IProperty[] {VARIANT});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.getName().equals("variant"))
+ {
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }
+ return false;
+ }
+
public static enum EnumType implements IStringSerializable
{
NORTH_WEST(1, "north_west"),

View File

@ -0,0 +1,35 @@
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
@@ -40,14 +40,17 @@
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
{
@@ -58,7 +61,9 @@
}
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())

View File

@ -0,0 +1,30 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java
@@ -79,7 +79,10 @@
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)
@@ -117,7 +120,7 @@
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)
@@ -147,4 +150,6 @@
{
return new BlockState(this, new IProperty[] {FACING});
}
+
+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; }
}

View File

@ -0,0 +1,126 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -18,7 +18,7 @@
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");
@@ -76,9 +76,9 @@
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);
}
}
}
@@ -118,9 +118,9 @@
{
Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).getBlock();
- if (block != Blocks.log && block != Blocks.log2)
+ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)))
{
- if (block.getMaterial() == Material.leaves)
+ if (block.isLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)))
{
this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2;
}
@@ -227,40 +227,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
- {
- int i = this.getSaplingDropChance(state);
-
- if (fortune > 0)
- {
- i -= 2 << fortune;
-
- if (i < 10)
- {
- i = 10;
- }
- }
-
- if (worldIn.rand.nextInt(i) == 0)
- {
- Item item = this.getItemDropped(state, worldIn.rand, fortune);
- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state)));
- }
-
- i = 200;
-
- if (fortune > 0)
- {
- i -= 10 << fortune;
-
- if (i < 40)
- {
- i = 40;
- }
- }
-
- this.dropApple(worldIn, pos, state, i);
- }
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance)
@@ -297,4 +264,48 @@
}
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 void beginLeavesDecay(World world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ if (!(Boolean)state.getValue(CHECK_DECAY))
+ {
+ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
+ }
+ }
+
+ @Override
+ public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ Random rand = world instanceof World ? ((World)world).rand : new Random();
+ int chance = this.getSaplingDropChance(state);
+
+ if (fortune > 0)
+ {
+ chance -= 2 << fortune;
+ if (chance < 10) chance = 10;
+ }
+
+ if (rand.nextInt(chance) == 0)
+ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state)));
+
+ chance = 200;
+ if (fortune > 0)
+ {
+ chance -= 10 << fortune;
+ if (chance < 40) chance = 40;
+ }
+
+ this.captureDrops(true);
+ if (world instanceof World)
+ this.dropApple((World)world, pos, state, chance); // Dammet mojang
+ ret.addAll(this.captureDrops(false));
+ return ret;
+ }
+
}

View File

@ -0,0 +1,15 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLever.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java
@@ -238,6 +238,12 @@
return new BlockState(this, new IProperty[] {FACING, POWERED});
}
+
+ private boolean canAttach(World world, BlockPos pos, EnumFacing side)
+ {
+ return world.isSideSolid(pos, side);
+ }
+
public static enum EnumOrientation implements IStringSerializable
{
DOWN_X(0, "down_x", EnumFacing.DOWN),

View File

@ -0,0 +1,24 @@
--- ../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.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);
}
}
}
@@ -47,6 +47,9 @@
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis()));
}
+ @Override public boolean canSustainLeaves(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
{
X("x"),

View File

@ -0,0 +1,19 @@
--- ../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);
- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15);
- this.dropXpOnBlockBreak(worldIn, pos, i);
}
+ @Override
+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
+ }
+
public boolean isOpaqueCube()
{
return false;

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -73,7 +73,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));
}
else
{

View File

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -40,7 +40,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)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
}
@@ -54,7 +54,7 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos);
Block block = worldIn.getBlockState(blockpos.up()).getBlock();
- 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, this.getDefaultState());
}

View File

@ -0,0 +1,49 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -39,7 +39,7 @@
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)
@@ -55,9 +55,11 @@
super.updateTick(worldIn, pos, state, rand);
}
+ @SuppressWarnings("unused")
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
+ if (false && !worldIn.isRemote)
{
int i = 1;
@@ -108,4 +110,24 @@
{
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @Override
+ public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ Random rand = world instanceof World ? ((World)world).rand : new Random();
+ int count = 1;
+
+ if (((Integer)state.getValue(AGE)) >= 3)
+ {
+ count = 2 + rand.nextInt(3) + (fortune > 0 ? rand.nextInt(fortune + 1) : 0);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ ret.add(new ItemStack(Items.nether_wart));
+ }
+
+ return ret;
+ }
}

View File

@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java
@@ -101,14 +101,15 @@
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)));
+ }
}

View File

@ -0,0 +1,23 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNote.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java
@@ -59,7 +59,9 @@
if (tileentity instanceof TileEntityNote)
{
TileEntityNote tileentitynote = (TileEntityNote)tileentity;
+ int old = tileentitynote.note;
tileentitynote.changePitch();
+ if (old == tileentitynote.note) return false;
tileentitynote.triggerNote(worldIn, pos);
playerIn.triggerAchievement(StatList.field_181735_S);
}
@@ -99,6 +101,10 @@
public boolean onBlockEventReceived(World worldIn, BlockPos pos, IBlockState state, int eventID, int eventParam)
{
+ net.minecraftforge.event.world.NoteBlockEvent.Play e = new net.minecraftforge.event.world.NoteBlockEvent.Play(worldIn, pos, state, eventParam, eventID);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(e)) return false;
+ eventID = e.instrument.ordinal();
+ eventParam = e.getVanillaNoteId();
float f = (float)Math.pow(2.0D, (double)(eventParam - 12) / 12.0D);
worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "note." + this.getInstrument(eventID), 3.0F, f);
worldIn.spawnParticle(EnumParticleTypes.NOTE, (double)pos.getX() + 0.5D, (double)pos.getY() + 1.2D, (double)pos.getZ() + 0.5D, (double)eventParam / 24.0D, 0.0D, 0.0D, new int[0]);

View File

@ -0,0 +1,21 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java
@@ -144,11 +144,17 @@
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())));
+ }
}

View File

@ -0,0 +1,41 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
@@ -39,7 +39,10 @@
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock())));
+ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH))
+ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH))
+ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST))
+ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST));
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -65,10 +68,10 @@
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))
{
@@ -187,4 +190,11 @@
{
return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
}
+
+ 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());
+ }
}

View File

@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -190,7 +190,7 @@
}
}
- 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);
}
@@ -334,7 +334,7 @@
return false;
}
- return !(blockIn instanceof ITileEntityProvider);
+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos)));
}
else
{
@@ -372,7 +372,9 @@
{
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;

View File

@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java
@@ -110,16 +110,7 @@
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)
@@ -283,4 +274,16 @@
{
return new BlockState(this, new IProperty[] {FACING, TYPE});
}
+
+ @Override
+ public java.util.List<net.minecraft.item.ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos);
+ if (tileentitypiston != null)
+ {
+ IBlockState pushed = tileentitypiston.getPistonState();
+ return pushed.getBlock().getDrops(world, pos, pushed, fortune);
+ }
+ return new java.util.ArrayList();
+ }
}

View File

@ -0,0 +1,25 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java
@@ -24,13 +24,14 @@
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;
+ }
}

View File

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

View File

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java
+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java
@@ -91,6 +91,26 @@
return new BlockState(this, new IProperty[] {VARIANT});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class)
+ {
+ EnumType current = (EnumType)state.getValue(prop);
+ EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y :
+ current == EnumType.LINES_Y ? EnumType.LINES_Z :
+ current == EnumType.LINES_Z ? EnumType.LINES_X : current;
+ if (next == current)
+ return false;
+ world.setBlockState(pos, state.withProperty(prop, next));
+ return true;
+ }
+ }
+ return false;
+ }
+
public static enum EnumType implements IStringSerializable
{
DEFAULT(0, "default", "default"),

View File

@ -0,0 +1,147 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java
@@ -32,7 +32,7 @@
public static boolean isRailBlock(IBlockState state)
{
Block block = state.getBlock();
- return block == Blocks.rail || block == Blocks.golden_rail || block == Blocks.detector_rail || block == Blocks.activator_rail;
+ return block instanceof BlockRailBase;
}
protected BlockRailBase(boolean isPowered)
@@ -176,6 +176,81 @@
public abstract IProperty<BlockRailBase.EnumRailDirection> getShapeProperty();
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pod Block's position in world
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos)
+ {
+ return !this.isPowered;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param pod Block's position in world
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(IBlockAccess world, BlockPos pos)
+ {
+ return true;
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param pod Block's position in world
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
+ {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param pod Block's position in world
+ */
+ public void onMinecartPass(World world, net.minecraft.entity.item.EntityMinecart cart, BlockPos pos)
+ {
+ }
+
+ /**
+ * Rotate the block. For vanilla blocks this rotates around the axis passed in (generally, it should be the "face" that was hit).
+ * Note: for mod blocks, this is up to the block and modder to decide. It is not mandated that it be a rotation around the
+ * face, but could be a rotation to orient *to* that face, or a visiting of possible rotations.
+ * The method should return true if the rotation was successful though.
+ *
+ * @param world The world
+ * @param pos Block position in world
+ * @param axis The axis to rotate around
+ * @return True if the rotation was successful, False if the rotation failed, or is not possible
+ */
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.getName().equals("shape"))
+ {
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /* ======================================== FORGE END =====================================*/
+
public static enum EnumRailDirection implements IStringSerializable
{
NORTH_SOUTH(0, "north_south"),
@@ -248,6 +323,7 @@
private final boolean isPowered;
private final List<BlockPos> field_150657_g = Lists.<BlockPos>newArrayList();
private static final String __OBFID = "CL_00000196";
+ private final boolean canMakeSlopes;
public Rail(World worldIn, BlockPos pos, IBlockState state)
{
@@ -256,7 +332,8 @@
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);
}
@@ -442,7 +519,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -455,7 +532,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
{
if (BlockRailBase.isRailBlock(this.world, blockpos3.up()))
{
@@ -598,7 +675,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -611,7 +688,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
{
if (BlockRailBase.isRailBlock(this.world, blockpos3.up()))
{

View File

@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java
@@ -297,6 +297,21 @@
return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite()).withProperty(POWERED, Boolean.valueOf(false)).withProperty(MODE, BlockRedstoneComparator.Mode.COMPARE);
}
+ @Override
+ public void onNeighborChange(IBlockAccess world, BlockPos pos, BlockPos neighbor)
+ {
+ if (pos.getY() == neighbor.getY() && world instanceof World)
+ {
+ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock());
+ }
+ }
+
+ @Override
+ public boolean getWeakChanges(IBlockAccess world, BlockPos pos)
+ {
+ return true;
+ }
+
public static enum Mode implements IStringSerializable
{
COMPARE("compare"),

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java
@@ -199,6 +199,8 @@
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
BlockPos blockpos = pos.offset(enumfacing.getOpposite());
+ if(net.minecraftforge.event.ForgeEventFactory.onNeighborNotify(worldIn, pos, worldIn.getBlockState(pos), java.util.EnumSet.of(enumfacing.getOpposite())).isCanceled())
+ return;
worldIn.notifyBlockOfStateChange(blockpos, this);
worldIn.notifyNeighborsOfStateExcept(blockpos, this, enumfacing);
}

View File

@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java
@@ -92,12 +92,16 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
+ }
- if (this.getItemDropped(state, worldIn.rand, fortune) != Item.getItemFromBlock(this))
+ @Override
+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ if (this.getItemDropped(world.getBlockState(pos), RANDOM, fortune) != Item.getItemFromBlock(this))
{
- int i = 1 + worldIn.rand.nextInt(5);
- this.dropXpOnBlockBreak(worldIn, pos, i);
+ return 1 + RANDOM.nextInt(5);
}
+ return 0;
}
@SideOnly(Side.CLIENT)

View File

@ -0,0 +1,59 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -59,10 +59,10 @@
BlockPos blockpos = pos.offset(direction);
Block block = worldIn.getBlockState(pos.offset(direction)).getBlock();
- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down()))))
+ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos.down(), null)))
{
Block block1 = worldIn.getBlockState(pos.up()).getBlock();
- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
+ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
}
else
{
@@ -360,35 +360,24 @@
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) </