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

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

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,66 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -13,7 +13,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockBush extends Block
+public class BlockBush extends Block implements net.minecraftforge.common.IPlantable
{
private static final String __OBFID = "CL_00000208";
@@ -38,7 +38,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return super.canPlaceBlockAt(worldIn, pos) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ return super.canPlaceBlockAt(worldIn, pos) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected boolean canPlaceBlockOn(Block ground)
@@ -68,7 +68,10 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ BlockPos down = pos.down();
+ Block soil = worldIn.getBlockState(down).getBlock();
+ if (state.getBlock() != this) return this.canPlaceBlockOn(soil); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ return soil.canSustainPlant(worldIn, down, net.minecraft.util.EnumFacing.UP, this);
}
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
@@ -91,4 +94,33 @@
{
return EnumWorldBlockLayer.CUTOUT;
}
+
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ if (this == Blocks.wheat) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.carrots) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.potatoes) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.melon_stem) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.pumpkin_stem) return net.minecraftforge.common.EnumPlantType.Crop;
+ if (this == Blocks.deadbush) return net.minecraftforge.common.EnumPlantType.Desert;
+ if (this == Blocks.waterlily) return net.minecraftforge.common.EnumPlantType.Water;
+ if (this == Blocks.red_mushroom) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.brown_mushroom) return net.minecraftforge.common.EnumPlantType.Cave;
+ if (this == Blocks.nether_wart) return net.minecraftforge.common.EnumPlantType.Nether;
+ if (this == Blocks.sapling) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.tallgrass) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.double_plant) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.red_flower) return net.minecraftforge.common.EnumPlantType.Plains;
+ if (this == Blocks.yellow_flower) return net.minecraftforge.common.EnumPlantType.Plains;
+ return net.minecraftforge.common.EnumPlantType.Plains;
+ }
+
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ if (state.getBlock() != this) return getDefaultState();
+ return state;
+ }
}

View file

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

View file

@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
@@ -18,7 +18,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockCactus extends Block
+public class BlockCactus extends Block implements net.minecraftforge.common.IPlantable
{
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
private static final String __OBFID = "CL_00000210";
@@ -110,7 +110,7 @@
}
Block block = worldIn.getBlockState(pos.down()).getBlock();
- return block == Blocks.cactus || block == Blocks.sand;
+ return block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this);
}
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
@@ -138,4 +138,16 @@
{
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ return net.minecraftforge.common.EnumPlantType.Desert;
+ }
+
+ @Override
+ public IBlockState getPlant(net.minecraft.world.IBlockAccess world, BlockPos pos)
+ {
+ return getDefaultState();
+ }
}

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src-work/minecraft/net/minecraft/block/BlockChest.java
@@ -528,7 +528,7 @@
private boolean isBelowSolidBlock(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.up()).getBlock().isNormalCube();
+ return worldIn.isSideSolid(pos.up(), EnumFacing.DOWN, false);
}
private boolean isOcelotSittingOnChest(World worldIn, BlockPos pos)

View file

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

View file

@ -0,0 +1,77 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -82,11 +82,11 @@
float f1 = 0.0F;
IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j));
- if (iblockstate.getBlock() == Blocks.farmland)
+ if (iblockstate.getBlock().canSustainPlant(worldIn, blockpos.add(i, 0, j), net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)blockIn))
{
f1 = 1.0F;
- if (((Integer)iblockstate.getValue(BlockFarmland.MOISTURE)).intValue() > 0)
+ if (iblockstate.getBlock().isFertile(worldIn, blockpos.add(i, 0, j)))
{
f1 = 3.0F;
}
@@ -127,7 +127,7 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.canPlaceBlockOn(worldIn.getBlockState(pos.down()).getBlock());
+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && worldIn.getBlockState(pos.down()).getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected Item getSeed()
@@ -143,24 +143,6 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0);
-
- if (!worldIn.isRemote)
- {
- int i = ((Integer)state.getValue(AGE)).intValue();
-
- if (i >= 7)
- {
- int j = 3 + fortune;
-
- for (int k = 0; k < j; ++k)
- {
- if (worldIn.rand.nextInt(15) <= i)
- {
- spawnAsEntity(worldIn, pos, new ItemStack(this.getSeed(), 1, 0));
- }
- }
- }
- }
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -203,4 +185,26 @@
{
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @Override
+ public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
+ int age = ((Integer)state.getValue(AGE)).intValue();
+ Random rand = world instanceof World ? ((World)world).rand : new Random();
+
+ if (age >= 7)
+ {
+ int k = 3 + fortune;
+
+ for (int i = 0; i < 3 + fortune; ++i)
+ {
+ if (rand.nextInt(15) <= age)
+ {
+ ret.add(new ItemStack(this.getSeed(), 1, 0));
+ }
+ }
+ }
+ return ret;
+ }
}

View file

@ -0,0 +1,33 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java
@@ -14,7 +14,7 @@
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
-public class BlockDeadBush extends BlockBush
+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable
{
private static final String __OBFID = "CL_00000224";
@@ -47,14 +47,15 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
- }
- else
- {
super.harvestBlock(worldIn, player, pos, state, te);
}
}
+
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return new java.util.ArrayList<ItemStack>(java.util.Arrays.asList(new ItemStack(Blocks.deadbush)));
+ }
}

View file

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
@@ -155,7 +155,7 @@
{
if (this.blockMaterial == Material.iron)
{
- return true;
+ return false; //Allow items to interact with the door
}
else
{
@@ -273,7 +273,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return pos.getY() >= 255 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
+ return pos.getY() >= worldIn.getHeight() - 1 ? false : World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && super.canPlaceBlockAt(worldIn, pos) && super.canPlaceBlockAt(worldIn, pos.up());
}
public int getMobilityFlag()

View file

@ -0,0 +1,89 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoublePlant.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoublePlant.java
@@ -25,7 +25,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockDoublePlant extends BlockBush implements IGrowable
+public class BlockDoublePlant extends BlockBush implements IGrowable, net.minecraftforge.common.IShearable
{
public static final PropertyEnum<BlockDoublePlant.EnumPlantType> VARIANT = PropertyEnum.<BlockDoublePlant.EnumPlantType>create("variant", BlockDoublePlant.EnumPlantType.class);
public static final PropertyEnum<BlockDoublePlant.EnumBlockHalf> HALF = PropertyEnum.<BlockDoublePlant.EnumBlockHalf>create("half", BlockDoublePlant.EnumBlockHalf.class);
@@ -91,6 +91,8 @@
Block block = (Block)(flag ? this : worldIn.getBlockState(blockpos).getBlock());
Block block1 = (Block)(flag ? worldIn.getBlockState(blockpos1).getBlock() : this);
+ if (!flag) this.dropBlockAsItem(worldIn, pos, state, 0); //Forge move above the setting to air.
+
if (block == this)
{
worldIn.setBlockState(blockpos, Blocks.air.getDefaultState(), 2);
@@ -99,17 +101,13 @@
if (block1 == this)
{
worldIn.setBlockState(blockpos1, Blocks.air.getDefaultState(), 3);
-
- if (!flag)
- {
- this.dropBlockAsItem(worldIn, blockpos1, state, 0);
- }
}
}
}
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
+ if (state.getBlock() != this) return super.canBlockStay(worldIn, pos, state); //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
{
return worldIn.getBlockState(pos.down()).getBlock() == this;
@@ -159,7 +157,6 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (worldIn.isRemote || player.getCurrentEquippedItem() == null || player.getCurrentEquippedItem().getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player))
{
super.harvestBlock(worldIn, player, pos, state, te);
}
@@ -222,8 +219,6 @@
else
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta();
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i));
return true;
}
}
@@ -294,6 +289,32 @@
return Block.EnumOffsetType.XZ;
}
+ @Override
+ public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ EnumPlantType type = (EnumPlantType)state.getValue(VARIANT);
+ return state.getValue(HALF) == EnumBlockHalf.LOWER && (type == EnumPlantType.FERN || type == EnumPlantType.GRASS);
+ }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ EnumPlantType type = (EnumPlantType)world.getBlockState(pos).getValue(VARIANT);
+ if (type == EnumPlantType.FERN) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.FERN.getMeta()));
+ if (type == EnumPlantType.GRASS) ret.add(new ItemStack(Blocks.tallgrass, 2, BlockTallGrass.EnumType.GRASS.getMeta()));
+ return ret;
+ }
+ @Override
+ public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
+ {
+ //Forge: Break both parts on the client to prevent the top part flickering as default type for a few frames.
+ IBlockState state = world.getBlockState(pos);
+ if (state.getBlock() == this && state.getValue(HALF) == EnumBlockHalf.LOWER && world.getBlockState(pos.up()).getBlock() == this)
+ world.setBlockToAir(pos.up());
+ return world.setBlockToAir(pos);
+ }
+
public static enum EnumBlockHalf implements IStringSerializable
{
UPPER,

View file

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
@@ -87,6 +87,7 @@
public static boolean canFallInto(World worldIn, BlockPos pos)
{
+ if (worldIn.isAirBlock(pos)) return true;
Block block = worldIn.getBlockState(pos).getBlock();
Material material = block.blockMaterial;
return block == Blocks.fire || material == Material.air || material == Material.water || material == Material.lava;

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -90,7 +90,7 @@
private boolean hasCrops(World worldIn, BlockPos pos)
{
Block block = worldIn.getBlockState(pos.up()).getBlock();
- return block instanceof BlockCrops || block instanceof BlockStem;
+ return block instanceof net.minecraftforge.common.IPlantable && canSustainPlant(worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block);
}
private boolean hasWater(World worldIn, BlockPos pos)

View file

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

View file

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

View file

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
@@ -59,7 +59,7 @@
{
if (!worldIn.isRemote)
{
- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2)
+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
}
@@ -73,7 +73,7 @@
Block block = worldIn.getBlockState(blockpos.up()).getBlock();
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2)
+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2)
{
worldIn.setBlockState(blockpos, Blocks.grass.getDefaultState());
}
@@ -111,7 +111,7 @@
{
if (j >= i / 16)
{
- if (worldIn.getBlockState(blockpos1).getBlock().blockMaterial == Material.air)
+ if (worldIn.isAirBlock(blockpos1))
{
if (rand.nextInt(8) == 0)
{

View file

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

View file

@ -0,0 +1,35 @@
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
@@ -40,14 +40,17 @@
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
player.addExhaustion(0.025F);
- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(player))
+ if (this.canSilkHarvest(worldIn, pos, worldIn.getBlockState(pos), player) && EnchantmentHelper.getSilkTouchModifier(player))
{
+ java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
- if (itemstack != null)
- {
- spawnAsEntity(worldIn, pos, itemstack);
- }
+ if (itemstack != null) items.add(itemstack);
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, worldIn.getBlockState(pos), 0, 1.0f, true, player);
+
+ for (ItemStack is : items)
+ spawnAsEntity(worldIn, pos, is);
}
else
{
@@ -58,7 +61,9 @@
}
int i = EnchantmentHelper.getFortuneModifier(player);
+ harvesters.set(player);
this.dropBlockAsItem(worldIn, pos, state, i);
+ harvesters.set(null);
Material material = worldIn.getBlockState(pos.down()).getBlock().getMaterial();
if (material.blocksMovement() || material.isLiquid())

View file

@ -0,0 +1,30 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLadder.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLadder.java
@@ -79,7 +79,10 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.west()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.east()).getBlock().isNormalCube() ? true : (worldIn.getBlockState(pos.north()).getBlock().isNormalCube() ? true : worldIn.getBlockState(pos.south()).getBlock().isNormalCube()));
+ return worldIn.isSideSolid(pos.west(), EnumFacing.EAST, true) ||
+ worldIn.isSideSolid(pos.east(), EnumFacing.WEST, true) ||
+ worldIn.isSideSolid(pos.north(), EnumFacing.SOUTH, true) ||
+ worldIn.isSideSolid(pos.south(), EnumFacing.NORTH, true);
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
@@ -117,7 +120,7 @@
protected boolean canBlockStay(World worldIn, BlockPos pos, EnumFacing facing)
{
- return worldIn.getBlockState(pos.offset(facing.getOpposite())).getBlock().isNormalCube();
+ return worldIn.isSideSolid(pos.offset(facing.getOpposite()), facing, true);
}
public IBlockState getStateFromMeta(int meta)
@@ -147,4 +150,6 @@
{
return new BlockState(this, new IProperty[] {FACING});
}
+
+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity) { return true; }
}

View file

@ -0,0 +1,126 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -18,7 +18,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public abstract class BlockLeaves extends BlockLeavesBase
+public abstract class BlockLeaves extends BlockLeavesBase implements net.minecraftforge.common.IShearable
{
public static final PropertyBool DECAYABLE = PropertyBool.create("decayable");
public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay");
@@ -76,9 +76,9 @@
BlockPos blockpos = pos.add(j1, k1, l1);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue())
+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos);
}
}
}
@@ -118,9 +118,9 @@
{
Block block = worldIn.getBlockState(blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)).getBlock();
- if (block != Blocks.log && block != Blocks.log2)
+ if (!block.canSustainLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)))
{
- if (block.getMaterial() == Material.leaves)
+ if (block.isLeaves(worldIn, blockpos$mutableblockpos.func_181079_c(k + i2, l + j2, i1 + k2)))
{
this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2;
}
@@ -227,40 +227,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
- {
- int i = this.getSaplingDropChance(state);
-
- if (fortune > 0)
- {
- i -= 2 << fortune;
-
- if (i < 10)
- {
- i = 10;
- }
- }
-
- if (worldIn.rand.nextInt(i) == 0)
- {
- Item item = this.getItemDropped(state, worldIn.rand, fortune);
- spawnAsEntity(worldIn, pos, new ItemStack(item, 1, this.damageDropped(state)));
- }
-
- i = 200;
-
- if (fortune > 0)
- {
- i -= 10 << fortune;
-
- if (i < 40)
- {
- i = 40;
- }
- }
-
- this.dropApple(worldIn, pos, state, i);
- }
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
protected void dropApple(World worldIn, BlockPos pos, IBlockState state, int chance)
@@ -297,4 +264,48 @@
}
public abstract BlockPlanks.EnumType getWoodType(int meta);
+
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isLeaves(IBlockAccess world, BlockPos pos){ return true; }
+
+ @Override
+ public void beginLeavesDecay(World world, BlockPos pos)
+ {
+ IBlockState state = world.getBlockState(pos);
+ if (!(Boolean)state.getValue(CHECK_DECAY))
+ {
+ world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4);
+ }
+ }
+
+ @Override
+ public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ Random rand = world instanceof World ? ((World)world).rand : new Random();
+ int chance = this.getSaplingDropChance(state);
+
+ if (fortune > 0)
+ {
+ chance -= 2 << fortune;
+ if (chance < 10) chance = 10;
+ }
+
+ if (rand.nextInt(chance) == 0)
+ ret.add(new ItemStack(getItemDropped(state, rand, fortune), 1, damageDropped(state)));
+
+ chance = 200;
+ if (fortune > 0)
+ {
+ chance -= 10 << fortune;
+ if (chance < 40) chance = 40;
+ }
+
+ this.captureDrops(true);
+ if (world instanceof World)
+ this.dropApple((World)world, pos, state, chance); // Dammet mojang
+ ret.addAll(this.captureDrops(false));
+ return ret;
+ }
+
}

View file

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

View file

@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLog.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java
@@ -34,9 +34,9 @@
{
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.getBlock().getMaterial() == Material.leaves && !((Boolean)iblockstate.getValue(BlockLeaves.CHECK_DECAY)).booleanValue())
+ if (iblockstate.getBlock().isLeaves(worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, iblockstate.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate.getBlock().beginLeavesDecay(worldIn, blockpos);
}
}
}
@@ -47,6 +47,9 @@
return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(LOG_AXIS, BlockLog.EnumAxis.fromFacingAxis(facing.getAxis()));
}
+ @Override public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isWood(net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+
public static enum EnumAxis implements IStringSerializable
{
X("x"),

View file

@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java
@@ -39,10 +39,14 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
- int i = 15 + worldIn.rand.nextInt(15) + worldIn.rand.nextInt(15);
- this.dropXpOnBlockBreak(worldIn, pos, i);
}
+ @Override
+ public int getExpDrop(net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
+ }
+
public boolean isOpaqueCube()
{
return false;

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -73,7 +73,7 @@
if (pos.getY() >= 0 && pos.getY() < 256)
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
- return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canPlaceBlockOn(iblockstate.getBlock()));
+ return iblockstate.getBlock() == Blocks.mycelium ? true : (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && iblockstate.getBlock().canSustainPlant(worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this));
}
else
{

View file

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -40,7 +40,7 @@
{
if (!worldIn.isRemote)
{
- if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity() > 2)
+ if (worldIn.getLightFromNeighbors(pos.up()) < 4 && worldIn.getBlockState(pos.up()).getBlock().getLightOpacity(worldIn, pos.up()) > 2)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState().withProperty(BlockDirt.VARIANT, BlockDirt.DirtType.DIRT));
}
@@ -54,7 +54,7 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos);
Block block = worldIn.getBlockState(blockpos.up()).getBlock();
- if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity() <= 2)
+ if (iblockstate.getBlock() == Blocks.dirt && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.DIRT && worldIn.getLightFromNeighbors(blockpos.up()) >= 4 && block.getLightOpacity(worldIn, blockpos.up()) <= 2)
{
worldIn.setBlockState(blockpos, this.getDefaultState());
}

View file

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

View file

@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java
@@ -101,14 +101,15 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te)
{
- if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
- player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4));
- }
- else
- {
super.harvestBlock(worldIn, player, pos, state, te);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ IBlockState state = world.getBlockState(pos);
+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4)));
+ }
}

View file

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

View file

@ -0,0 +1,21 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java
@@ -144,11 +144,17 @@
if (!worldIn.isRemote && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.shears)
{
player.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ IBlockState state = world.getBlockState(pos);
+ return new java.util.ArrayList(java.util.Arrays.asList(new ItemStack(this, 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata())));
+ }
}

View file

@ -0,0 +1,41 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
@@ -39,7 +39,10 @@
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- return state.withProperty(NORTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock()))).withProperty(SOUTH, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock()))).withProperty(WEST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock()))).withProperty(EAST, Boolean.valueOf(this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock())));
+ return state.withProperty(NORTH, canPaneConnectTo(worldIn, pos, EnumFacing.NORTH))
+ .withProperty(SOUTH, canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH))
+ .withProperty(WEST, canPaneConnectTo(worldIn, pos, EnumFacing.WEST))
+ .withProperty(EAST, canPaneConnectTo(worldIn, pos, EnumFacing.EAST));
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -65,10 +68,10 @@
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
{
- boolean flag = this.canPaneConnectToBlock(worldIn.getBlockState(pos.north()).getBlock());
- boolean flag1 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.south()).getBlock());
- boolean flag2 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.west()).getBlock());
- boolean flag3 = this.canPaneConnectToBlock(worldIn.getBlockState(pos.east()).getBlock());
+ boolean flag = this.canPaneConnectTo(worldIn, pos, EnumFacing.NORTH);
+ boolean flag1 = this.canPaneConnectTo(worldIn, pos, EnumFacing.SOUTH);
+ boolean flag2 = this.canPaneConnectTo(worldIn, pos, EnumFacing.WEST);
+ boolean flag3 = this.canPaneConnectTo(worldIn, pos, EnumFacing.EAST);
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
{
@@ -187,4 +190,11 @@
{
return new BlockState(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
}
+
+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir)
+ {
+ BlockPos off = pos.offset(dir);
+ Block block = world.getBlockState(off).getBlock();
+ return canPaneConnectToBlock(block) || block.isSideSolid(world, off, dir.getOpposite());
+ }
}

View file

@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -190,7 +190,7 @@
}
}
- if (!flag1 && block.getMaterial() != Material.air && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
+ if (!flag1 && !block.isAir(worldIn, blockpos) && canPush(block, worldIn, blockpos, enumfacing.getOpposite(), false) && (block.getMobilityFlag() == 0 || block == Blocks.piston || block == Blocks.sticky_piston))
{
this.doMove(worldIn, pos, enumfacing, false);
}
@@ -334,7 +334,7 @@
return false;
}
- return !(blockIn instanceof ITileEntityProvider);
+ return !(blockIn.hasTileEntity(worldIn.getBlockState(pos)));
}
else
{
@@ -372,7 +372,9 @@
{
BlockPos blockpos = (BlockPos)list1.get(j);
Block block = worldIn.getBlockState(blockpos).getBlock();
- block.dropBlockAsItem(worldIn, blockpos, worldIn.getBlockState(blockpos), 0);
+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f;
+ block.dropBlockAsItemWithChance(worldIn, blockpos, worldIn.getBlockState(blockpos), chance, 0);
worldIn.setBlockToAir(blockpos);
--i;
ablock[i] = block;

View file

@ -0,0 +1,37 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java
@@ -110,16 +110,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
- {
- TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);
-
- if (tileentitypiston != null)
- {
- IBlockState iblockstate = tileentitypiston.getPistonState();
- iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0);
- }
- }
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
public MovingObjectPosition collisionRayTrace(World worldIn, BlockPos pos, Vec3 start, Vec3 end)
@@ -283,4 +274,16 @@
{
return new BlockState(this, new IProperty[] {FACING, TYPE});
}
+
+ @Override
+ public java.util.List<net.minecraft.item.ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntityPiston tileentitypiston = this.getTileEntity(world, pos);
+ if (tileentitypiston != null)
+ {
+ IBlockState pushed = tileentitypiston.getPistonState();
+ return pushed.getBlock().getDrops(world, pos, pushed, fortune);
+ }
+ return new java.util.ArrayList();
+ }
}

View file

@ -0,0 +1,25 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java
@@ -24,13 +24,14 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
-
- if (!worldIn.isRemote)
- {
- if (((Integer)state.getValue(AGE)).intValue() >= 7 && worldIn.rand.nextInt(50) == 0)
- {
- spawnAsEntity(worldIn, pos, new ItemStack(Items.poisonous_potato));
- }
- }
}
+ @Override
+ public java.util.List<net.minecraft.item.ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
+ java.util.Random rand = world instanceof World ? ((World)world).rand : new java.util.Random();
+ if (((Integer)state.getValue(AGE)) >= 7 && rand.nextInt(50) == 0)
+ ret.add(new ItemStack(Items.poisonous_potato));
+ return ret;
+ }
}

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java
@@ -117,7 +117,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && World.doesBlockHaveSolidTopSurface(worldIn, pos.down());
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,59 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -59,10 +59,10 @@
BlockPos blockpos = pos.offset(direction);
Block block = worldIn.getBlockState(pos.offset(direction)).getBlock();
- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (block.isSolidFullCube() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down()))))
+ if (!canRestoneConnect(worldIn, blockpos, direction) && (block.isSolidFullCube() || !canRestoneConnect(worldIn, blockpos.down(), null)))
{
Block block1 = worldIn.getBlockState(pos.up()).getBlock();
- return !block1.isSolidFullCube() && block.isSolidFullCube() && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
+ return !block1.isSolidFullCube() && block.isSolidFullCube() && canRestoneConnect(worldIn, blockpos.up(), null) ? BlockRedstoneWire.EnumAttachPosition.UP : BlockRedstoneWire.EnumAttachPosition.NONE;
}
else
{
@@ -360,35 +360,24 @@
Block block = iblockstate.getBlock();
boolean flag = block.isNormalCube();
boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube();
- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
+ return !flag1 && flag && canRestoneConnect(worldIn, blockpos.up(), null) ? true : (canRestoneConnect(worldIn, blockpos, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canRestoneConnect(worldIn, blockpos.down(), null)));
}
- protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos)
+ protected static boolean canRestoneConnect(IBlockAccess world, BlockPos pos, EnumFacing side)
{
- return canConnectUpwardsTo(worldIn.getBlockState(pos));
- }
-
- protected static boolean canConnectUpwardsTo(IBlockState state)
- {
- return canConnectTo(state, (EnumFacing)null);
- }
-
- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side)
- {
- Block block = blockState.getBlock();
-
- if (block == Blocks.redstone_wire)
+ IBlockState state = world.getBlockState(pos);
+ if (state.getBlock() == Blocks.redstone_wire)
{
return true;
}
- else if (Blocks.unpowered_repeater.isAssociated(block))
+ else if (Blocks.unpowered_repeater.isAssociated(state.getBlock()))
{
- EnumFacing enumfacing = (EnumFacing)blockState.getValue(BlockRedstoneRepeater.FACING);
- return enumfacing == side || enumfacing.getOpposite() == side;
+ EnumFacing direction = (EnumFacing)state.getValue(BlockRedstoneRepeater.FACING);
+ return direction == side || direction.getOpposite() == side;
}
else
{
- return block.canProvidePower() && side != null;
+ return state.getBlock().canConnectRedstone(world, pos, side);
}
}

View file

@ -0,0 +1,35 @@
--- ../src-base/minecraft/net/minecraft/block/BlockReed.java
+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java
@@ -18,7 +18,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockReed extends Block
+public class BlockReed extends Block implements net.minecraftforge.common.IPlantable
{
public static final PropertyInteger AGE = PropertyInteger.create("age", 0, 15);
private static final String __OBFID = "CL_00000300";
@@ -66,6 +66,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
Block block = worldIn.getBlockState(pos.down()).getBlock();
+ if (block.canSustainPlant(worldIn, pos.down(), EnumFacing.UP, this)) return true;
if (block == this)
{
@@ -165,4 +166,15 @@
{
return new BlockState(this, new IProperty[] {AGE});
}
+
+ @Override
+ public net.minecraftforge.common.EnumPlantType getPlantType(IBlockAccess world, BlockPos pos)
+ {
+ return net.minecraftforge.common.EnumPlantType.Beach;
+ }
+ @Override
+ public IBlockState getPlant(IBlockAccess world, BlockPos pos)
+ {
+ return this.getDefaultState();
+ }
}

View file

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

View file

@ -0,0 +1,57 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java
@@ -123,10 +123,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)
@@ -134,13 +130,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())
{
@@ -149,7 +150,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)
{
@@ -159,12 +160,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
@@ -96,7 +96,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());
}
@@ -150,8 +150,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();
@@ -161,13 +165,14 @@
for (int j = 0; j < 3; ++j)
{
- if (worldIn.rand.nextInt(15) <= i)
+ if (RANDOM.nextInt(15) <= i)
{
- 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<BlockTallGrass.EnumType> TYPE = PropertyEnum.<BlockTallGrass.EnumType>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)
@@ -54,7 +54,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)
@@ -64,13 +64,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);
}
}
@@ -206,4 +200,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
@@ -65,7 +65,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);
}
}
@@ -86,7 +86,7 @@
{
BlockPos blockpos = pos.offset(facing.getOpposite());
boolean flag = facing.getAxis().isHorizontal();
- return flag && worldIn.isBlockNormalCube(blockpos, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
+ return flag && worldIn.isSideSolid(blockpos, facing, true) || facing.equals(EnumFacing.UP) && this.canPlaceOn(worldIn, blockpos);
}
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
@@ -99,7 +99,7 @@
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
- if (worldIn.isBlockNormalCube(pos.offset(enumfacing.getOpposite()), true))
+ if (worldIn.isSideSolid(pos.offset(enumfacing.getOpposite()), enumfacing, true))
{
return this.getDefaultState().withProperty(FACING, enumfacing);
}
@@ -132,7 +132,7 @@
EnumFacing enumfacing1 = enumfacing.getOpposite();
boolean flag = false;
- if (enumfacing$axis.isHorizontal() && !worldIn.isBlockNormalCube(pos.offset(enumfacing1), true))
+ if (enumfacing$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<BlockTrapDoor.DoorHalf> HALF = PropertyEnum.<BlockTrapDoor.DoorHalf>create("half", BlockTrapDoor.DoorHalf.class);
@@ -141,9 +143,10 @@
{
if (!worldIn.isRemote)
{
+ EnumFacing direction = (EnumFacing)state.getValue(FACING);
BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());
- if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()))
+ if (!(isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()) || worldIn.isSideSolid(blockpos, direction, true)))
{
worldIn.setBlockToAir(pos);
this.dropBlockAsItem(worldIn, pos, state, 0);
@@ -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,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java
@@ -59,14 +59,14 @@
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).getBlock().isNormalCube();
+ return side.getAxis().isHorizontal() && worldIn.isSideSolid(pos.offset(side.getOpposite()), side, true);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
- if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock().isNormalCube())
+ if (worldIn.isSideSolid(pos.offset(enumfacing), enumfacing.getOpposite(), true))
{
return true;
}
@@ -100,7 +100,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

@ -0,0 +1,40 @@
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
@@ -25,7 +25,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class BlockVine extends Block
+public class BlockVine extends Block implements net.minecraftforge.common.IShearable
{
public static final PropertyBool UP = PropertyBool.create("up");
public static final PropertyBool NORTH = PropertyBool.create("north");
@@ -388,13 +388,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.vine, 1, 0));
- }
- else
- {
super.harvestBlock(worldIn, player, pos, state, te);
}
}
@@ -475,4 +469,14 @@
return i;
}
+ /*************************FORGE START***********************************/
+ @Override public boolean isLadder(IBlockAccess world, BlockPos pos, EntityLivingBase entity){ return true; }
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(this, 1));
+ }
+ /*************************FORGE END***********************************/
+
}

View file

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java
+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java
@@ -79,7 +79,7 @@
{
Block block = this.world.getBlockState(origin).getBlock();
- if (block.getMaterial() == Material.air)
+ if (block.isAir(world, origin))
{
return true;
}
@@ -110,7 +110,7 @@
BlockPos blockpos = origin.offset(this.moveDirection.getOpposite(), i);
block = this.world.getBlockState(blockpos).getBlock();
- if (block.getMaterial() == Material.air || !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
+ if (block.isAir(world, blockpos)|| !BlockPistonBase.canPush(block, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
{
break;
}
@@ -157,7 +157,7 @@
block = this.world.getBlockState(blockpos1).getBlock();
- if (block.getMaterial() == Material.air)
+ if (block.isAir(world, blockpos1))
{
return true;
}

View file

@ -0,0 +1,53 @@
--- ../src-base/minecraft/net/minecraft/block/state/BlockState.java
+++ ../src-work/minecraft/net/minecraft/block/state/BlockState.java
@@ -40,6 +40,16 @@
public BlockState(Block blockIn, IProperty... properties)
{
+ this(blockIn, properties, null);
+ }
+
+ protected StateImplementation createState(Block block, ImmutableMap properties, ImmutableMap unlistedProperties)
+ {
+ return new StateImplementation(block, properties);
+ }
+
+ protected BlockState(Block blockIn, IProperty[] properties, ImmutableMap unlistedProperties)
+ {
this.block = blockIn;
Arrays.sort(properties, new Comparator<IProperty>()
{
@@ -56,7 +66,7 @@
for (List<Comparable> list1 : Cartesian.cartesianProduct(this.getAllowedValues()))
{
Map<IProperty, Comparable> map1 = MapPopulator.<IProperty, Comparable>createMap(this.properties, list1);
- BlockState.StateImplementation blockstate$stateimplementation = new BlockState.StateImplementation(blockIn, ImmutableMap.copyOf(map1));
+ BlockState.StateImplementation blockstate$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map), unlistedProperties);
map.put(map1, blockstate$stateimplementation);
list.add(blockstate$stateimplementation);
}
@@ -136,6 +146,13 @@
}
}
+ protected StateImplementation(Block blockIn, ImmutableMap propertiesIn, ImmutableTable propertyValueTable)
+ {
+ this.block = blockIn;
+ this.properties = propertiesIn;
+ this.propertyValueTable = propertyValueTable;
+ }
+
public <T extends Comparable<T>, V extends T> IBlockState withProperty(IProperty<T> property, V value)
{
if (!this.properties.containsKey(property))
@@ -203,5 +220,10 @@
map.put(property, value);
return map;
}
+
+ public ImmutableTable<IProperty, Comparable, IBlockState> getPropertyValueTable()
+ {
+ return propertyValueTable;
+ }
}
}

View file

@ -0,0 +1,12 @@
--- ../src-base/minecraft/net/minecraft/block/state/BlockStateBase.java
+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateBase.java
@@ -69,4 +69,9 @@
return stringbuilder.toString();
}
+
+ public com.google.common.collect.ImmutableTable<IProperty, Comparable, IBlockState> getPropertyValueTable()
+ {
+ return null;
+ }
}

View file

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java
+++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java
@@ -10,6 +10,6 @@
public static String getClientModName()
{
- return "vanilla";
+ return net.minecraftforge.fml.common.FMLCommonHandler.instance().getModName();
}
}

View file

@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java
@@ -140,6 +140,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);

View file

@ -0,0 +1,244 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -302,7 +302,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;
@@ -416,10 +415,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"));
@@ -455,6 +454,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);
@@ -468,17 +469,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);
@@ -488,22 +493,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();
@@ -684,21 +692,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()
@@ -886,11 +896,6 @@
public void displayGuiScreen(GuiScreen guiScreenIn)
{
- if (this.currentScreen != null)
- {
- this.currentScreen.onGuiClosed();
- }
-
if (guiScreenIn == null && this.theWorld == null)
{
guiScreenIn = new GuiMainMenu();
@@ -900,6 +905,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;
@@ -1380,7 +1396,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();
}
}
@@ -1601,6 +1617,8 @@
--this.rightClickDelayTimer;
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick();
+
this.mcProfiler.startSection("gui");
if (!this.isGamePaused)
@@ -1750,6 +1768,7 @@
this.currentScreen.handleMouseInput();
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput();
}
if (this.leftClickCounter > 0)
@@ -1928,6 +1947,7 @@
}
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput();
}
for (int l = 0; l < 9; ++l)
@@ -2124,12 +2144,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);
@@ -2190,8 +2213,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;
}
@@ -2202,6 +2231,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();
@@ -2215,6 +2246,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 +2280,7 @@
this.ingameGUI.func_181029_i();
this.setServerData((ServerData)null);
this.integratedServerIsRunning = false;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.theWorld);
}
this.mcSoundHandler.stopSounds();

View file

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java
+++ ../src-work/minecraft/net/minecraft/client/entity/AbstractClientPlayer.java
@@ -129,6 +129,6 @@
f *= 1.0F - f1 * 0.15F;
}
- return f;
+ return net.minecraftforge.client.ForgeHooksClient.getOffsetFOV(this, f);
}
}

View file

@ -0,0 +1,112 @@
--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java
@@ -58,7 +58,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)
{
@@ -98,6 +98,7 @@
public void onResourceManagerReload(IResourceManager resourceManager)
{
this.readFontTexture();
+ this.readGlyphSizes();
}
private void readFontTexture()
@@ -106,7 +107,7 @@
try
{
- bufferedimage = TextureUtil.readBufferedImage(Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture).getInputStream());
+ bufferedimage = TextureUtil.readBufferedImage(getResourceInputStream(this.locationFontTexture));
}
catch (IOException ioexception)
{
@@ -166,7 +167,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)
@@ -225,7 +226,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_)
@@ -272,7 +273,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 i;
@@ -371,7 +372,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;
@@ -510,7 +511,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_);
@@ -589,11 +590,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;
@@ -847,6 +843,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

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java
@@ -22,6 +22,7 @@
public boolean visible;
protected boolean hovered;
private static final String __OBFID = "CL_00000668";
+ public int packedFGColour; //FML
public GuiButton(int buttonId, int x, int y, String buttonText)
{

View file

@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java
@@ -216,13 +216,14 @@
this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(new ChatComponentText(stringbuilder.toString()), 1);
}
- 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 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.mc.objectMouseOver != null && this.mc.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)

View file

@ -0,0 +1,27 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
@@ -313,14 +313,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);
}
}
}
@@ -372,7 +365,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,22 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
@@ -75,13 +75,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,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
@@ -107,6 +107,9 @@
{
BlockPos blockpos = new BlockPos(this.mc.getRenderViewEntity().posX, this.mc.getRenderViewEntity().getEntityBoundingBox().minY, this.mc.getRenderViewEntity().posZ);
+ arraylist.add("");
+ arraylist.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false));
+
if (this.isReducedDebug())
{
return Lists.newArrayList(new String[] {"Minecraft 1.8.8 (" + this.mc.getVersion() + "/" + ClientBrandRetriever.getClientModName() + ")", this.mc.debug, this.mc.renderGlobal.getDebugInfoRenders(), this.mc.renderGlobal.getDebugInfoEntities(), "P: " + this.mc.effectRenderer.getStatistics() + ". T: " + this.mc.theWorld.getDebugLoadedEntities(), this.mc.theWorld.getProviderName(), "", String.format("Chunk-relative: %d %d %d", new Object[]{Integer.valueOf(blockpos.getX() & 15), Integer.valueOf(blockpos.getY() & 15), Integer.valueOf(blockpos.getZ() & 15)})});

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java
@@ -187,7 +187,7 @@
if (this.mc.getSaveLoader().canLoadWorld(s))
{
- 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,22 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java
@@ -459,4 +459,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,104 @@
--- ../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_)
{
@@ -260,6 +262,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
{
@@ -281,7 +290,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))
{
@@ -366,7 +375,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);
@@ -414,11 +423,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 guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
@@ -484,12 +495,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
@@ -658,6 +671,14 @@
this.drawTexturedModalRect(i, j + (int)((float)(k - j - 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)
@@ -790,6 +811,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

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java
+++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java
@@ -10,7 +10,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public abstract class ModelBase
{
public float swingProgress;

View file

@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java
+++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java
@@ -4,7 +4,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class ModelBox
{
private PositionTextureVertex[] vertexPositions;
@@ -82,6 +81,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void render(WorldRenderer p_178780_1_, float p_178780_2_)
{
for (int i = 0; i < this.quadList.length; ++i)

View file

@ -0,0 +1,42 @@
--- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java
@@ -10,7 +10,6 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
-@SideOnly(Side.CLIENT)
public class ModelRenderer
{
public float textureWidth;
@@ -110,6 +109,7 @@
this.rotationPointZ = p_78793_3_;
}
+ @SideOnly(Side.CLIENT)
public void render(float p_78785_1_)
{
if (!this.isHidden)
@@ -191,6 +191,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void renderWithRotation(float p_78791_1_)
{
if (!this.isHidden)
@@ -226,6 +227,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void postRender(float p_78794_1_)
{
if (!this.isHidden)
@@ -267,6 +269,7 @@
}
}
+ @SideOnly(Side.CLIENT)
private void compileDisplayList(float p_78788_1_)
{
this.displayList = GLAllocation.generateDisplayLists(1);

View file

@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java
+++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java
@@ -1,10 +1,7 @@
package net.minecraft.client.model;
import net.minecraft.util.Vec3;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class PositionTextureVertex
{
public Vec3 vector3D;

View file

@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java
+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java
@@ -4,10 +4,7 @@
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.Vec3;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class TexturedQuad
{
public PositionTextureVertex[] vertexPositions;

View file

@ -0,0 +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.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.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.func_181124_a(inetaddress, port, GuiConnecting.this.mc.gameSettings.func_181148_f());
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,48 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -112,6 +112,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;
@@ -357,11 +363,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)
@@ -394,7 +408,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

View file

@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java
@@ -53,12 +53,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
@@ -106,7 +106,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,62 @@
--- ../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();
@@ -751,14 +751,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);
}
}
@@ -809,6 +811,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();
@@ -1134,6 +1141,10 @@
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
+ else
+ {
+ tileentity.onDataPacket(netManager, packetIn);
+ }
}
}
@@ -1342,7 +1353,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

@ -0,0 +1,33 @@
--- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java
@@ -134,6 +134,7 @@
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_.getFXLayer();
int j = p_78873_1_.func_174838_j() != 1.0F ? 0 : 1;
@@ -356,7 +357,7 @@
public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_)
{
- 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_.getBlock().getActualState(p_180533_2_, this.worldObj, p_180533_1_);
int i = 4;
@@ -462,4 +463,13 @@
return "" + i;
}
+
+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.MovingObjectPosition target)
+ {
+ Block block = worldObj.getBlockState(pos).getBlock();
+ if (block != null && !block.addHitEffects(worldObj, target, this))
+ {
+ addBlockHitEffects(pos, target.sideHit);
+ }
+ }
}

View file

@ -0,0 +1,9 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java
@@ -317,5 +317,6 @@
return new ModelResourceLocation(s + "_double_slab", s1);
}
});
+ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this);
}
}

View file

@ -0,0 +1,49 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java
@@ -24,7 +24,7 @@
{
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.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)
+ {
+ IBlockState extendedState = block.getExtendedState(p_175020_1_, p_175020_4_, p_175020_2_);
+ for ( net.minecraft.util.EnumWorldBlockLayer layer : net.minecraft.util.EnumWorldBlockLayer.values() )
+ {
+ if ( block.canRenderInLayer( layer ) )
+ {
+ 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_)).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_)).makeBakedModel();
this.blockModelRenderer.renderModel(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.getInstance().getWorldRenderer());
}
@@ -129,6 +147,12 @@
ibakedmodel = ((WeightedBakedModel)ibakedmodel).getAlternativeModel(MathHelper.getPositionRandom(p_175022_3_));
}
+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartBlockModel)
+ {
+ IBlockState extendedState = block.getExtendedState(p_175022_1_, p_175022_2_, p_175022_3_);
+ ibakedmodel = ((net.minecraftforge.client.model.ISmartBlockModel)ibakedmodel).handleBlockState(extendedState);
+ }
+
return ibakedmodel;
}

View file

@ -0,0 +1,109 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java
@@ -580,14 +580,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);
}
@@ -654,17 +648,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, -f, 0.0F);
@@ -1171,7 +1168,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
{
@@ -1333,6 +1330,7 @@
EntityPlayer 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();
}
@@ -1399,8 +1397,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);
@@ -1837,6 +1839,13 @@
this.fogColorBlue = f7;
}
+ 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);
}
@@ -1855,6 +1864,10 @@
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks);
+ 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))
{
float f1 = 5.0F;
@@ -1932,6 +1945,7 @@
GlStateManager.setFogStart(f * 0.05F);
GlStateManager.setFogEnd(Math.min(f, 192.0F) * 0.5F);
}
+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, block, partialTicks, p_78468_1_, f1);
}
GlStateManager.enableColorMaterial();

View file

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

View file

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java
@@ -51,6 +51,11 @@
}
}
+ if(ibakedmodel instanceof net.minecraftforge.client.model.ISmartItemModel)
+ {
+ ibakedmodel = ((net.minecraftforge.client.model.ISmartItemModel)ibakedmodel).handleItemState(stack);
+ }
+
if (ibakedmodel == null)
{
ibakedmodel = this.modelManager.getMissingModel();

View file

@ -0,0 +1,46 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java
@@ -314,7 +314,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(abstractclientplayer, f2, f, f1);
}
@@ -384,6 +384,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));
}
}
@@ -392,11 +393,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_);
}
}
@@ -513,6 +516,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

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
@@ -84,6 +84,10 @@
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 initializeTextures()
{
ContextCapabilities contextcapabilities = GLContext.getCapabilities();
@@ -844,6 +848,12 @@
{
GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_);
}
+
+ if (p_77475_0_ == lightmapTexUnit)
+ {
+ lastBrightnessX = p_77475_1_;
+ lastBrightnessY = p_77475_2_;
+ }
}
public static void glBlendFunc(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_)

View file

@ -0,0 +1,70 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java
@@ -526,8 +526,10 @@
public void renderEntities(Entity p_180446_1_, ICamera p_180446_2_, float partialTicks)
{
+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass();
if (this.renderEntitiesStartupCounter > 0)
{
+ if (pass > 0) return;
--this.renderEntitiesStartupCounter;
}
else
@@ -1162,6 +1164,12 @@
public void renderSky(float partialTicks, int pass)
{
+ net.minecraftforge.client.IRenderHandler renderer = this.theWorld.provider.getSkyRenderer();
+ if (renderer != null)
+ {
+ renderer.render(partialTicks, theWorld, mc);
+ return;
+ }
if (this.mc.theWorld.provider.getDimensionId() == 1)
{
this.renderSkyEnd();
@@ -1379,6 +1387,12 @@
public void renderClouds(float p_180447_1_, int p_180447_2_)
{
+ net.minecraftforge.client.IRenderHandler renderer = this.mc.theWorld.provider.getCloudRenderer();
+ if (renderer != null)
+ {
+ renderer.render(p_180447_1_, this.mc.theWorld, mc);
+ return;
+ }
if (this.mc.theWorld.provider.isSurfaceWorld())
{
if (this.mc.gameSettings.func_181147_e() == 2)
@@ -1794,8 +1808,11 @@
double d4 = (double)blockpos.getY() - d1;
double d5 = (double)blockpos.getZ() - d2;
Block block = this.theWorld.getBlockState(blockpos).getBlock();
+ TileEntity te = this.theWorld.getTileEntity(blockpos);
+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;
+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking();
- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull))
+ if (!hasBreak)
{
if (d3 * d3 + d4 * d4 + d5 * d5 > 1024.0D)
{
@@ -1950,13 +1967,16 @@
if (recordName != null)
{
ItemRecord itemrecord = ItemRecord.getRecord(recordName);
+ ResourceLocation resource = null;
if (itemrecord != null)
{
this.mc.ingameGUI.setRecordPlayingMessage(itemrecord.getRecordNameLocal());
+ resource = itemrecord.getRecordResource(recordName);
}
- PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(new ResourceLocation(recordName), (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ());
+ if (resource == null) resource = new ResourceLocation(recordName);
+ PositionedSoundRecord positionedsoundrecord = PositionedSoundRecord.create(resource, (float)blockPosIn.getX(), (float)blockPosIn.getY(), (float)blockPosIn.getZ());
this.mapSoundPositions.put(blockPosIn, positionedsoundrecord);
this.mc.getSoundHandler().playSound(positionedsoundrecord);
}

View file

@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java
@@ -580,6 +580,14 @@
}
}
+ public void checkAndGrow()
+ {
+ if (this.rawBufferIndex >= this.bufferSize - this.vertexFormat.getNextOffset())
+ {
+ this.growBuffer(2097152);
+ }
+ }
+
@SideOnly(Side.CLIENT)
public class State
{

View file

@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java
@@ -5,8 +5,9 @@
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
-public class BakedQuad
+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer
{
+ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); }
protected final int[] vertexData;
protected final int tintIndex;
protected final EnumFacing face;

View file

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java
@@ -21,6 +21,11 @@
public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, ModelRotation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
{
+ return makeBakedQuad(posFrom, posTo, face, sprite, facing, (net.minecraftforge.client.model.ITransformation)modelRotationIn, partRotation, uvLocked, shade);
+ }
+
+ public BakedQuad makeBakedQuad(Vector3f posFrom, Vector3f posTo, BlockPartFace face, TextureAtlasSprite sprite, EnumFacing facing, net.minecraftforge.client.model.ITransformation modelRotationIn, BlockPartRotation partRotation, boolean uvLocked, boolean shade)
+ {
int[] aint = this.makeQuadVertexData(face, sprite, facing, this.getPositionsDiv16(posFrom, posTo), modelRotationIn, partRotation, uvLocked, shade);
EnumFacing enumfacing = getFacingFromVertexData(aint);

View file

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java
@@ -10,7 +10,11 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
+/*
+ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead
+ */
@SideOnly(Side.CLIENT)
+@Deprecated
public class ItemCameraTransforms
{
public static final ItemCameraTransforms DEFAULT = new ItemCameraTransforms();

View file

@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java
@@ -13,9 +13,14 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.util.vector.Vector3f;
+/*
+ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation}
+ */
@SideOnly(Side.CLIENT)
-public class ItemTransformVec3f
+@Deprecated
+public class ItemTransformVec3f implements net.minecraftforge.client.model.IModelState
{
+ public net.minecraftforge.client.model.TRSRTransformation apply(net.minecraftforge.client.model.IModelPart part) { return new net.minecraftforge.client.model.TRSRTransformation(this); }
public static final ItemTransformVec3f DEFAULT = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F));
public final Vector3f rotation;
public final Vector3f translation;

View file

@ -0,0 +1,29 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java
@@ -30,7 +30,7 @@
public static ModelBlockDefinition parseFromReader(Reader p_178331_0_)
{
- return (ModelBlockDefinition)GSON.fromJson(p_178331_0_, ModelBlockDefinition.class);
+ return net.minecraftforge.client.model.BlockStateLoader.load(p_178331_0_, GSON);
}
public ModelBlockDefinition(Collection<ModelBlockDefinition.Variants> p_i46221_1_)
@@ -160,11 +160,17 @@
return this.modelLocation;
}
+ @Deprecated
public ModelRotation getRotation()
{
return this.modelRotation;
}
+ public net.minecraftforge.client.model.IModelState getState()
+ {
+ return this.modelRotation;
+ }
+
public boolean isUvLocked()
{
return this.uvLock;

View file

@ -0,0 +1,46 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
@@ -159,7 +159,7 @@
lvt_10_1_.func_178606_a(blockpos$mutableblockpos);
}
- if (block.hasTileEntity())
+ if (block.hasTileEntity(iblockstate))
{
TileEntity tileentity = iblockaccess.getTileEntity(new BlockPos(blockpos$mutableblockpos));
TileEntitySpecialRenderer<TileEntity> tileentityspecialrenderer = TileEntityRendererDispatcher.instance.<TileEntity>getSpecialRenderer(tileentity);
@@ -190,6 +190,7 @@
aboolean[j] |= blockrendererdispatcher.renderBlock(iblockstate, blockpos$mutableblockpos, iblockaccess, worldrenderer);
}
+ }
}
for (EnumWorldBlockLayer enumworldblocklayer : EnumWorldBlockLayer.values())
@@ -386,6 +387,26 @@
return this.needsUpdate;
}
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Creates a new RegionRenderCache instance.<br>
+ * Extending classes can change the behavior of the cache, allowing to visually change
+ * blocks (schematics etc).
+ *
+ * @see RegionRenderCache
+ * @param world The world to cache.
+ * @param from The starting position of the chunk minus one on each axis.
+ * @param to The ending position of the chunk plus one on each axis.
+ * @param subtract Padding used internally by the RegionRenderCache constructor to make
+ * the cache a 20x20x20 cube, for a total of 8000 states in the cache.
+ * @return new RegionRenderCache instance
+ */
+ protected RegionRenderCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract)
+ {
+ return new RegionRenderCache(world, from, to, subtract);
+ }
+ /* ========================================= FORGE END ======================================*/
+
public BlockPos func_181701_a(EnumFacing p_181701_1_)
{
return (BlockPos)this.field_181702_p.get(p_181701_1_);

View file

@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java
@@ -158,4 +158,25 @@
{
return TextureMap.locationBlocksTexture;
}
+
+ /*==================================== FORGE START ===========================================*/
+
+ /**
+ * Items should spread out when rendered in 3d?
+ * @return
+ */
+ public boolean shouldSpreadItems()
+ {
+ return true;
+ }
+
+ /**
+ * Items should have a bob effect
+ * @return
+ */
+ public boolean shouldBob()
+ {
+ return true;
+ }
+ /*==================================== FORGE END =============================================*/
}

View file

@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java
@@ -73,7 +73,7 @@
public RenderItem(TextureManager textureManager, ModelManager modelManager)
{
this.textureManager = textureManager;
- this.itemModelMesher = new ItemModelMesher(modelManager);
+ this.itemModelMesher = new net.minecraftforge.client.ItemModelMesherForge(modelManager);
this.registerItems();
}
@@ -250,6 +250,10 @@
{
GlStateManager.scale(2.0F, 2.0F, 2.0F);
}
+ else
+ {
+ modelresourcelocation = item.getModel(stack, entityplayer, entityplayer.getItemInUseCount());
+ }
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
}

View file

@ -0,0 +1,25 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
@@ -194,6 +194,10 @@
this.skinMap.put("default", this.field_178637_m);
this.skinMap.put("slim", new RenderPlayer(this, true));
}
+
+ public Map<String, RenderPlayer> getSkinMap() {
+ return (Map<String, RenderPlayer>) java.util.Collections.unmodifiableMap(skinMap);
+ }
public void setRenderPosition(double p_178628_1_, double p_178628_3_, double p_178628_5_)
{
@@ -242,9 +246,9 @@
IBlockState iblockstate = worldIn.getBlockState(new BlockPos(p_180597_3_));
Block block = iblockstate.getBlock();
- if (block == Blocks.bed)
+ if (block.isBed(worldIn, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_))
{
- int i = ((EnumFacing)iblockstate.getValue(BlockBed.FACING)).getHorizontalIndex();
+ int i = block.getBedDirection(worldIn, new BlockPos(p_180597_3_)).getHorizontalIndex();
this.playerViewY = (float)(i * 90 + 180);
this.playerViewX = 0.0F;
}

View file

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
@@ -62,6 +62,7 @@
this.func_177137_d(entity);
super.doRender(entity, x, d0, z, p_76986_8_, partialTicks);
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_180596_1_, this, p_180596_9_, p_180596_2_, p_180596_4_, p_180596_6_));
}
private void func_177137_d(AbstractClientPlayer p_177137_1_)

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java
@@ -45,7 +45,7 @@
case 4:
return butcherVillagerTextures;
default:
- return villagerTextures;
+ return net.minecraftforge.fml.common.registry.VillagerRegistry.getVillagerSkin(entity.getProfession(), villagerTextures);
}
}

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