regenerate reference patchset at patches.mcp. These will be used to generate a new patchtree under patches.

This commit is contained in:
cpw 2015-11-08 15:50:52 -05:00
parent ff19efe146
commit b1aa31215f
520 changed files with 13397 additions and 13450 deletions

View file

@ -3,186 +3,186 @@
@@ -39,8 +39,9 @@
public class Block
{
private static final ResourceLocation field_176230_a = new ResourceLocation("air");
- public static final RegistryNamespacedDefaultedByKey field_149771_c = new RegistryNamespacedDefaultedByKey(field_176230_a);
- public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap();
+ public static final RegistryNamespacedDefaultedByKey field_149771_c = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry();
private static final ResourceLocation AIR_ID = new ResourceLocation("air");
- public static final RegistryNamespacedDefaultedByKey blockRegistry = new RegistryNamespacedDefaultedByKey(AIR_ID);
- public static final ObjectIntIdentityMap BLOCK_STATE_IDS = new ObjectIntIdentityMap();
+ public static final RegistryNamespacedDefaultedByKey blockRegistry = net.minecraftforge.fml.common.registry.GameData.getBlockRegistry();
+ @Deprecated //Modders: DO NOT use this! Use GameRegistry
+ public static final ObjectIntIdentityMap field_176229_d = net.minecraftforge.fml.common.registry.GameData.getBlockStateIDMap();
private CreativeTabs field_149772_a;
public static final Block.SoundType field_149769_e = new Block.SoundType("stone", 1.0F, 1.0F);
public static final Block.SoundType field_149766_f = new Block.SoundType("wood", 1.0F, 1.0F);
+ public static final ObjectIntIdentityMap 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);
@@ -124,6 +125,9 @@
private String field_149770_b;
private String unlocalizedName;
private static final String __OBFID = "CL_00000199";
+ public final net.minecraftforge.fml.common.registry.RegistryDelegate<Block> delegate =
+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)field_149771_c).getDelegate(this, Block.class);
+ ((net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry)blockRegistry).getDelegate(this, Block.class);
+
public static int func_149682_b(Block p_149682_0_)
public static int getIdFromBlock(Block blockIn)
{
return field_149771_c.func_148757_b(p_149682_0_);
return blockRegistry.getIDForObject(blockIn);
@@ -136,7 +140,8 @@
public static Block func_149729_e(int p_149729_0_)
public static Block getBlockById(int id)
{
- return (Block)field_149771_c.func_148754_a(p_149729_0_);
+ Block ret = (Block)field_149771_c.func_148754_a(p_149729_0_);
+ return ret == null ? net.minecraft.init.Blocks.field_150350_a : ret;
- return (Block)blockRegistry.getObjectById(id);
+ Block ret = (Block)blockRegistry.getObjectById(id);
+ return ret == null ? net.minecraft.init.Blocks.air : ret;
}
public static IBlockState func_176220_d(int p_176220_0_)
public static IBlockState getStateById(int id)
@@ -300,7 +305,7 @@
public boolean func_176200_f(World p_176200_1_, BlockPos p_176200_2_)
public boolean isReplaceable(World worldIn, BlockPos pos)
{
- return false;
+ return func_149688_o().func_76222_j();
+ return getMaterial().isReplaceable();
}
public Block func_149711_c(float p_149711_1_)
public Block setHardness(float hardness)
@@ -337,9 +342,10 @@
return this.field_149789_z;
return this.needsRandomTick;
}
+ @Deprecated //Forge: New State sensitive version.
public boolean func_149716_u()
public boolean hasTileEntity()
{
- return this.field_149758_A;
+ return hasTileEntity(func_176223_P());
- return this.isBlockContainer;
+ return hasTileEntity(getDefaultState());
}
public final void func_149676_a(float p_149676_1_, float p_149676_2_, float p_149676_3_, float p_149676_4_, float p_149676_5_, float p_149676_6_)
public final void setBlockBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
@@ -356,13 +362,13 @@
public int func_176207_c(IBlockAccess p_176207_1_, BlockPos p_176207_2_)
public int getMixedBrightnessForBlock(IBlockAccess worldIn, BlockPos pos)
{
Block block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c();
- int i = p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m());
+ int i = p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_));
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)
{
p_176207_2_ = p_176207_2_.func_177977_b();
block = p_176207_1_.func_180495_p(p_176207_2_).func_177230_c();
- return p_176207_1_.func_175626_b(p_176207_2_, block.func_149750_m());
+ return p_176207_1_.func_175626_b(p_176207_2_, block.getLightValue(p_176207_1_, p_176207_2_));
pos = pos.down();
block = worldIn.getBlockState(pos).getBlock();
- return worldIn.getCombinedLight(pos, block.getLightValue());
+ return worldIn.getCombinedLight(pos, block.getLightValue(worldIn, pos));
}
else
{
@@ -438,7 +444,13 @@
public void func_176213_c(World p_176213_1_, BlockPos p_176213_2_, IBlockState p_176213_3_) {}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {}
- public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_) {}
+ public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_)
- public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {}
+ public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
+ {
+ if (hasTileEntity(p_180663_3_) && !(this instanceof BlockContainer))
+ if (hasTileEntity(state) && !(this instanceof BlockContainer))
+ {
+ p_180663_1_.func_175713_t(p_180663_2_);
+ worldIn.removeTileEntity(pos);
+ }
+ }
public int func_149745_a(Random p_149745_1_)
public int quantityDropped(Random random)
{
@@ -452,8 +464,7 @@
public float func_180647_a(EntityPlayer p_180647_1_, World p_180647_2_, BlockPos p_180647_3_)
public float getPlayerRelativeBlockHardness(EntityPlayer playerIn, World worldIn, BlockPos pos)
{
- float f = this.func_176195_g(p_180647_2_, p_180647_3_);
- return f < 0.0F ? 0.0F : (!p_180647_1_.func_146099_a(this) ? p_180647_1_.func_180471_a(this) / f / 100.0F : p_180647_1_.func_180471_a(this) / f / 30.0F);
+ return net.minecraftforge.common.ForgeHooks.blockStrength(p_180647_2_.func_180495_p(p_180647_3_), p_180647_1_, p_180647_2_, p_180647_3_);
- 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 func_176226_b(World p_176226_1_, BlockPos p_176226_2_, IBlockState p_176226_3_, int p_176226_4_)
public final void dropBlockAsItem(World worldIn, BlockPos pos, IBlockState state, int forture)
@@ -463,20 +474,16 @@
public void func_180653_a(World p_180653_1_, BlockPos p_180653_2_, IBlockState p_180653_3_, float p_180653_4_, int p_180653_5_)
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!p_180653_1_.field_72995_K)
+ if (!p_180653_1_.field_72995_K && !p_180653_1_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
- if (!worldIn.isRemote)
+ if (!worldIn.isRemote && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
{
- int j = this.func_149679_a(p_180653_5_, p_180653_1_.field_73012_v);
+ java.util.List<ItemStack> items = getDrops(p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_);
+ p_180653_4_ = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180653_1_, p_180653_2_, p_180653_3_, p_180653_5_, p_180653_4_, false, harvesters.get());
- int j = this.quantityDroppedWithBonus(fortune, worldIn.rand);
+ java.util.List<ItemStack> items = getDrops(worldIn, pos, state, fortune);
+ chance = net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, fortune, chance, false, harvesters.get());
- for (int k = 0; k < j; ++k)
+ for (ItemStack item : items)
{
if (p_180653_1_.field_73012_v.nextFloat() <= p_180653_4_)
if (worldIn.rand.nextFloat() <= chance)
{
- Item item = this.func_180660_a(p_180653_3_, p_180653_1_.field_73012_v, p_180653_5_);
- Item item = this.getItemDropped(state, worldIn.rand, fortune);
-
- if (item != null)
- {
- func_180635_a(p_180653_1_, p_180653_2_, new ItemStack(item, 1, this.func_180651_a(p_180653_3_)));
- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state)));
- }
+ func_180635_a(p_180653_1_, p_180653_2_, item);
+ spawnAsEntity(worldIn, pos, item);
}
}
}
@@ -484,8 +491,13 @@
public static void func_180635_a(World p_180635_0_, BlockPos p_180635_1_, ItemStack p_180635_2_)
public static void spawnAsEntity(World worldIn, BlockPos pos, ItemStack stack)
{
- if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops"))
+ if (!p_180635_0_.field_72995_K && p_180635_0_.func_82736_K().func_82766_b("doTileDrops") && !p_180635_0_.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
- if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops"))
+ if (!worldIn.isRemote && worldIn.getGameRules().getGameRuleBooleanValue("doTileDrops") && !worldIn.restoringBlockSnapshots) // do not drop items while restoring blockstates, prevents item dupe
{
+ if (captureDrops.get())
+ {
+ capturedDrops.get().add(p_180635_2_);
+ capturedDrops.get().add(stack);
+ return;
+ }
float f = 0.5F;
double d0 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
double d1 = (double)(p_180635_0_.field_73012_v.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
@@ -670,7 +682,7 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().field_149764_J.func_76222_j();
+ return p_176196_1_.func_180495_p(p_176196_2_).func_177230_c().func_176200_f(p_176196_1_, p_176196_2_);
- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable();
+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
}
public boolean func_180639_a(World p_180639_1_, BlockPos p_180639_2_, IBlockState p_180639_3_, EntityPlayer p_180639_4_, EnumFacing p_180639_5_, float p_180639_6_, float p_180639_7_, float p_180639_8_)
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
@@ -772,25 +784,35 @@
p_180657_2_.func_71029_a(StatList.field_75934_C[func_149682_b(this)]);
p_180657_2_.func_71020_j(0.025F);
player.triggerAchievement(StatList.mineBlockStatArray[getIdFromBlock(this)]);
player.addExhaustion(0.025F);
- if (this.func_149700_E() && EnchantmentHelper.func_77502_d(p_180657_2_))
+ if (this.canSilkHarvest(p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), p_180657_2_) && EnchantmentHelper.func_77502_d(p_180657_2_))
- 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.func_180643_i(p_180657_4_);
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
- func_180635_a(p_180657_1_, p_180657_3_, itemstack);
- spawnAsEntity(worldIn, pos, itemstack);
+ items.add(itemstack);
}
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, p_180657_1_, p_180657_3_, p_180657_1_.func_180495_p(p_180657_3_), 0, 1.0f, true, p_180657_2_);
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player);
+ for (ItemStack stack : items)
+ {
+ func_180635_a(p_180657_1_, p_180657_3_, stack);
+ spawnAsEntity(worldIn, pos, stack);
+ }
}
else
{
+ harvesters.set(p_180657_2_);
int i = EnchantmentHelper.func_77517_e(p_180657_2_);
this.func_176226_b(p_180657_1_, p_180657_3_, p_180657_4_, i);
+ harvesters.set(player);
int i = EnchantmentHelper.getFortuneModifier(player);
this.dropBlockAsItem(worldIn, pos, state, i);
+ harvesters.set(null);
}
}
+ @Deprecated //Forge: State sensitive version
protected boolean func_149700_E()
protected boolean canSilkHarvest()
{
- return this.func_149686_d() && !this.field_149758_A;
+ return this.func_149686_d() && !this.hasTileEntity(silk_check_state.get());
- return this.isFullCube() && !this.isBlockContainer;
+ return this.isFullCube() && !this.hasTileEntity(silk_check_state.get());
}
protected ItemStack func_180643_i(IBlockState p_180643_1_)
protected ItemStack createStackedBlock(IBlockState state)
@@ -967,6 +989,1033 @@
return Block.EnumOffsetType.NONE;
}
@ -201,12 +201,12 @@
+ */
+ public int getLightValue(IBlockAccess world, BlockPos pos)
+ {
+ Block block = world.func_180495_p(pos).func_177230_c();
+ Block block = world.getBlockState(pos).getBlock();
+ if (block != this)
+ {
+ return block.getLightValue(world, pos);
+ }
+ return func_149750_m();
+ return getLightValue();
+ }
+
+ /**
@ -230,7 +230,7 @@
+ */
+ public boolean isNormalCube(IBlockAccess world, BlockPos pos)
+ {
+ return func_149688_o().func_76218_k() && func_149686_d() && !func_149744_f();
+ return getMaterial().isOpaque() && isFullCube() && !canProvidePower();
+ }
+
+ /**
@ -243,11 +243,11 @@
+ */
+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ IBlockState state = this.func_176221_a(world.func_180495_p(pos), world, pos);
+ IBlockState state = this.getActualState(world.getBlockState(pos), world, pos);
+
+ if (this instanceof BlockSlab)
+ {
+ return func_149730_j() || (state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP);
+ return isFullBlock() || (state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP && side == EnumFacing.UP);
+ }
+ else if (this instanceof BlockFarmland)
+ {
@ -255,26 +255,26 @@
+ }
+ else if (this instanceof BlockStairs)
+ {
+ boolean flipped = state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP;
+ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.func_177229_b(BlockStairs.field_176310_M);
+ EnumFacing facing = (EnumFacing)state.func_177229_b(BlockStairs.field_176309_a);
+ boolean flipped = state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
+ BlockStairs.EnumShape shape = (BlockStairs.EnumShape)state.getValue(BlockStairs.SHAPE);
+ EnumFacing facing = (EnumFacing)state.getValue(BlockStairs.FACING);
+ if (side == EnumFacing.UP) return flipped;
+ if (facing == side) return true;
+ if (flipped)
+ {
+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176735_f();
+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176746_e();
+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateYCCW();
+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateY();
+ }
+ else
+ {
+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.func_176746_e();
+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.func_176735_f();
+ if (shape == BlockStairs.EnumShape.INNER_LEFT ) return side == facing.rotateY();
+ if (shape == BlockStairs.EnumShape.INNER_RIGHT) return side == facing.rotateYCCW();
+ }
+ return false;
+ }
+ else if (this instanceof BlockSnow)
+ {
+ return ((Integer)state.func_177229_b(BlockSnow.field_176315_a)) >= 8;
+ return ((Integer)state.getValue(BlockSnow.LAYERS)) >= 8;
+ }
+ else if (this instanceof BlockHopper && side == EnumFacing.UP)
+ {
@ -312,7 +312,7 @@
+ */
+ public boolean isAir(IBlockAccess world, BlockPos pos)
+ {
+ return func_149688_o() == Material.field_151579_a;
+ return getMaterial() == Material.air;
+ }
+
+ /**
@ -347,7 +347,7 @@
+ */
+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ {
+ return world.func_175698_g(pos);
+ return world.setBlockToAir(pos);
+ }
+
+ /**
@ -361,7 +361,7 @@
+ */
+ public int getFlammability(IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ return net.minecraft.init.Blocks.field_150480_ab.func_176532_c(this);
+ return net.minecraft.init.Blocks.fire.getFlammability(this);
+ }
+
+ /**
@ -389,7 +389,7 @@
+ */
+ public int getFireSpreadSpeed(IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ return net.minecraft.init.Blocks.field_150480_ab.func_176534_d(this);
+ return net.minecraft.init.Blocks.fire.getEncouragement(this);
+ }
+
+ /**
@ -405,11 +405,11 @@
+ */
+ public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
+ {
+ if (this == net.minecraft.init.Blocks.field_150424_aL && side == EnumFacing.UP)
+ if (this == net.minecraft.init.Blocks.netherrack && side == EnumFacing.UP)
+ {
+ return true;
+ }
+ if ((world.field_73011_w instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.field_150357_h && side == EnumFacing.UP)
+ if ((world.provider instanceof net.minecraft.world.WorldProviderEnd) && this == net.minecraft.init.Blocks.bedrock && side == EnumFacing.UP)
+ {
+ return true;
+ }
@ -444,7 +444,7 @@
+ {
+ if (isTileProvider)
+ {
+ return ((ITileEntityProvider)this).func_149915_a(world, func_176201_c(state));
+ return ((ITileEntityProvider)this).createNewTileEntity(world, getMetaFromState(state));
+ }
+ return null;
+ }
@ -460,7 +460,7 @@
+ */
+ public int quantityDropped(IBlockState state, int fortune, Random random)
+ {
+ return func_149679_a(fortune, random);
+ return quantityDroppedWithBonus(fortune, random);
+ }
+
+ /**
@ -476,15 +476,15 @@
+ {
+ List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+
+ Random rand = world instanceof World ? ((World)world).field_73012_v : RANDOM;
+ Random rand = world instanceof World ? ((World)world).rand : RANDOM;
+
+ int count = quantityDropped(state, fortune, rand);
+ for(int i = 0; i < count; i++)
+ {
+ Item item = this.func_180660_a(state, rand, fortune);
+ Item item = this.getItemDropped(state, rand, fortune);
+ if (item != null)
+ {
+ ret.add(new ItemStack(item, 1, this.func_180651_a(state)));
+ ret.add(new ItemStack(item, 1, this.damageDropped(state)));
+ }
+ }
+ return ret;
@ -502,7 +502,7 @@
+ public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player)
+ {
+ silk_check_state.set(state);;
+ boolean ret = this.func_149700_E();
+ boolean ret = this.canSilkHarvest();
+ silk_check_state.set(null);
+ return ret;
+ }
@ -518,14 +518,14 @@
+ */
+ public boolean canCreatureSpawn(IBlockAccess world, BlockPos pos, net.minecraft.entity.EntityLiving.SpawnPlacementType type)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ IBlockState state = world.getBlockState(pos);
+ if (this instanceof BlockSlab)
+ {
+ return (func_149730_j() || state.func_177229_b(BlockSlab.field_176554_a) == BlockSlab.EnumBlockHalf.TOP);
+ return (isFullBlock() || state.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP);
+ }
+ else if (this instanceof BlockStairs)
+ {
+ return state.func_177229_b(BlockStairs.field_176308_b) == BlockStairs.EnumHalf.TOP;
+ return state.getValue(BlockStairs.HALF) == BlockStairs.EnumHalf.TOP;
+ }
+ return isSideSolid(world, pos, EnumFacing.UP);
+ }
@ -542,7 +542,7 @@
+ */
+ public boolean isBed(IBlockAccess world, BlockPos pos, Entity player)
+ {
+ return this == net.minecraft.init.Blocks.field_150324_C;
+ return this == net.minecraft.init.Blocks.bed;
+ }
+
+ /**
@ -557,7 +557,7 @@
+ public BlockPos getBedSpawnPosition(IBlockAccess world, BlockPos pos, EntityPlayer player)
+ {
+ if (world instanceof World)
+ return BlockBed.func_176468_a((World)world, pos, 0);
+ return BlockBed.getSafeExitLocation((World)world, pos, 0);
+ return null;
+ }
+
@ -573,10 +573,10 @@
+ {
+ if (world instanceof World)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ state = state.func_177230_c().func_176221_a(state, world, pos);
+ state = state.func_177226_a(BlockBed.field_176471_b, true);
+ ((World)world).func_180501_a(pos, state, 4);
+ IBlockState state = world.getBlockState(pos);
+ state = state.getBlock().getActualState(state, world, pos);
+ state = state.withProperty(BlockBed.OCCUPIED, true);
+ ((World)world).setBlockState(pos, state, 4);
+ }
+ }
+
@ -590,7 +590,7 @@
+ */
+ public EnumFacing getBedDirection(IBlockAccess world, BlockPos pos)
+ {
+ return (EnumFacing)func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockDirectional.field_176387_N);
+ return (EnumFacing)getActualState(world.getBlockState(pos), world, pos).getValue(BlockDirectional.FACING);
+ }
+
+ /**
@ -602,7 +602,7 @@
+ */
+ public boolean isBedFoot(IBlockAccess world, BlockPos pos)
+ {
+ return func_176221_a(world.func_180495_p(pos), world, pos).func_177229_b(BlockBed.field_176472_a) == BlockBed.EnumPartType.FOOT;
+ return getActualState(world.getBlockState(pos), world, pos).getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT;
+ }
+
+ /**
@ -634,7 +634,7 @@
+ */
+ public boolean isLeaves(IBlockAccess world, BlockPos pos)
+ {
+ return func_149688_o() == Material.field_151584_j;
+ return getMaterial() == Material.leaves;
+ }
+
+ /**
@ -646,7 +646,7 @@
+ */
+ public boolean canBeReplacedByLeaves(IBlockAccess world, BlockPos pos)
+ {
+ return !func_149730_j();
+ return !isFullBlock();
+ }
+
+ /**
@ -671,7 +671,7 @@
+ */
+ public boolean isReplaceableOreGen(World world, BlockPos pos, com.google.common.base.Predicate<IBlockState> target)
+ {
+ return target.apply(world.func_180495_p(pos));
+ return target.apply(world.getBlockState(pos));
+ }
+
+ /**
@ -685,7 +685,7 @@
+ */
+ public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion)
+ {
+ return func_149638_a(exploder);
+ return getExplosionResistance(exploder);
+ }
+
+ /**
@ -699,8 +699,8 @@
+ */
+ public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
+ {
+ world.func_175698_g(pos);
+ func_180652_a(world, pos, explosion);
+ world.setBlockToAir(pos);
+ onBlockDestroyedByExplosion(world, pos, explosion);
+ }
+
+ /**
@ -714,7 +714,7 @@
+ */
+ public boolean canConnectRedstone(IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return func_149744_f() && side != null;
+ return canProvidePower() && side != null;
+ }
+
+ /**
@ -733,7 +733,7 @@
+ }
+ else
+ {
+ return this instanceof BlockFence || this == net.minecraft.init.Blocks.field_150359_w || this == net.minecraft.init.Blocks.field_150463_bK || this == net.minecraft.init.Blocks.field_150399_cn;
+ return this instanceof BlockFence || this == net.minecraft.init.Blocks.glass || this == net.minecraft.init.Blocks.cobblestone_wall || this == net.minecraft.init.Blocks.stained_glass;
+ }
+ }
+
@ -763,15 +763,15 @@
+ @Deprecated
+ public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos)
+ {
+ Item item = func_180665_b(world, pos);
+ Item item = getItem(world, pos);
+
+ if (item == null)
+ {
+ return null;
+ }
+
+ Block block = item instanceof ItemBlock && !func_149648_K() ? Block.func_149634_a(item) : this;
+ return new ItemStack(item, 1, block.func_176222_j(world, pos));
+ Block block = item instanceof ItemBlock && !isFlowerPot() ? Block.getBlockFromItem(item) : this;
+ return new ItemStack(item, 1, block.getDamageValue(world, pos));
+ }
+
+ /**
@ -838,39 +838,39 @@
+ */
+ public boolean canSustainPlant(IBlockAccess world, BlockPos pos, EnumFacing direction, net.minecraftforge.common.IPlantable plantable)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ IBlockState plant = plantable.getPlant(world, pos.func_177972_a(direction));
+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.func_177972_a(direction));
+ IBlockState state = world.getBlockState(pos);
+ IBlockState plant = plantable.getPlant(world, pos.offset(direction));
+ net.minecraftforge.common.EnumPlantType plantType = plantable.getPlantType(world, pos.offset(direction));
+
+ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150434_aF && this == net.minecraft.init.Blocks.field_150434_aF)
+ if (plant.getBlock() == net.minecraft.init.Blocks.cactus && this == net.minecraft.init.Blocks.cactus)
+ {
+ return true;
+ }
+
+ if (plant.func_177230_c() == net.minecraft.init.Blocks.field_150436_aH && this == net.minecraft.init.Blocks.field_150436_aH)
+ if (plant.getBlock() == net.minecraft.init.Blocks.reeds && this == net.minecraft.init.Blocks.reeds)
+ {
+ return true;
+ }
+
+ if (plantable instanceof BlockBush && ((BlockBush)plantable).func_149854_a(this))
+ if (plantable instanceof BlockBush && ((BlockBush)plantable).canPlaceBlockOn(this))
+ {
+ return true;
+ }
+
+ switch (plantType)
+ {
+ case Desert: return this == net.minecraft.init.Blocks.field_150354_m || this == net.minecraft.init.Blocks.field_150405_ch || this == net.minecraft.init.Blocks.field_150406_ce || this == net.minecraft.init.Blocks.field_150346_d;
+ case Nether: return this == net.minecraft.init.Blocks.field_150425_aM;
+ case Crop: return this == net.minecraft.init.Blocks.field_150458_ak;
+ case Desert: return this == net.minecraft.init.Blocks.sand || this == net.minecraft.init.Blocks.hardened_clay || this == net.minecraft.init.Blocks.stained_hardened_clay || this == net.minecraft.init.Blocks.dirt;
+ case Nether: return this == net.minecraft.init.Blocks.soul_sand;
+ case Crop: return this == net.minecraft.init.Blocks.farmland;
+ case Cave: return isSideSolid(world, pos, EnumFacing.UP);
+ case Plains: return this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150458_ak;
+ case Water: return func_149688_o() == Material.field_151586_h && ((Integer)state.func_177229_b(BlockLiquid.field_176367_b)) == 0;
+ case Plains: return this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.farmland;
+ case Water: return getMaterial() == Material.water && ((Integer)state.getValue(BlockLiquid.LEVEL)) == 0;
+ case Beach:
+ boolean isBeach = this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150346_d || this == net.minecraft.init.Blocks.field_150354_m;
+ boolean hasWater = (world.func_180495_p(pos.func_177974_f()).func_177230_c().func_149688_o() == Material.field_151586_h ||
+ world.func_180495_p(pos.func_177976_e()).func_177230_c().func_149688_o() == Material.field_151586_h ||
+ world.func_180495_p(pos.func_177978_c()).func_177230_c().func_149688_o() == Material.field_151586_h ||
+ world.func_180495_p(pos.func_177968_d()).func_177230_c().func_149688_o() == Material.field_151586_h);
+ boolean isBeach = this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.dirt || this == net.minecraft.init.Blocks.sand;
+ boolean hasWater = (world.getBlockState(pos.east()).getBlock().getMaterial() == Material.water ||
+ world.getBlockState(pos.west()).getBlock().getMaterial() == Material.water ||
+ world.getBlockState(pos.north()).getBlock().getMaterial() == Material.water ||
+ world.getBlockState(pos.south()).getBlock().getMaterial() == Material.water);
+ return isBeach && hasWater;
+ }
+
@ -892,9 +892,9 @@
+ */
+ public void onPlantGrow(World world, BlockPos pos, BlockPos source)
+ {
+ if (this == net.minecraft.init.Blocks.field_150349_c || this == net.minecraft.init.Blocks.field_150458_ak)
+ if (this == net.minecraft.init.Blocks.grass || this == net.minecraft.init.Blocks.farmland)
+ {
+ world.func_180501_a(pos, net.minecraft.init.Blocks.field_150346_d.func_176223_P(), 2);
+ world.setBlockState(pos, net.minecraft.init.Blocks.dirt.getDefaultState(), 2);
+ }
+ }
+
@ -909,9 +909,9 @@
+ */
+ public boolean isFertile(World world, BlockPos pos)
+ {
+ if (this == net.minecraft.init.Blocks.field_150458_ak)
+ if (this == net.minecraft.init.Blocks.farmland)
+ {
+ return ((Integer)world.func_180495_p(pos).func_177229_b(BlockFarmland.field_176531_a)) > 0;
+ return ((Integer)world.getBlockState(pos).getValue(BlockFarmland.MOISTURE)) > 0;
+ }
+
+ return false;
@ -931,7 +931,7 @@
+ */
+ public int getLightOpacity(IBlockAccess world, BlockPos pos)
+ {
+ return func_149717_k();
+ return getLightOpacity();
+ }
+
+ /**
@ -945,11 +945,11 @@
+ {
+ if (entity instanceof net.minecraft.entity.boss.EntityWither)
+ {
+ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150384_bq && this != net.minecraft.init.Blocks.field_150378_br && this != net.minecraft.init.Blocks.field_150483_bI;
+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.end_portal && this != net.minecraft.init.Blocks.end_portal_frame && this != net.minecraft.init.Blocks.command_block;
+ }
+ else if (entity instanceof net.minecraft.entity.boss.EntityDragon)
+ {
+ return this != net.minecraft.init.Blocks.field_180401_cv && this != net.minecraft.init.Blocks.field_150343_Z && this != net.minecraft.init.Blocks.field_150377_bs && this != net.minecraft.init.Blocks.field_150357_h && this != net.minecraft.init.Blocks.field_150483_bI;
+ return this != net.minecraft.init.Blocks.barrier && this != net.minecraft.init.Blocks.obsidian && this != net.minecraft.init.Blocks.end_stone && this != net.minecraft.init.Blocks.bedrock && this != net.minecraft.init.Blocks.command_block;
+ }
+
+ return true;
@ -965,7 +965,7 @@
+ */
+ public boolean isBeaconBase(IBlockAccess worldObj, BlockPos pos, BlockPos beacon)
+ {
+ return this == net.minecraft.init.Blocks.field_150475_bE || this == net.minecraft.init.Blocks.field_150340_R || this == net.minecraft.init.Blocks.field_150484_ah || this == net.minecraft.init.Blocks.field_150339_S;
+ return this == net.minecraft.init.Blocks.emerald_block || this == net.minecraft.init.Blocks.gold_block || this == net.minecraft.init.Blocks.diamond_block || this == net.minecraft.init.Blocks.iron_block;
+ }
+
+ /**
@ -981,12 +981,12 @@
+ */
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.func_177701_a().equals("facing") || prop.func_177701_a().equals("rotation"))
+ if (prop.getName().equals("facing") || prop.getName().equals("rotation"))
+ {
+ world.func_175656_a(pos, state.func_177231_a(prop));
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }
@ -1002,12 +1002,12 @@
+ */
+ public EnumFacing[] getValidRotations(World world, BlockPos pos)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.func_177701_a().equals("facing") && prop.func_177699_b() == EnumFacing.class)
+ if (prop.getName().equals("facing") && prop.getValueClass() == EnumFacing.class)
+ {
+ java.util.Collection<EnumFacing> values = ((java.util.Collection<EnumFacing>)prop.func_177700_c());
+ java.util.Collection<EnumFacing> values = ((java.util.Collection<EnumFacing>)prop.getAllowedValues());
+ return values.toArray(new EnumFacing[values.size()]);
+ }
+ }
@ -1022,7 +1022,7 @@
+ */
+ public float getEnchantPowerBonus(World world, BlockPos pos)
+ {
+ return this == net.minecraft.init.Blocks.field_150342_X ? 1 : 0;
+ return this == net.minecraft.init.Blocks.bookshelf ? 1 : 0;
+ }
+
+ /**
@ -1035,15 +1035,15 @@
+ */
+ public boolean recolorBlock(World world, BlockPos pos, EnumFacing side, net.minecraft.item.EnumDyeColor color)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.func_177701_a().equals("color") && prop.func_177699_b() == net.minecraft.item.EnumDyeColor.class)
+ if (prop.getName().equals("color") && prop.getValueClass() == net.minecraft.item.EnumDyeColor.class)
+ {
+ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.func_177229_b(prop);
+ net.minecraft.item.EnumDyeColor current = (net.minecraft.item.EnumDyeColor)state.getValue(prop);
+ if (current != color)
+ {
+ world.func_175656_a(pos, state.func_177226_a(prop, color));
+ world.setBlockState(pos, state.withProperty(prop, color));
+ return true;
+ }
+ }
@ -1081,7 +1081,7 @@
+ */
+ public boolean shouldCheckWeakPower(IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return func_149721_r();
+ return isNormalCube();
+ }
+
+ /**
@ -1114,7 +1114,7 @@
+ */
+ public void setHarvestLevel(String toolClass, int level)
+ {
+ Iterator<IBlockState> itr = func_176194_O().func_177619_a().iterator();
+ Iterator<IBlockState> itr = getBlockState().getValidStates().iterator();
+ while (itr.hasNext())
+ {
+ setHarvestLevel(toolClass, level, itr.next());
@ -1135,7 +1135,7 @@
+ */
+ public void setHarvestLevel(String toolClass, int level, IBlockState state)
+ {
+ int idx = this.func_176201_c(state);
+ int idx = this.getMetaFromState(state);
+ this.harvestTool[idx] = toolClass;
+ this.harvestLevel[idx] = level;
+ }
@ -1146,7 +1146,7 @@
+ */
+ public String getHarvestTool(IBlockState state)
+ {
+ return harvestTool[func_176201_c(state)];
+ return harvestTool[getMetaFromState(state)];
+ }
+
+ /**
@ -1158,7 +1158,7 @@
+ */
+ public int getHarvestLevel(IBlockState state)
+ {
+ return harvestLevel[func_176201_c(state)];
+ return harvestLevel[getMetaFromState(state)];
+ }
+
+ /**
@ -1167,7 +1167,7 @@
+ */
+ public boolean isToolEffective(String type, IBlockState state)
+ {
+ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.field_150450_ax || this == net.minecraft.init.Blocks.field_150439_ay || this == net.minecraft.init.Blocks.field_150343_Z))
+ if ("pickaxe".equals(type) && (this == net.minecraft.init.Blocks.redstone_ore || this == net.minecraft.init.Blocks.lit_redstone_ore || this == net.minecraft.init.Blocks.obsidian))
+ return false;
+ return type != null && type.equals(getHarvestTool(state));
+ }
@ -1177,7 +1177,7 @@
+ */
+ public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos)
+ {
+ return func_176221_a(state, world, pos);
+ return getActualState(state, world, pos);
+ }
+
+ /**
@ -1186,7 +1186,7 @@
+ */
+ public boolean canRenderInLayer(EnumWorldBlockLayer layer)
+ {
+ return func_180664_k() == layer;
+ return getBlockLayer() == layer;
+ }
+
+ // For Internal use only to capture droped items inside getDrops
@ -1214,6 +1214,6 @@
+ }
+ /* ========================================= FORGE END ======================================*/
+
public static void func_149671_p()
public static void registerBlocks()
{
func_176215_a(0, field_176230_a, (new BlockAir()).func_149663_c("air"));
registerBlock(0, AIR_ID, (new BlockAir()).setUnlocalizedName("air"));

View file

@ -0,0 +1,9 @@
--- ../src-base/minecraft/net/minecraft/block/BlockAir.java
+++ ../src-work/minecraft/net/minecraft/block/BlockAir.java
@@ -36,4 +36,6 @@
}
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {}
+
+ public boolean isReplaceable(World worldIn, BlockPos pos){ return true; }
}

View file

@ -0,0 +1,66 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -12,7 +12,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";
@@ -32,7 +32,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)
@@ -62,7 +62,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)
@@ -85,4 +88,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,46 @@
--- ../src-base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src-work/minecraft/net/minecraft/block/BlockButton.java
@@ -18,6 +18,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import static net.minecraft.util.EnumFacing.*;
public abstract class BlockButton extends Block
{
@@ -57,7 +58,7 @@
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
- return worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube();
+ return worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
@@ -69,7 +70,7 @@
{
EnumFacing enumfacing = aenumfacing[j];
- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube())
+ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true))
{
return true;
}
@@ -80,7 +81,7 @@
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube() ? this.getDefaultState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getDefaultState().withProperty(FACING, EnumFacing.DOWN).withProperty(POWERED, Boolean.valueOf(false));
+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true) ? this.getDefaultState().withProperty(FACING, facing).withProperty(POWERED, Boolean.valueOf(false)) : this.getDefaultState().withProperty(FACING, EnumFacing.DOWN).withProperty(POWERED, Boolean.valueOf(false));
}
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
@@ -89,7 +90,7 @@
{
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);

View file

@ -7,20 +7,20 @@
-public class BlockCactus extends Block
+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable
{
public static final PropertyInteger field_176587_a = PropertyInteger.func_177719_a("age", 0, 15);
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
private static final String __OBFID = "CL_00000210";
@@ -115,7 +115,7 @@
}
Block block = p_176586_1_.func_180495_p(p_176586_2_.func_177977_b()).func_177230_c();
- return block == Blocks.field_150434_aF || block == Blocks.field_150354_m;
+ return block.canSustainPlant(p_176586_1_, p_176586_2_.func_177977_b(), EnumFacing.UP, this);
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 func_180634_a(World p_180634_1_, BlockPos p_180634_2_, IBlockState p_180634_3_, Entity p_180634_4_)
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
@@ -143,4 +143,16 @@
{
return new BlockState(this, new IProperty[] {field_176587_a});
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @Override
@ -32,6 +32,6 @@
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ return func_176223_P();
+ return getDefaultState();
+ }
}

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java
@@ -531,7 +531,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
@@ -137,6 +137,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 j = ((Integer)state.getValue(AGE)).intValue();
byte b0 = 1;
@@ -147,8 +154,9 @@
for (int k = 0; k < b0; ++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(blockpos1.add(i, 0, j));
- if (iblockstate.getBlock() == Blocks.farmland)
+ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos1.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, blockpos1.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 j = ((Integer)state.getValue(AGE)).intValue();
-
- if (j >= 7)
- {
- int k = 3 + fortune;
-
- for (int l = 0; l < k; ++l)
- {
- if (worldIn.rand.nextInt(15) <= j)
- {
- 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

@ -11,16 +11,16 @@
@@ -41,14 +41,15 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_)
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ)
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]);
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150330_I, 1, 0));
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
- }
- else
- {
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_);
super.harvestBlock(worldIn, player, pos, state, te);
}
}
+
@ -28,6 +28,6 @@
+ @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.field_150330_I)));
+ 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
@@ -149,7 +149,7 @@
{
if (this.blockMaterial == Material.iron)
{
- return true;
+ return false; //Allow items to interact with the door
}
else
{
@@ -267,7 +267,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
@@ -24,7 +24,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 VARIANT = PropertyEnum.create("variant", BlockDoublePlant.EnumPlantType.class);
public static final PropertyEnum HALF = PropertyEnum.create("half", BlockDoublePlant.EnumBlockHalf.class);
@@ -89,6 +89,8 @@
Object object = flag ? this : worldIn.getBlockState(blockpos1).getBlock();
Object object1 = flag ? worldIn.getBlockState(blockpos2).getBlock() : this;
+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air.
+
if (object == this)
{
worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3);
@@ -97,17 +99,13 @@
if (object1 == this)
{
worldIn.setBlockState(blockpos2, Blocks.air.getDefaultState(), 3);
-
- if (!flag)
- {
- this.dropBlockAsItem(worldIn, blockpos2, 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;
@@ -157,7 +155,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);
}
@@ -220,8 +217,6 @@
else
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- int i = (enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta();
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i));
return true;
}
}
@@ -296,6 +291,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);
+ }
+
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
@@ -85,6 +85,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
@@ -89,7 +89,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 @@
b0 = -50;
}
- this.catchOnFire(worldIn, pos.east(), 300 + b0, rand, i);
- this.catchOnFire(worldIn, pos.west(), 300 + b0, rand, i);
- this.catchOnFire(worldIn, pos.down(), 250 + b0, rand, i);
- this.catchOnFire(worldIn, pos.up(), 250 + b0, rand, i);
- this.catchOnFire(worldIn, pos.north(), 300 + b0, rand, i);
- this.catchOnFire(worldIn, pos.south(), 300 + b0, rand, i);
+ this.tryCatchFire(worldIn, pos.east(), 300 + b0, rand, i, EnumFacing.WEST);
+ this.tryCatchFire(worldIn, pos.west(), 300 + b0, rand, i, EnumFacing.EAST);
+ this.tryCatchFire(worldIn, pos.down(), 250 + b0, rand, i, EnumFacing.UP);
+ this.tryCatchFire(worldIn, pos.up(), 250 + b0, rand, i, EnumFacing.DOWN);
+ this.tryCatchFire(worldIn, pos.north(), 300 + b0, rand, i, EnumFacing.SOUTH);
+ this.tryCatchFire(worldIn, pos.south(), 300 + b0, rand, i, EnumFacing.NORTH);
for (int j = -1; j <= 1; ++j)
{
@@ -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 k = 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 k = worldIn.getBlockState(pos).getBlock().getFlammability(worldIn, pos, face);
+
if (random.nextInt(chance) < k)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
@@ -314,7 +324,7 @@
{
EnumFacing enumfacing = aenumfacing[j];
- if (this.canCatchFire(worldIn, pos.offset(enumfacing)))
+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()))
{
return true;
}
@@ -338,7 +348,7 @@
for (int k = 0; k < j; ++k)
{
EnumFacing enumfacing = aenumfacing[k];
- 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;
@@ -350,9 +360,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)
@@ -396,9 +407,9 @@
double d1;
double d2;
- 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 (i = 0; i < 2; ++i)
{
@@ -409,7 +420,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.east()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.east(), EnumFacing.WEST))
{
for (i = 0; i < 2; ++i)
{
@@ -420,7 +431,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.north()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))
{
for (i = 0; i < 2; ++i)
{
@@ -431,7 +442,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.south()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))
{
for (i = 0; i < 2; ++i)
{
@@ -442,7 +453,7 @@
}
}
- if (Blocks.fire.canCatchFire(worldIn, pos.up()))
+ if (Blocks.fire.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN))
{
for (i = 0; i < 2; ++i)
{
@@ -490,4 +501,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

@ -2,16 +2,16 @@
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java
@@ -162,13 +162,6 @@
public void func_180663_b(World p_180663_1_, BlockPos p_180663_2_, IBlockState p_180663_3_)
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
- TileEntityFlowerPot tileentityflowerpot = this.func_176442_d(p_180663_1_, p_180663_2_);
- TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos);
-
- if (tileentityflowerpot != null && tileentityflowerpot.func_145965_a() != null)
- if (tileentityflowerpot != null && tileentityflowerpot.getFlowerPotItem() != null)
- {
- func_180635_a(p_180663_1_, p_180663_2_, new ItemStack(tileentityflowerpot.func_145965_a(), 1, tileentityflowerpot.func_145966_b()));
- spawnAsEntity(worldIn, pos, new ItemStack(tileentityflowerpot.getFlowerPotItem(), 1, tileentityflowerpot.getFlowerPotData()));
- }
-
super.func_180663_b(p_180663_1_, p_180663_2_, p_180663_3_);
super.breakBlock(worldIn, pos, state);
}
@@ -388,6 +381,31 @@
@ -24,9 +24,9 @@
+ 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.func_175625_s(pos) instanceof TileEntityFlowerPot ? (TileEntityFlowerPot)world.func_175625_s(pos) : null;
+ if (te != null && te.func_145965_a() != null)
+ ret.add(new ItemStack(te.func_145965_a(), 1, te.func_145966_b()));
+ 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
@ -36,10 +36,10 @@
+ return super.removedByPlayer(world, pos, player, willHarvest);
+ }
+ @Override
+ public void func_180657_a(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
+ {
+ super.func_180657_a(world, player, pos, state, te);
+ world.func_175698_g(pos);
+ super.harvestBlock(world, player, pos, state, te);
+ world.setBlockToAir(pos);
+ }
+ /*===========================FORGE END==========================================*/
+

View file

@ -0,0 +1,41 @@
--- ../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(blockpos1.up()).getBlock();
IBlockState iblockstate1 = worldIn.getBlockState(blockpos1);
- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2)
+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2)
{
worldIn.setBlockState(blockpos1, Blocks.grass.getDefaultState());
}
@@ -120,18 +120,11 @@
continue;
}
}
- else if (worldIn.getBlockState(blockpos2).getBlock().blockMaterial == Material.air)
+ else if (worldIn.isAirBlock(blockpos2))
{
if (rand.nextInt(8) == 0)
{
- BlockFlower.EnumFlowerType enumflowertype = worldIn.getBiomeGenForCoords(blockpos2).pickRandomFlower(rand, blockpos2);
- BlockFlower blockflower = enumflowertype.getBlockType().getBlock();
- IBlockState iblockstate1 = blockflower.getDefaultState().withProperty(blockflower.getTypeProperty(), enumflowertype);
-
- if (blockflower.canBlockStay(worldIn, blockpos2, iblockstate1))
- {
- worldIn.setBlockState(blockpos2, iblockstate1, 3);
- }
+ worldIn.getBiomeGenForCoords(blockpos2).plantFlower(worldIn, rand, blockpos2);
}
else
{

View file

@ -1,17 +1,17 @@
--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java
@@ -64,6 +64,20 @@
return new BlockState(this, new IProperty[] {field_176380_a});
return new BlockState(this, new IProperty[] {VARIANT});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.func_177701_a().equals("variant"))
+ if (prop.getName().equals("variant"))
+ {
+ world.func_175656_a(pos, state.func_177231_a(prop));
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }

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,32 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java
@@ -80,7 +80,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)
@@ -124,7 +127,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);
}
@SideOnly(Side.CLIENT)
@@ -155,6 +158,8 @@
return new BlockState(this, new IProperty[] {FACING});
}
+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; }
+
static final class SwitchEnumFacing
{
static final int[] FACING_LOOKUP = new int[EnumFacing.values().length];

View file

@ -0,0 +1,130 @@
--- ../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 blockpos1 = pos.add(i1, j1, k1);
IBlockState iblockstate1 = worldIn.getBlockState(blockpos1);
- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(CHECK_DECAY)).booleanValue())
+ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1))
{
- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1);
}
}
}
@@ -119,11 +119,12 @@
{
for (i2 = -b0; i2 <= b0; ++i2)
{
- Block block = worldIn.getBlockState(new BlockPos(j + k1, k + l1, l + i2)).getBlock();
+ BlockPos tmp = new BlockPos(j + k1, k + l1, l + i2);
+ Block block = worldIn.getBlockState(tmp).getBlock();
- if (block != Blocks.log && block != Blocks.log2)
+ if (!block.canSustainLeaves(worldIn, tmp))
{
- if (block.getMaterial() == Material.leaves)
+ if (block.isLeaves(worldIn, tmp))
{
this.surroundings[(k1 + j1) * i1 + (l1 + j1) * b1 + i2 + j1] = -2;
}
@@ -230,40 +231,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
- {
- int j = this.getSaplingDropChance(state);
-
- if (fortune > 0)
- {
- j -= 2 << fortune;
-
- if (j < 10)
- {
- j = 10;
- }
- }
-
- if (worldIn.rand.nextInt(j) == 0)
- {
- Item item = this.getItemDropped(state, worldIn.rand, fortune);
- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state)));
- }
-
- j = 200;
-
- if (fortune > 0)
- {
- j -= 10 << fortune;
-
- if (j < 40)
- {
- j = 40;
- }
- }
-
- this.dropApple(worldIn, pos, state, j);
- }
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance) {}
@@ -298,4 +266,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,67 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLever.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java
@@ -47,24 +47,24 @@
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
- return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.offset(side.getOpposite()));
+ return side == EnumFacing.UP && World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : worldIn.isSideSolid(pos.offset(side.getOpposite()), side);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return this.canSustainLever(worldIn, pos.west()) ? true : (this.canSustainLever(worldIn, pos.east()) ? true : (this.canSustainLever(worldIn, pos.north()) ? true : (this.canSustainLever(worldIn, pos.south()) ? true : (World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) ? true : this.canSustainLever(worldIn, pos.up())))));
+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST ) ||
+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST ) ||
+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH) ||
+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH) ||
+ worldIn.isSideSolid(pos.down(), EnumFacing.UP ) ||
+ worldIn.isSideSolid(pos.up(), EnumFacing.DOWN );
}
- protected boolean canSustainLever(World worldIn, BlockPos pos)
- {
- return worldIn.getBlockState(pos).getBlock().isNormalCube();
- }
-
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
IBlockState iblockstate = this.getDefaultState().withProperty(POWERED, Boolean.valueOf(false));
- if (this.canSustainLever(worldIn, pos.offset(facing.getOpposite())))
+ if (worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing))
{
return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(facing, placer.getHorizontalFacing()));
}
@@ -87,7 +87,7 @@
enumfacing1 = (EnumFacing)iterator.next();
}
- while (enumfacing1 == facing || !this.canSustainLever(worldIn, pos.offset(enumfacing1.getOpposite())));
+ while (enumfacing1 == facing || !worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1));
return iblockstate.withProperty(FACING, BlockLever.EnumOrientation.forFacings(enumfacing1, placer.getHorizontalFacing()));
}
@@ -116,7 +116,8 @@
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
- if (this.checkForDrop(worldIn, pos) && !this.canSustainLever(worldIn, pos.offset(((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing().getOpposite())))
+ EnumFacing dir = ((BlockLever.EnumOrientation)state.getValue(FACING)).getFacing();
+ if (this.checkForDrop(worldIn, pos) && !worldIn.isSideSolid(pos.offset(dir.getOpposite()), dir))
{
this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockToAir(pos);
@@ -235,6 +236,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
@@ -38,9 +38,9 @@
BlockPos blockpos1 = (BlockPos)iterator.next();
IBlockState iblockstate1 = worldIn.getBlockState(blockpos1);
- if (iblockstate1.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate1.getValue(BlockLeaves.CHECK_DECAY)).booleanValue())
+ if (iblockstate1.getBlock().isLeaves(worldIn, blockpos1))
{
- worldIn.setBlockState(blockpos1, iblockstate1.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate1.getBlock().beginLeavesDecay(worldIn, blockpos1);
}
}
}
@@ -51,6 +51,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 j = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15);
- this.dropXpOnBlockBreak(worldIn, pos, j);
}
+ @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
@@ -76,7 +76,7 @@
if (pos.getY() >= 0 && pos.getY() < 256)
{
IBlockState iblockstate1 = worldIn.getBlockState(pos.down());
- return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate1.getBlock()));
+ return iblockstate1.getBlock() == Blocks.mycelium ? true : (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate1.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
@@ -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)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
}
@@ -53,7 +53,7 @@
IBlockState iblockstate1 = worldIn.getBlockState(blockpos1);
Block block = worldIn.getBlockState(blockpos1.up()).getBlock();
- if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity() <= 2)
+ if (iblockstate1.getBlock() == Blocks.dirt && iblockstate1.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos1.up()) >= 4 && block.getLightOpacity(worldIn, blockpos1.up()) <= 2)
{
worldIn.setBlockState(blockpos1, this.getDefaultState());
}

View file

@ -0,0 +1,49 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -36,7 +36,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)
@@ -52,9 +52,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 j = 1;
@@ -105,4 +107,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
@@ -105,14 +105,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
@@ -58,7 +58,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);
}
@@ -96,6 +98,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
@@ -148,11 +148,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,59 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java
@@ -10,6 +10,7 @@
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockOre extends Block
@@ -54,34 +55,40 @@
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(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))
{
int j = 0;
if (this == Blocks.coal_ore)
{
- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2);
+ j = MathHelper.getRandomIntegerInRange(rand, 0, 2);
}
else if (this == Blocks.diamond_ore)
{
- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7);
+ j = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.emerald_ore)
{
- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7);
+ j = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.lapis_ore)
{
- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
+ j = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
else if (this == Blocks.quartz_ore)
{
- j = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
+ j = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
- this.dropXpOnBlockBreak(worldIn, pos, j);
+ return j;
}
+ return 0;
}
public int getDamageValue(World worldIn, BlockPos pos)

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 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
@@ -200,7 +200,7 @@
}
}
- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
+ if (!flag1 && !block.isAir(worldIn, blockpos1) && canPush(block, worldIn, blockpos1, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
{
this.doMove(worldIn, pos, enumfacing, false);
}
@@ -344,7 +344,7 @@
return false;
}
- return !(blockIn instanceof ITileEntityProvider);
+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos)));
}
else
{
@@ -384,7 +384,9 @@
{
blockpos1 = (BlockPos)list1.get(j);
Block block = worldIn.getBlockState(blockpos1).getBlock();
- block.dropBlockAsItem(worldIn, blockpos1, worldIn.getBlockState(blockpos1), 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, blockpos1, worldIn.getBlockState(blockpos1), chance, 0);
worldIn.setBlockToAir(blockpos1);
--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 iblockstate1 = tileentitypiston.getPistonState();
- iblockstate1.getBlock().dropBlockAsItem(worldIn, pos, iblockstate1, 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
@@ -109,7 +109,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

@ -1,23 +1,23 @@
--- ../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[] {field_176335_a});
return new BlockState(this, new IProperty[] {VARIANT});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.func_177701_a().equals("variant") && prop.func_177699_b() == EnumType.class)
+ if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class)
+ {
+ EnumType current = (EnumType)state.func_177229_b(prop);
+ 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.func_175656_a(pos, state.func_177226_a(prop, next));
+ world.setBlockState(pos, state.withProperty(prop, next));
+ return true;
+ }
+ }

View file

@ -1,18 +1,18 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java
@@ -33,7 +33,7 @@
public static boolean func_176563_d(IBlockState p_176563_0_)
public static boolean isRailBlock(IBlockState state)
{
Block block = p_176563_0_.func_177230_c();
- return block == Blocks.field_150448_aq || block == Blocks.field_150318_D || block == Blocks.field_150319_E || block == Blocks.field_150408_cc;
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 p_i45389_1_)
protected BlockRailBase(boolean isPowered)
@@ -174,7 +174,81 @@
}
public abstract IProperty func_176560_l();
public abstract IProperty getShapeProperty();
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Return true if the rail can make corners.
@ -23,7 +23,7 @@
+ */
+ public boolean isFlexibleRail(IBlockAccess world, BlockPos pos)
+ {
+ return !this.field_150053_a;
+ return !this.isPowered;
+ }
+ /**
@ -74,12 +74,12 @@
+ */
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.func_177228_b().keySet())
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : (java.util.Set<IProperty>)state.getProperties().keySet())
+ {
+ if (prop.func_177701_a().equals("shape"))
+ if (prop.getName().equals("shape"))
+ {
+ world.func_175656_a(pos, state.func_177231_a(prop));
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }
@ -92,20 +92,20 @@
{
NORTH_SOUTH(0, "north_south"),
@@ -251,6 +325,7 @@
private final boolean field_150656_f;
private final boolean isPowered;
private final List field_150657_g = Lists.newArrayList();
private static final String __OBFID = "CL_00000196";
+ private final boolean canMakeSlopes;
public Rail(World p_i45739_2_, BlockPos p_i45739_3_, IBlockState p_i45739_4_)
public Rail(World worldIn, BlockPos pos, IBlockState state)
{
@@ -259,7 +334,8 @@
this.field_180366_e = p_i45739_4_;
this.field_180365_d = (BlockRailBase)p_i45739_4_.func_177230_c();
BlockRailBase.EnumRailDirection enumraildirection = (BlockRailBase.EnumRailDirection)p_i45739_4_.func_177229_b(BlockRailBase.this.func_176560_l());
- this.field_150656_f = this.field_180365_d.field_150053_a;
+ this.field_150656_f = !this.field_180365_d.isFlexibleRail(p_i45739_2_, p_i45739_3_);
+ canMakeSlopes = this.field_180365_d.canMakeSlopes(p_i45739_2_, p_i45739_3_);
this.state = state;
this.block = (BlockRailBase)state.getBlock();
BlockRailBase.EnumRailDirection 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(enumraildirection);
}
@ -116,7 +116,7 @@
- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -461,7 +537,7 @@
}
@ -125,7 +125,7 @@
- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST)
+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a()))
if (BlockRailBase.isRailBlock(this.world, blockpos3.up()))
{
@@ -604,7 +680,7 @@
}
@ -134,7 +134,7 @@
- if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos.func_177984_a()))
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -617,7 +693,7 @@
}
@ -143,5 +143,5 @@
- if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST)
+ if (enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
{
if (BlockRailBase.func_176562_d(this.field_150660_b, blockpos3.func_177984_a()))
if (BlockRailBase.isRailBlock(this.world, blockpos3.up()))
{

View file

@ -1,15 +1,15 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java
@@ -295,6 +295,21 @@
return this.func_176223_P().func_177226_a(field_176387_N, p_180642_8_.func_174811_aO().func_176734_d()).func_177226_a(field_176464_a, Boolean.valueOf(false)).func_177226_a(field_176463_b, BlockRedstoneComparator.Mode.COMPARE);
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.func_177956_o() == neighbor.func_177956_o() && world instanceof World)
+ if (pos.getY() == neighbor.getY() && world instanceof World)
+ {
+ func_176204_a((World)world, pos, world.func_180495_p(pos), world.func_180495_p(neighbor).func_177230_c());
+ onNeighborBlockChange((World)world, pos, world.getBlockState(pos), world.getBlockState(neighbor).getBlock());
+ }
+ }
+

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java
@@ -200,6 +200,8 @@
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
BlockPos blockpos1 = 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(blockpos1, this);
worldIn.notifyNeighborsOfStateExcept(blockpos1, 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 j = 1 + worldIn.rand.nextInt(5);
- this.dropXpOnBlockBreak(worldIn, pos, j);
+ 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
@@ -60,10 +60,10 @@
BlockPos blockpos1 = pos.offset(direction);
Block block = worldIn.getBlockState(pos.offset(direction)).getBlock();
- if (!canConnectTo(worldIn.getBlockState(blockpos1), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos1.down()))))
+ if (!canRestoneConnect(worldIn, blockpos1, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos1.down(), null)))
{
Block block1 = worldIn.getBlockState(pos.up()).getBlock();
- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos1.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
+ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos1.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
}
else
{
@@ -393,35 +393,25 @@
Block block = iblockstate.getBlock();
boolean flag = block.isNormalCube();
boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube();
- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos1.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos1.down())));
+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos1.up(), null) ? true : (canRestoneConnect(worldIn, blockpos1, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos1.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));
- }
+ IBlockState state = world.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)
+ if (state.getBlock() == Blocks.redstone_wire)
{
return true;
}
- else if (Blocks.unpowered_repeater.isAssociated(block))
+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock()))
{
- EnumFacing enumfacing1 = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING);
- return enumfacing1 == side || enumfacing1.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);
}
}

View file

@ -7,19 +7,19 @@
-public class BlockReed extends Block
+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable
{
public static final PropertyInteger field_176355_a = PropertyInteger.func_177719_a("age", 0, 15);
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
private static final String __OBFID = "CL_00000300";
@@ -67,6 +67,7 @@
public boolean func_176196_c(World p_176196_1_, BlockPos p_176196_2_)
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
Block block = p_176196_1_.func_180495_p(p_176196_2_.func_177977_b()).func_177230_c();
+ if (block.canSustainPlant(p_176196_1_, p_176196_2_.func_177977_b(), EnumFacing.UP, this)) return true;
Block block = worldIn.getBlockState(pos.down()).getBlock();
+ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true;
if (block == this)
{
@@ -172,4 +173,15 @@
{
return new BlockState(this, new IProperty[] {field_176355_a});
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @Override
@ -30,6 +30,6 @@
+ @Override
+ public IBlockState getPlant(IBlockAccess world, BlockPos pos)
+ {
+ return this.func_176223_P();
+ return this.getDefaultState();
+ }
}

View file

@ -10,17 +10,17 @@
public abstract class BlockRotatedPillar extends Block
@@ -13,4 +14,18 @@
{
super(p_i45425_1_);
super(materialIn);
}
+
+ public boolean rotateBlock(net.minecraft.world.World world, net.minecraft.util.BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.func_180495_p(pos);
+ for (net.minecraft.block.properties.IProperty prop : (java.util.Set<net.minecraft.block.properties.IProperty>)state.func_177228_b().keySet())
+ IBlockState state = world.getBlockState(pos);
+ for (net.minecraft.block.properties.IProperty prop : (java.util.Set<net.minecraft.block.properties.IProperty>)state.getProperties().keySet())
+ {
+ if (prop.func_177701_a().equals("axis"))
+ if (prop.getName().equals("axis"))
+ {
+ world.func_175656_a(pos, state.func_177231_a(prop));
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }

View file

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java
@@ -66,6 +66,7 @@
public void generateTree(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(worldIn, rand, pos)) return;
Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
int i = 0;
int j = 0;

View file

@ -0,0 +1,55 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java
@@ -122,8 +122,6 @@
return tileentity instanceof TileEntitySkull ? ((TileEntitySkull)tileentity).getSkullType() : super.getDamageValue(worldIn, pos);
}
- public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune) {}
-
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
if (player.capabilities.isCreativeMode)
@@ -131,13 +129,18 @@
state = state.withProperty(NODROP, Boolean.valueOf(true));
worldIn.setBlockState(pos, state, 4);
}
+ this.dropBlockAsItem(worldIn, pos, state, 0);
super.onBlockHarvested(worldIn, pos, state, player);
}
public void breakBlock(World worldIn, BlockPos pos, IBlockState state)
{
- if (!worldIn.isRemote)
+ super.breakBlock(worldIn, pos, state);
+ }
+ public java.util.List<ItemStack> getDrops(IBlockAccess worldIn, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
{
if (!((Boolean)state.getValue(NODROP)).booleanValue())
{
@@ -146,7 +149,7 @@
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)
{
@@ -156,12 +159,11 @@
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
- spawnAsEntity(worldIn, pos, itemstack);
+ ret.add(itemstack);
}
}
-
- super.breakBlock(worldIn, pos, state);
}
+ return ret;
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)

View file

@ -0,0 +1,53 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
@@ -80,7 +80,7 @@
{
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)
@@ -92,7 +92,6 @@
{
if (!this.canPlaceBlockAt(worldIn, p_176314_2_))
{
- this.dropBlockAsItem(worldIn, p_176314_2_, p_176314_3_, 0);
worldIn.setBlockToAir(p_176314_2_);
return false;
}
@@ -104,9 +103,8 @@
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)
@@ -116,14 +114,13 @@
public int quantityDropped(Random random)
{
- return 0;
+ return 1;
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
if (worldIn.getLightFor(EnumSkyBlock.BLOCK, pos) > 11)
{
- this.dropBlockAsItem(worldIn, pos, worldIn.getBlockState(pos), 0);
worldIn.setBlockToAir(pos);
}
}
@@ -153,4 +150,6 @@
{
return new BlockState(this, new IProperty[] {LAYERS});
}
+
+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; }
}

View file

@ -0,0 +1,42 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
@@ -108,7 +108,7 @@
pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand));
Block block = worldIn.getBlockState(pos.down()).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))
{
worldIn.setBlockState(pos, this.crop.getDefaultState());
}
@@ -162,8 +162,12 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
+ }
- if (!worldIn.isRemote)
+ @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>();
{
Item item = this.getSeedItem();
@@ -173,13 +177,14 @@
for (int k = 0; k < 3; ++k)
{
- if (worldIn.rand.nextInt(15) <= j)
+ if (RANDOM.nextInt(15) <= j)
{
- spawnAsEntity(worldIn, pos, new ItemStack(item));
+ ret.add(new ItemStack(item));
}
}
}
}
+ return ret;
}
protected Item getSeedItem()

View file

@ -0,0 +1,66 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java
@@ -23,7 +23,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockTallGrass extends BlockBush implements IGrowable
+public class BlockTallGrass extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable
{
public static final PropertyEnum TYPE = PropertyEnum.create("type", BlockTallGrass.EnumType.class);
private static final String __OBFID = "CL_00000321";
@@ -44,7 +44,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 boolean isReplaceable(World worldIn, BlockPos pos)
@@ -74,7 +74,7 @@
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null;
+ return null;
}
public int quantityDroppedWithBonus(int fortune, Random random)
@@ -84,13 +84,7 @@
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);
}
}
@@ -210,4 +204,22 @@
}
}
}
+
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ ret.add(new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)world.getBlockState(pos).getValue(TYPE)).getMeta()));
+ return ret;
+ }
+ @Override
+ public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ if (RANDOM.nextInt(8) != 0) return ret;
+ ItemStack seed = net.minecraftforge.common.ForgeHooks.getGrassSeed(RANDOM);
+ if (seed != null) ret.add(seed);
+ return ret;
+ }
}

View file

@ -0,0 +1,38 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java
@@ -70,7 +70,7 @@
else
{
Block block = worldIn.getBlockState(pos).getBlock();
- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass;
+ return block.canPlaceTorchOnTop(worldIn, pos);
}
}
@@ -97,7 +97,7 @@
{
BlockPos blockpos1 = pos.offset(facing.getOpposite());
boolean flag = facing.getAxis().isHorizontal();
- return flag && worldIn.isBlockNormalCube(blockpos1, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1);
+ return flag && worldIn.isSideSolid(blockpos1, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos1);
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
@@ -120,7 +120,7 @@
enumfacing1 = (EnumFacing)iterator.next();
}
- while (!worldIn.isBlockNormalCube(pos.offset(enumfacing1.getOpposite()), true));
+ while (!worldIn.isSideSolid(pos.offset(enumfacing1.getOpposite()), enumfacing1, true));
return this.getDefaultState().withProperty(FACING, enumfacing1);
}
@@ -149,7 +149,7 @@
EnumFacing enumfacing1 = enumfacing.getOpposite();
boolean flag = false;
- if (axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
+ if (axis.isHorizontal() && !worldIn.isSideSolid(pos.offset(enumfacing1), enumfacing1, true))
{
flag = true;
}

View file

@ -0,0 +1,43 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java
@@ -25,6 +25,8 @@
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 HALF = PropertyEnum.create("half", BlockTrapDoor.DoorHalf.class);
@@ -141,9 +143,10 @@
{
if (!worldIn.isRemote)
{
+ EnumFacing direction = (EnumFacing)state.getValue(FACING);
BlockPos blockpos1 = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());
- if (!isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock()))
+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos1).getBlock()) || worldIn.isSideSolid(blockpos1, direction, true)))
{
worldIn.setBlockToAir(pos);
this.dropBlockAsItem(worldIn, pos, state, 0);
@@ -187,7 +190,10 @@
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)
@@ -224,6 +230,7 @@
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;
}

View file

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java
@@ -60,7 +60,7 @@
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)
@@ -77,7 +77,7 @@
enumfacing = (EnumFacing)iterator.next();
}
- while (!worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube());
+ while (!worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true));
return true;
}
@@ -107,7 +107,7 @@
{
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);

View file

@ -7,20 +7,20 @@
-public class BlockVine extends Block
+public class BlockVine extends Block implements net.minecraftforge.common.IShearable
{
public static final PropertyBool field_176277_a = PropertyBool.func_177716_a("up");
public static final PropertyBool field_176273_b = PropertyBool.func_177716_a("north");
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool NORTH = PropertyBool.create("north");
@@ -416,13 +416,7 @@
public void func_180657_a(World p_180657_1_, EntityPlayer p_180657_2_, BlockPos p_180657_3_, IBlockState p_180657_4_, TileEntity p_180657_5_)
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!p_180657_1_.field_72995_K && p_180657_2_.func_71045_bC() != null && p_180657_2_.func_71045_bC().func_77973_b() == Items.field_151097_aZ)
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- p_180657_2_.func_71029_a(StatList.field_75934_C[Block.func_149682_b(this)]);
- func_180635_a(p_180657_1_, p_180657_3_, new ItemStack(Blocks.field_150395_bd, 1, 0));
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0));
- }
- else
- {
super.func_180657_a(p_180657_1_, p_180657_2_, p_180657_3_, p_180657_4_, p_180657_5_);
super.harvestBlock(worldIn, player, pos, state, te);
}
}
@@ -508,6 +502,16 @@
@ -39,4 +39,4 @@
+
static final class SwitchEnumFacing
{
static final int[] field_177057_a = new int[EnumFacing.values().length];
static final int[] FACING_LOOKUP = new int[EnumFacing.values().length];

View file

@ -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 @@
{
Block block = this.world.getBlockState(origin).getBlock();
- if (block.getMaterial() == Material.air)
+ if (block.isAir(world, origin))
{
return true;
}
@@ -111,7 +111,7 @@
BlockPos blockpos1 = origin.offset(this.moveDirection.getOpposite(), i);
block = this.world.getBlockState(blockpos1).getBlock();
- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos))
+ if (block.isAir(world, blockpos1)|| !BlockPistonBase.canPush(block, this.world, blockpos1, this.moveDirection, false) || blockpos1.equals(this.pistonPos))
{
break;
}
@@ -159,7 +159,7 @@
block = this.world.getBlockState(blockpos2).getBlock();
- if (block.getMaterial() == Material.air)
+ if (block.isAir(world, blockpos2))
{
return true;
}

View file

@ -2,9 +2,9 @@
+++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java
@@ -47,6 +47,16 @@
public BlockState(Block p_i45663_1_, IProperty ... p_i45663_2_)
public BlockState(Block blockIn, IProperty ... properties)
{
+ this(p_i45663_1_, p_i45663_2_, null);
+ this(blockIn, properties, null);
+ }
+
+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties)
@ -12,33 +12,33 @@
+ return new StateImplementation(block, properties);
+ }
+
+ protected BlockState(Block p_i45663_1_, IProperty[] p_i45663_2_, ImmutableMap unlistedProperties)
+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties)
+ {
this.field_177627_c = p_i45663_1_;
Arrays.sort(p_i45663_2_, new Comparator()
this.block = blockIn;
Arrays.sort(properties, new Comparator()
{
@@ -70,7 +80,7 @@
{
List list = (List)iterator.next();
Map map = MapPopulator.func_179400_b(this.field_177624_d, list);
- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(p_i45663_1_, ImmutableMap.copyOf(map), null);
+ BlockState.StateImplementation stateimplementation = createState(p_i45663_1_, ImmutableMap.copyOf(map), unlistedProperties);
Map map = MapPopulator.createMap(this.properties, list);
- BlockState.StateImplementation stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map), null);
+ BlockState.StateImplementation stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties);
linkedhashmap.put(map, stateimplementation);
arraylist.add(stateimplementation);
}
@@ -135,6 +145,13 @@
this.field_177239_a = p_i45660_1_;
this.field_177237_b = p_i45660_2_;
this.block = blockIn;
this.properties = propertiesIn;
}
+
+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable)
+ {
+ this.field_177239_a = blockIn;
+ this.field_177237_b = propertiesIn;
+ this.field_177238_c = propertyValueTable;
+ this.block = blockIn;
+ this.properties = propertiesIn;
+ this.propertyValueTable = propertyValueTable;
+ }
public Collection func_177227_a()
public Collection getPropertyNames()
{
@@ -231,5 +248,10 @@
{
@ -47,7 +47,7 @@
+
+ public ImmutableTable<IProperty, Comparable, IBlockState> getPropertyValueTable()
+ {
+ return field_177238_c;
+ return propertyValueTable;
+ }
}
}

View file

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java
@@ -139,6 +139,10 @@
GlStateManager.clear(16640);
}
+ try
+ {
+ if (!net.minecraftforge.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering
+ {
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
@@ -177,6 +181,12 @@
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
this.mc.fontRendererObj.drawStringWithShadow(this.currentlyDisplayedText, (float)((l - this.mc.fontRendererObj.getStringWidth(this.currentlyDisplayedText)) / 2), (float)(i1 / 2 - 4 - 16), 16777215);
this.mc.fontRendererObj.drawStringWithShadow(this.message, (float)((l - this.mc.fontRendererObj.getStringWidth(this.message)) / 2), (float)(i1 / 2 - 4 + 8), 16777215);
+ }
+ }
+ catch (java.io.IOException e)
+ {
+ com.google.common.base.Throwables.propagate(e);
+ } //FML End
this.framebuffer.unbindFramebuffer();
if (OpenGlHelper.isFramebufferEnabled())

View file

@ -0,0 +1,476 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -296,7 +296,6 @@
this.sessionService = (new YggdrasilAuthenticationService(gameConfig.userInfo.proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
this.session = gameConfig.userInfo.session;
logger.info("Setting user: " + this.session.getUsername());
- logger.info("(Session ID is " + this.session.getSessionID() + ")");
this.isDemo = gameConfig.gameInfo.isDemo;
this.displayWidth = gameConfig.displayInfo.width > 0 ? gameConfig.displayInfo.width : 1;
this.displayHeight = gameConfig.displayInfo.height > 0 ? gameConfig.displayInfo.height : 1;
@@ -410,10 +409,10 @@
this.mcResourceManager = new SimpleReloadableResourceManager(this.metadataSerializer_);
this.mcLanguageManager = new LanguageManager(this.metadataSerializer_, this.gameSettings.language);
this.mcResourceManager.registerReloadListener(this.mcLanguageManager);
- this.refreshResources();
+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.defaultResourcePacks, this.mcResourceManager);
this.renderEngine = new TextureManager(this.mcResourceManager);
this.mcResourceManager.registerReloadListener(this.renderEngine);
- this.drawSplashScreen(this.renderEngine);
+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.renderEngine);
this.initStream();
this.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService);
this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"));
@@ -449,6 +448,8 @@
}
});
this.mouseHelper = new MouseHelper();
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true);
+ bar.step("GL Setup");
this.checkGLError("Pre startup");
GlStateManager.enableTexture2D();
GlStateManager.shadeModel(7425);
@@ -462,17 +463,21 @@
GlStateManager.loadIdentity();
GlStateManager.matrixMode(5888);
this.checkGLError("Startup");
- this.textureMapBlocks = new TextureMap("textures");
+ bar.step("Loading Texture Map");
+ this.textureMapBlocks = new TextureMap("textures",true);
this.textureMapBlocks.setMipmapLevels(this.gameSettings.mipmapLevels);
this.renderEngine.loadTickableTexture(TextureMap.locationBlocksTexture, this.textureMapBlocks);
this.renderEngine.bindTexture(TextureMap.locationBlocksTexture);
this.textureMapBlocks.setBlurMipmapDirect(false, this.gameSettings.mipmapLevels > 0);
+ bar.step("Loading Model Manager");
this.modelManager = new ModelManager(this.textureMapBlocks);
this.mcResourceManager.registerReloadListener(this.modelManager);
+ bar.step("Loading Item Renderer");
this.renderItem = new RenderItem(this.renderEngine, this.modelManager);
this.renderManager = new RenderManager(this.renderEngine, this.renderItem);
this.itemRenderer = new ItemRenderer(this);
this.mcResourceManager.registerReloadListener(this.renderItem);
+ bar.step("Loading Entity Renderer");
this.entityRenderer = new EntityRenderer(this, this.mcResourceManager);
this.mcResourceManager.registerReloadListener(this.entityRenderer);
this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(), this.gameSettings);
@@ -482,22 +487,25 @@
this.guiAchievement = new GuiAchievement(this);
GlStateManager.viewport(0, 0, this.displayWidth, this.displayHeight);
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading();
this.checkGLError("Post startup");
- this.ingameGUI = new GuiIngame(this);
+ this.ingameGUI = new net.minecraftforge.client.GuiIngameForge(this);
if (this.serverName != null)
{
- this.displayGuiScreen(new GuiConnecting(new GuiMainMenu(), this, this.serverName, this.serverPort));
+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.serverName, this.serverPort);
}
else
{
this.displayGuiScreen(new GuiMainMenu());
}
- this.renderEngine.deleteTexture(this.mojangLogo);
+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(renderEngine, mojangLogo);
this.mojangLogo = null;
this.loadingScreen = new LoadingScreenRenderer(this);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete();
if (this.gameSettings.fullScreen && !this.fullscreen)
{
this.toggleFullscreen();
@@ -681,21 +689,23 @@
File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
Bootstrap.printToSYSOUT(crashReportIn.getCompleteReport());
+ int retVal;
if (crashReportIn.getFile() != null)
{
Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + crashReportIn.getFile());
- System.exit(-1);
+ retVal = -1;
}
else if (crashReportIn.saveToFile(file2))
{
Bootstrap.printToSYSOUT("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
- System.exit(-1);
+ retVal = -1;
}
else
{
Bootstrap.printToSYSOUT("#@?@# Game crashed! Crash report could not be saved. #@?@#");
- System.exit(-2);
+ retVal = -2;
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal);
}
public boolean isUnicode()
@@ -887,11 +897,6 @@
public void displayGuiScreen(GuiScreen guiScreenIn)
{
- if (this.currentScreen != null)
- {
- this.currentScreen.onGuiClosed();
- }
-
if (guiScreenIn == null && this.theWorld == null)
{
guiScreenIn = new GuiMainMenu();
@@ -901,6 +906,17 @@
guiScreenIn = new GuiGameOver();
}
+ GuiScreen old = this.currentScreen;
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(guiScreenIn);
+
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
+
+ guiScreenIn = event.gui;
+ if (old != null && guiScreenIn != old)
+ {
+ old.onGuiClosed();
+ }
+
if (guiScreenIn instanceof GuiMainMenu)
{
this.gameSettings.showDebugInfo = false;
@@ -999,7 +1015,7 @@
{
while (!this.scheduledTasks.isEmpty())
{
- ((FutureTask)this.scheduledTasks.poll()).run();
+ net.minecraftforge.fml.common.FMLCommonHandler.callFuture(((FutureTask)this.scheduledTasks.poll()));
}
}
@@ -1034,9 +1050,11 @@
if (!this.skipRenderWorld)
{
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks);
this.mcProfiler.endStartSection("gameRenderer");
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks);
this.mcProfiler.endSection();
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks);
}
this.mcProfiler.endSection();
@@ -1382,7 +1400,7 @@
if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air && this.playerController.func_180512_c(blockpos, this.objectMouseOver.sideHit))
{
- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit);
+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver);
this.thePlayer.swingItem();
}
}
@@ -1462,15 +1480,19 @@
case 2:
BlockPos blockpos = this.objectMouseOver.getBlockPos();
- if (this.theWorld.getBlockState(blockpos).getBlock().getMaterial() != Material.air)
+ if (!this.theWorld.isAirBlock(blockpos))
{
int i = itemstack != null ? itemstack.stackSize : 0;
+
+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.theWorld, blockpos, this.objectMouseOver.sideHit).isCanceled();
+ if (result) { //Forge: Kept separate to simplify patch
if (this.playerController.func_178890_a(this.thePlayer, this.theWorld, itemstack, blockpos, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec))
{
flag = false;
this.thePlayer.swingItem();
}
+ }
if (itemstack == null)
{
@@ -1493,7 +1515,8 @@
{
ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem();
- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1))
+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(thePlayer, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_AIR, theWorld, null, null).isCanceled();
+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1))
{
this.entityRenderer.itemRenderer.resetEquippedProgress2();
}
@@ -1591,6 +1614,8 @@
--this.rightClickDelayTimer;
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick();
+
this.mcProfiler.startSection("gui");
if (!this.isGamePaused)
@@ -1689,6 +1714,8 @@
while (Mouse.next())
{
+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;
+
i = Mouse.getEventButton();
KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());
@@ -1744,6 +1771,7 @@
this.currentScreen.handleMouseInput();
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput();
}
if (this.leftClickCounter > 0)
@@ -1920,6 +1948,7 @@
}
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput();
}
for (i = 0; i < 9; ++i)
@@ -2120,12 +2149,15 @@
this.myNetworkManager.processReceivedPackets();
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick();
+
this.mcProfiler.endSection();
this.systemTime = getSystemTime();
}
public void launchIntegratedServer(String folderName, String worldName, WorldSettings worldSettingsIn)
{
+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(folderName, worldName, worldSettingsIn);
this.loadWorld((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.saveLoader.getSaveLoader(folderName, false);
@@ -2161,6 +2193,12 @@
while (!this.theIntegratedServer.serverIsInRunLoop())
{
+ if (!net.minecraftforge.fml.common.StartupQuery.check())
+ {
+ loadWorld(null);
+ displayGuiScreen(null);
+ return;
+ }
String s2 = this.theIntegratedServer.getUserMessage();
if (s2 != null)
@@ -2186,8 +2224,14 @@
SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint();
NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress);
networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null));
- networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN));
- networkmanager.sendPacket(new C00PacketLoginStart(this.getSession().getProfile()));
+ networkmanager.sendPacket(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true));
+ com.mojang.authlib.GameProfile gameProfile = this.getSession().getProfile();
+ if (!this.getSession().hasCachedProperties())
+ {
+ gameProfile = sessionService.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
+ this.getSession().setProperties(gameProfile.getProperties());
+ }
+ networkmanager.sendPacket(new C00PacketLoginStart(gameProfile));
this.myNetworkManager = networkmanager;
}
@@ -2198,6 +2242,8 @@
public void loadWorld(WorldClient worldClientIn, String loadingMessage)
{
+ if (theWorld != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(theWorld));
+
if (worldClientIn == null)
{
NetHandlerPlayClient nethandlerplayclient = this.getNetHandler();
@@ -2211,6 +2257,18 @@
{
this.theIntegratedServer.initiateShutdown();
this.theIntegratedServer.setStaticInstance();
+ if (loadingScreen != null)
+ {
+ this.loadingScreen.displayLoadingString(I18n.format("forge.client.shutdown.internal"));
+ }
+ while (!theIntegratedServer.isServerStopped())
+ {
+ try
+ {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException ie) {}
+ }
}
this.theIntegratedServer = null;
@@ -2237,6 +2295,7 @@
this.setServerData((ServerData)null);
this.integratedServerIsRunning = false;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld);
}
this.mcSoundHandler.stopSounds();
@@ -2341,134 +2400,11 @@
if (this.objectMouseOver != null)
{
boolean flag = this.thePlayer.capabilities.isCreativeMode;
- int i = 0;
- boolean flag1 = false;
- TileEntity tileentity = null;
- Object object;
- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
- {
- BlockPos blockpos = this.objectMouseOver.getBlockPos();
- Block block = this.theWorld.getBlockState(blockpos).getBlock();
-
- if (block.getMaterial() == Material.air)
- {
- return;
- }
-
- object = block.getItem(this.theWorld, blockpos);
-
- if (object == null)
- {
- return;
- }
-
- if (flag && GuiScreen.isCtrlKeyDown())
- {
- tileentity = this.theWorld.getTileEntity(blockpos);
- }
-
- Block block1 = object instanceof ItemBlock && !block.isFlowerPot() ? Block.getBlockFromItem((Item)object) : block;
- i = block1.getDamageValue(this.theWorld, blockpos);
- flag1 = ((Item)object).getHasSubtypes();
- }
- else
- {
- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag)
- {
- return;
- }
-
- if (this.objectMouseOver.entityHit instanceof EntityPainting)
- {
- object = Items.painting;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
- {
- object = Items.lead;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
- {
- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
- ItemStack itemstack = entityitemframe.getDisplayedItem();
-
- if (itemstack == null)
- {
- object = Items.item_frame;
- }
- else
- {
- object = itemstack.getItem();
- i = itemstack.getMetadata();
- flag1 = true;
- }
- }
- else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
- {
- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
-
- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.getMinecartType().ordinal()])
- {
- case 1:
- object = Items.furnace_minecart;
- break;
- case 2:
- object = Items.chest_minecart;
- break;
- case 3:
- object = Items.tnt_minecart;
- break;
- case 4:
- object = Items.hopper_minecart;
- break;
- case 5:
- object = Items.command_block_minecart;
- break;
- default:
- object = Items.minecart;
- }
- }
- else if (this.objectMouseOver.entityHit instanceof EntityBoat)
- {
- object = Items.boat;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
- {
- object = Items.armor_stand;
- }
- else
- {
- object = Items.spawn_egg;
- i = EntityList.getEntityID(this.objectMouseOver.entityHit);
- flag1 = true;
-
- if (!EntityList.entityEggs.containsKey(Integer.valueOf(i)))
- {
- return;
- }
- }
- }
-
InventoryPlayer inventoryplayer = this.thePlayer.inventory;
- if (tileentity == null)
- {
- inventoryplayer.setCurrentItem((Item)object, i, flag1, flag);
- }
- else
- {
- NBTTagCompound nbttagcompound1 = new NBTTagCompound();
- tileentity.writeToNBT(nbttagcompound1);
- ItemStack itemstack1 = new ItemStack((Item)object, 1, i);
- itemstack1.setTagInfo("BlockEntityTag", nbttagcompound1);
- NBTTagCompound nbttagcompound = new NBTTagCompound();
- NBTTagList nbttaglist = new NBTTagList();
- nbttaglist.appendTag(new NBTTagString("(+NBT)"));
- nbttagcompound.setTag("Lore", nbttaglist);
- itemstack1.setTagInfo("display", nbttagcompound);
- inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, itemstack1);
- }
-
+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return;
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
if (flag)
{
int j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + inventoryplayer.currentItem;
@@ -2726,18 +2662,8 @@
public static int getGLMaximumTextureSize()
{
- for (int i = 16384; i > 0; i >>= 1)
- {
- GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
- int j = GL11.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH);
-
- if (j != 0)
- {
- return i;
- }
- }
-
- return -1;
+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done.
+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize();
}
public boolean isSnooperEnabled()

View file

@ -21,32 +21,32 @@
{
@@ -81,6 +86,7 @@
{
this.func_148613_b();
this.func_148608_i();
this.unloadSoundSystem();
this.loadSoundSystem();
+ MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this));
}
private synchronized void func_148608_i()
private synchronized void loadSoundSystem()
@@ -329,6 +335,9 @@
}
else
{
+ p_148611_1_ = ForgeHooksClient.playSound(this, p_148611_1_);
+ if (p_148611_1_ == null) return;
+ sound = ForgeHooksClient.playSound(this, sound);
+ if (sound == null) return;
+
SoundEventAccessorComposite soundeventaccessorcomposite = this.field_148622_c.func_147680_a(p_148611_1_.func_147650_b());
SoundEventAccessorComposite soundeventaccessorcomposite = this.sndHandler.getSound(sound.getSoundLocation());
if (soundeventaccessorcomposite == null)
@@ -370,10 +379,12 @@
if (soundpoolentry.func_148648_d())
if (soundpoolentry.isStreamingSound())
{
this.field_148620_e.newStreamingSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1);
+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, p_148611_1_, s));
this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1);
+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, sound, s));
}
else
{
this.field_148620_e.newSource(false, s, func_148612_a(resourcelocation), resourcelocation.toString(), flag, p_148611_1_.func_147649_g(), p_148611_1_.func_147654_h(), p_148611_1_.func_147651_i(), p_148611_1_.func_147656_j().func_148586_a(), f1);
+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, p_148611_1_, s));
this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation), resourcelocation.toString(), flag, sound.getXPosF(), sound.getYPosF(), sound.getZPosF(), sound.getAttenuationType().getTypeInt(), f1);
+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, sound, s));
}
field_148621_b.debug(field_148623_a, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.func_148652_a(), soundeventaccessorcomposite.func_148729_c(), s});
logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {soundpoolentry.getSoundPoolEntryLocation(), soundeventaccessorcomposite.getSoundEventLocation(), s});

View file

@ -0,0 +1,80 @@
--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
@@ -53,6 +53,9 @@
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
@SideOnly(Side.CLIENT)
public class EntityPlayerSP extends AbstractClientPlayer
@@ -342,6 +345,15 @@
this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent);
}
+ private boolean isHeadspaceFree(BlockPos pos, int height)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ if (isOpenBlockSpace(pos.add(0, y, 0))) return false;
+ }
+ return true;
+ }
+
protected boolean pushOutOfBlocks(double x, double y, double z)
{
if (this.noClip)
@@ -354,30 +366,34 @@
double d3 = x - (double)blockpos.getX();
double d4 = z - (double)blockpos.getZ();
- if (!this.isOpenBlockSpace(blockpos))
+ int entHeight = Math.max(Math.round(this.height), 1);
+
+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight);
+
+ if (inTranslucentBlock)
{
byte b0 = -1;
double d5 = 9999.0D;
- if (this.isOpenBlockSpace(blockpos.west()) && d3 < d5)
+ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d3 < d5)
{
d5 = d3;
b0 = 0;
}
- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d3 < d5)
+ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d3 < d5)
{
d5 = 1.0D - d3;
b0 = 1;
}
- if (this.isOpenBlockSpace(blockpos.north()) && d4 < d5)
+ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d4 < d5)
{
d5 = d4;
b0 = 4;
}
- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d4 < d5)
+ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d4 < d5)
{
d5 = 1.0D - d4;
b0 = 5;
@@ -445,6 +461,11 @@
public void playSound(String name, float volume, float pitch)
{
+ PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, name, volume, pitch);
+ if (event.isCanceled() || event.name == null) return;
+ name = event.name;
+ volume = event.newVolume;
+ pitch = event.newPitch;
this.worldObj.playSound(this.posX, this.posY, this.posZ, name, volume, pitch, false);
}

View file

@ -0,0 +1,155 @@
--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java
@@ -57,7 +57,7 @@
this.locationFontTexture = p_i1035_2_;
this.renderEngine = p_i1035_3_;
this.unicodeFlag = p_i1035_4_;
- p_i1035_3_.bindTexture(this.locationFontTexture);
+ bindTexture(this.locationFontTexture);
for (int i = 0; i < 32; ++i)
{
@@ -97,6 +97,7 @@
public void onResourceManagerReload(IResourceManager resourceManager)
{
this.readFontTexture();
+ this.readGlyphSizes();
}
private void readFontTexture()
@@ -105,7 +106,7 @@
try
{
- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream());
+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture));
}
catch (IOException ioexception)
{
@@ -172,7 +173,7 @@
try
{
- inputstream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin")).getInputStream();
+ inputstream = getResourceInputStream(new ResourceLocation("font/glyph_sizes.bin"));
inputstream.read(this.glyphWidth);
}
catch (IOException ioexception)
@@ -195,7 +196,7 @@
float f = (float)(p_78266_1_ % 16 * 8);
float f1 = (float)(p_78266_1_ / 16 * 8);
float f2 = p_78266_2_ ? 1.0F : 0.0F;
- this.renderEngine.bindTexture(this.locationFontTexture);
+ bindTexture(this.locationFontTexture);
float f3 = (float)this.charWidth[p_78266_1_] - 0.01F;
GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.glTexCoord2f(f / 128.0F, f1 / 128.0F);
@@ -222,7 +223,7 @@
private void loadGlyphTexture(int p_78257_1_)
{
- this.renderEngine.bindTexture(this.getUnicodePageLocation(p_78257_1_));
+ bindTexture(this.getUnicodePageLocation(p_78257_1_));
}
protected float renderUnicodeChar(char p_78277_1_, boolean p_78277_2_)
@@ -269,7 +270,7 @@
public int drawString(String p_175065_1_, float p_175065_2_, float p_175065_3_, int p_175065_4_, boolean p_175065_5_)
{
- GlStateManager.enableAlpha();
+ enableAlpha();
this.resetStyles();
int j;
@@ -341,7 +342,7 @@
k = this.colorCode[j];
this.textColor = k;
- GlStateManager.color((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha);
+ setColor((float)(k >> 16) / 255.0F, (float)(k >> 8 & 255) / 255.0F, (float)(k & 255) / 255.0F, this.alpha);
}
else if (j == 16)
{
@@ -370,7 +371,7 @@
this.strikethroughStyle = false;
this.underlineStyle = false;
this.italicStyle = false;
- GlStateManager.color(this.red, this.blue, this.green, this.alpha);
+ setColor(this.red, this.blue, this.green, this.alpha);
}
++i;
@@ -390,7 +391,7 @@
j = k;
}
- float f1 = this.unicodeFlag ? 0.5F : 1.0F;
+ float f1 = getCharWidth(c0) / 32f;
boolean flag1 = (c0 == 0 || j == -1 || this.unicodeFlag) && p_78255_2_;
if (flag1)
@@ -429,6 +430,15 @@
++f;
}
+ doDraw(f);
+ }
+ }
+ }
+
+ protected void doDraw(float f)
+ {
+ {
+ {
Tessellator tessellator;
WorldRenderer worldrenderer;
@@ -504,7 +514,7 @@
this.blue = (float)(p_180455_4_ >> 8 & 255) / 255.0F;
this.green = (float)(p_180455_4_ & 255) / 255.0F;
this.alpha = (float)(p_180455_4_ >> 24 & 255) / 255.0F;
- GlStateManager.color(this.red, this.blue, this.green, this.alpha);
+ setColor(this.red, this.blue, this.green, this.alpha);
this.posX = p_180455_2_;
this.posY = p_180455_3_;
this.renderStringAtPos(p_180455_1_, p_180455_5_);
@@ -583,11 +593,6 @@
int j = this.glyphWidth[p_78263_1_] >>> 4;
int k = this.glyphWidth[p_78263_1_] & 15;
- if (k > 7)
- {
- k = 15;
- j = 0;
- }
++k;
return (k - j) / 2 + 1;
@@ -842,6 +847,26 @@
return this.bidiFlag;
}
+ protected void setColor(float r, float g, float b, float a)
+ {
+ GlStateManager.color(r,g,b,a);
+ }
+
+ protected void enableAlpha()
+ {
+ GlStateManager.enableAlpha();
+ }
+
+ protected void bindTexture(ResourceLocation location)
+ {
+ renderEngine.bindTexture(location);
+ }
+
+ protected InputStream getResourceInputStream(ResourceLocation location) throws IOException
+ {
+ return Minecraft.getMinecraft().getResourceManager().getResource(location).getInputStream();
+ }
+
public int getColorCode(char p_175064_1_)
{
return this.colorCode["0123456789abcdef".indexOf(p_175064_1_)];

View file

@ -1,24 +1,24 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java
@@ -22,6 +22,7 @@
public boolean field_146125_m;
protected boolean field_146123_n;
public boolean visible;
protected boolean hovered;
private static final String __OBFID = "CL_00000668";
+ public int packedFGColour; //FML
public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_)
public GuiButton(int buttonId, int x, int y, String buttonText)
{
@@ -75,8 +76,12 @@
this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_);
this.mouseDragged(mc, mouseX, mouseY);
int l = 14737632;
- if (!this.field_146124_l)
- if (!this.enabled)
+ if (packedFGColour != 0)
{
+ l = packedFGColour;
+ }
+ else if (!this.field_146124_l)
+ else if (!this.enabled)
+ {
l = 10526880;
}
else if (this.field_146123_n)
else if (this.hovered)

View file

@ -1,21 +1,21 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java
@@ -217,13 +217,14 @@
this.field_146297_k.field_71456_v.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1);
this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1);
}
- this.field_146415_a.func_146191_b((String)this.field_146412_t.get(this.field_146413_s++));
+ this.field_146415_a.func_146191_b(net.minecraft.util.EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++)));
- this.inputField.writeText((String)this.foundPlayerNames.get(this.autocompleteIndex++));
+ this.inputField.writeText(net.minecraft.util.EnumChatFormatting.getTextWithoutFormattingCodes((String)this.foundPlayerNames.get(this.autocompleteIndex++)));
}
private void func_146405_a(String p_146405_1_, String p_146405_2_)
private void sendAutocompleteRequest(String p_146405_1_, String p_146405_2_)
{
if (p_146405_1_.length() >= 1)
{
+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_);
BlockPos blockpos = null;
if (this.field_146297_k.field_71476_x != null && this.field_146297_k.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK)
if (this.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
@@ -285,6 +286,13 @@
String[] astring1 = p_146406_1_;
int i = p_146406_1_.length;

View file

@ -0,0 +1,36 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
@@ -213,6 +213,8 @@
}
}
+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress();
+
WorldSettings.GameType gametype = WorldSettings.GameType.getByName(this.field_146342_r);
WorldSettings worldsettings = new WorldSettings(i, gametype, this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]);
worldsettings.setWorldName(this.chunkProviderSettingsJson);
@@ -320,14 +322,7 @@
}
else if (button.id == 8)
{
- if (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT)
- {
- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.chunkProviderSettingsJson));
- }
- else
- {
- this.mc.displayGuiScreen(new GuiCustomizeWorldScreen(this, this.chunkProviderSettingsJson));
- }
+ WorldType.worldTypes[this.selectedIndex].onCustomizeButton(mc, this);
}
}
}
@@ -379,7 +374,7 @@
this.btnBonusItems.visible = this.field_146344_y;
this.btnMapType.visible = this.field_146344_y;
this.btnAllowCommands.visible = this.field_146344_y;
- this.btnCustomizeType.visible = this.field_146344_y && (WorldType.worldTypes[this.selectedIndex] == WorldType.FLAT || WorldType.worldTypes[this.selectedIndex] == WorldType.CUSTOMIZED);
+ this.btnCustomizeType.visible = this.field_146344_y && WorldType.worldTypes[this.selectedIndex].isCustomizable();
}
this.func_146319_h();

View file

@ -0,0 +1,33 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
@@ -30,8 +30,9 @@
this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + b0, I18n.format("menu.returnToGame", new Object[0])));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.options", new Object[0])));
+ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("fml.menu.modoptions")));
GuiButton guibutton;
- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20, I18n.format("menu.shareToLan", new Object[0])));
+ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + b0, 200, 20, I18n.format("menu.shareToLan", new Object[0])));
this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.achievements", new Object[0])));
this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + b0, 98, 20, I18n.format("gui.stats", new Object[0])));
guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic();
@@ -58,13 +59,19 @@
this.mc.setIngameFocus();
break;
case 5:
+ if (this.mc.thePlayer != null)
this.mc.displayGuiScreen(new GuiAchievements(this, this.mc.thePlayer.getStatFileWriter()));
break;
case 6:
+ if (this.mc.thePlayer != null)
this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
break;
case 7:
this.mc.displayGuiScreen(new GuiShareToLan(this));
+ break;
+ case 12:
+ net.minecraftforge.fml.client.FMLClientHandler.instance().showInGameModOptions(this);
+ break;
}
}

View file

@ -0,0 +1,44 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java
@@ -198,6 +198,11 @@
this.buttonList.add(new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer", new Object[0])));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.format("menu.multiplayer", new Object[0])));
this.buttonList.add(this.realmsButton = new GuiButton(14, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("menu.online", new Object[0])));
+ GuiButton fmlModButton = new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.format("fml.menu.mods"));
+ fmlModButton.xPosition = this.width / 2 + 2;
+ realmsButton.width = 98;
+ fmlModButton.width = 98;
+ this.buttonList.add(fmlModButton);
}
private void addDemoButtons(int p_73972_1_, int p_73972_2_)
@@ -245,6 +250,11 @@
this.mc.shutdown();
}
+ if (button.id == 6)
+ {
+ this.mc.displayGuiScreen(new net.minecraftforge.fml.client.GuiModList(this));
+ }
+
if (button.id == 11)
{
this.mc.launchIntegratedServer("Demo_World", "Demo_World", DemoWorldServer.demoWorldSettings);
@@ -492,7 +502,16 @@
s = s + " Demo";
}
- this.drawString(this.fontRendererObj, s, 2, this.height - 10, -1);
+ java.util.List<String> brandings = com.google.common.collect.Lists.reverse(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(true));
+ for (int i = 0; i < brandings.size(); i++)
+ {
+ String brd = brandings.get(i);
+ if (!com.google.common.base.Strings.isNullOrEmpty(brd))
+ {
+ this.drawString(this.fontRendererObj, brd, 2, this.height - ( 10 + i * (this.fontRendererObj.FONT_HEIGHT + 1)), 16777215);
+ }
+ }
+ net.minecraftforge.client.ForgeHooksClient.renderMainMenu(this, this.fontRendererObj, this.width, this.height);
String s1 = "Copyright Mojang AB. Do not distribute!";
this.drawString(this.fontRendererObj, s1, this.width - this.fontRendererObj.getStringWidth(s1) - 2, this.height - 10, -1);

View file

@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
@@ -41,6 +41,7 @@
public GuiMultiplayer(GuiScreen parentScreen)
{
this.parentScreen = parentScreen;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList();
}
public void initGui()
@@ -373,7 +374,7 @@
private void connectToServer(ServerData server)
{
- this.mc.displayGuiScreen(new GuiConnecting(this, this.mc, server));
+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServer(this, server);
}
public void selectServer(int index)

View file

@ -0,0 +1,12 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
@@ -170,6 +170,9 @@
long l = j - k;
ArrayList arraylist = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)});
+ arraylist.add("");
+ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false));
+
if (this.isReducedDebug())
{
return arraylist;

View file

@ -0,0 +1,113 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java
@@ -37,6 +37,9 @@
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
+import net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent;
+import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
+import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.StringUtils;
@@ -146,7 +149,8 @@
}
}
- this.drawHoveringText(list, x, y);
+ FontRenderer font = stack.getItem().getFontRenderer(stack);
+ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
}
protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY)
@@ -156,6 +160,11 @@
protected void drawHoveringText(List textLines, int x, int y)
{
+ drawHoveringText(textLines, x, y, fontRendererObj);
+ }
+
+ protected void drawHoveringText(List textLines, int x, int y, FontRenderer font)
+ {
if (!textLines.isEmpty())
{
GlStateManager.disableRescaleNormal();
@@ -168,7 +177,7 @@
while (iterator.hasNext())
{
String s = (String)iterator.next();
- int l = this.fontRendererObj.getStringWidth(s);
+ int l = font.getStringWidth(s);
if (l > k)
{
@@ -213,7 +222,7 @@
for (int i2 = 0; i2 < textLines.size(); ++i2)
{
String s1 = (String)textLines.get(i2);
- this.fontRendererObj.drawStringWithShadow(s1, (float)j2, (float)k2, -1);
+ font.drawStringWithShadow(s1, j2, k2, -1);
if (i2 == 0)
{
@@ -441,6 +450,7 @@
this.mc.ingameGUI.getChatGUI().addToSentMessages(msg);
}
+ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return;
this.mc.thePlayer.sendChatMessage(msg);
}
@@ -454,9 +464,14 @@
if (guibutton.mousePressed(this.mc, mouseX, mouseY))
{
- this.selectedButton = guibutton;
- guibutton.playPressSound(this.mc.getSoundHandler());
- this.actionPerformed(guibutton);
+ ActionPerformedEvent.Pre event = new ActionPerformedEvent.Pre(this, guibutton, this.buttonList);
+ if (MinecraftForge.EVENT_BUS.post(event))
+ break;
+ this.selectedButton = event.button;
+ event.button.playPressSound(this.mc.getSoundHandler());
+ this.actionPerformed(event.button);
+ if (this.equals(this.mc.currentScreen))
+ MinecraftForge.EVENT_BUS.post(new ActionPerformedEvent.Post(this, event.button, this.buttonList));
}
}
}
@@ -482,8 +497,12 @@
this.fontRendererObj = mc.fontRendererObj;
this.width = width;
this.height = height;
- this.buttonList.clear();
- this.initGui();
+ if (!MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Pre(this, this.buttonList)))
+ {
+ this.buttonList.clear();
+ this.initGui();
+ }
+ MinecraftForge.EVENT_BUS.post(new InitGuiEvent.Post(this, this.buttonList));
}
public void initGui() {}
@@ -494,7 +513,9 @@
{
while (Mouse.next())
{
+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue;
this.handleMouseInput();
+ if (this.equals(this.mc.currentScreen)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this));
}
}
@@ -502,7 +523,9 @@
{
while (Keyboard.next())
{
+ if (MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue;
this.handleKeyboardInput();
+ if (this.equals(this.mc.currentScreen)) MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this));
}
}
}

View file

@ -2,9 +2,9 @@
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java
@@ -187,7 +187,7 @@
if (this.field_146297_k.func_71359_d().func_90033_f(s))
if (this.mc.getSaveLoader().canLoadWorld(s))
{
- this.field_146297_k.func_71371_a(s, s1, (WorldSettings)null);
- this.mc.launchIntegratedServer(s, s1, (WorldSettings)null);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1);
}
}

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java
@@ -34,7 +34,7 @@
if (!s.isEmpty())
{
- this.mc.thePlayer.sendChatMessage(s);
+ this.sendChatMessage(s); // Forge: fix vanilla not adding messages to the sent list while sleeping
}
this.inputField.setText("");

View file

@ -0,0 +1,40 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java
@@ -185,16 +185,7 @@
GlStateManager.disableFog();
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- float f1 = 32.0F;
- worldrenderer.startDrawingQuads();
- worldrenderer.setColorOpaque_I(2105376);
- worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1));
- worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1));
- worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1));
- worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1));
- tessellator.draw();
+ this.drawContainerBackground(tessellator);
int i1 = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
int j1 = this.top + 4 - (int)this.amountScrolled;
@@ -456,4 +447,19 @@
{
return this.slotHeight;
}
+
+ protected void drawContainerBackground(Tessellator tessellator)
+ {
+ WorldRenderer worldrenderer = tessellator.getWorldRenderer();
+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ float f1 = 32.0F;
+ worldrenderer.startDrawingQuads();
+ worldrenderer.setColorOpaque_I(2105376);
+ worldrenderer.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1));
+ worldrenderer.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1));
+ worldrenderer.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1));
+ worldrenderer.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1));
+ tessellator.draw();
+ }
}

View file

@ -0,0 +1,23 @@
--- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java
+++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java
@@ -84,7 +84,7 @@
boolean flag2 = this.field_148301_e.version < 47;
boolean flag3 = flag1 || flag2;
this.field_148300_d.fontRendererObj.drawString(this.field_148301_e.serverName, x + 32 + 3, y + 1, 16777215);
- List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(this.field_148301_e.serverMOTD, listWidth - 32 - 2);
+ List list = this.field_148300_d.fontRendererObj.listFormattedStringToWidth(net.minecraftforge.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.serverMOTD), listWidth - 48 - 2);
for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1)
{
@@ -178,6 +178,11 @@
int k2 = mouseX - x;
int l2 = mouseY - y;
+ String tooltip = net.minecraftforge.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, x, listWidth, y, k2, l2);
+ if (tooltip != null)
+ {
+ this.field_148303_c.func_146793_a(tooltip);
+ } else
if (k2 >= listWidth - 15 && k2 <= listWidth - 5 && l2 >= 0 && l2 <= 8)
{
this.field_148303_c.func_146793_a(s1);

View file

@ -0,0 +1,127 @@
--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java
+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java
@@ -24,6 +24,9 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.input.Mouse;
+import java.util.LinkedList;
+import java.util.List;
+import net.minecraftforge.common.AchievementPage;
@SideOnly(Side.CLIENT)
public class GuiAchievements extends GuiScreen implements IProgressMeter
@@ -50,6 +53,10 @@
private boolean loadingAchievements = true;
private static final String __OBFID = "CL_00000722";
+ private int currentPage = -1;
+ private GuiButton button;
+ private LinkedList<Achievement> minecraftAchievements = new LinkedList<Achievement>();
+
public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_)
{
this.parentScreen = p_i45026_1_;
@@ -58,6 +65,14 @@
short short2 = 141;
this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12);
this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2);
+ minecraftAchievements.clear();
+ for (Object achievement : AchievementList.achievementList)
+ {
+ if (!AchievementPage.isAchievementInPages((Achievement)achievement))
+ {
+ minecraftAchievements.add((Achievement)achievement);
+ }
+ }
}
public void initGui()
@@ -65,6 +80,7 @@
this.mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS));
this.buttonList.clear();
this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0])));
+ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage)));
}
protected void actionPerformed(GuiButton button) throws IOException
@@ -75,6 +91,16 @@
{
this.mc.displayGuiScreen(this.parentScreen);
}
+
+ if (button.id == 2)
+ {
+ currentPage++;
+ if (currentPage >= AchievementPage.getAchievementPages().size())
+ {
+ currentPage = -1;
+ }
+ this.button.displayString = AchievementPage.getTitle(currentPage);
+ }
}
}
@@ -260,7 +286,9 @@
GlStateManager.depthFunc(518);
GlStateManager.pushMatrix();
GlStateManager.translate((float)k1, (float)l1, -200.0F);
- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F);
+ // FIXES models rendering weirdly in the acheivements pane
+ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284
+ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F);
GlStateManager.enableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableRescaleNormal();
@@ -341,11 +369,12 @@
int i4;
int l4;
- for (i3 = 0; i3 < AchievementList.achievementList.size(); ++i3)
+ List<Achievement> achievementList = (currentPage == -1 ? minecraftAchievements : AchievementPage.getAchievementPage(currentPage).getAchievements());
+ for (i3 = 0; i3 < achievementList.size(); ++i3)
{
- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(i3);
+ Achievement achievement1 = achievementList.get(i3);
- if (achievement1.parentAchievement != null)
+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement))
{
j3 = achievement1.displayColumn * 24 - k + 11;
k3 = achievement1.displayRow * 24 - l + 11;
@@ -401,9 +430,9 @@
int i5;
int j5;
- for (k3 = 0; k3 < AchievementList.achievementList.size(); ++k3)
+ for (k3 = 0; k3 < achievementList.size(); ++k3)
{
- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(k3);
+ Achievement achievement2 = (Achievement)achievementList.get(k3);
l4 = achievement2.displayColumn * 24 - k;
i5 = achievement2.displayRow * 24 - l;
@@ -445,6 +474,7 @@
this.mc.getTextureManager().bindTexture(field_146561_C);
+ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it.
if (achievement2.getSpecial())
{
this.drawTexturedModalRect(l4 - 2, i5 - 2, 26, 202, 26, 26);
@@ -453,6 +483,7 @@
{
this.drawTexturedModalRect(l4 - 2, i5 - 2, 0, 202, 26, 26);
}
+ GlStateManager.disableBlend(); //Forge: Cleanup states we set.
if (!this.statFileWriter.canUnlockAchievement(achievement2))
{
@@ -461,7 +492,7 @@
this.itemRender.func_175039_a(false);
}
- GlStateManager.enableLighting();
+ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065
GlStateManager.enableCull();
this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l4 + 3, i5 + 3);
GlStateManager.blendFunc(770, 771);

View file

@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiStats.java
+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiStats.java
@@ -769,6 +769,7 @@
super(mcIn, GuiStats.this.width, GuiStats.this.height, 32, GuiStats.this.height - 64, GuiStats.this.fontRendererObj.FONT_HEIGHT * 4);
this.setShowSelectionBox(false);
Iterator iterator = EntityList.entityEggs.values().iterator();
+ iterator = com.google.common.collect.Iterators.concat(iterator, net.minecraftforge.fml.common.registry.EntityRegistry.getEggs().values().iterator());
while (iterator.hasNext())
{
@@ -806,7 +807,7 @@
protected void drawSlot(int entryID, int p_180791_2_, int p_180791_3_, int p_180791_4_, int p_180791_5_, int p_180791_6_)
{
EntityList.EntityEggInfo entityegginfo = (EntityList.EntityEggInfo)this.field_148222_l.get(entryID);
- String s = I18n.format("entity." + EntityList.getStringFromID(entityegginfo.spawnedID) + ".name", new Object[0]);
+ String s = I18n.format("entity." + entityegginfo.name + ".name", new Object[0]);
int k1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151512_d);
int l1 = GuiStats.this.field_146546_t.readStat(entityegginfo.field_151513_e);
String s1 = I18n.format("stat.entityKills", new Object[] {Integer.valueOf(k1), s});

View file

@ -0,0 +1,65 @@
--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.Set;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -178,8 +179,11 @@
GlStateManager.translate(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
this.itemRender.zLevel = 200.0F;
+ FontRenderer font = null;
+ if (stack != null) font = stack.getItem().getFontRenderer(stack);
+ if (font == null) font = fontRendererObj;
this.itemRender.renderItemAndEffectIntoGUI(stack, x, y);
- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText);
+ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText);
this.zLevel = 0.0F;
this.itemRender.zLevel = 0.0F;
}
@@ -240,13 +244,12 @@
if (itemstack == null)
{
- String s1 = slotIn.getSlotTexture();
+ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite();
- if (s1 != null)
+ if (textureatlassprite != null)
{
- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1);
GlStateManager.disableLighting();
- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
+ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation());
this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16);
GlStateManager.enableLighting();
flag1 = true;
@@ -465,6 +468,7 @@
protected void mouseReleased(int mouseX, int mouseY, int state)
{
+ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
int l = this.guiLeft;
int i1 = this.guiTop;
@@ -698,4 +702,16 @@
this.mc.thePlayer.closeScreen();
}
}
+
+ /* ======================================== FORGE START =====================================*/
+
+ /**
+ * Returns the slot that is currently displayed under the mouse.
+ */
+ public Slot getSlotUnderMouse()
+ {
+ return this.theSlot;
+ }
+
+ /* ======================================== FORGE END =====================================*/
}

View file

@ -0,0 +1,267 @@
--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
@@ -49,6 +49,8 @@
private boolean field_147057_D;
private CreativeCrafting field_147059_E;
private static final String __OBFID = "CL_00000752";
+ private static int tabPage = 0;
+ private int maxPages = 0;
public GuiContainerCreative(EntityPlayer p_i1088_1_)
{
@@ -187,7 +189,7 @@
return;
}
- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2))
+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770
{
if (clickedButton == 0)
{
@@ -262,6 +264,13 @@
this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]);
this.field_147059_E = new CreativeCrafting(this.mc);
this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E);
+ int tabCount = CreativeTabs.creativeTabArray.length;
+ if (tabCount > 12)
+ {
+ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<"));
+ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">"));
+ maxPages = ((tabCount - 12) / 10) + 1;
+ }
}
else
{
@@ -283,7 +292,7 @@
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex())
+ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar())
{
if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat))
{
@@ -320,6 +329,15 @@
{
GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
containercreative.itemList.clear();
+
+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex];
+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch)
+ {
+ tab.displayAllReleventItems(containercreative.itemList);
+ updateFilteredItems(containercreative);
+ return;
+ }
+
Iterator iterator = Item.itemRegistry.iterator();
while (iterator.hasNext())
@@ -331,10 +349,17 @@
item.getSubItems(item, (CreativeTabs)null, containercreative.itemList);
}
}
+ updateFilteredItems(containercreative);
+ }
+ //split from above for custom search tabs
+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative)
+ {
+ Iterator iterator;
Enchantment[] aenchantment = Enchantment.enchantmentsBookList;
int j = aenchantment.length;
+ if (CreativeTabs.creativeTabArray[selectedTabIndex] != CreativeTabs.tabAllSearch) j = 0; //Forge: Don't add enchants to custom tabs.
for (int i = 0; i < j; ++i)
{
Enchantment enchantment = aenchantment[i];
@@ -385,7 +410,7 @@
{
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
- if (creativetabs.drawInForegroundOfTab())
+ if (creativetabs != null && creativetabs.drawInForegroundOfTab())
{
GlStateManager.disableBlend();
this.fontRendererObj.drawString(I18n.format(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752);
@@ -428,7 +453,7 @@
{
CreativeTabs creativetabs = acreativetabs[k1];
- if (this.func_147049_a(creativetabs, l, i1))
+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1))
{
this.setCurrentCreativeTab(creativetabs);
return;
@@ -441,11 +466,13 @@
private boolean needsScrollBars()
{
+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false;
return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.inventorySlots).func_148328_e();
}
private void setCurrentCreativeTab(CreativeTabs p_147050_1_)
{
+ if (p_147050_1_ == null) return;
int i = selectedTabIndex;
selectedTabIndex = p_147050_1_.getTabIndex();
GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
@@ -514,12 +541,14 @@
if (this.searchField != null)
{
- if (p_147050_1_ == CreativeTabs.tabAllSearch)
+ if (p_147050_1_.hasSearchBar())
{
this.searchField.setVisible(true);
this.searchField.setCanLoseFocus(false);
this.searchField.setFocused(true);
this.searchField.setText("");
+ this.searchField.width = p_147050_1_.getSearchbarWidth();
+ this.searchField.xPosition = this.guiLeft + (82 /*default left*/ + 89 /*default width*/) - this.searchField.width;
this.updateCreativeSearch();
}
else
@@ -590,23 +619,45 @@
super.drawScreen(mouseX, mouseY, partialTicks);
CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray;
- int i2 = acreativetabs.length;
+ int start = tabPage * 10;
+ int i2 = Math.min(acreativetabs.length, ((tabPage + 1) * 10) + 2);
+ if (tabPage != 0) start += 2;
+ boolean rendered = false;
- for (int j2 = 0; j2 < i2; ++j2)
+ for (int j2 = start; j2 < i2; ++j2)
{
CreativeTabs creativetabs = acreativetabs[j2];
+ if (creativetabs == null) continue;
if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY))
{
+ rendered = true;
break;
}
}
+ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY))
+ {
+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY);
+ }
+
if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY))
{
this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY);
}
+ if (maxPages != 0)
+ {
+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
+ int width = fontRendererObj.getStringWidth(page);
+ GlStateManager.disableLighting();
+ this.zLevel = 300.0F;
+ itemRender.zLevel = 300.0F;
+ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1);
+ this.zLevel = 0.0F;
+ itemRender.zLevel = 0.0F;
+ }
+
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
}
@@ -675,17 +726,36 @@
int k = acreativetabs.length;
int l;
- for (l = 0; l < k; ++l)
+ int start = tabPage * 10;
+ k = Math.min(acreativetabs.length, ((tabPage + 1) * 10 + 2));
+ if (tabPage != 0) start += 2;
+
+ for (l = start; l < k; ++l)
{
CreativeTabs creativetabs1 = acreativetabs[l];
this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
+ if (creativetabs1 == null) continue;
if (creativetabs1.getTabIndex() != selectedTabIndex)
{
this.func_147051_a(creativetabs1);
}
}
+ if (tabPage != 0)
+ {
+ if (creativetabs != CreativeTabs.tabAllSearch)
+ {
+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
+ func_147051_a(CreativeTabs.tabAllSearch);
+ }
+ if (creativetabs != CreativeTabs.tabInventory)
+ {
+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
+ func_147051_a(CreativeTabs.tabInventory);
+ }
+ }
+
this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
this.searchField.drawTextBox();
@@ -700,6 +770,14 @@
this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15);
}
+ if (creativetabs == null || creativetabs.getTabPage() != tabPage)
+ {
+ if (creativetabs != CreativeTabs.tabAllSearch && creativetabs != CreativeTabs.tabInventory)
+ {
+ return;
+ }
+ }
+
this.func_147051_a(creativetabs);
if (creativetabs == CreativeTabs.tabInventory)
@@ -710,6 +788,15 @@
protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_)
{
+ if (p_147049_1_.getTabPage() != tabPage)
+ {
+ if (p_147049_1_ != CreativeTabs.tabAllSearch &&
+ p_147049_1_ != CreativeTabs.tabInventory)
+ {
+ return false;
+ }
+ }
+
int k = p_147049_1_.getTabColumn();
int l = 28 * k;
byte b0 = 0;
@@ -810,6 +897,8 @@
}
GlStateManager.disableLighting();
+ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it.
+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
this.drawTexturedModalRect(l, i1, j, k, 28, b0);
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
@@ -836,6 +925,15 @@
{
this.mc.displayGuiScreen(new GuiStats(this, this.mc.thePlayer.getStatFileWriter()));
}
+
+ if (button.id == 101)
+ {
+ tabPage = Math.max(tabPage - 1, 0);
+ }
+ else if (button.id == 102)
+ {
+ tabPage = Math.min(tabPage + 1, maxPages);
+ }
}
public int getSelectedTabIndex()

View file

@ -7,4 +7,4 @@
-@SideOnly(Side.CLIENT)
public abstract class ModelBase
{
public float field_78095_p;
public float swingProgress;

View file

@ -7,12 +7,12 @@
-@SideOnly(Side.CLIENT)
public class ModelBox
{
private PositionTextureVertex[] field_78253_h;
private PositionTextureVertex[] vertexPositions;
@@ -82,6 +81,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void func_178780_a(WorldRenderer p_178780_1_, float p_178780_2_)
public void render(WorldRenderer p_178780_1_, float p_178780_2_)
{
for (int i = 0; i < this.field_78254_i.length; ++i)
for (int i = 0; i < this.quadList.length; ++i)

View file

@ -7,36 +7,36 @@
-@SideOnly(Side.CLIENT)
public class ModelRenderer
{
public float field_78801_a;
public float textureWidth;
@@ -110,6 +109,7 @@
this.field_78798_e = p_78793_3_;
this.rotationPointZ = p_78793_3_;
}
+ @SideOnly(Side.CLIENT)
public void func_78785_a(float p_78785_1_)
public void render(float p_78785_1_)
{
if (!this.field_78807_k)
if (!this.isHidden)
@@ -192,6 +192,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void func_78791_b(float p_78791_1_)
public void renderWithRotation(float p_78791_1_)
{
if (!this.field_78807_k)
if (!this.isHidden)
@@ -227,6 +228,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void func_78794_c(float p_78794_1_)
public void postRender(float p_78794_1_)
{
if (!this.field_78807_k)
if (!this.isHidden)
@@ -268,6 +270,7 @@
}
}
+ @SideOnly(Side.CLIENT)
private void func_78788_d(float p_78788_1_)
private void compileDisplayList(float p_78788_1_)
{
this.field_78811_r = GLAllocation.func_74526_a(1);
this.displayList = GLAllocation.generateDisplayLists(1);

View file

@ -10,4 +10,4 @@
-@SideOnly(Side.CLIENT)
public class PositionTextureVertex
{
public Vec3 field_78243_a;
public Vec3 vector3D;

View file

@ -10,4 +10,4 @@
-@SideOnly(Side.CLIENT)
public class TexturedQuad
{
public PositionTextureVertex[] field_78239_a;
public PositionTextureVertex[] vertexPositions;

View file

@ -1,10 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
@@ -56,6 +56,7 @@
Chunk chunk = new Chunk(this.field_73235_d, p_73158_1_, p_73158_2_);
this.field_73236_b.func_76163_a(ChunkCoordIntPair.func_77272_a(p_73158_1_, p_73158_2_), chunk);
this.field_73237_c.add(chunk);
Chunk chunk = new Chunk(this.worldObj, p_73158_1_, p_73158_2_);
this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_), chunk);
this.chunkListing.add(chunk);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk));
chunk.func_177417_c(true);
chunk.setChunkLoaded(true);
return chunk;
}

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
@@ -69,7 +69,7 @@
inetaddress = InetAddress.getByName(ip);
GuiConnecting.this.networkManager = NetworkManager.provideLanClient(inetaddress, port);
GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
- GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN));
+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN, true));
GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
}
catch (UnknownHostException unknownhostexception)

View file

@ -0,0 +1,69 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -113,6 +113,12 @@
}
}
+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, pos, mc.thePlayer))
+ {
+ return false;
+ }
+
if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)
{
return false;
@@ -130,7 +136,7 @@
else
{
worldclient.playAuxSFX(2001, pos, Block.getStateId(iblockstate));
- boolean flag = worldclient.setBlockToAir(pos);
+ boolean flag = block1.removedByPlayer(worldclient, pos, mc.thePlayer, false);
if (flag)
{
@@ -360,11 +366,19 @@
{
if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
{
+
+ if (p_178890_3_ != null &&
+ p_178890_3_.getItem() != null &&
+ p_178890_3_.getItem().onItemUseFirst(p_178890_3_, p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2))
+ {
+ return true;
+ }
+
IBlockState iblockstate = p_178890_2_.getBlockState(p_178890_4_);
- if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2))
+ if ((!p_178890_1_.isSneaking() || p_178890_1_.getHeldItem() == null || p_178890_1_.getHeldItem().getItem().doesSneakBypassUse(p_178890_2_, p_178890_4_, p_178890_1_)))
{
- flag = true;
+ flag = iblockstate.getBlock().onBlockActivated(p_178890_2_, p_178890_4_, iblockstate, p_178890_1_, p_178890_5_, f, f1, f2);
}
if (!flag && p_178890_3_ != null && p_178890_3_.getItem() instanceof ItemBlock)
@@ -397,7 +411,9 @@
}
else
{
- return p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2);
+ if (!p_178890_3_.onItemUse(p_178890_1_, p_178890_2_, p_178890_4_, p_178890_5_, f, f1, f2)) return false;
+ if (p_178890_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_178890_1_, p_178890_3_);
+ return true;
}
}
else
@@ -428,9 +444,10 @@
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = itemstack1;
- if (itemstack1.stackSize == 0)
+ if (itemstack1.stackSize <= 0)
{
playerIn.inventory.mainInventory[playerIn.inventory.currentItem] = null;
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(playerIn, itemstack1);
}
return true;

View file

@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java
@@ -54,12 +54,13 @@
super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_5_, true);
this.sendQueue = p_i45063_1_;
this.getWorldInfo().setDifficulty(p_i45063_4_);
- this.setSpawnPoint(new BlockPos(8, 64, 8));
this.provider.registerWorld(this);
+ this.setSpawnPoint(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect.
this.chunkProvider = this.createChunkProvider();
this.mapStorage = new SaveDataMemoryStorage();
this.calculateInitialSkylight();
this.calculateInitialWeather();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
}
public void tick()

View file

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java
@@ -24,6 +24,7 @@
public void processHandshake(C00Handshake packetIn)
{
+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(packetIn, this.networkManager)) return;
this.networkManager.setConnectionState(packetIn.getRequestedState());
this.networkManager.setNetHandler(new NetHandlerLoginServer(this.mcServer, this.networkManager));
}

View file

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
@@ -92,7 +92,10 @@
{
this.gameProfile = packetIn.getProfile();
this.networkManager.setConnectionState(EnumConnectionState.PLAY);
- this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile));
+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.networkManager);
+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, this.gameProfile);
+ this.networkManager.setNetHandler(nhpc);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc);
}
public void onDisconnect(IChatComponent reason)

View file

@ -0,0 +1,72 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
@@ -247,7 +247,7 @@
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
this.gameController.playerController = new PlayerControllerMP(this.gameController, this);
- this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), packetIn.getDimension(), packetIn.getDifficulty(), this.gameController.mcProfiler);
+ this.clientWorldController = new WorldClient(this, new WorldSettings(0L, packetIn.getGameType(), false, packetIn.isHardcoreMode(), packetIn.getWorldType()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(getNetworkManager()).getOverrideDimension(packetIn), packetIn.getDifficulty(), this.gameController.mcProfiler);
this.gameController.gameSettings.difficulty = packetIn.getDifficulty();
this.gameController.loadWorld(this.clientWorldController);
this.gameController.thePlayer.dimension = packetIn.getDimension();
@@ -410,7 +410,8 @@
public void handleSpawnExperienceOrb(S11PacketSpawnExperienceOrb packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
- EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d(), (double)packetIn.func_148983_e(), (double)packetIn.func_148982_f(), packetIn.func_148986_g());
+ EntityXPOrb entityxporb = new EntityXPOrb(this.clientWorldController, (double)packetIn.func_148984_d() / 32.0D, (double)packetIn.func_148983_e() / 32.0D, (double)packetIn.func_148982_f() / 32.0D, packetIn.func_148986_g());
+ // FORGE: BugFix MC-12013 Wrong XP orb clientside spawn position
entityxporb.serverPosX = packetIn.func_148984_d();
entityxporb.serverPosY = packetIn.func_148983_e();
entityxporb.serverPosZ = packetIn.func_148982_f();
@@ -754,14 +755,16 @@
public void handleChat(S02PacketChat packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
+ net.minecraft.util.IChatComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.func_179841_c(), packetIn.func_148915_c());
+ if (message == null) return;
if (packetIn.func_179841_c() == 2)
{
- this.gameController.ingameGUI.func_175188_a(packetIn.func_148915_c(), false);
+ this.gameController.ingameGUI.func_175188_a(message, false);
}
else
{
- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.func_148915_c());
+ this.gameController.ingameGUI.getChatGUI().printChatMessage(message);
}
}
@@ -812,6 +815,11 @@
float f = (float)(packetIn.func_149028_l() * 360) / 256.0F;
float f1 = (float)(packetIn.func_149030_m() * 360) / 256.0F;
EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.func_149025_e(), this.gameController.theWorld);
+ if (entitylivingbase == null)
+ {
+ net.minecraftforge.fml.common.FMLLog.info("Server attempted to spawn an unknown entity using ID: {0} at ({1}, {2}, {3}) Skipping!", packetIn.func_149025_e(), d0, d1, d2);
+ return;
+ }
entitylivingbase.serverPosX = packetIn.func_149023_f();
entitylivingbase.serverPosY = packetIn.func_149034_g();
entitylivingbase.serverPosZ = packetIn.func_149029_h();
@@ -1137,6 +1145,10 @@
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
+ else
+ {
+ tileentity.onDataPacket(netManager, packetIn);
+ }
}
}
@@ -1346,7 +1358,7 @@
if (entity instanceof EntityLivingBase)
{
- PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e(), packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f());
+ PotionEffect potioneffect = new PotionEffect(packetIn.func_149427_e() & 0xff, packetIn.func_180755_e(), packetIn.func_149428_f(), false, packetIn.func_179707_f());
potioneffect.setPotionDurationMax(packetIn.func_149429_c());
((EntityLivingBase)entity).addPotionEffect(potioneffect);
}

View file

@ -1,10 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java
+++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java
@@ -148,6 +148,7 @@
p_147224_1_.func_147407_a((String)null);
server.setBase64EncodedIconData((String)null);
}
+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse);
this.field_175092_e = Minecraft.func_71386_F();
networkmanager.func_179290_a(new C01PacketPing(this.field_175092_e));
+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse);
this.field_175092_e = Minecraft.getSystemTime();
networkmanager.sendPacket(new C01PacketPing(this.field_175092_e));
this.field_147403_d = true;

View file

@ -2,20 +2,20 @@
+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java
@@ -135,6 +135,7 @@
public void func_78873_a(EntityFX p_78873_1_)
public void addEffect(EntityFX p_78873_1_)
{
+ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs.
int i = p_78873_1_.func_70537_b();
int i = p_78873_1_.getFXLayer();
int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1;
@@ -361,7 +362,7 @@
public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_)
{
- if (p_180533_2_.func_177230_c().func_149688_o() != Material.field_151579_a)
+ if (!p_180533_2_.func_177230_c().isAir(field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this))
- if (p_180533_2_.getBlock().getMaterial() != Material.air)
+ if (!p_180533_2_.getBlock().isAir(worldObj, p_180533_1_) && !p_180533_2_.getBlock().addDestroyEffects(worldObj, p_180533_1_, this))
{
p_180533_2_ = p_180533_2_.func_177230_c().func_176221_a(p_180533_2_, this.field_78878_a, p_180533_1_);
p_180533_2_ = p_180533_2_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_);
byte b0 = 4;
@@ -467,4 +468,13 @@
@ -24,10 +24,10 @@
+
+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target)
+ {
+ Block block = field_78878_a.func_180495_p(pos).func_177230_c();
+ if (block != null && !block.addHitEffects(field_78878_a, target, this))
+ Block block = worldObj.getBlockState(pos).getBlock();
+ if (block != null && !block.addHitEffects(worldObj, target, this))
+ {
+ func_180532_a(pos, target.field_178784_b);
+ addBlockHitEffects(pos, target.sideHit);
+ }
+ }
}

View file

@ -2,17 +2,17 @@
+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java
@@ -24,7 +24,7 @@
{
private BlockModelShapes field_175028_a;
private final GameSettings field_175026_b;
- private final BlockModelRenderer field_175027_c = new BlockModelRenderer();
+ private final BlockModelRenderer field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer();
private final ChestRenderer field_175024_d = new ChestRenderer();
private final BlockFluidRenderer field_175025_e = new BlockFluidRenderer();
private BlockModelShapes blockModelShapes;
private final GameSettings gameSettings;
- private final BlockModelRenderer blockModelRenderer = new BlockModelRenderer();
+ private final BlockModelRenderer blockModelRenderer = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer();
private final ChestRenderer chestRenderer = new ChestRenderer();
private final BlockFluidRenderer fluidRenderer = new BlockFluidRenderer();
private static final String __OBFID = "CL_00002520";
@@ -49,6 +49,24 @@
{
p_175020_1_ = block.func_176221_a(p_175020_1_, p_175020_4_, p_175020_2_);
IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_175020_1_);
p_175020_1_ = block.getActualState(p_175020_1_, p_175020_4_, p_175020_2_);
IBakedModel ibakedmodel = this.blockModelShapes.getModelForState(p_175020_1_);
+
+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel)
+ {
@ -24,18 +24,18 @@
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(layer);
+
+ IBakedModel targetLayer = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState);
+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).func_177645_b();
+ this.field_175027_c.func_178259_a(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c());
+ IBakedModel damageModel = (new SimpleBakedModel.Builder(targetLayer, p_175020_3_)).makeBakedModel();
+ this.blockModelRenderer.renderModel(p_175020_4_, damageModel, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer());
+ }
+ }
+ return;
+ }
+
IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).func_177645_b();
this.field_175027_c.func_178259_a(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c());
IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(ibakedmodel, p_175020_3_)).makeBakedModel();
this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer());
}
@@ -129,6 +147,12 @@
ibakedmodel = ((WeightedBakedModel)ibakedmodel).func_177564_a(MathHelper.func_180186_a(p_175022_3_));
ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_));
}
+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel)

View file

@ -0,0 +1,176 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java
@@ -403,7 +403,7 @@
if (d3 < d2 || d2 == 0.0D)
{
- if (entity1 == entity.ridingEntity)
+ if (entity1 == entity.ridingEntity && !entity.canRiderInteract())
{
if (d2 == 0.0D)
{
@@ -556,14 +556,8 @@
{
BlockPos blockpos = new BlockPos(entity);
IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);
- Block block = iblockstate.getBlock();
+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.mc.theWorld, blockpos, iblockstate, entity);
- if (block == Blocks.bed)
- {
- int j = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex();
- GlStateManager.rotate((float)(j * 90), 0.0F, 1.0F, 0.0F);
- }
-
GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F);
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, -1.0F, 0.0F, 0.0F);
}
@@ -630,17 +624,20 @@
if (!this.mc.gameSettings.debugCamEnable)
{
- GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_, 1.0F, 0.0F, 0.0F);
-
+ float yaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F;
+ float pitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * p_78467_1_;
+ float roll = 0.0F;
if (entity instanceof EntityAnimal)
{
EntityAnimal entityanimal = (EntityAnimal)entity;
- GlStateManager.rotate(entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F);
+ yaw = entityanimal.prevRotationYawHead + (entityanimal.rotationYawHead - entityanimal.prevRotationYawHead) * p_78467_1_ + 180.0F;
}
- else
- {
- GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F);
- }
+ Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, p_78467_1_);
+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, block, p_78467_1_, yaw, pitch, roll);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
+ GlStateManager.rotate(event.roll, 0.0F, 0.0F, 1.0F);
+ GlStateManager.rotate(event.pitch, 1.0F, 0.0F, 0.0F);
+ GlStateManager.rotate(event.yaw, 0.0F, 1.0F, 0.0F);
}
GlStateManager.translate(0.0F, -f1, 0.0F);
@@ -1081,7 +1078,7 @@
try
{
- this.mc.currentScreen.drawScreen(l, i1, partialTicks);
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.mc.currentScreen, l, i1, partialTicks);
}
catch (Throwable throwable)
{
@@ -1145,7 +1142,7 @@
if (this.mc.playerController.getCurrentGameType() == WorldSettings.GameType.SPECTATOR)
{
- flag = block.hasTileEntity() && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
+ flag = block.hasTileEntity(this.mc.theWorld.getBlockState(blockpos)) && this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory;
}
else
{
@@ -1296,7 +1293,9 @@
GlStateManager.pushMatrix();
RenderHelper.enableStandardItemLighting();
this.mc.mcProfiler.endStartSection("entities");
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0);
renderglobal.renderEntities(entity, frustum, partialTicks);
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0);
RenderHelper.disableStandardItemLighting();
this.disableLightmap();
GlStateManager.matrixMode(5888);
@@ -1308,6 +1307,7 @@
entityplayer = (EntityPlayer)entity;
GlStateManager.disableAlpha();
this.mc.mcProfiler.endStartSection("outline");
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks))
renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks);
GlStateManager.enableAlpha();
}
@@ -1321,6 +1321,7 @@
entityplayer = (EntityPlayer)entity;
GlStateManager.disableAlpha();
this.mc.mcProfiler.endStartSection("outline");
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, mc.objectMouseOver, 0, entityplayer.getHeldItem(), partialTicks))
renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks);
GlStateManager.enableAlpha();
}
@@ -1373,6 +1374,16 @@
renderglobal.renderBlockLayer(EnumWorldBlockLayer.TRANSLUCENT, (double)partialTicks, pass, entity);
}
+ if (!this.debugView) //Only render if render pass 0 happens as well.
+ {
+ RenderHelper.enableStandardItemLighting();
+ this.mc.mcProfiler.endStartSection("entities");
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1);
+ renderglobal.renderEntities(entity, frustum, partialTicks);
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1);
+ RenderHelper.disableStandardItemLighting();
+ }
+
GlStateManager.shadeModel(7424);
GlStateManager.depthMask(true);
GlStateManager.enableCull();
@@ -1385,8 +1396,12 @@
this.renderCloudsCheck(renderglobal, partialTicks, pass);
}
+ this.mc.mcProfiler.endStartSection("forge_render_last");
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, partialTicks);
+
this.mc.mcProfiler.endStartSection("hand");
+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(renderglobal, partialTicks, pass))
if (this.renderHand)
{
GlStateManager.clear(256);
@@ -1498,6 +1513,13 @@
protected void renderRainSnow(float partialTicks)
{
+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getWeatherRenderer();
+ if (renderer != null)
+ {
+ renderer.render(partialTicks, this.mc.theWorld, mc);
+ return;
+ }
+
float f1 = this.mc.theWorld.getRainStrength(partialTicks);
if (f1 > 0.0F)
@@ -1835,6 +1857,13 @@
this.fogColorBlue = f8;
}
+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, block, partialTicks, this.fogColorRed, this.fogColorGreen, this.fogColorBlue);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
+
+ this.fogColorRed = event.red;
+ this.fogColorGreen = event.green;
+ this.fogColorBlue = event.blue;
+
GlStateManager.clearColor(this.fogColorRed, this.fogColorGreen, this.fogColorBlue, 0.0F);
}
@@ -1854,6 +1883,10 @@
Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks);
float f1;
+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, block, partialTicks, 0.1F);
+ if (hook >= 0)
+ GlStateManager.setFogDensity(hook);
+ else
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).isPotionActive(Potion.blindness))
{
f1 = 5.0F;
@@ -1931,6 +1964,7 @@
GlStateManager.setFogStart(f1 * 0.05F);
GlStateManager.setFogEnd(Math.min(f1, 192.0F) * 0.5F);
}
+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f1);
}
GlStateManager.enableColorMaterial();

View file

@ -1,11 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
@@ -83,6 +83,8 @@
this.func_73729_b(i + 6, j + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18);
this.drawTexturedModalRect(i + 6, j + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18);
}
+ potion.renderInventoryEffect(i, j, potioneffect, field_146297_k);
+ potion.renderInventoryEffect(i, j, potioneffect, mc);
+ if (!potion.shouldRenderInvText(potioneffect)) continue;
String s1 = I18n.func_135052_a(potion.func_76393_a(), new Object[0]);
String s1 = I18n.format(potion.getName(), new Object[0]);
if (potioneffect.func_76458_c() == 1)
if (potioneffect.getAmplifier() == 1)

View file

@ -6,9 +6,9 @@
+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel)
+ {
+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(p_178089_1_);
+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack);
+ }
+
if (ibakedmodel == null)
{
ibakedmodel = this.field_178090_d.func_174951_a();
ibakedmodel = this.modelManager.getMissingModel();

View file

@ -0,0 +1,65 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java
@@ -308,7 +308,7 @@
if (this.itemToRender != null)
{
- if (this.itemToRender.getItem() == Items.filled_map)
+ if (this.itemToRender.getItem() instanceof net.minecraft.item.ItemMap)
{
this.func_178097_a(entityplayersp, f3, f1, f2);
}
@@ -359,7 +359,8 @@
if (this.mc.thePlayer.isEntityInsideOpaqueBlock())
{
- IBlockState iblockstate = this.mc.theWorld.getBlockState(new BlockPos(this.mc.thePlayer));
+ BlockPos blockpos = new BlockPos(this.mc.thePlayer);
+ IBlockState iblockstate = this.mc.theWorld.getBlockState(blockpos);
EntityPlayerSP entityplayersp = this.mc.thePlayer;
for (int i = 0; i < 8; ++i)
@@ -367,7 +368,7 @@
double d0 = entityplayersp.posX + (double)(((float)((i >> 0) % 2) - 0.5F) * entityplayersp.width * 0.8F);
double d1 = entityplayersp.posY + (double)(((float)((i >> 1) % 2) - 0.5F) * 0.1F);
double d2 = entityplayersp.posZ + (double)(((float)((i >> 2) % 2) - 0.5F) * entityplayersp.width * 0.8F);
- BlockPos blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2);
+ blockpos = new BlockPos(d0, d1 + (double)entityplayersp.getEyeHeight(), d2);
IBlockState iblockstate1 = this.mc.theWorld.getBlockState(blockpos);
if (iblockstate1.getBlock().isVisuallyOpaque())
@@ -378,6 +379,7 @@
if (iblockstate.getBlock().getRenderType() != -1)
{
+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(mc.thePlayer, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, blockpos))
this.func_178108_a(p_78447_1_, this.mc.getBlockRendererDispatcher().getBlockModelShapes().getTexture(iblockstate));
}
}
@@ -386,11 +388,13 @@
{
if (this.mc.thePlayer.isInsideOfMaterial(Material.water))
{
+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(mc.thePlayer, p_78447_1_))
this.renderWaterOverlayTexture(p_78447_1_);
}
if (this.mc.thePlayer.isBurning())
{
+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(mc.thePlayer, p_78447_1_))
this.renderFireInFirstPerson(p_78447_1_);
}
}
@@ -507,6 +511,12 @@
{
if (!this.itemToRender.getIsItemStackEqual(itemstack))
{
+ if (!this.itemToRender.getItem().shouldCauseReequipAnimation(this.itemToRender, itemstack, equippedItemSlot != entityplayersp.inventory.currentItem))
+ {
+ this.itemToRender = itemstack;
+ this.equippedItemSlot = entityplayersp.inventory.currentItem;
+ return;
+ }
flag = true;
}
}

View file

@ -1,14 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
@@ -78,6 +78,10 @@
public static int field_148826_e;
public static int GL_STATIC_DRAW;
private static final String __OBFID = "CL_00001179";
+ /* Stores the last values sent into setLightmapTextureCoords */
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
+
public static void func_77474_a()
public static void initializeTextures()
{
ContextCapabilities contextcapabilities = GLContext.getCapabilities();
@@ -813,6 +817,12 @@
@ -16,11 +16,11 @@
GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_);
}
+
+ if (p_77475_0_ == field_77476_b)
+ if (p_77475_0_ == lightmapTexUnit)
+ {
+ lastBrightnessX = p_77475_1_;
+ lastBrightnessY = p_77475_2_;
+ }
}
public static void func_148821_a(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_)
public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_)

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