Delete mcp patches.

This commit is contained in:
LexManos 2016-03-14 21:07:05 -07:00
parent 9e74f9e7c0
commit 3839d33770
351 changed files with 0 additions and 20335 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,46 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBanner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBanner.java
@@ -104,14 +104,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- ItemStack itemstack = this.func_185549_e(worldIn, pos, state);
-
- if (itemstack != null)
{
- spawnAsEntity(worldIn, pos, itemstack);
- }
- else
- {
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
}
@@ -138,6 +131,28 @@
}
}
+ @Override
+ public java.util.List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntity te = world.getTileEntity(pos);
+
+ java.util.List<ItemStack> ret = new java.util.ArrayList<ItemStack>();
+ if (te instanceof TileEntityBanner)
+ {
+ TileEntityBanner banner = (TileEntityBanner)te;
+ ItemStack item = new ItemStack(Items.banner, 1, banner.getBaseColor());
+ NBTTagCompound nbt = new NBTTagCompound();
+ TileEntityBanner.func_181020_a(nbt, banner.getBaseColor(), banner.func_181021_d());
+ item.setTagInfo("BlockEntityTag", nbt);
+ ret.add(item);
+ }
+ else
+ {
+ ret.add(new ItemStack(Items.banner, 1, 0));
+ }
+ return ret;
+ }
+
public static class BlockBannerHanging extends BlockBanner
{
protected static final AxisAlignedBB field_185551_d = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 0.78125D, 1.0D);

View file

@ -1,69 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -14,7 +14,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
{
protected static final AxisAlignedBB field_185515_b = new AxisAlignedBB(0.30000001192092896D, 0.0D, 0.30000001192092896D, 0.699999988079071D, 0.6000000238418579D, 0.699999988079071D);
@@ -37,7 +37,8 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return super.canPlaceBlockAt(worldIn, pos) && this.func_185514_i(worldIn.getBlockState(pos.down()));
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ return super.canPlaceBlockAt(worldIn, pos) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected boolean func_185514_i(IBlockState p_185514_1_)
@@ -67,6 +68,11 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
+ if (state.getBlock() == this) //Forge: This function is called during world gen and placement, before this block is set, so if we are not 'here' then assume it's the pre-check.
+ {
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ return soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
+ }
return this.func_185514_i(worldIn.getBlockState(pos.down()));
}
@@ -90,6 +96,35 @@
return false;
}
+ @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;
+ }
+
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{

View file

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

View file

@ -1,41 +0,0 @@
--- ../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);
protected static final AxisAlignedBB field_185593_b = new AxisAlignedBB(0.0625D, 0.0D, 0.0625D, 0.9375D, 0.9375D, 0.9375D);
@@ -110,8 +110,8 @@
}
}
- Block block = worldIn.getBlockState(pos.down()).getBlock();
- return block == Blocks.cactus || block == Blocks.sand && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid();
+ IBlockState state = worldIn.getBlockState(pos.down());
+ return state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && !worldIn.getBlockState(pos.up()).func_185904_a().isLiquid();
}
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
@@ -135,6 +135,18 @@
return ((Integer)state.getValue(AGE)).intValue();
}
+ @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();
+ }
+
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {AGE});

View file

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

View file

@ -1,27 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -131,6 +131,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;
@@ -141,8 +148,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;
}
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)

View file

@ -1,61 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCrops.java
@@ -116,11 +116,11 @@
float f1 = 0.0F;
IBlockState iblockstate = worldIn.getBlockState(blockpos.add(i, 0, j));
- if (iblockstate.getBlock() == Blocks.farmland)
+ if (iblockstate.getBlock().canSustainPlant(iblockstate, 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;
}
@@ -161,7 +161,8 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && this.func_185514_i(worldIn.getBlockState(pos.down()));
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ return (worldIn.getLight(pos) >= 8 || worldIn.canSeeSky(pos)) && soil.getBlock().canSustainPlant(soil, worldIn, pos.down(), net.minecraft.util.EnumFacing.UP, this);
}
protected Item getSeed()
@@ -174,11 +175,33 @@
return Items.wheat;
}
+ @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;
+ }
+
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, 0);
- if (!worldIn.isRemote)
+ if (false && !worldIn.isRemote) // Forge: NOP all this.
{
int i = this.func_185527_x(state);

View file

@ -1,32 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDeadBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDeadBush.java
@@ -16,7 +16,7 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockDeadBush extends BlockBush
+public class BlockDeadBush extends BlockBush implements net.minecraftforge.common.IShearable
{
protected static final AxisAlignedBB field_185516_a = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
@@ -57,7 +57,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.deadbush, 1, 0));
@@ -67,4 +67,11 @@
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
}
+
+ @Override public boolean isShearable(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos){ return true; }
+ @Override
+ public java.util.List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(Blocks.deadbush));
+ }
}

View file

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

View file

@ -1,90 +0,0 @@
--- ../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);
@@ -88,6 +88,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);
@@ -96,17 +98,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;
@@ -149,7 +147,6 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (worldIn.isRemote || p_180657_6_ == null || p_180657_6_.getItem() != Items.shears || state.getValue(HALF) != BlockDoublePlant.EnumBlockHalf.LOWER || !this.onHarvest(worldIn, pos, state, player))
{
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
@@ -212,8 +209,6 @@
else
{
player.triggerAchievement(StatList.func_188055_a(this));
- int i = (blockdoubleplant$enumplanttype == BlockDoublePlant.EnumPlantType.GRASS ? BlockTallGrass.EnumType.GRASS : BlockTallGrass.EnumType.FERN).getMeta();
- spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 2, i));
return true;
}
}
@@ -284,6 +279,33 @@
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(IBlockState state, 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.
+ 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

@ -1,20 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDragonEgg.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDragonEgg.java
@@ -48,7 +48,7 @@
private void checkFall(World worldIn, BlockPos pos)
{
- if (BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
+ if (worldIn.isAirBlock(pos.down()) && BlockFalling.func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
{
int i = 32;
@@ -61,7 +61,7 @@
worldIn.setBlockToAir(pos);
BlockPos blockpos;
- for (blockpos = pos; BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
+ for (blockpos = pos; worldIn.isAirBlock(blockpos) && BlockFalling.func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}

View file

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDropper.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDropper.java
@@ -43,7 +43,7 @@
{
ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
- if (itemstack != null)
+ if (itemstack != null && net.minecraftforge.items.VanillaInventoryCodeHooks.dropperInsertHook(worldIn, pos, tileentitydispenser, i, itemstack))
{
EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
BlockPos blockpos = pos.offset(enumfacing);

View file

@ -1,20 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
@@ -44,7 +44,7 @@
private void checkFallable(World worldIn, BlockPos pos)
{
- if (func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
+ if (worldIn.isAirBlock(pos) && func_185759_i(worldIn.getBlockState(pos.down())) && pos.getY() >= 0)
{
int i = 32;
@@ -62,7 +62,7 @@
worldIn.setBlockToAir(pos);
BlockPos blockpos;
- for (blockpos = pos.down(); func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
+ for (blockpos = pos.down(); worldIn.isAirBlock(blockpos) && func_185759_i(worldIn.getBlockState(blockpos)) && blockpos.getY() > 0; blockpos = blockpos.down())
{
;
}

View file

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -87,7 +87,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.getBlockState(pos), worldIn, pos, net.minecraft.util.EnumFacing.UP, (net.minecraftforge.common.IPlantable)block);
}
private boolean hasWater(World worldIn, BlockPos pos)

View file

@ -1,209 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -37,7 +37,15 @@
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
- return !worldIn.getBlockState(pos.down()).func_185896_q() && !Blocks.fire.canCatchFire(worldIn, pos.down()) ? state.withProperty(NORTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.north()))).withProperty(EAST, Boolean.valueOf(this.canCatchFire(worldIn, pos.east()))).withProperty(SOUTH, Boolean.valueOf(this.canCatchFire(worldIn, pos.south()))).withProperty(WEST, Boolean.valueOf(this.canCatchFire(worldIn, pos.west()))).withProperty(UPPER, Boolean.valueOf(this.canCatchFire(worldIn, pos.up()))) : this.getDefaultState();
+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(worldIn, pos.down(), EnumFacing.UP))
+ {
+ return state.withProperty(NORTH, this.canCatchFire(worldIn, pos.north(), EnumFacing.SOUTH))
+ .withProperty(EAST, this.canCatchFire(worldIn, pos.east(), EnumFacing.WEST))
+ .withProperty(SOUTH, this.canCatchFire(worldIn, pos.south(), EnumFacing.NORTH))
+ .withProperty(WEST, this.canCatchFire(worldIn, pos.west(), EnumFacing.EAST))
+ .withProperty(UPPER, this.canCatchFire(worldIn, pos.up(), EnumFacing.DOWN));
+ }
+ return this.getDefaultState();
}
protected BlockFire()
@@ -90,6 +98,7 @@
public void setFireInfo(Block blockIn, int encouragement, int flammability)
{
+ 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));
}
@@ -129,13 +138,8 @@
}
Block block = worldIn.getBlockState(pos.down()).getBlock();
- boolean flag = block == Blocks.netherrack;
+ boolean flag = block.isFireSource(worldIn, pos.down(), EnumFacing.UP);
- if (worldIn.provider instanceof WorldProviderEnd && block == Blocks.bedrock)
- {
- flag = true;
- }
-
int i = ((Integer)state.getValue(AGE)).intValue();
if (!flag && worldIn.isRaining() && this.canDie(worldIn, pos) && rand.nextFloat() < 0.2F + (float)i * 0.03F)
@@ -156,7 +160,7 @@
{
if (!this.canNeighborCatchFire(worldIn, pos))
{
- if (!worldIn.getBlockState(pos.down()).func_185896_q() || i > 3)
+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP) || i > 3)
{
worldIn.setBlockToAir(pos);
}
@@ -164,7 +168,7 @@
return;
}
- 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;
@@ -179,12 +183,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)
{
@@ -243,22 +247,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);
@@ -290,7 +302,7 @@
{
for (EnumFacing enumfacing : EnumFacing.values())
{
- if (this.canCatchFire(worldIn, pos.offset(enumfacing)))
+ if (this.canCatchFire(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()))
{
return true;
}
@@ -311,7 +323,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;
@@ -323,9 +335,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)
@@ -364,9 +377,9 @@
pos.func_184134_a((double)((float)state.getX() + 0.5F), (double)((float)state.getY() + 0.5F), (double)((float)state.getZ() + 0.5F), SoundEvents.field_187643_bs, SoundCategory.BLOCKS, 1.0F + rand.nextFloat(), rand.nextFloat() * 0.7F + 0.3F, false);
}
- if (!pos.getBlockState(state.down()).func_185896_q() && !Blocks.fire.canCatchFire(pos, state.down()))
+ if (!pos.getBlockState(state.down()).isSideSolid(pos, state.down(), EnumFacing.UP) && !Blocks.fire.canCatchFire(pos, state.down(), EnumFacing.UP))
{
- if (Blocks.fire.canCatchFire(pos, state.west()))
+ if (Blocks.fire.canCatchFire(pos, state.west(), EnumFacing.EAST))
{
for (int j = 0; j < 2; ++j)
{
@@ -377,7 +390,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.east()))
+ if (Blocks.fire.canCatchFire(pos, state.east(), EnumFacing.WEST))
{
for (int k = 0; k < 2; ++k)
{
@@ -388,7 +401,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.north()))
+ if (Blocks.fire.canCatchFire(pos, state.north(), EnumFacing.SOUTH))
{
for (int l = 0; l < 2; ++l)
{
@@ -399,7 +412,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.south()))
+ if (Blocks.fire.canCatchFire(pos, state.south(), EnumFacing.NORTH))
{
for (int i1 = 0; i1 < 2; ++i1)
{
@@ -410,7 +423,7 @@
}
}
- if (Blocks.fire.canCatchFire(pos, state.up()))
+ if (Blocks.fire.canCatchFire(pos, state.up(), EnumFacing.DOWN))
{
for (int j1 = 0; j1 < 2; ++j1)
{
@@ -458,4 +471,19 @@
{
return new BlockStateContainer(this, new IProperty[] {AGE, NORTH, EAST, SOUTH, WEST, UPPER});
}
+
+ /*================================= 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

@ -1,48 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFlowerPot.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowerPot.java
@@ -148,13 +148,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);
}
@@ -374,6 +367,31 @@
return BlockRenderLayer.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(IBlockState state, 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(state, world, pos, player, willHarvest);
+ }
+ @Override
+ public void harvestBlock(World world, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack tool)
+ {
+ super.harvestBlock(world, player, pos, state, te, tool);
+ world.setBlockToAir(pos);
+ }
+ /*===========================FORGE END==========================================*/
+
public static enum EnumFlowerType implements IStringSerializable
{
EMPTY("empty"),

View file

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

View file

@ -1,23 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockHugeMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockHugeMushroom.java
@@ -221,6 +221,20 @@
return new BlockStateContainer(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

@ -1,34 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockIce.java
+++ ../src-work/minecraft/net/minecraft/block/BlockIce.java
@@ -40,14 +40,19 @@
player.triggerAchievement(StatList.func_188055_a(this));
player.addExhaustion(0.025F);
- if (this.canSilkHarvest() && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0)
+ if (this.canSilkHarvest(worldIn, pos, state, player) && EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185306_r, p_180657_6_) > 0)
{
+ java.util.List<ItemStack> items = new java.util.ArrayList<ItemStack>();
ItemStack itemstack = this.createStackedBlock(state);
if (itemstack != null)
{
- spawnAsEntity(worldIn, pos, itemstack);
+ items.add(itemstack);
}
+
+ net.minecraftforge.event.ForgeEventFactory.fireBlockHarvesting(items, worldIn, pos, state, 0, 1.0f, true, player);
+ for (ItemStack is : items)
+ spawnAsEntity(worldIn, pos, is);
}
else
{
@@ -58,7 +63,9 @@
}
int i = EnchantmentHelper.getEnchantmentLevel(Enchantments.field_185308_t, p_180657_6_);
+ harvesters.set(player);
this.dropBlockAsItem(worldIn, pos, state, i);
+ harvesters.set(null);
Material material = worldIn.getBlockState(pos.down()).func_185904_a();
if (material.blocksMovement() || material.isLiquid())

View file

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

View file

@ -1,127 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -17,7 +17,7 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public abstract class BlockLeaves extends Block
+public abstract class BlockLeaves extends Block implements net.minecraftforge.common.IShearable
{
public static final PropertyBool DECAYABLE = PropertyBool.create("decayable");
public static final PropertyBool CHECK_DECAY = PropertyBool.create("check_decay");
@@ -53,9 +53,9 @@
BlockPos blockpos = pos.add(j1, k1, l1);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
- if (iblockstate.func_185904_a() == Material.leaves && !((Boolean)iblockstate.getValue(CHECK_DECAY)).booleanValue())
+ if (iblockstate.getBlock().isLeaves(iblockstate, worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, iblockstate.withProperty(CHECK_DECAY, Boolean.valueOf(true)), 4);
+ iblockstate.getBlock().beginLeavesDecay(iblockstate, worldIn, blockpos);
}
}
}
@@ -96,9 +96,9 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2));
Block block = iblockstate.getBlock();
- if (block != Blocks.log && block != Blocks.log2)
+ if (!block.canSustainLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)))
{
- if (iblockstate.func_185904_a() == Material.leaves)
+ if (block.isLeaves(iblockstate, worldIn, blockpos$mutableblockpos.set(k + i2, l + j2, i1 + k2)))
{
this.surroundings[(i2 + l1) * k1 + (j2 + l1) * j1 + k2 + l1] = -2;
}
@@ -205,40 +205,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- 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)
@@ -274,6 +241,49 @@
public abstract BlockPlanks.EnumType getWoodType(int meta);
+ @Override public boolean isShearable(ItemStack item, IBlockAccess world, BlockPos pos){ return true; }
+ @Override public boolean isLeaves(IBlockState state, IBlockAccess world, BlockPos pos){ return true; }
+
+ @Override
+ public void beginLeavesDecay(IBlockState state, World world, BlockPos 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;
+ }
+
+
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState worldIn, IBlockAccess pos, BlockPos side, EnumFacing p_176225_4_)
{

View file

@ -1,15 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLever.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLever.java
@@ -295,6 +295,12 @@
return new BlockStateContainer(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

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

View file

@ -1,19 +0,0 @@
--- ../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(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return 15 + RANDOM.nextInt(15) + RANDOM.nextInt(15);
+ }
+
public boolean isOpaqueCube(IBlockState p_149662_1_)
{
return false;

View file

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

View file

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

View file

@ -1,51 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -42,7 +42,7 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.func_185514_i(worldIn.getBlockState(pos.down()));
+ return super.canBlockStay(worldIn, pos, state);
}
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
@@ -58,9 +58,11 @@
super.updateTick(worldIn, pos, state, rand);
}
+ @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;
@@ -106,6 +108,26 @@
return ((Integer)state.getValue(AGE)).intValue();
}
+ @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;
+ }
+
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {AGE});

View file

@ -1,22 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNewLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNewLeaf.java
@@ -98,7 +98,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) //Forge: Noop this
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4));
@@ -108,4 +108,10 @@
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata() - 4));
+ }
}

View file

@ -1,23 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNote.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNote.java
@@ -64,7 +64,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_188087_U);
}
@@ -104,6 +106,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.func_184133_a((EntityPlayer)null, pos, this.func_185576_e(eventID), SoundCategory.BLOCKS, 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

@ -1,28 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOldLeaf.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOldLeaf.java
@@ -14,6 +14,7 @@
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -103,11 +104,16 @@
if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
{
player.triggerAchievement(StatList.func_188055_a(this));
- spawnAsEntity(worldIn, pos, new ItemStack(Item.getItemFromBlock(this), 1, ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata()));
}
else
{
super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
}
}
+
+ @Override
+ public List<ItemStack> onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune)
+ {
+ return java.util.Arrays.asList(new ItemStack(this, 1, world.getBlockState(pos).getValue(VARIANT).getMetadata()));
+ }
}

View file

@ -1,50 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java
@@ -59,34 +59,39 @@
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(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ Random rand = world instanceof World ? ((World)world).rand : new Random();
+ if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this))
{
int i = 0;
if (this == Blocks.coal_ore)
{
- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 0, 2);
+ i = MathHelper.getRandomIntegerInRange(rand, 0, 2);
}
else if (this == Blocks.diamond_ore)
{
- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7);
+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.emerald_ore)
{
- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 3, 7);
+ i = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.lapis_ore)
{
- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
else if (this == Blocks.quartz_ore)
{
- i = MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
+ i = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
- this.dropXpOnBlockBreak(worldIn, pos, i);
+ return i;
}
+ return 0;
}
public ItemStack func_185473_a(World p_185473_1_, BlockPos p_185473_2_, IBlockState p_185473_3_)

View file

@ -1,26 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
@@ -105,7 +105,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)
@@ -182,4 +185,11 @@
{
return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
}
+
+ public boolean canPaneConnectTo(IBlockAccess world, BlockPos pos, EnumFacing dir)
+ {
+ BlockPos off = pos.offset(dir);
+ IBlockState state = world.getBlockState(off);
+ return canPaneConnectToBlock(state.getBlock()) || state.isSideSolid(world, off, dir.getOpposite());
+ }
}

View file

@ -1,31 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -235,7 +235,7 @@
}
}
- if (!flag1 && iblockstate.func_185904_a() != Material.air && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston))
+ if (!flag1 && !iblockstate.getBlock().isAir(iblockstate, worldIn, blockpos) && func_185646_a(iblockstate, worldIn, blockpos, enumfacing.getOpposite(), false) && (iblockstate.func_185905_o() == EnumPushReaction.NORMAL || block == Blocks.piston || block == Blocks.sticky_piston))
{
this.doMove(worldIn, pos, enumfacing, false);
}
@@ -320,7 +320,7 @@
return false;
}
- return !block.hasTileEntity();
+ return !block.hasTileEntity(p_185646_0_);
}
else
{
@@ -366,7 +366,9 @@
{
BlockPos blockpos1 = (BlockPos)list2.get(j);
IBlockState iblockstate = worldIn.getBlockState(blockpos1);
- iblockstate.getBlock().dropBlockAsItem(worldIn, blockpos1, iblockstate, 0);
+ // Forge: With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = iblockstate.getBlock() instanceof BlockSnow ? -1.0f : 1.0f;
+ iblockstate.getBlock().dropBlockAsItemWithChance(worldIn, blockpos1, iblockstate, chance, 0);
worldIn.setBlockToAir(blockpos1);
--k;
aiblockstate[k] = iblockstate;

View file

@ -1,36 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonMoving.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonMoving.java
@@ -110,7 +110,7 @@
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState state, float chance, int fortune)
{
- if (!worldIn.isRemote)
+ if (false && !worldIn.isRemote) // Forge: Noop this out
{
TileEntityPiston tileentitypiston = this.func_185589_c(worldIn, pos);
@@ -120,6 +120,7 @@
iblockstate.getBlock().dropBlockAsItem(worldIn, pos, iblockstate, 0);
}
}
+ super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
}
public RayTraceResult collisionRayTrace(IBlockState worldIn, World pos, BlockPos start, Vec3d end, Vec3d p_180636_5_)
@@ -190,4 +191,16 @@
{
return new BlockStateContainer(this, new IProperty[] {FACING, TYPE});
}
+
+ @Override
+ public java.util.List<net.minecraft.item.ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ TileEntityPiston tileentitypiston = this.func_185589_c(world, pos);
+ if (tileentitypiston != null)
+ {
+ IBlockState pushed = tileentitypiston.getPistonState();
+ return pushed.getBlock().getDrops(world, pos, pushed, fortune);
+ }
+ return new java.util.ArrayList();
+ }
}

View file

@ -1,25 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPotato.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPotato.java
@@ -27,7 +27,7 @@
{
super.dropBlockAsItemWithChance(worldIn, pos, state, chance, fortune);
- if (!worldIn.isRemote)
+ if (false && !worldIn.isRemote) //Forge: Moved to getDrops
{
if (this.func_185525_y(state) && worldIn.rand.nextInt(50) == 0)
{
@@ -40,4 +40,13 @@
{
return field_185534_a[((Integer)p_185496_1_.getValue(this.func_185524_e())).intValue()];
}
+
+ @Override
+ public java.util.List<ItemStack> getDrops(net.minecraft.world.IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
+ {
+ java.util.List<ItemStack> ret = super.getDrops(world, pos, state, fortune);
+ if (this.func_185525_y(state) && RANDOM.nextInt(50) == 0)
+ ret.add(new ItemStack(Items.poisonous_potato));
+ return ret;
+ }
}

View file

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java
@@ -117,7 +117,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos).getBlock().blockMaterial.isReplaceable() && worldIn.getBlockState(pos.down()).func_185896_q();
+ return worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos) && worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP);
}
public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_)

View file

@ -1,29 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockQuartz.java
+++ ../src-work/minecraft/net/minecraft/block/BlockQuartz.java
@@ -113,6 +113,26 @@
return new BlockStateContainer(this, new IProperty[] {VARIANT});
}
+ public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
+ {
+ IBlockState state = world.getBlockState(pos);
+ for (IProperty prop : 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

@ -1,186 +0,0 @@
--- ../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)
@@ -65,7 +65,7 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- return worldIn.getBlockState(pos.down()).func_185896_q();
+ return worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos, EnumFacing.UP);
}
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
@@ -88,24 +88,24 @@
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.getShapeProperty());
boolean flag = false;
- if (!worldIn.getBlockState(pos.down()).func_185896_q())
+ if (!worldIn.getBlockState(pos.down()).isSideSolid(worldIn, pos.down(), EnumFacing.UP))
{
flag = true;
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).func_185896_q())
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_EAST && !worldIn.getBlockState(pos.east()).isSideSolid(worldIn, pos.east(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_WEST && !worldIn.getBlockState(pos.west()).isSideSolid(worldIn, pos.west(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_NORTH && !worldIn.getBlockState(pos.north()).isSideSolid(worldIn, pos.north(), EnumFacing.UP))
{
flag = true;
}
- else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).func_185896_q())
+ else if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.ASCENDING_SOUTH && !worldIn.getBlockState(pos.south()).isSideSolid(worldIn, pos.south(), EnumFacing.UP))
{
flag = true;
}
@@ -160,6 +160,81 @@
public abstract IProperty<BlockRailBase.EnumRailDirection> getShapeProperty();
+ /* ======================================== 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 : 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"),
@@ -230,6 +305,7 @@
private IBlockState state;
private final boolean isPowered;
private final List<BlockPos> field_150657_g = Lists.<BlockPos>newArrayList();
+ private final boolean canMakeSlopes;
public Rail(World worldIn, BlockPos pos, IBlockState state)
{
@@ -238,7 +314,8 @@
this.state = state;
this.block = (BlockRailBase)state.getBlock();
BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)state.getValue(this.block.getShapeProperty());
- this.isPowered = this.block.isPowered;
+ this.isPowered = !this.block.isFlexibleRail(worldIn, pos);
+ this.canMakeSlopes = this.block.canMakeSlopes(worldIn, pos);
this.func_180360_a(blockrailbase$enumraildirection);
}
@@ -429,7 +506,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -442,7 +519,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.EAST_WEST && canMakeSlopes)
{
if (BlockRailBase.isRailBlock(this.world, blockpos3.up()))
{
@@ -585,7 +662,7 @@
}
}
- if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH)
+ if (blockrailbase$enumraildirection == BlockRailBase.EnumRailDirection.NORTH_SOUTH && canMakeSlopes)
{
if (BlockRailBase.isRailBlock(this.world, blockpos.up()))
{
@@ -598,7 +675,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

@ -1,24 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java
@@ -310,6 +310,21 @@
return this.getDefaultState().withProperty(field_185512_D, 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

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneDiode.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneDiode.java
@@ -204,6 +204,8 @@
{
EnumFacing enumfacing = (EnumFacing)state.getValue(field_185512_D);
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

@ -1,22 +0,0 @@
--- ../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(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune)
+ {
+ if (this.getItemDropped(state, 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

@ -1,55 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -97,15 +97,15 @@
BlockPos blockpos = pos.offset(direction);
IBlockState iblockstate = worldIn.getBlockState(pos.offset(direction));
- if (!canConnectTo(worldIn.getBlockState(blockpos), direction) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn.getBlockState(blockpos.down()))))
+ if (!canConnectTo(worldIn.getBlockState(blockpos), direction, worldIn, blockpos) && (iblockstate.func_185915_l() || !canConnectUpwardsTo(worldIn, blockpos.down())))
{
IBlockState iblockstate1 = worldIn.getBlockState(pos.up());
if (!iblockstate1.func_185915_l())
{
- boolean flag = worldIn.getBlockState(blockpos).func_185896_q() || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone;
+ boolean flag = worldIn.getBlockState(blockpos).isSideSolid(worldIn, blockpos, EnumFacing.UP) || worldIn.getBlockState(blockpos).getBlock() == Blocks.glowstone;
- if (flag && canConnectUpwardsTo(worldIn.getBlockState(blockpos.up())))
+ if (flag && canConnectUpwardsTo(worldIn, blockpos.up()))
{
if (iblockstate.func_185898_k())
{
@@ -406,21 +406,16 @@
IBlockState iblockstate = worldIn.getBlockState(blockpos);
boolean flag = iblockstate.func_185915_l();
boolean flag1 = worldIn.getBlockState(pos.up()).func_185915_l();
- return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
+ return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side, worldIn, pos) ? true : (iblockstate.getBlock() == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.field_185512_D) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
}
protected static boolean canConnectUpwardsTo(IBlockAccess worldIn, BlockPos pos)
{
- return canConnectUpwardsTo(worldIn.getBlockState(pos));
+ return canConnectTo(worldIn.getBlockState(pos), null, worldIn, pos);
}
- protected static boolean canConnectUpwardsTo(IBlockState state)
+ protected static boolean canConnectTo(IBlockState blockState, EnumFacing side, IBlockAccess world, BlockPos pos)
{
- return canConnectTo(state, (EnumFacing)null);
- }
-
- protected static boolean canConnectTo(IBlockState blockState, EnumFacing side)
- {
Block block = blockState.getBlock();
if (block == Blocks.redstone_wire)
@@ -434,7 +429,7 @@
}
else
{
- return blockState.func_185897_m() && side != null;
+ return blockState.getBlock().canConnectRedstone(blockState, world, pos, side);
}
}

View file

@ -1,40 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockReed.java
+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java
@@ -19,7 +19,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);
protected static final AxisAlignedBB field_185701_b = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 1.0D, 0.875D);
@@ -69,7 +69,9 @@
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
- Block block = worldIn.getBlockState(pos.down()).getBlock();
+ IBlockState state = worldIn.getBlockState(pos.down());
+ Block block = state.getBlock();
+ if (block.canSustainPlant(state, worldIn, pos.down(), EnumFacing.UP, this)) return true;
if (block == this)
{
@@ -162,6 +164,17 @@
return ((Integer)state.getValue(AGE)).intValue();
}
+ @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();
+ }
+
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {AGE});

View file

@ -1,24 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRotatedPillar.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRotatedPillar.java
@@ -28,6 +28,21 @@
super(p_i46385_1_, p_i46385_2_);
}
+ @Override
+ public boolean rotateBlock(net.minecraft.world.World world, BlockPos pos, EnumFacing axis)
+ {
+ net.minecraft.block.state.IBlockState state = world.getBlockState(pos);
+ for (net.minecraft.block.properties.IProperty<?> prop : state.getProperties().keySet())
+ {
+ if (prop.getName().equals("axis"))
+ {
+ world.setBlockState(pos, state.cycleProperty(prop));
+ return true;
+ }
+ }
+ return false;
+ }
+
public IBlockState func_185499_a(IBlockState p_185499_1_, Rotation p_185499_2_)
{
switch (p_185499_2_)

View file

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

@ -1,57 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java
@@ -116,10 +116,6 @@
return new ItemStack(Items.skull, 1, i);
}
- 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)
@@ -127,13 +123,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())
{
@@ -142,7 +143,7 @@
if (tileentity instanceof TileEntitySkull)
{
TileEntitySkull tileentityskull = (TileEntitySkull)tileentity;
- ItemStack itemstack = this.func_185473_a(worldIn, pos, state);
+ ItemStack itemstack = new ItemStack(Items.skull, 1, tileentityskull.getSkullType());
if (tileentityskull.getSkullType() == 3 && tileentityskull.getPlayerProfile() != null)
{
@@ -152,12 +153,11 @@
itemstack.getTagCompound().setTag("SkullOwner", nbttagcompound);
}
- 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

@ -1,36 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSlab.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSlab.java
@@ -50,6 +50,17 @@
return this.isDouble();
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if ( state.func_185914_p() )
+ return true;
+
+ // face is on the block being rendered, not this block.
+ EnumBlockHalf side = world.getBlockState(pos).getValue(HALF);
+ return (side == EnumBlockHalf.TOP && face == EnumFacing.DOWN) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.UP);
+ }
+
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
IBlockState iblockstate = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
@@ -77,13 +88,14 @@
{
return false;
}
- else
+ else if (false) // Forge: Additional logic breaks doesSideBlockRendering and is no longer useful.
{
IBlockState iblockstate = pos.getBlockState(side.offset(p_176225_4_));
boolean flag = func_185675_i(iblockstate) && iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
boolean flag1 = func_185675_i(worldIn) && worldIn.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP;
return flag1 ? (p_176225_4_ == EnumFacing.DOWN ? true : (p_176225_4_ == EnumFacing.UP && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || !flag)) : (p_176225_4_ == EnumFacing.UP ? true : (p_176225_4_ == EnumFacing.DOWN && super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_) ? true : !func_185675_i(iblockstate) || flag));
}
+ return super.shouldSideBeRendered(worldIn, pos, side, p_176225_4_);
}
@SideOnly(Side.CLIENT)

View file

@ -1,55 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
@@ -73,7 +73,7 @@
{
IBlockState iblockstate = worldIn.getBlockState(pos.down());
Block block = iblockstate.getBlock();
- return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.func_185904_a() == Material.leaves ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false;
+ return block != Blocks.ice && block != Blocks.packed_ice ? (iblockstate.getBlock().isLeaves(iblockstate, worldIn, pos.down()) ? true : (block == this && ((Integer)iblockstate.getValue(LAYERS)).intValue() >= 7 ? true : iblockstate.func_185914_p() && iblockstate.func_185904_a().blocksMovement())) : false;
}
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
@@ -85,7 +85,6 @@
{
if (!this.canPlaceBlockAt(worldIn, pos))
{
- this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockToAir(pos);
return false;
}
@@ -97,9 +96,8 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- spawnAsEntity(worldIn, pos, new ItemStack(Items.snowball, ((Integer)state.getValue(LAYERS)).intValue() + 1, 0));
+ super.harvestBlock(worldIn, player, pos, state, te, p_180657_6_);
worldIn.setBlockToAir(pos);
- player.triggerAchievement(StatList.func_188055_a(this));
}
public Item getItemDropped(IBlockState state, Random rand, int fortune)
@@ -109,14 +107,13 @@
public int quantityDropped(Random random)
{
- 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);
}
}
@@ -150,6 +147,8 @@
return ((Integer)state.getValue(LAYERS)).intValue() - 1;
}
+ @Override public int quantityDropped(IBlockState state, int fortune, Random random){ return ((Integer)state.getValue(LAYERS)) + 1; }
+
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] {LAYERS});

View file

@ -1,22 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStairs.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStairs.java
@@ -443,6 +443,19 @@
return new BlockStateContainer(this, new IProperty[] {FACING, HALF, SHAPE});
}
+ @Override
+ public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face)
+ {
+ if ( state.func_185914_p() )
+ return true;
+
+ // face is on the block being rendered, not this block.
+ IBlockState iblockstate = world.getBlockState(pos);
+ EnumHalf half = iblockstate.getValue(HALF);
+ EnumFacing side = iblockstate.getValue(FACING);
+ return side == face.getOpposite() || (half == EnumHalf.TOP && face == EnumFacing.DOWN) || (half == EnumHalf.BOTTOM && face == EnumFacing.UP);
+ }
+
public static enum EnumHalf implements IStringSerializable
{
TOP("top"),

View file

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java
@@ -52,7 +52,7 @@
{
blockpos = blockpos.add(rand.nextInt(3) - 1, 1, rand.nextInt(3) - 1);
- if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos))
+ if (blockpos.getY() >= 0 && blockpos.getY() < worldIn.getHeight() && !worldIn.isBlockLoaded(blockpos))
{
return;
}

View file

@ -1,46 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
@@ -89,9 +89,10 @@
}
pos = pos.offset(EnumFacing.Plane.HORIZONTAL.random(rand));
- Block block = worldIn.getBlockState(pos.down()).getBlock();
+ IBlockState soil = worldIn.getBlockState(pos.down());
+ Block block = soil.getBlock();
- if (worldIn.getBlockState(pos).getBlock().blockMaterial == Material.air && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
+ if (worldIn.isAirBlock(pos) && (block.canSustainPlant(soil, worldIn, pos.down(), EnumFacing.UP, this) || block == Blocks.dirt || block == Blocks.grass))
{
worldIn.setBlockState(pos, this.crop.getDefaultState());
}
@@ -109,8 +110,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();
@@ -120,13 +125,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

@ -1,61 +0,0 @@
--- ../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);
protected static final AxisAlignedBB field_185522_c = new AxisAlignedBB(0.09999999403953552D, 0.0D, 0.09999999403953552D, 0.8999999761581421D, 0.800000011920929D, 0.8999999761581421D);
@@ -41,7 +41,7 @@
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
- return this.func_185514_i(worldIn.getBlockState(pos.down()));
+ return super.canBlockStay(worldIn, pos, state);
}
public boolean isReplaceable(IBlockAccess worldIn, BlockPos pos)
@@ -51,7 +51,7 @@
public Item getItemDropped(IBlockState state, Random rand, int fortune)
{
- return rand.nextInt(8) == 0 ? Items.wheat_seeds : null;
+ return null;
}
public int quantityDroppedWithBonus(int fortune, Random random)
@@ -61,7 +61,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop Taken care of by IShearable
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.tallgrass, 1, ((BlockTallGrass.EnumType)state.getValue(TYPE)).getMeta()));
@@ -181,4 +181,22 @@
}
}
}
+
+ @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

@ -1,47 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java
@@ -79,14 +79,14 @@
private boolean canPlaceOn(World worldIn, BlockPos pos)
{
- if (worldIn.getBlockState(pos).func_185896_q())
+ IBlockState state = worldIn.getBlockState(pos);
+ if (state.isSideSolid(worldIn, pos, EnumFacing.UP))
{
return true;
}
else
{
- Block block = worldIn.getBlockState(pos).getBlock();
- return block instanceof BlockFence || block == Blocks.glass || block == Blocks.cobblestone_wall || block == Blocks.stained_glass;
+ return state.getBlock().canPlaceTorchOnTop(state, worldIn, pos);
}
}
@@ -107,7 +107,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)
@@ -120,7 +120,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);
}
@@ -153,7 +153,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), enumfacing, true))
{
flag = true;
}

View file

@ -1,21 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java
@@ -241,6 +241,18 @@
return new BlockStateContainer(this, new IProperty[] {FACING, OPEN, HALF});
}
+ @Override
+ public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity)
+ {
+ if (state.getValue(OPEN))
+ {
+ IBlockState down = world.getBlockState(pos.down());
+ if (down.getBlock() == net.minecraft.init.Blocks.ladder)
+ return down.getValue(BlockLadder.FACING) == state.getValue(FACING);
+ }
+ return false;
+ }
+
public static enum DoorHalf implements IStringSerializable
{
TOP("top"),

View file

@ -1,28 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java
@@ -77,14 +77,14 @@
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side)
{
- return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).func_185915_l();
+ return side.getAxis().isHorizontal() && worldIn.getBlockState(pos.offset(side.getOpposite())).isSideSolid(worldIn, pos.offset(side.getOpposite()), side);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
- if (worldIn.getBlockState(pos.offset(enumfacing)).func_185915_l())
+ if (worldIn.getBlockState(pos.offset(enumfacing)).isSideSolid(worldIn, pos.offset(enumfacing), enumfacing.getOpposite()))
{
return true;
}
@@ -118,7 +118,7 @@
{
EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
- if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).func_185915_l())
+ if (!worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).isSideSolid(worldIn, pos.offset(enumfacing.getOpposite()), enumfacing))
{
this.dropBlockAsItem(worldIn, pos, state, 0);
worldIn.setBlockToAir(pos);

View file

@ -1,35 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
@@ -26,7 +26,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");
@@ -342,7 +342,7 @@
public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack p_180657_6_)
{
- if (!worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears)
+ if (false && !worldIn.isRemote && p_180657_6_ != null && p_180657_6_.getItem() == Items.shears) // Forge: Noop, Covered by IShearable
{
player.triggerAchievement(StatList.func_188055_a(this));
spawnAsEntity(worldIn, pos, new ItemStack(Blocks.vine, 1, 0));
@@ -457,4 +457,14 @@
return i;
}
+ /*************************FORGE START***********************************/
+ @Override public boolean isLadder(IBlockState state, 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

@ -1,29 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java
+++ ../src-work/minecraft/net/minecraft/block/state/BlockPistonStructureHelper.java
@@ -80,7 +80,7 @@
IBlockState iblockstate = this.world.getBlockState(origin);
Block block = iblockstate.getBlock();
- if (iblockstate.func_185904_a() == Material.air)
+ if (iblockstate.getBlock().isAir(iblockstate, this.world, origin))
{
return true;
}
@@ -112,7 +112,7 @@
iblockstate = this.world.getBlockState(blockpos);
block = iblockstate.getBlock();
- if (iblockstate.func_185904_a() == Material.air || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos) || !BlockPistonBase.func_185646_a(iblockstate, this.world, blockpos, this.moveDirection, false) || blockpos.equals(this.pistonPos))
{
break;
}
@@ -159,7 +159,7 @@
iblockstate = this.world.getBlockState(blockpos1);
- if (iblockstate.func_185904_a() == Material.air)
+ if (iblockstate.getBlock().isAir(iblockstate, this.world, blockpos1))
{
return true;
}

View file

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

View file

@ -1,77 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/state/BlockStateContainer.java
+++ ../src-work/minecraft/net/minecraft/block/state/BlockStateContainer.java
@@ -55,6 +55,16 @@
public BlockStateContainer(Block blockIn, IProperty<?>... properties)
{
+ this(blockIn, properties, null);
+ }
+
+ protected StateImplementation createState(Block block, ImmutableMap<IProperty<?>, Comparable<?>> properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
+ return new StateImplementation(block, properties);
+ }
+
+ protected BlockStateContainer(Block blockIn, IProperty<?>[] properties, ImmutableMap<net.minecraftforge.common.property.IUnlistedProperty<?>, com.google.common.base.Optional<?>> unlistedProperties)
+ {
this.block = blockIn;
Map < String, IProperty<? >> map = Maps. < String, IProperty<? >> newHashMap();
@@ -71,7 +81,7 @@
for (List < Comparable<? >> list : Cartesian.cartesianProduct(this.getAllowedValues()))
{
Map < IProperty<?>, Comparable<? >> map1 = MapPopulator. < IProperty<?>, Comparable<? >> createMap(this.properties.values(), list);
- BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = new BlockStateContainer.StateImplementation(blockIn, ImmutableMap.copyOf(map1));
+ BlockStateContainer.StateImplementation blockstatecontainer$stateimplementation = createState(blockIn, ImmutableMap.copyOf(map1), unlistedProperties);
map2.put(map1, blockstatecontainer$stateimplementation);
list1.add(blockstatecontainer$stateimplementation);
}
@@ -163,6 +173,13 @@
this.properties = propertiesIn;
}
+ protected StateImplementation(Block blockIn, ImmutableMap<IProperty<?>, Comparable<?>> propertiesIn, ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> propertyValueTable)
+ {
+ this.block = blockIn;
+ this.properties = propertiesIn;
+ this.propertyValueTable = propertyValueTable;
+ }
+
public Collection < IProperty<? >> getPropertyNames()
{
return Collections. < IProperty<? >> unmodifiableCollection(this.properties.keySet());
@@ -414,5 +431,34 @@
{
return this.block.func_185481_k(this);
}
+
+ //Forge Start
+ public ImmutableTable<IProperty<?>, Comparable<?>, IBlockState> getPropertyValueTable()
+ {
+ return propertyValueTable;
+ }
+
+ @Override
+ public int getLightOpacity(IBlockAccess world, BlockPos pos)
+ {
+ return this.block.getLightOpacity(this, world, pos);
+ }
+
+ @Override
+ public int getLightValue(IBlockAccess world, BlockPos pos)
+ {
+ return this.block.getLightValue(this, world, pos);
+ }
+
+ public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return this.block.isSideSolid(this, world, pos, side);
+ }
+
+ @Override
+ public boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side)
+ {
+ return this.block.doesSideBlockRendering(this, world, pos, side);
+ }
}
}

View file

@ -1,27 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/state/IBlockProperties.java
+++ ../src-work/minecraft/net/minecraft/block/state/IBlockProperties.java
@@ -25,9 +25,13 @@
boolean func_185913_b();
+ @Deprecated //Forge location aware version below
int func_185891_c();
+ int getLightOpacity(IBlockAccess world, BlockPos pos);
+ @Deprecated //Forge location aware version below
int func_185906_d();
+ int getLightValue(IBlockAccess world, BlockPos pos);
@SideOnly(Side.CLIENT)
boolean func_185895_e();
@@ -88,5 +92,10 @@
RayTraceResult func_185910_a(World p_185910_1_, BlockPos p_185910_2_, Vec3d p_185910_3_, Vec3d p_185910_4_);
+ @Deprecated // Forge: Use isSideSolid(IBlockAccess, BlockPos, EnumFacing.UP) instead
boolean func_185896_q();
+
+ //Forge added functions
+ boolean doesSideBlockRendering(IBlockAccess world, BlockPos pos, EnumFacing side);
+ boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side);
}

View file

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

View file

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

View file

@ -1,476 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -318,7 +318,6 @@
this.sessionService = (new YggdrasilAuthenticationService(this.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;
@@ -432,10 +431,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.skinManager = new SkinManager(this.renderEngine, new File(this.fileAssets, "skins"), this.sessionService);
this.saveLoader = new AnvilSaveConverter(new File(this.mcDataDir, "saves"), this.field_184131_U);
this.mcSoundHandler = new SoundHandler(this.mcResourceManager, this.gameSettings);
@@ -469,6 +468,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);
@@ -482,19 +483,23 @@
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);
this.field_184127_aH = BlockColors.func_186723_a();
this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH);
+ bar.step("Loading Item Renderer");
this.renderItem = new RenderItem(this.renderEngine, this.modelManager, this.field_184128_aI);
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.field_184127_aH);
@@ -504,23 +509,26 @@
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);
this.field_184132_p = new DebugRenderer(this);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete();
if (this.gameSettings.fullScreen && !this.fullscreen)
{
this.toggleFullscreen();
@@ -692,21 +700,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()
@@ -899,11 +909,6 @@
public void displayGuiScreen(GuiScreen guiScreenIn)
{
- if (this.currentScreen != null)
- {
- this.currentScreen.onGuiClosed();
- }
-
if (guiScreenIn == null && this.theWorld == null)
{
guiScreenIn = new GuiMainMenu();
@@ -913,6 +918,17 @@
guiScreenIn = new GuiGameOver((ITextComponent)null);
}
+ 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 || guiScreenIn instanceof GuiMultiplayer)
{
this.gameSettings.showDebugInfo = false;
@@ -1051,9 +1067,11 @@
if (!this.skipRenderWorld)
{
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.timer.renderPartialTicks);
this.mcProfiler.endStartSection("gameRenderer");
this.entityRenderer.updateCameraAndRender(this.timer.renderPartialTicks, i);
this.mcProfiler.endSection();
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.timer.renderPartialTicks);
}
this.mcProfiler.endSection();
@@ -1393,9 +1411,9 @@
{
BlockPos blockpos = this.objectMouseOver.getBlockPos();
- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit))
+ if (!this.theWorld.isAirBlock(blockpos) && this.playerController.onPlayerDamageBlock(blockpos, this.objectMouseOver.sideHit))
{
- this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver.sideHit);
+ this.effectRenderer.addBlockHitEffects(blockpos, this.objectMouseOver);
this.thePlayer.func_184609_a(EnumHand.MAIN_HAND);
}
}
@@ -1429,7 +1447,7 @@
case BLOCK:
BlockPos blockpos = this.objectMouseOver.getBlockPos();
- if (this.theWorld.getBlockState(blockpos).func_185904_a() != Material.air)
+ if (!this.theWorld.isAirBlock(blockpos))
{
this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit);
break;
@@ -1623,6 +1641,8 @@
--this.rightClickDelayTimer;
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick();
+
this.mcProfiler.startSection("gui");
if (!this.isGamePaused)
@@ -1734,6 +1754,7 @@
this.joinPlayerCounter = 0;
this.theWorld.joinEntityInSurroundings(this.thePlayer);
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput();
}
this.mcProfiler.endStartSection("gameRenderer");
@@ -1821,6 +1842,7 @@
this.myNetworkManager.processReceivedPackets();
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick();
this.mcProfiler.endSection();
this.systemTime = getSystemTime();
}
@@ -1926,6 +1948,7 @@
this.gameSettings.showLagometer = this.gameSettings.showDebugInfo && GuiScreen.isAltKeyDown();
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput();
}
}
@@ -2166,6 +2189,8 @@
{
while (Mouse.next())
{
+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;
+
int i = Mouse.getEventButton();
KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());
@@ -2231,6 +2256,7 @@
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);
@@ -2273,6 +2299,12 @@
while (!this.theIntegratedServer.serverIsInRunLoop())
{
+ if (!net.minecraftforge.fml.common.StartupQuery.check())
+ {
+ loadWorld(null);
+ displayGuiScreen(null);
+ return;
+ }
String s = this.theIntegratedServer.getUserMessage();
if (s != null)
@@ -2298,8 +2330,14 @@
SocketAddress socketaddress = this.theIntegratedServer.getNetworkSystem().addLocalEndpoint();
NetworkManager networkmanager = NetworkManager.provideLocalClient(socketaddress);
networkmanager.setNetHandler(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null));
- networkmanager.sendPacket(new C00Handshake(107, socketaddress.toString(), 0, EnumConnectionState.LOGIN));
- networkmanager.sendPacket(new CPacketLoginStart(this.getSession().getProfile()));
+ networkmanager.sendPacket(new C00Handshake(107, 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 CPacketLoginStart(gameProfile));
this.myNetworkManager = networkmanager;
}
@@ -2310,6 +2348,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();
@@ -2322,6 +2362,18 @@
if (this.theIntegratedServer != null && this.theIntegratedServer.isAnvilFileSet())
{
this.theIntegratedServer.initiateShutdown();
+ 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;
@@ -2345,6 +2397,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();
@@ -2461,159 +2514,8 @@
{
if (this.objectMouseOver != null && this.objectMouseOver.typeOfHit != RayTraceResult.Type.MISS)
{
- boolean flag = this.thePlayer.capabilities.isCreativeMode;
- TileEntity tileentity = null;
- ItemStack itemstack;
-
- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
- {
- BlockPos blockpos = this.objectMouseOver.getBlockPos();
- IBlockState iblockstate = this.theWorld.getBlockState(blockpos);
- Block block = iblockstate.getBlock();
-
- if (iblockstate.func_185904_a() == Material.air)
- {
- return;
- }
-
- itemstack = block.func_185473_a(this.theWorld, blockpos, iblockstate);
-
- if (itemstack == null)
- {
- return;
- }
-
- if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
- {
- tileentity = this.theWorld.getTileEntity(blockpos);
- }
- }
- else
- {
- if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag)
- {
- return;
- }
-
- if (this.objectMouseOver.entityHit instanceof EntityPainting)
- {
- itemstack = new ItemStack(Items.painting);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
- {
- itemstack = new ItemStack(Items.lead);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
- {
- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
- ItemStack itemstack1 = entityitemframe.getDisplayedItem();
-
- if (itemstack1 == null)
- {
- itemstack = new ItemStack(Items.item_frame);
- }
- else
- {
- itemstack = ItemStack.copyItemStack(itemstack1);
- }
- }
- else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
- {
- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
- Item item;
-
- switch (entityminecart.func_184264_v())
- {
- case FURNACE:
- item = Items.furnace_minecart;
- break;
- case CHEST:
- item = Items.chest_minecart;
- break;
- case TNT:
- item = Items.tnt_minecart;
- break;
- case HOPPER:
- item = Items.hopper_minecart;
- break;
- case COMMAND_BLOCK:
- item = Items.command_block_minecart;
- break;
- default:
- item = Items.minecart;
- }
-
- itemstack = new ItemStack(item);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityBoat)
- {
- itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).func_184455_j());
- }
- else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
- {
- itemstack = new ItemStack(Items.armor_stand);
- }
- else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal)
- {
- itemstack = new ItemStack(Items.field_185158_cP);
- }
- else
- {
- String s = EntityList.getEntityString(this.objectMouseOver.entityHit);
-
- if (!EntityList.entityEggs.containsKey(s))
- {
- return;
- }
-
- itemstack = new ItemStack(Items.spawn_egg);
- ItemMonsterPlacer.func_185078_a(itemstack, s);
- }
- }
-
- if (itemstack.getItem() == null)
- {
- String s1 = "";
-
- if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
- {
- s1 = ((ResourceLocation)Block.blockRegistry.getNameForObject(this.theWorld.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString();
- }
- else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY)
- {
- s1 = EntityList.getEntityString(this.objectMouseOver.entityHit);
- }
-
- logger.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s1});
- }
- else
- {
- InventoryPlayer inventoryplayer = this.thePlayer.inventory;
-
- if (tileentity != null)
- {
- this.func_184119_a(itemstack, tileentity);
- }
-
- int i = inventoryplayer.func_184429_b(itemstack);
-
- if (flag)
- {
- inventoryplayer.func_184434_a(itemstack);
- this.playerController.sendSlotPacket(this.thePlayer.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem);
- }
- else if (i != -1)
- {
- if (InventoryPlayer.func_184435_e(i))
- {
- inventoryplayer.currentItem = i;
- }
- else
- {
- this.playerController.func_187100_a(i);
- }
- }
- }
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld);
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
}
}
@@ -2909,18 +2811,8 @@
public static int getGLMaximumTextureSize()
{
- for (int i = 16384; i > 0; i >>= 1)
- {
- GlStateManager.func_187419_a(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null);
- int j = GlStateManager.func_187411_c(32868, 0, 4096);
-
- if (j != 0)
- {
- return i;
- }
- }
-
- return -1;
+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done.
+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize();
}
public boolean isSnooperEnabled()

View file

@ -1,41 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java
+++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java
@@ -76,6 +76,7 @@
{
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundSetupEvent(this));
}
catch (SoundSystemException soundsystemexception)
{
@@ -100,6 +101,7 @@
this.unloadSoundSystem();
this.loadSoundSystem();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.SoundLoadEvent(this));
}
private synchronized void loadSoundSystem()
@@ -350,6 +352,9 @@
}
else
{
+ p_sound = net.minecraftforge.client.ForgeHooksClient.playSound(this, p_sound);
+ if (p_sound == null) return;
+
if (!this.field_188777_o.isEmpty())
{
for (ISoundEventListener isoundeventlistener : this.field_188777_o)
@@ -400,10 +405,12 @@
if (sound.func_188723_h())
{
this.sndSystem.newStreamingSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlayStreamingSourceEvent(this, p_sound, s));
}
else
{
this.sndSystem.newSource(false, s, getURLForSoundResource(resourcelocation1), resourcelocation1.toString(), flag, p_sound.getXPosF(), p_sound.getYPosF(), p_sound.getZPosF(), p_sound.getAttenuationType().getTypeInt(), f);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.sound.PlaySoundSourceEvent(this, p_sound, s));
}
logger.debug(LOG_MARKER, "Playing sound {} for event {} as channel {}", new Object[] {sound.func_188719_a(), resourcelocation1, s});

View file

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

View file

@ -1,73 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
@@ -400,6 +400,15 @@
this.mc.ingameGUI.getChatGUI().printChatMessage(chatComponent);
}
+ private boolean isHeadspaceFree(BlockPos pos, int height)
+ {
+ for (int y = 0; y < height; y++)
+ {
+ if (isOpenBlockSpace(pos.add(0, y, 0))) return false;
+ }
+ return true;
+ }
+
protected boolean pushOutOfBlocks(double x, double y, double z)
{
if (this.noClip)
@@ -412,30 +421,34 @@
double d0 = x - (double)blockpos.getX();
double d1 = z - (double)blockpos.getZ();
- if (!this.isOpenBlockSpace(blockpos))
+ int entHeight = Math.max(Math.round(this.height), 1);
+
+ boolean inTranslucentBlock = this.isHeadspaceFree(blockpos, entHeight);
+
+ if (inTranslucentBlock)
{
int i = -1;
double d2 = 9999.0D;
- if (this.isOpenBlockSpace(blockpos.west()) && d0 < d2)
+ if (!this.isHeadspaceFree(blockpos.west(), entHeight) && d0 < d2)
{
d2 = d0;
i = 0;
}
- if (this.isOpenBlockSpace(blockpos.east()) && 1.0D - d0 < d2)
+ if (!this.isHeadspaceFree(blockpos.east(), entHeight) && 1.0D - d0 < d2)
{
d2 = 1.0D - d0;
i = 1;
}
- if (this.isOpenBlockSpace(blockpos.north()) && d1 < d2)
+ if (!this.isHeadspaceFree(blockpos.north(), entHeight) && d1 < d2)
{
d2 = d1;
i = 4;
}
- if (this.isOpenBlockSpace(blockpos.south()) && 1.0D - d1 < d2)
+ if (!this.isHeadspaceFree(blockpos.south(), entHeight) && 1.0D - d1 < d2)
{
d2 = 1.0D - d1;
i = 5;
@@ -515,7 +528,13 @@
public void func_184185_a(SoundEvent p_184185_1_, float p_184185_2_, float p_184185_3_)
{
- this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_, false);
+ net.minecraftforge.event.entity.PlaySoundAtEntityEvent event = net.minecraftforge.event.ForgeEventFactory.onPlaySoundAtEntity(this, p_184185_1_, this.func_184176_by(), p_184185_2_, p_184185_3_);
+ if (event.isCanceled() || event.getSound() == null) return;
+ p_184185_1_ = event.getSound();
+ p_184185_2_ = event.getVolume();
+ p_184185_3_ = event.getPitch();
+
+ this.worldObj.func_184134_a(this.posX, this.posY, this.posZ, p_184185_1_, event.getCategory(), p_184185_2_, p_184185_3_, false);
}
public boolean isServerWorld()

View file

@ -1,144 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/FontRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/FontRenderer.java
@@ -57,7 +57,7 @@
this.locationFontTexture = location;
this.renderEngine = textureManagerIn;
this.unicodeFlag = unicode;
- textureManagerIn.bindTexture(this.locationFontTexture);
+ bindTexture(this.locationFontTexture);
for (int i = 0; i < 32; ++i)
{
@@ -97,6 +97,7 @@
public void onResourceManagerReload(IResourceManager resourceManager)
{
this.readFontTexture();
+ this.readGlyphSizes();
}
private void readFontTexture()
@@ -106,7 +107,7 @@
try
{
- iresource = Minecraft.getMinecraft().getResourceManager().getResource(this.locationFontTexture);
+ iresource = getResource(this.locationFontTexture);
bufferedimage = TextureUtil.readBufferedImage(iresource.getInputStream());
}
catch (IOException ioexception)
@@ -171,7 +172,7 @@
try
{
- iresource = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("font/glyph_sizes.bin"));
+ iresource = getResource(new ResourceLocation("font/glyph_sizes.bin"));
iresource.getInputStream().read(this.glyphWidth);
}
catch (IOException ioexception)
@@ -202,7 +203,7 @@
int i = ch % 16 * 8;
int j = ch / 16 * 8;
int k = italic ? 1 : 0;
- this.renderEngine.bindTexture(this.locationFontTexture);
+ bindTexture(this.locationFontTexture);
int l = this.charWidth[ch];
float f = (float)l - 0.01F;
GlStateManager.func_187447_r(5);
@@ -230,7 +231,7 @@
private void loadGlyphTexture(int page)
{
- this.renderEngine.bindTexture(this.getUnicodePageLocation(page));
+ bindTexture(this.getUnicodePageLocation(page));
}
protected float renderUnicodeChar(char ch, boolean italic)
@@ -279,7 +280,7 @@
public int drawString(String text, float x, float y, int color, boolean dropShadow)
{
- GlStateManager.enableAlpha();
+ enableAlpha();
this.resetStyles();
int i;
@@ -349,7 +350,7 @@
int j1 = this.colorCode[i1];
this.textColor = j1;
- GlStateManager.color((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha);
+ setColor((float)(j1 >> 16) / 255.0F, (float)(j1 >> 8 & 255) / 255.0F, (float)(j1 & 255) / 255.0F, this.alpha);
}
else if (i1 == 16)
{
@@ -378,7 +379,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;
@@ -406,7 +407,7 @@
c0 = c1;
}
- float f1 = this.unicodeFlag ? 0.5F : 1.0F;
+ float f1 = j == -1 || this.unicodeFlag ? 0.5f : 1f;
boolean flag = (c0 == 0 || j == -1 || this.unicodeFlag) && shadow;
if (flag)
@@ -444,7 +445,16 @@
++f;
}
+ doDraw(f);
+ }
+ }
+ }
+ protected void doDraw(float f)
+ {
+ {
+ {
+
if (this.strikethroughStyle)
{
Tessellator tessellator = Tessellator.getInstance();
@@ -517,7 +527,7 @@
this.blue = (float)(color >> 8 & 255) / 255.0F;
this.green = (float)(color & 255) / 255.0F;
this.alpha = (float)(color >> 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 = x;
this.posY = y;
this.renderStringAtPos(text, dropShadow);
@@ -848,6 +858,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 IResource getResource(ResourceLocation location) throws IOException
+ {
+ return Minecraft.getMinecraft().getResourceManager().getResource(location);
+ }
+
public int getColorCode(char character)
{
int i = "0123456789abcdef".indexOf(character);

View file

@ -1,22 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java
@@ -22,6 +22,7 @@
public boolean enabled;
public boolean visible;
protected boolean hovered;
+ public int packedFGColour; //FML
public GuiButton(int buttonId, int x, int y, String buttonText)
{
@@ -75,6 +76,11 @@
this.mouseDragged(mc, mouseX, mouseY);
int j = 14737632;
+ if (packedFGColour != 0)
+ {
+ j = packedFGColour;
+ }
+ else
if (!this.enabled)
{
j = 10526880;

View file

@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java
@@ -250,6 +250,7 @@
public BlockPos func_186839_b()
{
+
BlockPos blockpos = null;
if (this.field_186853_g.objectMouseOver != null && this.field_186853_g.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)

View file

@ -1,36 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
@@ -205,6 +205,8 @@
}
}
+ WorldType.worldTypes[this.selectedIndex].onGUICreateWorldPress();
+
WorldSettings worldsettings = new WorldSettings(i, WorldSettings.GameType.getByName(this.gameMode), this.field_146341_s, this.field_146337_w, WorldType.worldTypes[this.selectedIndex]);
worldsettings.setWorldName(this.chunkProviderSettingsJson);
@@ -311,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);
}
}
}
@@ -370,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

@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java
@@ -360,7 +360,8 @@
BlockPos blockpos = raytraceresult.getBlockPos();
- if (!this.mc.theWorld.getBlockState(blockpos).getBlock().hasTileEntity() || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory))
+ net.minecraft.block.state.IBlockState state = this.mc.theWorld.getBlockState(blockpos);
+ if (!state.getBlock().hasTileEntity(state) || !(this.mc.theWorld.getTileEntity(blockpos) instanceof IInventory))
{
return;
}

View file

@ -1,33 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
@@ -30,8 +30,9 @@
this.buttonList.add(new GuiButton(4, this.width / 2 - 100, this.height / 4 + 24 + i, I18n.format("menu.returnToGame", new Object[0])));
this.buttonList.add(new GuiButton(0, this.width / 2 - 100, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.options", new Object[0])));
+ this.buttonList.add(new GuiButton(12, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("fml.menu.modoptions")));
GuiButton guibutton;
- this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + i, 98, 20, I18n.format("menu.shareToLan", new Object[0])));
+ this.buttonList.add(guibutton = new GuiButton(7, this.width / 2 - 100, this.height / 4 + 72 + i, 200, 20, I18n.format("menu.shareToLan", new Object[0])));
this.buttonList.add(new GuiButton(5, this.width / 2 - 100, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.achievements", new Object[0])));
this.buttonList.add(new GuiButton(6, this.width / 2 + 2, this.height / 4 + 48 + i, 98, 20, I18n.format("gui.stats", new Object[0])));
guibutton.enabled = this.mc.isSingleplayer() && !this.mc.getIntegratedServer().getPublic();
@@ -74,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

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiListWorldSelectionEntry.java
@@ -242,7 +242,7 @@
if (this.field_186784_e.getSaveLoader().canLoadWorld(this.field_186786_g.getFileName()))
{
- this.field_186784_e.launchIntegratedServer(this.field_186786_g.getFileName(), this.field_186786_g.getDisplayName(), (WorldSettings)null);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(field_186785_f, this.field_186786_g);
}
}

View file

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

View file

@ -1,19 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
@@ -40,6 +40,7 @@
public GuiMultiplayer(GuiScreen parentScreen)
{
this.parentScreen = parentScreen;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().setupServerList();
}
public void initGui()
@@ -372,7 +373,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

@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
@@ -190,6 +190,9 @@
long l = j - k;
List<String> list = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.mc.isJava64bit() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(bytesToMb(l)), Long.valueOf(bytesToMb(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(bytesToMb(j))}), "", String.format("CPU: %s", new Object[]{OpenGlHelper.getCpu()}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GlStateManager.func_187416_u(7936)}), GlStateManager.func_187416_u(7937), GlStateManager.func_187416_u(7938)});
+ list.add("");
+ list.addAll(net.minecraftforge.fml.common.FMLCommonHandler.instance().getBrandings(false));
+
if (this.isReducedDebug())
{
return list;

View file

@ -1,107 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java
@@ -141,7 +141,8 @@
}
}
- this.drawHoveringText(list, x, y);
+ FontRenderer font = stack.getItem().getFontRenderer(stack);
+ this.drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
}
protected void drawCreativeTabHoveringText(String tabName, int mouseX, int mouseY)
@@ -151,6 +152,11 @@
protected void drawHoveringText(List<String> textLines, int x, int y)
{
+ drawHoveringText(textLines, x, y, fontRendererObj);
+ }
+
+ protected void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font)
+ {
if (!textLines.isEmpty())
{
GlStateManager.disableRescaleNormal();
@@ -161,7 +167,7 @@
for (String s : textLines)
{
- int j = this.fontRendererObj.getStringWidth(s);
+ int j = font.getStringWidth(s);
if (j > i)
{
@@ -206,7 +212,7 @@
for (int k1 = 0; k1 < textLines.size(); ++k1)
{
String s1 = (String)textLines.get(k1);
- this.fontRendererObj.drawStringWithShadow(s1, (float)l1, (float)i2, -1);
+ font.drawStringWithShadow(s1, (float)l1, (float)i2, -1);
if (k1 == 0)
{
@@ -421,6 +427,7 @@
{
this.mc.ingameGUI.getChatGUI().addToSentMessages(msg);
}
+ if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(mc.thePlayer, msg) != 0) return;
this.mc.thePlayer.sendChatMessage(msg);
}
@@ -435,9 +442,15 @@
if (guibutton.mousePressed(this.mc, mouseX, mouseY))
{
+ net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre event = new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Pre(this, guibutton, this.buttonList);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
+ break;
+ guibutton = event.button;
this.selectedButton = guibutton;
guibutton.playPressSound(this.mc.getSoundHandler());
this.actionPerformed(guibutton);
+ if (this.equals(this.mc.currentScreen))
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.ActionPerformedEvent.Post(this, event.button, this.buttonList));
}
}
}
@@ -467,8 +480,12 @@
this.fontRendererObj = mc.fontRendererObj;
this.width = width;
this.height = height;
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Pre(this, this.buttonList)))
+ {
this.buttonList.clear();
this.initGui();
+ }
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent.Post(this, this.buttonList));
}
public void func_183500_a(int p_183500_1_, int p_183500_2_)
@@ -487,7 +504,9 @@
{
while (Mouse.next())
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Pre(this))) continue;
this.handleMouseInput();
+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.MouseInputEvent.Post(this));
}
}
@@ -495,7 +514,9 @@
{
while (Keyboard.next())
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Pre(this))) continue;
this.handleKeyboardInput();
+ if (this.equals(this.mc.currentScreen)) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent.Post(this));
}
}
}
@@ -557,6 +578,7 @@
public void drawDefaultBackground()
{
this.drawWorldBackground(0);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.BackgroundDrawnEvent(this));
}
public void drawWorldBackground(int tint)

View file

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSleepMP.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSleepMP.java
@@ -32,7 +32,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

@ -1,39 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java
@@ -181,15 +181,8 @@
GlStateManager.disableFog();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer vertexbuffer = tessellator.getWorldRenderer();
- this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- float f = 32.0F;
- vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
- vertexbuffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- vertexbuffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- vertexbuffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- vertexbuffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
- tessellator.draw();
+ // Forge: background rendering moved into separate method.
+ this.drawContainerBackground(tessellator);
int k = this.left + this.width / 2 - this.getListWidth() / 2 + 2;
int l = this.top + 4 - (int)this.amountScrolled;
@@ -458,4 +451,18 @@
{
return this.slotHeight;
}
+
+ protected void drawContainerBackground(Tessellator tessellator)
+ {
+ VertexBuffer buffer = tessellator.getWorldRenderer();
+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
+ GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
+ float f = 32.0F;
+ buffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
+ buffer.pos((double)this.left, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.right, (double)this.bottom, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.bottom + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.right, (double)this.top, 0.0D).func_187315_a((double)((float)this.right / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ buffer.pos((double)this.left, (double)this.top, 0.0D).func_187315_a((double)((float)this.left / f), (double)((float)(this.top + (int)this.amountScrolled) / f)).color(32, 32, 32, 255).endVertex();
+ tessellator.draw();
+ }
}

View file

@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiUtilRenderComponents.java
@@ -73,6 +73,7 @@
s3 = s4;
}
+ s3 = FontRenderer.getFormatFromString(s2) + s3; //Forge: Fix chat formatting not surviving line wrapping.
TextComponentString textcomponentstring2 = new TextComponentString(s3);
textcomponentstring2.setChatStyle(itextcomponent1.getChatStyle().createShallowCopy());
list1.add(j + 1, textcomponentstring2);

View file

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

View file

@ -1,116 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java
+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java
@@ -49,6 +49,10 @@
private StatFileWriter statFileWriter;
private boolean loadingAchievements = true;
+ private int currentPage = -1;
+ private GuiButton button;
+ private java.util.LinkedList<Achievement> minecraftAchievements = new java.util.LinkedList<Achievement>();
+
public GuiAchievements(GuiScreen parentScreenIn, StatFileWriter statFileWriterIn)
{
this.parentScreen = parentScreenIn;
@@ -57,6 +61,14 @@
int j = 141;
this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.field_187982_f.displayColumn * 24 - i / 2 - 12);
this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.field_187982_f.displayRow * 24 - j / 2);
+ minecraftAchievements.clear();
+ for (Achievement achievement : AchievementList.field_187981_e)
+ {
+ if (!net.minecraftforge.common.AchievementPage.isAchievementInPages(achievement))
+ {
+ minecraftAchievements.add(achievement);
+ }
+ }
}
public void initGui()
@@ -64,6 +76,7 @@
this.mc.getNetHandler().addToSendQueue(new CPacketClientStatus(CPacketClientStatus.State.REQUEST_STATS));
this.buttonList.clear();
this.buttonList.add(new GuiOptionButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.format("gui.done", new Object[0])));
+ this.buttonList.add(button = new GuiButton(2, (width - field_146555_f) / 2 + 24, height / 2 + 74, 125, 20, net.minecraftforge.common.AchievementPage.getTitle(currentPage)));
}
protected void actionPerformed(GuiButton button) throws IOException
@@ -74,6 +87,16 @@
{
this.mc.displayGuiScreen(this.parentScreen);
}
+
+ if (button.id == 2)
+ {
+ currentPage++;
+ if (currentPage >= net.minecraftforge.common.AchievementPage.getAchievementPages().size())
+ {
+ currentPage = -1;
+ }
+ this.button.displayString = net.minecraftforge.common.AchievementPage.getTitle(currentPage);
+ }
}
}
@@ -257,7 +280,9 @@
GlStateManager.depthFunc(518);
GlStateManager.pushMatrix();
GlStateManager.translate((float)i1, (float)j1, -200.0F);
- GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 0.0F);
+ // FIXES models rendering weirdly in the acheivements pane
+ // see https://github.com/MinecraftForge/MinecraftForge/commit/1b7ce7592caafb760ec93066184182ae0711e793#commitcomment-10512284
+ GlStateManager.scale(1.0F / this.field_146570_r, 1.0F / this.field_146570_r, 1.0F);
GlStateManager.enableTexture2D();
GlStateManager.disableLighting();
GlStateManager.enableRescaleNormal();
@@ -331,11 +356,12 @@
GlStateManager.depthFunc(515);
this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
- for (int j5 = 0; j5 < AchievementList.field_187981_e.size(); ++j5)
+ java.util.List<Achievement> achievementList = (currentPage == -1 ? minecraftAchievements : net.minecraftforge.common.AchievementPage.getAchievementPage(currentPage).getAchievements());
+ for (int j5 = 0; j5 < achievementList.size(); ++j5)
{
Achievement achievement1 = (Achievement)AchievementList.field_187981_e.get(j5);
- if (achievement1.parentAchievement != null)
+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement))
{
int k5 = achievement1.displayColumn * 24 - i + 11;
int l5 = achievement1.displayRow * 24 - j + 11;
@@ -389,9 +415,9 @@
GlStateManager.enableRescaleNormal();
GlStateManager.enableColorMaterial();
- for (int i6 = 0; i6 < AchievementList.field_187981_e.size(); ++i6)
+ for (int i6 = 0; i6 < achievementList.size(); ++i6)
{
- Achievement achievement2 = (Achievement)AchievementList.field_187981_e.get(i6);
+ Achievement achievement2 = achievementList.get(i6);
int l6 = achievement2.displayColumn * 24 - i;
int j7 = achievement2.displayRow * 24 - j;
@@ -432,6 +458,7 @@
this.mc.getTextureManager().bindTexture(ACHIEVEMENT_BACKGROUND);
+ GlStateManager.enableBlend(); // Forge: Specifically enable blend because it is needed here. And we fix Generic RenderItem's leakage of it.
if (achievement2.getSpecial())
{
this.drawTexturedModalRect(l6 - 2, j7 - 2, 26, 202, 26, 26);
@@ -440,6 +467,7 @@
{
this.drawTexturedModalRect(l6 - 2, j7 - 2, 0, 202, 26, 26);
}
+ GlStateManager.disableBlend(); //Forge: Cleanup states we set.
if (!this.statFileWriter.canUnlockAchievement(achievement2))
{
@@ -448,7 +476,7 @@
this.itemRender.func_175039_a(false);
}
- GlStateManager.enableLighting();
+ GlStateManager.disableLighting(); //Forge: Make sure Lighting is disabled. Fixes MC-33065
GlStateManager.enableCull();
this.itemRender.renderItemAndEffectIntoGUI(achievement2.theItemStack, l6 + 3, j7 + 3);
GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);

View file

@ -1,70 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
@@ -176,8 +176,11 @@
GlStateManager.translate(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
this.itemRender.zLevel = 200.0F;
+ net.minecraft.client.gui.FontRenderer font = null;
+ if (stack != null) font = stack.getItem().getFontRenderer(stack);
+ if (font == null) font = fontRendererObj;
this.itemRender.renderItemAndEffectIntoGUI(stack, x, y);
- this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, x, y - (this.draggedStack == null ? 0 : 8), altText);
+ this.itemRender.renderItemOverlayIntoGUI(font, stack, x, y - (this.draggedStack == null ? 0 : 8), altText);
this.zLevel = 0.0F;
this.itemRender.zLevel = 0.0F;
}
@@ -240,13 +243,12 @@
if (itemstack == null && slotIn.canBeHovered())
{
- String s1 = slotIn.getSlotTexture();
+ TextureAtlasSprite textureatlassprite = slotIn.getBackgroundSprite();
- if (s1 != null)
+ if (textureatlassprite != null)
{
- TextureAtlasSprite textureatlassprite = this.mc.getTextureMapBlocks().getAtlasSprite(s1);
GlStateManager.disableLighting();
- this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
+ this.mc.getTextureManager().bindTexture(slotIn.getBackgroundLocation());
this.drawTexturedModalRect(i, j, textureatlassprite, 16, 16);
GlStateManager.enableLighting();
flag1 = true;
@@ -327,6 +329,7 @@
int j = this.guiLeft;
int k = this.guiTop;
boolean flag1 = mouseX < j || mouseY < k || mouseX >= j + this.xSize || mouseY >= k + this.ySize;
+ if (slot != null) flag1 = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int l = -1;
if (slot != null)
@@ -464,10 +467,12 @@
protected void mouseReleased(int mouseX, int mouseY, int state)
{
+ super.mouseReleased(mouseX, mouseY, state); //Forge, Call parent to release buttons
Slot slot = this.getSlotAtPosition(mouseX, mouseY);
int i = this.guiLeft;
int j = this.guiTop;
boolean flag = mouseX < i || mouseY < j || mouseX >= i + this.xSize || mouseY >= j + this.ySize;
+ if (slot != null) flag = false; // Forge, prevent dropping of items through slots outside of GUI boundaries
int k = -1;
if (slot != null)
@@ -686,4 +691,16 @@
this.mc.thePlayer.closeScreen();
}
}
+
+ /* ======================================== FORGE START =====================================*/
+
+ /**
+ * Returns the slot that is currently displayed under the mouse.
+ */
+ public Slot getSlotUnderMouse()
+ {
+ return this.theSlot;
+ }
+
+ /* ======================================== FORGE END =====================================*/
}

View file

@ -1,256 +0,0 @@
--- ../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 Slot field_147064_C;
private boolean field_147057_D;
private CreativeCrafting field_147059_E;
+ private static int tabPage = 0;
+ private int maxPages = 0;
public GuiContainerCreative(EntityPlayer p_i1088_1_)
{
@@ -258,6 +260,13 @@
this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]);
this.field_147059_E = new CreativeCrafting(this.mc);
this.mc.thePlayer.inventoryContainer.onCraftGuiOpened(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
{
@@ -279,7 +288,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))
{
@@ -317,6 +326,14 @@
GuiContainerCreative.ContainerCreative guicontainercreative$containercreative = (GuiContainerCreative.ContainerCreative)this.inventorySlots;
guicontainercreative$containercreative.itemList.clear();
+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex];
+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch)
+ {
+ tab.displayAllReleventItems(guicontainercreative$containercreative.itemList);
+ updateFilteredItems(guicontainercreative$containercreative);
+ return;
+ }
+
for (Item item : Item.itemRegistry)
{
if (item != null && item.getCreativeTab() != null)
@@ -324,7 +341,13 @@
item.getSubItems(item, (CreativeTabs)null, guicontainercreative$containercreative.itemList);
}
}
+ updateFilteredItems(guicontainercreative$containercreative);
+ }
+ //split from above for custom search tabs
+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative guicontainercreative$containercreative)
+ {
+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == CreativeTabs.tabAllSearch) // FORGE: Only add enchanted books to the regular search
for (Enchantment enchantment : Enchantment.field_185264_b)
{
if (enchantment != null && enchantment.type != null)
@@ -332,7 +355,6 @@
Items.enchanted_book.getAll(enchantment, guicontainercreative$containercreative.itemList);
}
}
-
Iterator<ItemStack> iterator = guicontainercreative$containercreative.itemList.iterator();
String s1 = this.searchField.getText().toLowerCase();
@@ -364,7 +386,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);
@@ -399,7 +421,7 @@
for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray)
{
- if (this.func_147049_a(creativetabs, i, j))
+ if (creativetabs != null && this.func_147049_a(creativetabs, i, j))
{
this.setCurrentCreativeTab(creativetabs);
return;
@@ -412,11 +434,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;
@@ -487,12 +511,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
@@ -562,20 +588,43 @@
}
super.drawScreen(mouseX, mouseY, partialTicks);
+ int start = tabPage * 10;
+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10) + 2);
+ if (tabPage != 0) start += 2;
+ boolean rendered = false;
- for (CreativeTabs creativetabs : CreativeTabs.creativeTabArray)
+ for (CreativeTabs creativetabs : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end))
{
+ if (creativetabs == null) continue;
if (this.renderCreativeInventoryHoveringText(creativetabs, mouseX, mouseY))
{
+ rendered = true;
break;
}
}
+ if (!rendered && renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, mouseX, mouseY))
+ {
+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, mouseX, mouseY);
+ }
+
if (this.field_147064_C != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, mouseX, mouseY))
{
this.drawCreativeTabHoveringText(I18n.format("inventory.binSlot", new Object[0]), mouseX, mouseY);
}
+ if (maxPages != 0)
+ {
+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
+ int width = fontRendererObj.getStringWidth(page);
+ GlStateManager.disableLighting();
+ this.zLevel = 300.0F;
+ itemRender.zLevel = 300.0F;
+ fontRendererObj.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1);
+ this.zLevel = 0.0F;
+ itemRender.zLevel = 0.0F;
+ }
+
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
}
@@ -637,16 +686,35 @@
RenderHelper.enableGUIStandardItemLighting();
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
- for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray)
+ int start = tabPage * 10;
+ int end = Math.min(CreativeTabs.creativeTabArray.length, ((tabPage + 1) * 10 + 2));
+ if (tabPage != 0) start += 2;
+
+ for (CreativeTabs creativetabs1 : java.util.Arrays.copyOfRange(CreativeTabs.creativeTabArray,start,end))
{
this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
+ if (creativetabs1 == null) continue;
if (creativetabs1.getTabIndex() != selectedTabIndex)
{
this.func_147051_a(creativetabs1);
}
}
+ if (tabPage != 0)
+ {
+ if (creativetabs != CreativeTabs.tabAllSearch)
+ {
+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
+ func_147051_a(CreativeTabs.tabAllSearch);
+ }
+ if (creativetabs != CreativeTabs.tabInventory)
+ {
+ this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
+ func_147051_a(CreativeTabs.tabInventory);
+ }
+ }
+
this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
this.searchField.drawTextBox();
@@ -661,6 +729,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)
@@ -671,6 +747,14 @@
protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_)
{
+ if (p_147049_1_.getTabPage() != tabPage)
+ {
+ if (p_147049_1_ != CreativeTabs.tabAllSearch && p_147049_1_ != CreativeTabs.tabInventory)
+ {
+ return false;
+ }
+ }
+
int i = p_147049_1_.getTabColumn();
int j = 28 * i;
int k = 0;
@@ -767,6 +851,8 @@
}
GlStateManager.disableLighting();
+ GlStateManager.color(1F, 1F, 1F); //Forge: Reset color in case Items change it.
+ GlStateManager.enableBlend(); //Forge: Make sure blend is enabled else tabs show a white border.
this.drawTexturedModalRect(l, i1, j, k, 28, j1);
this.zLevel = 100.0F;
this.itemRender.zLevel = 100.0F;
@@ -793,6 +879,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

@ -1,10 +0,0 @@
--- ../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

@ -1,18 +0,0 @@
--- ../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;
@@ -81,6 +80,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void render(VertexBuffer renderer, float scale)
{
for (int i = 0; i < this.quadList.length; ++i)

View file

@ -1,42 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java
@@ -9,7 +9,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class ModelRenderer
{
public float textureWidth;
@@ -108,6 +107,7 @@
this.rotationPointZ = rotationPointZIn;
}
+ @SideOnly(Side.CLIENT)
public void render(float p_78785_1_)
{
if (!this.isHidden)
@@ -189,6 +189,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void renderWithRotation(float p_78791_1_)
{
if (!this.isHidden)
@@ -224,6 +225,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void postRender(float scale)
{
if (!this.isHidden)
@@ -265,6 +267,7 @@
}
}
+ @SideOnly(Side.CLIENT)
private void compileDisplayList(float scale)
{
this.displayList = GLAllocation.generateDisplayLists(1);

View file

@ -1,13 +0,0 @@
--- ../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.math.Vec3d;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class PositionTextureVertex
{
public Vec3d vector3D;

View file

@ -1,18 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java
+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java
@@ -7,7 +7,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class TexturedQuad
{
public PositionTextureVertex[] vertexPositions;
@@ -43,6 +42,7 @@
this.vertexPositions = apositiontexturevertex;
}
+ @SideOnly(Side.CLIENT)
public void draw(VertexBuffer renderer, float scale)
{
Vec3d vec3d = this.vertexPositions[1].vector3D.subtractReverse(this.vertexPositions[0].vector3D);

View file

@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
@@ -52,6 +52,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

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
@@ -67,7 +67,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(107, ip, port, EnumConnectionState.LOGIN));
+ GuiConnecting.this.networkManager.sendPacket(new C00Handshake(107, ip, port, EnumConnectionState.LOGIN, true));
GuiConnecting.this.networkManager.sendPacket(new CPacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
}
catch (UnknownHostException unknownhostexception)

View file

@ -1,93 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -121,6 +121,12 @@
}
}
+ ItemStack stack = mc.thePlayer.func_184614_ca();
+ if (stack != null && stack.getItem() != null && stack.getItem().onBlockStartBreak(stack, p_187103_1_, mc.thePlayer))
+ {
+ return false;
+ }
+
if (this.currentGameType.isCreative() && this.mc.thePlayer.func_184614_ca() != null && this.mc.thePlayer.func_184614_ca().getItem() instanceof ItemSword)
{
return false;
@@ -142,14 +148,7 @@
else
{
world.playAuxSFX(2001, p_187103_1_, Block.getStateId(iblockstate));
- block.onBlockHarvested(world, p_187103_1_, iblockstate, this.mc.thePlayer);
- boolean flag = world.setBlockState(p_187103_1_, Blocks.air.getDefaultState(), 11);
- if (flag)
- {
- block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate);
- }
-
this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ());
if (!this.currentGameType.isCreative())
@@ -160,13 +159,20 @@
{
itemstack1.onBlockDestroyed(world, iblockstate, p_187103_1_, this.mc.thePlayer);
- if (itemstack1.stackSize == 0)
+ if (itemstack1.stackSize <= 0)
{
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.mc.thePlayer, itemstack1, EnumHand.MAIN_HAND);
this.mc.thePlayer.func_184611_a(EnumHand.MAIN_HAND, (ItemStack)null);
}
}
}
+ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, mc.thePlayer, false);
+
+ if (flag)
+ {
+ block.onBlockDestroyedByPlayer(world, p_187103_1_, iblockstate);
+ }
return flag;
}
}
@@ -373,11 +379,15 @@
{
if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
{
+ net.minecraft.item.Item item = p_187099_3_ == null ? null : p_187099_3_.getItem();
+ EnumActionResult ret = item == null ? EnumActionResult.PASS : item.onItemUseFirst(p_187099_3_, p_187099_1_, p_187099_2_, p_187099_4_, p_187099_5_, f, f1, f2, p_187099_7_);
+ if (ret != EnumActionResult.PASS) return ret;
+
IBlockState iblockstate = p_187099_2_.getBlockState(p_187099_4_);
- if ((!p_187099_1_.isSneaking() || p_187099_1_.func_184614_ca() == null && p_187099_1_.func_184592_cb() == null) && iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2))
+ if ((!p_187099_1_.isSneaking() || (p_187099_1_.func_184614_ca() == null || item.doesSneakBypassUse(p_187099_3_, p_187099_2_, p_187099_4_, p_187099_1_)) && p_187099_1_.func_184592_cb() == null))
{
- flag = true;
+ flag = iblockstate.getBlock().onBlockActivated(p_187099_2_, p_187099_4_, iblockstate, p_187099_1_, p_187099_7_, p_187099_3_, p_187099_5_, f, f1, f2);
}
if (!flag && p_187099_3_ != null && p_187099_3_.getItem() instanceof ItemBlock)
@@ -418,7 +428,9 @@
}
else
{
- return p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2);
+ EnumActionResult ret = p_187099_3_.onItemUse(p_187099_1_, p_187099_2_, p_187099_4_, p_187099_7_, p_187099_5_, f, f1, f2);
+ if (p_187099_3_.stackSize <= 0) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, p_187099_3_, p_187099_7_);
+ return ret;
}
}
else
@@ -453,9 +465,10 @@
{
p_187101_1_.func_184611_a(p_187101_4_, itemstack);
- if (itemstack.stackSize == 0)
+ if (itemstack.stackSize <= 0)
{
p_187101_1_.func_184611_a(p_187101_4_, (ItemStack)null);
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_4_);
}
}

View file

@ -1,17 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java
@@ -63,12 +63,13 @@
this.field_184157_a = Sets.<ChunkCoordIntPair>newHashSet();
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

@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java
@@ -23,6 +23,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

@ -1,14 +0,0 @@
--- ../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(ITextComponent reason)

View file

@ -1,62 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
@@ -267,7 +267,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();
@@ -785,14 +785,16 @@
public void handleChat(SPacketChat packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(packetIn.getType(), packetIn.getChatComponent());
+ if (message == null) return;
if (packetIn.getType() == 2)
{
- this.gameController.ingameGUI.setRecordPlaying(packetIn.getChatComponent(), false);
+ this.gameController.ingameGUI.setRecordPlaying(message, false);
}
else
{
- this.gameController.ingameGUI.getChatGUI().printChatMessage(packetIn.getChatComponent());
+ this.gameController.ingameGUI.getChatGUI().printChatMessage(message);
}
}
@@ -848,6 +850,11 @@
float f = (float)(packetIn.getYaw() * 360) / 256.0F;
float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;
EntityLivingBase entitylivingbase = (EntityLivingBase)EntityList.createEntityByID(packetIn.getEntityType(), 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.getEntityType(), d0, d1, d2);
+ return;
+ }
EntityTracker.func_187254_a(entitylivingbase, d0, d1, d2);
entitylivingbase.renderYawOffset = entitylivingbase.rotationYawHead = (float)(packetIn.getHeadPitch() * 360) / 256.0F;
Entity[] aentity = entitylivingbase.getParts();
@@ -1179,6 +1186,10 @@
{
tileentity.readFromNBT(packetIn.getNbtCompound());
}
+ else
+ {
+ tileentity.onDataPacket(netManager, packetIn);
+ }
if (flag && this.gameController.currentScreen instanceof GuiCommandBlock)
{
@@ -1378,7 +1389,7 @@
if (entity instanceof EntityLivingBase)
{
- Potion potion = Potion.func_188412_a(packetIn.getEffectId());
+ Potion potion = Potion.func_188412_a(packetIn.getEffectId() & 0xFF);
if (potion != null)
{

View file

@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/network/ServerPinger.java
+++ ../src-work/minecraft/net/minecraft/client/network/ServerPinger.java
@@ -150,6 +150,7 @@
server.setBase64EncodedIconData((String)null);
}
+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(server, serverstatusresponse);
this.field_175092_e = Minecraft.getSystemTime();
networkmanager.sendPacket(new CPacketPing(this.field_175092_e));
this.field_147403_d = true;

View file

@ -1,43 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java
@@ -3,6 +3,9 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Queues;
+
+import akka.actor.FSM.State;
+
import java.util.ArrayDeque;
import java.util.Iterator;
import java.util.List;
@@ -143,6 +146,7 @@
public void addEffect(EntityFX effect)
{
+ if (effect == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs.
this.field_187241_h.add(effect);
}
@@ -376,7 +380,7 @@
public void addBlockDestroyEffects(BlockPos pos, IBlockState state)
{
- if (state.func_185904_a() != Material.air)
+ if (state.getBlock().isAir(state, worldObj, pos) && !state.getBlock().addDestroyEffects(worldObj, pos, this))
{
state = state.func_185899_b(this.worldObj, pos);
int i = 4;
@@ -460,4 +464,13 @@
return "" + i;
}
+
+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target)
+ {
+ IBlockState state = worldObj.getBlockState(pos);
+ if (state != null && !state.getBlock().addHitEffects(state, worldObj, target, this))
+ {
+ addBlockHitEffects(pos, target.sideHit);
+ }
+ }
}

View file

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

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