Inital patch update for 1.7.2, Doesn't compile, not done yet.

This commit is contained in:
Lex Manos 2013-12-21 00:10:35 -08:00
parent cd34090eb8
commit a6c45a7ade
273 changed files with 6887 additions and 8037 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,69 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBaseRailLogic.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBaseRailLogic.java
@@ -16,6 +16,8 @@
/** The chunk position the rail is at. */
private List railChunkPosition;
+ private final boolean canMakeSlopes;
+
final BlockRailBase theRail;
public BlockBaseRailLogic(BlockRailBase par1BlockRailBase, World par2World, int par3, int par4, int par5)
@@ -27,17 +29,11 @@
this.railY = par4;
this.railZ = par5;
int l = par2World.getBlockId(par3, par4, par5);
- int i1 = par2World.getBlockMetadata(par3, par4, par5);
- if (((BlockRailBase)Block.blocksList[l]).isPowered)
- {
- this.isStraightRail = true;
- i1 &= -9;
- }
- else
- {
- this.isStraightRail = false;
- }
+ BlockRailBase target = (BlockRailBase)Block.blocksList[l];
+ int i1 = target.getBasicRailMetadata(par2World, null, par3, par4, par5);
+ isStraightRail = !target.isFlexibleRail(par2World, par3, par4, par5);
+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5);
this.setBasicRail(i1);
}
@@ -232,7 +228,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1))
{
@@ -245,7 +241,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ))
{
@@ -390,7 +386,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX, this.railY + 1, this.railZ - 1))
{
@@ -403,7 +399,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRailBase.isRailBlockAt(this.logicWorld, this.railX + 1, this.railY + 1, this.railZ))
{

View file

@ -0,0 +1,73 @@
--- ../src-base/minecraft/net/minecraft/block/BlockBush.java
+++ ../src-work/minecraft/net/minecraft/block/BlockBush.java
@@ -6,8 +6,13 @@
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
+import net.minecraft.world.IBlockAccess;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+import static net.minecraftforge.common.EnumPlantType.*;
-public class BlockBush extends Block
+public class BlockBush extends Block implements IPlantable
{
private static final String __OBFID = "CL_00000208";
@@ -27,7 +32,7 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149854_a(p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_));
+ return super.func_149742_c(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.func_149718_j(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_);
}
protected boolean func_149854_a(Block p_149854_1_)
@@ -57,7 +62,7 @@
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
{
- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_));
+ return p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
}
public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
@@ -79,4 +84,37 @@
{
return 1;
}
+
+ @Override
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
+ {
+ if (this == Blocks.wheat) return Crop;
+ if (this == Blocks.carrots) return Crop;
+ if (this == Blocks.potatoes) return Crop;
+ if (this == Blocks.melon_stem) return Crop;
+ if (this == Blocks.pumpkin_stem) return Crop;
+ if (this == Blocks.deadbush) return Desert;
+ if (this == Blocks.waterlily) return Water;
+ if (this == Blocks.red_mushroom) return Cave;
+ if (this == Blocks.brown_mushroom) return Cave;
+ if (this == Blocks.nether_wart) return Nether;
+ if (this == Blocks.sapling) return Plains;
+ if (this == Blocks.tallgrass) return Plains;
+ if (this == Blocks.double_plant) return Plains;
+ if (this == Blocks.red_flower) return Plains;
+ if (this == Blocks.yellow_flower) return Plains;
+ return Plains;
+ }
+
+ @Override
+ public Block getPlant(IBlockAccess world, int x, int y, int z)
+ {
+ return this;
+ }
+
+ @Override
+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
+ {
+ return world.getBlockMetadata(x, y, z);
+ }
}

View file

@ -4,101 +4,97 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public abstract class BlockButton extends Block
{
/** Whether this button is sensible to arrows, used by wooden buttons. */
@@ -66,7 +69,11 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
private final boolean field_150047_a;
@@ -49,12 +52,19 @@
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)));
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
+ return (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) ||
+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST));
- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r()));
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
+ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST)) ||
+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST));
}
/**
@@ -74,7 +81,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) ||
+ (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) ||
+ (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
+ (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH));
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r()));
+ return (p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST)) ||
+ (p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST)) ||
+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH)) ||
+ (p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH));
}
/**
@@ -86,19 +96,22 @@
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
@@ -63,19 +73,21 @@
int k1 = j1 & 8;
j1 &= 7;
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149660_5_);
+
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
+
+ if (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
+ if (dir == NORTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
{
j1 = 4;
}
- else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ else if (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- else if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
+ else if (dir == SOUTH && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
{
j1 = 3;
}
- else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ else if (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- else if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
+ else if (dir == WEST && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
{
j1 = 2;
}
- else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ else if (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- else if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
+ else if (dir == EAST && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
{
j1 = 1;
}
@@ -115,7 +128,11 @@
*/
private int getOrientation(World par1World, int par2, int par3, int par4)
@@ -89,7 +101,11 @@
private int func_150045_e(World p_150045_1_, int p_150045_2_, int p_150045_3_, int p_150045_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? 1 : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? 2 : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? 3 : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? 4 : 1)));
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST)) return 1;
+ if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST)) return 2;
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) return 3;
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) return 4;
- return p_150045_1_.func_147439_a(p_150045_2_ - 1, p_150045_3_, p_150045_4_).func_149721_r() ? 1 : (p_150045_1_.func_147439_a(p_150045_2_ + 1, p_150045_3_, p_150045_4_).func_149721_r() ? 2 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ - 1).func_149721_r() ? 3 : (p_150045_1_.func_147439_a(p_150045_2_, p_150045_3_, p_150045_4_ + 1).func_149721_r() ? 4 : 1)));
+ if (p_150045_1_.isSideSolid(p_150045_2_ - 1, p_150045_3_, p_150045_4_, EAST)) return 1;
+ if (p_150045_1_.isSideSolid(p_150045_2_ + 1, p_150045_3_, p_150045_4_, WEST)) return 2;
+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ - 1, SOUTH)) return 3;
+ if (p_150045_1_.isSideSolid(p_150045_2_, p_150045_3_, p_150045_4_ + 1, NORTH)) return 4;
+ return 1;
}
/**
@@ -129,22 +146,22 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
@@ -99,22 +115,22 @@
int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 7;
boolean flag = false;
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1)
- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2)
- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4)
{
flag = true;
}

View file

@ -1,46 +1,48 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCactus.java
@@ -12,7 +12,11 @@
import net.minecraft.util.Icon;
@@ -11,9 +11,13 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
-public class BlockCactus extends Block
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+
+public class BlockCactus extends Block implements IPlantable
{
@SideOnly(Side.CLIENT)
private Icon cactusTopIcon;
@@ -158,7 +162,7 @@
private IIcon field_150041_a;
@@ -125,7 +129,7 @@
else
{
int l = par1World.getBlockId(par2, par3 - 1, par4);
- return l == Block.cactus.blockID || l == Block.sand.blockID;
+ return blocksList[l] != null && blocksList[l].canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this);
Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_);
- return block == Blocks.cactus || block == Blocks.sand;
+ return block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
}
}
@@ -182,4 +186,22 @@
this.cactusTopIcon = par1IconRegister.registerIcon(this.getTextureName() + "_top");
this.cactusBottomIcon = par1IconRegister.registerIcon(this.getTextureName() + "_bottom");
@@ -141,4 +145,22 @@
this.field_150041_a = p_149651_1_.registerIcon(this.func_149641_N() + "_top");
this.field_150040_b = p_149651_1_.registerIcon(this.func_149641_N() + "_bottom");
}
+
+ @Override
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
+ {
+ return EnumPlantType.Desert;
+ }
+
+ @Override
+ public int getPlantID(World world, int x, int y, int z)
+ public Block getPlant(IBlockAccess world, int x, int y, int z)
+ {
+ return blockID;
+ return this;
+ }
+
+ @Override
+ public int getPlantMetadata(World world, int x, int y, int z)
+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
+ {
+ return -1;
+ }

View file

@ -4,41 +4,41 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import static net.minecraftforge.common.ForgeDirection.*;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public class BlockChest extends BlockContainer
{
private final Random random = new Random();
@@ -446,7 +448,7 @@
private final Random field_149955_b = new Random();
@@ -407,7 +409,7 @@
{
return null;
}
- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_).func_149721_r())
+ else if (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_, DOWN))
{
return null;
}
@@ -454,19 +456,19 @@
@@ -415,19 +417,19 @@
{
return null;
}
- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
+ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
- else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_ - 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ - 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ - 1, p_149951_3_, p_149951_4_)))
{
return null;
}
- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
+ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
- else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_ + 1, p_149951_3_, p_149951_4_) == this && (p_149951_1_.isSideSolid(p_149951_2_ + 1, p_149951_3_ + 1, p_149951_4_, DOWN) || func_149953_o(p_149951_1_, p_149951_2_ + 1, p_149951_3_, p_149951_4_)))
{
return null;
}
- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
+ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ - 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ - 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ - 1)))
{
return null;
}
- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
+ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
- else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1).func_149721_r() || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1)))
+ else if (p_149951_1_.func_147439_a(p_149951_2_, p_149951_3_, p_149951_4_ + 1) == this && (p_149951_1_.isSideSolid(p_149951_2_, p_149951_3_ + 1, p_149951_4_ + 1, DOWN) || func_149953_o(p_149951_1_, p_149951_2_, p_149951_3_, p_149951_4_ + 1)))
{
return null;
}

View file

@ -1,49 +1,46 @@
--- ../src-base/minecraft/net/minecraft/block/BlockCocoa.java
+++ ../src-work/minecraft/net/minecraft/block/BlockCocoa.java
@@ -2,6 +2,8 @@
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@@ -201,7 +203,14 @@
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -160,6 +161,13 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
- int j1 = func_72219_c(par5);
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int p_149690_5_, int fortune)
+ {
+ ArrayList<ItemStack> dropped = super.getBlockDropped(world, x, y, z, metadata, fortune);
+ int j1 = func_72219_c(metadata);
+ ArrayList<ItemStack> dropped = super.getDrops(world, x, y, z, p_149690_5_, fortune);
int j1 = func_149987_c(p_149690_5_);
byte b0 = 1;
if (j1 >= 2)
@@ -211,8 +220,9 @@
@@ -170,8 +178,9 @@
for (int k1 = 0; k1 < b0; ++k1)
{
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.dyePowder, 1, 3));
+ dropped.add(new ItemStack(Item.dyePowder, 1, 3));
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.dye, 1, 3));
+ dropped.add(new ItemStack(Items.dye, 1, 3));
}
+ return dropped;
}
@SideOnly(Side.CLIENT)
@@ -248,4 +258,10 @@
this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i);
}
@@ -216,4 +225,10 @@
++j1;
p_149853_1_.setBlockMetadataWithNotify(p_149853_3_, p_149853_4_, p_149853_5_, j1 << 2 | i1, 2);
}
+
+ @Override
+ public int idDropped(int par1, Random par2Random, int par3)
+ public Item func_149650_a(int par1, Random par2Random, int par3)
+ {
+ return 0;
+ return null;
+ }
}

View file

@ -1,20 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockComparator.java
+++ ../src-work/minecraft/net/minecraft/block/BlockComparator.java
@@ -268,4 +268,17 @@
{
return new TileEntityComparator();
}
+
+ @Override
+ public void onNeighborTileChange(World world, int x, int y, int z, int tileX, int tileY, int tileZ)
+ {
+ if(y == tileY)
+ onNeighborBlockChange(world, x, y, z, world.getBlockId(tileX, tileY, tileZ));
+ }
+
+ @Override
+ public boolean weakTileChanges()
+ {
+ return true;
+ }
}

View file

@ -6,62 +6,74 @@
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -10,6 +11,7 @@
import net.minecraft.util.Icon;
@@ -12,6 +13,7 @@
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.util.ForgeDirection;
public class BlockCrops extends BlockFlower
public class BlockCrops extends BlockBush implements IGrowable
{
@@ -103,11 +105,11 @@
int j3 = par1World.getBlockId(l2, par3 - 1, i3);
@@ -89,11 +91,11 @@
{
float f1 = 0.0F;
- if (j3 == Block.tilledField.blockID)
+ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this))
- if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1) == Blocks.farmland)
+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).canSustainPlant(p_149864_1_, l, p_149864_3_ - 1, i1, ForgeDirection.UP, this))
{
f1 = 1.0F;
- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0)
+ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3))
- if (p_149864_1_.getBlockMetadata(l, p_149864_3_ - 1, i1) > 0)
+ if (p_149864_1_.func_147439_a(l, p_149864_3_ - 1, i1).isFertile(p_149864_1_, l, p_149864_3_ - 1, i1))
{
f1 = 3.0F;
}
@@ -175,22 +177,25 @@
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
@@ -145,22 +147,6 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
+ }
- if (!par1World.isRemote)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = super.getBlockDropped(world, x, y, z, metadata, fortune);
+
+ if (metadata >= 7)
{
- if (par5 >= 7)
+ for (int n = 0; n < 3 + fortune; n++)
{
- int j1 = 3 + par7;
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, 0);
-
- if (!p_149690_1_.isRemote)
- {
- if (p_149690_5_ >= 7)
- {
- int j1 = 3 + p_149690_7_;
-
- for (int k1 = 0; k1 < j1; ++k1)
+ if (world.rand.nextInt(15) <= metadata)
{
- if (par1World.rand.nextInt(15) <= par5)
- {
- if (p_149690_1_.rand.nextInt(15) <= p_149690_5_)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(this.getSeedItem(), 1, 0));
- this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(this.func_149866_i(), 1, 0));
- }
+ ret.add(new ItemStack(this.getSeedItem(), 1, 0));
}
}
}
+
+ return ret;
- }
- }
- }
}
/**
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
@@ -204,4 +190,23 @@
{
this.func_149863_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_);
}
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ if (metadata >= 7)
+ {
+ for (int i = 0; i < 3 + fortune; ++i)
+ {
+ if (world.rand.nextInt(15) <= metadata)
+ {
+ ret.add(new ItemStack(this.func_149866_i(), 1, 0));
+ }
+ }
+ }
+
+ return ret;
+ }
}

View file

@ -1,8 +1,8 @@
--- ../src-base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDoor.java
@@ -290,7 +290,7 @@
@@ -249,7 +249,7 @@
{
if (this.blockMaterial == Material.iron)
if (this.field_149764_J == Material.field_151573_f)
{
- return true;
+ return false; //Allow items to interact with the door

View file

@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFalling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFalling.java
@@ -84,7 +84,7 @@
{
Block block = p_149831_0_.func_147439_a(p_149831_1_, p_149831_2_, p_149831_3_);
- if (block.field_149764_J == Material.field_151579_a)
+ if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_))
{
return true;
}
@@ -94,6 +94,7 @@
}
else
{
+ //TODO: King, take a look here when doing liquids!
Material material = block.field_149764_J;
return material == Material.field_151586_h ? true : material == Material.field_151587_i;
}

View file

@ -1,22 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -11,6 +11,9 @@
import net.minecraft.util.Icon;
@@ -12,6 +12,8 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+
+import net.minecraftforge.common.util.ForgeDirection;
public class BlockFarmland extends Block
{
@SideOnly(Side.CLIENT)
@@ -115,7 +118,8 @@
@@ -94,7 +96,7 @@
{
int j1 = par1World.getBlockId(l, par3 + 1, i1);
Block block = p_149822_1_.func_147439_a(l, p_149822_3_ + 1, i1);
- if (j1 == Block.crops.blockID || j1 == Block.melonStem.blockID || j1 == Block.pumpkinStem.blockID || j1 == Block.potato.blockID || j1 == Block.carrot.blockID)
+ Block plant = blocksList[j1];
+ if (plant instanceof IPlantable && canSustainPlant(par1World, par2, par3, par4, ForgeDirection.UP, (IPlantable)plant))
- if (block == Blocks.wheat || block == Blocks.melon_stem || block == Blocks.pumpkin_stem || block == Blocks.potatoes || block == Blocks.carrots)
+ if (block instanceof IPlantable && canSustainPlant(p_149822_1_, p_149822_2_, p_149822_3_, p_149822_4_, ForgeDirection.UP, (IPlantable)block))
{
return true;
}

View file

@ -1,215 +1,275 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
@@ -11,6 +11,9 @@
@@ -2,7 +2,10 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.IdentityHashMap;
+import java.util.Map.Entry;
import java.util.Random;
+import com.google.common.collect.Maps;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -12,11 +15,15 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderEnd;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+
public class BlockFire extends Block
{
/** The chance this block will encourage nearby blocks to catch on fire */
@@ -36,6 +39,8 @@
*/
public void initializeBlock()
- private int[] field_149849_a = new int[256];
- private int[] field_149848_b = new int[256];
+ @Deprecated
+ private int[] field_149849_a = new int[4096];
+ @Deprecated
+ private int[] field_149848_b = new int[4096];
@SideOnly(Side.CLIENT)
private IIcon[] field_149850_M;
private static final String __OBFID = "CL_00000245";
@@ -56,8 +63,7 @@
public void func_149842_a(int p_149842_1_, int p_149842_2_, int p_149842_3_)
{
+ abilityToCatchFire = Block.blockFlammability;
+ chanceToEncourageFire = Block.blockFireSpreadSpeed;
this.setBurnRate(Block.planks.blockID, 5, 20);
this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20);
this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20);
@@ -62,8 +67,7 @@
*/
private void setBurnRate(int par1, int par2, int par3)
{
- this.chanceToEncourageFire[par1] = par2;
- this.abilityToCatchFire[par1] = par3;
+ Block.setBurnProperties(par1, par2, par3);
- this.field_149849_a[p_149842_1_] = p_149842_2_;
- this.field_149848_b[p_149842_1_] = p_149842_3_;
+ this.setFireInfo((Block)Block.field_149771_c.getObject(p_149842_1_), p_149842_2_, p_149842_3_);
}
/**
@@ -123,13 +127,9 @@
public AxisAlignedBB func_149668_a(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
@@ -94,13 +100,8 @@
{
if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
if (p_149674_1_.getGameRules().getGameRuleBooleanValue("doFireTick"))
{
- boolean flag = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID;
+ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ boolean flag = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), UP));
- boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.netherrack;
+ boolean flag = p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_).isFireSource(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP);
- if (par1World.provider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID)
- if (p_149674_1_.provider instanceof WorldProviderEnd && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ - 1, p_149674_4_) == Blocks.bedrock)
- {
- flag = true;
- }
-
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
if (!this.func_149742_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
{
par1World.setBlockToAir(par2, par3, par4);
@@ -157,7 +157,7 @@
par1World.setBlockToAir(par2, par3, par4);
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
@@ -128,7 +129,7 @@
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
}
}
- else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && l == 15 && par5Random.nextInt(4) == 0)
+ else if (!flag && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP) && l == 15 && par5Random.nextInt(4) == 0)
- else if (!flag && !this.func_149844_e(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) && l == 15 && p_149674_5_.nextInt(4) == 0)
+ else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0)
{
par1World.setBlockToAir(par2, par3, par4);
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
}
@@ -171,12 +171,12 @@
@@ -142,12 +143,12 @@
b0 = -50;
}
- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l);
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l);
+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + b0, par5Random, l, WEST );
+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + b0, par5Random, l, EAST );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + b0, par5Random, l, UP );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + b0, par5Random, l, DOWN );
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + b0, par5Random, l, SOUTH);
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + b0, par5Random, l, NORTH);
- this.func_149841_a(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l);
- this.func_149841_a(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l);
+ this.tryCatchFire(p_149674_1_, p_149674_2_ + 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, WEST );
+ this.tryCatchFire(p_149674_1_, p_149674_2_ - 1, p_149674_3_, p_149674_4_, 300 + b0, p_149674_5_, l, EAST );
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, 250 + b0, p_149674_5_, l, UP );
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ + 1, p_149674_4_, 250 + b0, p_149674_5_, l, DOWN );
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ - 1, 300 + b0, p_149674_5_, l, SOUTH);
+ this.tryCatchFire(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_ + 1, 300 + b0, p_149674_5_, l, NORTH);
for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1)
for (int i1 = p_149674_2_ - 1; i1 <= p_149674_2_ + 1; ++i1)
{
@@ -230,10 +230,21 @@
@@ -201,10 +202,16 @@
return false;
}
+ @Deprecated
private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7)
private void func_149841_a(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_)
{
- int j1 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)];
+ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, UP);
- int j1 = this.field_149848_b[Block.func_149682_b(p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_))];
+ this.tryCatchFire(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, p_149841_5_, p_149841_6_, p_149841_7_, UP);
+ }
+ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, ForgeDirection face)
+ private void tryCatchFire(World p_149841_1_, int p_149841_2_, int p_149841_3_, int p_149841_4_, int p_149841_5_, Random p_149841_6_, int p_149841_7_, ForgeDirection face)
+ {
+ int j1 = 0;
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)];
+ if (block != null)
+ {
+ j1 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face);
+ }
+ int j1 = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_).getFlammability(p_149841_1_, p_149841_2_, p_149841_3_, p_149841_4_, face);
+
if (par6Random.nextInt(par5) < j1)
if (p_149841_6_.nextInt(p_149841_5_) < j1)
{
boolean flag = par1World.getBlockId(par2, par3, par4) == Block.tnt.blockID;
@@ -266,7 +277,12 @@
*/
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
boolean flag = p_149841_1_.func_147439_a(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt;
@@ -234,7 +241,12 @@
private boolean func_149847_e(World p_149847_1_, int p_149847_2_, int p_149847_3_, int p_149847_4_)
{
- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1)))));
+ return canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST ) ||
+ canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST ) ||
+ canBlockCatchFire(par1World, par2, par3 - 1, par4, UP ) ||
+ canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN ) ||
+ canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH) ||
+ canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH);
- return this.func_149844_e(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_) ? true : (this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1) ? true : this.func_149844_e(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1)))));
+ return this.canCatchFire(p_149847_1_, p_149847_2_ + 1, p_149847_3_, p_149847_4_, WEST ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_ - 1, p_149847_3_, p_149847_4_, EAST ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ - 1, p_149847_4_, UP ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_ + 1, p_149847_4_, DOWN ) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ - 1, SOUTH) ||
+ this.canCatchFire(p_149847_1_, p_149847_2_, p_149847_3_, p_149847_4_ + 1, NORTH);
}
/**
@@ -282,12 +298,12 @@
private int func_149845_m(World p_149845_1_, int p_149845_2_, int p_149845_3_, int p_149845_4_)
@@ -247,12 +259,13 @@
}
else
{
- int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0);
- l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l);
- l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l);
+ int l = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, b0, WEST);
+ l = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, l, EAST);
+ l = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, l, UP);
+ l = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, l, DOWN);
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, l, SOUTH);
+ l = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, l, NORTH);
- int l = this.func_149846_a(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, b0);
- l = this.func_149846_a(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l);
- l = this.func_149846_a(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l);
+ int l = b0;
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ + 1, p_149845_3_, p_149845_4_, l, WEST );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_ - 1, p_149845_3_, p_149845_4_, l, EAST );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ - 1, p_149845_4_, l, UP );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_ + 1, p_149845_4_, l, DOWN );
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ - 1, l, SOUTH);
+ l = this.getChanceToEncourageFire(p_149845_1_, p_149845_2_, p_149845_3_, p_149845_4_ + 1, l, NORTH);
return l;
}
}
@@ -302,21 +318,24 @@
/**
* Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
+ * Deprecated for a side-sensitive version
*/
+ @Deprecated
public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
- return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0;
+ return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, UP);
@@ -262,15 +275,16 @@
return false;
}
/**
* Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the
* current number passed in it will return its number instead of the passed in one. Args: world, x, y, z,
* curChanceToEncourageFire
+ * Deprecated for a side-sensitive version
*/
+ @Deprecated
public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5)
public boolean func_149844_e(IBlockAccess p_149844_1_, int p_149844_2_, int p_149844_3_, int p_149844_4_)
{
- int i1 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)];
- return i1 > par5 ? i1 : par5;
+ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, UP);
- return this.field_149849_a[Block.func_149682_b(p_149844_1_.func_147439_a(p_149844_2_, p_149844_3_, p_149844_4_))] > 0;
+ return canCatchFire(p_149844_1_, p_149844_2_, p_149844_3_, p_149844_4_, UP);
}
/**
@@ -374,9 +393,9 @@
+ @Deprecated
public int func_149846_a(World p_149846_1_, int p_149846_2_, int p_149846_3_, int p_149846_4_, int p_149846_5_)
{
- int i1 = this.field_149849_a[Block.func_149682_b(p_149846_1_.func_147439_a(p_149846_2_, p_149846_3_, p_149846_4_))];
- return i1 > p_149846_5_ ? i1 : p_149846_5_;
+ return getChanceToEncourageFire(p_149846_1_, p_149846_2_, p_149846_3_, p_149846_4_, p_149846_5_, UP);
}
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
@@ -314,9 +328,9 @@
float f1;
float f2;
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4))
+ if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, UP))
- if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_))
+ if (!World.func_147466_a(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_) && !Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ - 1, p_149734_4_, UP))
{
- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, EAST))
- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_))
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ - 1, p_149734_3_, p_149734_4_, EAST))
{
for (l = 0; l < 2; ++l)
{
@@ -387,7 +406,7 @@
@@ -327,7 +341,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, WEST))
- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_))
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_ + 1, p_149734_3_, p_149734_4_, WEST))
{
for (l = 0; l < 2; ++l)
{
@@ -398,7 +417,7 @@
@@ -338,7 +352,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, SOUTH))
- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1))
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ - 1, SOUTH))
{
for (l = 0; l < 2; ++l)
{
@@ -409,7 +428,7 @@
@@ -349,7 +363,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, NORTH))
- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1))
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_, p_149734_4_ + 1, NORTH))
{
for (l = 0; l < 2; ++l)
{
@@ -420,7 +439,7 @@
@@ -360,7 +374,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, DOWN))
- if (Blocks.fire.func_149844_e(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_))
+ if (Blocks.fire.canCatchFire(p_149734_1_, p_149734_2_, p_149734_3_ + 1, p_149734_4_, DOWN))
{
for (l = 0; l < 2; ++l)
{
@@ -469,4 +488,46 @@
@@ -405,4 +419,100 @@
{
return this.iconArray[0];
return MapColor.field_151656_f;
}
+
+
+ /*================================= Forge Start ======================================*/
+ private static class FireInfo
+ {
+ private int encouragement = 0;
+ private int flammibility = 0;
+ }
+ private IdentityHashMap<Block, FireInfo> blockInfo = Maps.newIdentityHashMap();
+
+ public void setFireInfo(Block block, int encouragement, int flammibility)
+ {
+ int id = Block.func_149682_b(block);
+ this.field_149849_a[id] = encouragement;
+ this.field_149848_b[id] = flammibility;
+
+ FireInfo info = getInfo(block, true);
+ info.encouragement = encouragement;
+ info.flammibility = flammibility;
+ }
+
+ private FireInfo getInfo(Block block, boolean garentee)
+ {
+ FireInfo ret = blockInfo.get(block);
+ if (ret == null && garentee)
+ {
+ ret = new FireInfo();
+ blockInfo.put(block, ret);
+ }
+ return ret;
+ }
+
+ public void rebuildFireInfo()
+ {
+ for (int x = 0; x < 4096; x++)
+ {
+ //If we care.. we could detect changes in here and make sure we keep them, however
+ //it's my thinking that anyone who hacks into the private variables should DIAF and we don't care about them.
+ field_149849_a[x] = 0;
+ field_149848_b[x] = 0;
+ }
+
+ for (Entry<Block, FireInfo> e : blockInfo.entrySet())
+ {
+ int id = Block.func_149682_b(e.getKey());
+ if (id >= 0 && id < 4096)
+ {
+ field_149849_a[id] = e.getValue().encouragement;
+ field_149848_b[id] = e.getValue().flammibility;
+ }
+ }
+ }
+
+ public int getFlammability(Block block)
+ {
+ int id = Block.func_149682_b(block);
+ return id >= 0 && id < 4096 ? field_149848_b[id] : 0;
+ }
+
+ public int getEncouragement(Block block)
+ {
+ int id = Block.func_149682_b(block);
+ return id >= 0 && id < 4096 ? field_149849_a[id] : 0;
+ }
+
+ /**
+ * Side sensitive version that calls the block function.
+ *
@ -220,14 +280,9 @@
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
+ public boolean canCatchFire(IBlockAccess world, int x, int y, int z, ForgeDirection face)
+ {
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ return false;
+ return world.func_147439_a(x, y, z).isFlammable(world, x, y, z, face);
+ }
+
+ /**
@ -241,14 +296,10 @@
+ * @param face The side the fire is coming from
+ * @return The chance of the block catching fire, or oldChance if it is higher
+ */
+ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, ForgeDirection face)
+ public int getChanceToEncourageFire(IBlockAccess world, int x, int y, int z, int oldChance, ForgeDirection face)
+ {
+ int newChance = 0;
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ int newChance = world.func_147439_a(x, y, z).getFireSpreadSpeed(world, x, y, z, face);
+ return (newChance > oldChance ? newChance : oldChance);
+ }
+ /*================================= Forge Start ======================================*/
}

View file

@ -1,69 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFlower.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFlower.java
@@ -6,7 +6,12 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
-public class BlockFlower extends Block
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+import static net.minecraftforge.common.EnumPlantType.*;
+
+public class BlockFlower extends Block implements IPlantable
{
protected BlockFlower(int par1, Material par2Material)
{
@@ -27,7 +32,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return super.canPlaceBlockAt(par1World, par2, par3, par4) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
+ return super.canPlaceBlockAt(par1World, par2, par3, par4) && canBlockStay(par1World, par2, par3, par4);
}
/**
@@ -71,7 +76,9 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
- return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) && this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
+ Block soil = blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ return (par1World.getFullBlockLightValue(par2, par3, par4) >= 8 || par1World.canBlockSeeTheSky(par2, par3, par4)) &&
+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
}
/**
@@ -107,4 +114,32 @@
{
return 1;
}
+
+ @Override
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
+ {
+ if (blockID == crops.blockID ) return Crop;
+ if (blockID == deadBush.blockID ) return Desert;
+ if (blockID == waterlily.blockID ) return Water;
+ if (blockID == mushroomRed.blockID ) return Cave;
+ if (blockID == mushroomBrown.blockID) return Cave;
+ if (blockID == netherStalk.blockID ) return Nether;
+ if (blockID == sapling.blockID ) return Plains;
+ if (blockID == melonStem.blockID ) return Crop;
+ if (blockID == pumpkinStem.blockID ) return Crop;
+ if (blockID == tallGrass.blockID ) return Plains;
+ return Plains;
+ }
+
+ @Override
+ public int getPlantID(World world, int x, int y, int z)
+ {
+ return blockID;
+ }
+
+ @Override
+ public int getPlantMetadata(World world, int x, int y, int z)
+ {
+ return world.getBlockMetadata(x, y, z);
+ }
}

View file

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFlowing.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFlowing.java
@@ -206,7 +206,7 @@
{
this.triggerLavaMixEffects(par1World, par2, par3, par4);
}
- else
+ else if (i1 != Block.snow.blockID)//Forge: Damn snow.
{
Block.blocksList[i1].dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
}

View file

@ -1,25 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockFluid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockFluid.java
@@ -59,7 +59,7 @@
{
for (int l1 = -1; l1 <= 1; ++l1)
{
- int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).waterColorMultiplier;
+ int i2 = par1IBlockAccess.getBiomeGenForCoords(par2 + l1, par4 + k1).getWaterColorMultiplier();
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
@@ -83,6 +83,13 @@
return (float)(par0 + 1) / 9.0F;
}
+
+ @Deprecated //Implemented here for compatibility, need to change this when we make vanilla fluids use our fluid methods.
+ public float getFilledPercentage(IBlockAccess world, int x, int y, int z)
+ {
+ return 1 - BlockFluid.getFluidHeightPercent(world.getBlockMetadata(x, y, z));
+ }
+
@SideOnly(Side.CLIENT)
/**

View file

@ -1,20 +1,45 @@
--- ../src-base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockGrass.java
@@ -44,7 +44,7 @@
{
if (!par1World.isRemote)
{
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
{
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
}
@@ -57,7 +57,7 @@
int k1 = par4 + par5Random.nextInt(3) - 1;
int l1 = par1World.getBlockId(i1, j1 + 1, k1);
@@ -12,6 +12,7 @@
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeHooks;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2)
+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
@@ -43,7 +44,7 @@
{
if (!p_149674_1_.isRemote)
{
- if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2)
+ if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
{
p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
}
@@ -56,7 +57,7 @@
int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1);
- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2)
+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
{
par1World.setBlock(i1, j1, k1, Block.grass.blockID);
p_149674_1_.func_147449_b(i1, j1, k1, Blocks.grass);
}
@@ -184,15 +185,7 @@
}
else
{
- String s = p_149853_1_.getBiomeGenForCoords(i1, k1).func_150572_a(p_149853_2_, i1, j1, k1);
- field_149992_a.debug("Flower in " + p_149853_1_.getBiomeGenForCoords(i1, k1).biomeName + ": " + s);
- BlockFlower blockflower = BlockFlower.func_149857_e(s);
-
- if (blockflower != null && blockflower.func_149718_j(p_149853_1_, i1, j1, k1))
- {
- int i2 = BlockFlower.func_149856_f(s);
- p_149853_1_.func_147465_d(i1, j1, k1, blockflower, i2, 3);
- }
+ ForgeHooks.plantGrass(p_149853_1_, p_149853_2_, i1, j1, k1);
}
}

View file

@ -9,85 +9,84 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public class BlockLadder extends Block
{
protected BlockLadder(int par1)
@@ -104,7 +108,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
private static final String __OBFID = "CL_00000262";
@@ -79,29 +83,32 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH);
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r()));
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH);
}
/**
@@ -114,22 +121,22 @@
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
{
int j1 = par9;
int j1 = p_149660_9_;
- if ((par9 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if ((j1 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
- if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
+ if ((p_149660_9_ == 0 || p_149660_5_ == 2) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
{
j1 = 2;
}
- if ((j1 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if ((j1 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
+ if ((j1 == 0 || p_149660_5_ == 3) && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
{
j1 = 3;
}
- if ((j1 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if ((j1 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if ((j1 == 0 || p_149660_5_ == 4) && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
{
j1 = 4;
}
- if ((j1 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if ((j1 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if ((j1 == 0 || p_149660_5_ == 5) && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
{
j1 = 5;
}
@@ -146,22 +153,22 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4);
@@ -114,22 +121,22 @@
int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_);
boolean flag = false;
- if (i1 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (i1 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
- if (l == 2 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r())
+ if (l == 2 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH))
{
flag = true;
}
- if (i1 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (i1 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- if (l == 3 && p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r())
+ if (l == 3 && p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH))
{
flag = true;
}
- if (i1 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (i1 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- if (l == 4 && p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r())
+ if (l == 4 && p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST))
{
flag = true;
}
- if (i1 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (i1 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- if (l == 5 && p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r())
+ if (l == 5 && p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST))
{
flag = true;
}
@@ -182,4 +189,10 @@
@@ -147,4 +154,10 @@
{
return 1;
}
+
+ @Override
+ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity)
+ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity)
+ {
+ return true;
+ }

View file

@ -1,84 +1,78 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLeaves.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLeaves.java
@@ -2,6 +2,8 @@
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -16,7 +18,9 @@
import net.minecraft.creativetab.CreativeTabs;
@@ -15,8 +16,9 @@
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockLeaves extends BlockLeavesBase
+import net.minecraftforge.common.IShearable;
+
+public class BlockLeaves extends BlockLeavesBase implements IShearable
{
public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"};
public static final String[][] field_94396_b = new String[][] {{"leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, {"leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}};
@@ -111,10 +115,9 @@
{
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
- if (j2 == Block.leaves.blockID)
+ if (Block.blocksList[j2] != null)
-public abstract class BlockLeaves extends BlockLeavesBase
+public abstract class BlockLeaves extends BlockLeavesBase implements IShearable
{
int[] field_150128_a;
@SideOnly(Side.CLIENT)
@@ -82,10 +84,10 @@
{
for (int l1 = -b0; l1 <= b0; ++l1)
{
- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j)
+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1))
{
- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2);
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
- int i2 = p_149749_1_.getBlockMetadata(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
- p_149749_1_.setBlockMetadataWithNotify(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4);
+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
}
}
}
@@ -160,11 +163,13 @@
@@ -127,9 +129,9 @@
{
k2 = par1World.getBlockId(par2 + l1, par3 + i2, par4 + j2);
Block block = p_149674_1_.func_147439_a(p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2);
- if (k2 == Block.wood.blockID)
+ Block block = Block.blocksList[k2];
+
+ if (block != null && block.canSustainLeaves(par1World, par2 + l1, par3 + i2, par4 + j2))
- if (block != Blocks.log && block != Blocks.log2)
+ if (!block.canSustainLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
{
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
}
- else if (k2 == Block.leaves.blockID)
+ else if (block != null && block.isLeaves(par1World, par2 + l1, par3 + i2, par4 + j2))
{
this.adjacentTreeBlocks[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
}
@@ -329,15 +334,7 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
- if (block.func_149688_o() == Material.field_151584_j)
+ if (block.isLeaves(p_149674_1_, p_149674_2_ + l1, p_149674_3_ + i2, p_149674_4_ + j2))
{
this.field_150128_a[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
}
@@ -281,13 +283,7 @@
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
{
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID)
- {
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3));
- if (!p_149636_1_.isRemote && p_149636_2_.getCurrentEquippedItem() != null && p_149636_2_.getCurrentEquippedItem().getItem() == Items.shears)
{
- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1);
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Item.func_150898_a(this), 1, p_149636_6_ & 3));
- }
- else
- {
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
/**
@@ -418,4 +415,30 @@
}
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
}
}
@@ -318,4 +314,38 @@
}
public abstract String[] func_150125_e();
+
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
@ -88,11 +82,18 @@
+ @Override
+ public void beginLeavesDecay(World world, int x, int y, int z)
+ {
+
+ int i2 = world.getBlockMetadata(x, y, z);
+
+ if ((i2 & 8) == 0)
+ {
+ world.setBlockMetadataWithNotify(x, y, z, i2 | 8, 4);
+ }
+ world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
+ }
+
+ @Override
+ public boolean isLeaves(World world, int x, int y, int z)
+ public boolean isLeaves(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }

View file

@ -4,128 +4,125 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public class BlockLever extends Block
{
protected BlockLever(int par1)
@@ -57,7 +60,13 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
private static final String __OBFID = "CL_00000264";
@@ -42,12 +45,23 @@
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
- return par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4) ? true : (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)))));
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
+ return (dir == DOWN && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN )) ||
+ (dir == UP && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP )) ||
+ (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) ||
+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ));
- return p_149707_5_ == 0 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_ + 1, p_149707_4_).func_149721_r() ? true : (p_149707_5_ == 1 && World.func_147466_a(p_149707_1_, p_149707_2_, p_149707_3_ - 1, p_149707_4_) ? true : (p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r()))));
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
+ return (dir == DOWN && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ + 1, p_149707_4_, DOWN )) ||
+ (dir == UP && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_ - 1, p_149707_4_, UP )) ||
+ (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) ||
+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST ));
}
/**
@@ -65,7 +74,12 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) ? true : par1World.isBlockNormalCube(par2, par3 + 1, par4)))));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) ||
+ par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP ) ||
+ par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN );
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r() ? true : (World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ + 1, p_149742_4_).func_149721_r()))));
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ - 1, p_149742_4_, UP ) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_ + 1, p_149742_4_, DOWN );
}
/**
@@ -77,32 +91,32 @@
int k1 = par9 & 7;
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
@@ -56,32 +70,32 @@
int j1 = p_149660_9_ & 7;
byte b0 = -1;
- if (par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ if (par5 == 0 && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
- if (p_149660_5_ == 0 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_ + 1, p_149660_4_).func_149721_r())
+ if (p_149660_5_ == 0 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ + 1, p_149660_4_, DOWN))
{
b0 = 0;
}
- if (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
+ if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP))
- if (p_149660_5_ == 1 && World.func_147466_a(p_149660_1_, p_149660_2_, p_149660_3_ - 1, p_149660_4_))
+ if (p_149660_5_ == 1 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_ - 1, p_149660_4_, UP))
{
b0 = 5;
}
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
- if (p_149660_5_ == 2 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ + 1).func_149721_r())
+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH))
{
b0 = 4;
}
- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
- if (p_149660_5_ == 3 && p_149660_1_.func_147439_a(p_149660_2_, p_149660_3_, p_149660_4_ - 1).func_149721_r())
+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH))
{
b0 = 3;
}
- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
- if (p_149660_5_ == 4 && p_149660_1_.func_147439_a(p_149660_2_ + 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST))
{
b0 = 2;
}
- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
- if (p_149660_5_ == 5 && p_149660_1_.func_147439_a(p_149660_2_ - 1, p_149660_3_, p_149660_4_).func_149721_r())
+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST))
{
b0 = 1;
}
@@ -178,42 +192,42 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
@@ -147,42 +161,42 @@
int l = p_149695_1_.getBlockMetadata(p_149695_2_, p_149695_3_, p_149695_4_) & 7;
boolean flag = false;
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && i1 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && i1 == 1)
- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 1)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && l == 1)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && i1 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && i1 == 2)
- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && l == 2)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && l == 2)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && i1 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && i1 == 3)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && l == 3)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && l == 3)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && i1 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && i1 == 4)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && l == 4)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && l == 4)
{
flag = true;
}
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 5)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 5)
- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 5)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 5)
{
flag = true;
}
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && i1 == 6)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && i1 == 6)
- if (!World.func_147466_a(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && l == 6)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ - 1, p_149695_4_, UP) && l == 6)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 0)
+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 0)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 0)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 0)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3 + 1, par4) && i1 == 7)
+ if (!par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN) && i1 == 7)
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_ + 1, p_149695_4_).func_149721_r() && l == 7)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_ + 1, p_149695_4_, DOWN) && l == 7)
{
flag = true;
}

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLiquid.java
@@ -67,7 +67,7 @@
{
for (int l1 = -1; l1 <= 1; ++l1)
{
- int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).waterColorMultiplier;
+ int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).getWaterColorMultiplier();
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;

View file

@ -1,35 +1,44 @@
--- ../src-base/minecraft/net/minecraft/block/BlockLog.java
+++ ../src-work/minecraft/net/minecraft/block/BlockLog.java
@@ -62,14 +62,9 @@
{
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
@@ -7,6 +7,7 @@
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.util.IIcon;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
- if (j2 == Block.leaves.blockID)
+ if (Block.blocksList[j2] != null)
public abstract class BlockLog extends BlockRotatedPillar
@@ -53,14 +54,10 @@
{
for (int l1 = -b0; l1 <= b0; ++l1)
{
- if (p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1).func_149688_o() == Material.field_151584_j)
+ Block block = p_149749_1_.func_147439_a(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
+ if (block.isLeaves(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1))
{
- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2);
- int i2 = p_149749_1_.getBlockMetadata(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
-
- if ((k2 & 8) == 0)
- if ((i2 & 8) == 0)
- {
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
- p_149749_1_.setBlockMetadataWithNotify(p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1, i2 | 8, 4);
- }
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
+ block.beginLeavesDecay(p_149749_1_, p_149749_2_ + j1, p_149749_3_ + k1, p_149749_4_ + l1);
}
}
}
@@ -135,4 +130,16 @@
this.tree_top[i] = par1IconRegister.registerIcon(this.getTextureName() + "_" + woodType[i] + "_top");
}
@@ -79,4 +76,16 @@
{
return this.field_150166_b[p_150161_1_ % this.field_150166_b.length];
}
+
+ @Override
+ public boolean canSustainLeaves(World world, int x, int y, int z)
+ public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isWood(World world, int x, int y, int z)
+ public boolean isWood(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }

View file

@ -1,18 +1,28 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMobSpawner.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMobSpawner.java
@@ -45,9 +45,13 @@
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
- int j1 = 15 + par1World.rand.nextInt(15) + par1World.rand.nextInt(15);
- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1);
}
+
+ @Override
+ public int getExpDrop(World world, int data, int enchantmentLevel)
+ {
+ return 15 + world.rand.nextInt(15) + world.rand.nextInt(15);
+ }
@@ -7,6 +7,7 @@
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
public class BlockMobSpawner extends BlockContainer
@@ -36,10 +37,15 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
- int j1 = 15 + p_149690_1_.rand.nextInt(15) + p_149690_1_.rand.nextInt(15);
- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1);
}
+ private Random rand = new Random();
+ @Override
+ public int getExpDrop(IBlockAccess world, int metadata, int fortune)
+ {
+ return 15 + rand.nextInt(15) + rand.nextInt(15);
+ }
+
public boolean func_149662_c()
{
return false;

View file

@ -1,22 +1,19 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -4,6 +4,8 @@
@@ -4,6 +4,7 @@
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.common.ForgeDirection;
+
public class BlockMushroom extends BlockFlower
public class BlockMushroom extends BlockBush implements IGrowable
{
protected BlockMushroom(int par1)
@@ -96,7 +98,9 @@
if (par3 >= 0 && par3 < 256)
@@ -85,7 +86,7 @@
if (p_149718_3_ >= 0 && p_149718_3_ < 256)
{
int l = par1World.getBlockId(par2, par3 - 1, par4);
- return l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13 && this.canThisPlantGrowOnThisBlockID(l);
+ Block soil = Block.blocksList[l];
+ return (l == Block.mycelium.blockID || par1World.getFullBlockLightValue(par2, par3, par4) < 13) &&
+ (soil != null && soil.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
Block block = p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_);
- return block == Blocks.mycelium || block == Blocks.dirt && p_149718_1_.getBlockMetadata(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.getFullBlockLightValue(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && this.func_149854_a(block);
+ return block == Blocks.mycelium || block == Blocks.dirt && p_149718_1_.getBlockMetadata(p_149718_2_, p_149718_3_ - 1, p_149718_4_) == 2 || p_149718_1_.getFullBlockLightValue(p_149718_2_, p_149718_3_, p_149718_4_) < 13 && block.canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);
}
else
{

View file

@ -1,20 +1,20 @@
--- ../src-base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src-work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -41,7 +41,7 @@
@@ -37,7 +37,7 @@
{
if (!par1World.isRemote)
if (!p_149674_1_.isRemote)
{
- if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && Block.lightOpacity[par1World.getBlockId(par2, par3 + 1, par4)] > 2)
+ if (par1World.getBlockLightValue(par2, par3 + 1, par4) < 4 && par1World.getBlockLightOpacity(par2, par3 + 1, par4) > 2)
- if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.func_147439_a(p_149674_2_, p_149674_3_ + 1, p_149674_4_).func_149717_k() > 2)
+ if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) < 4 && p_149674_1_.getBlockLightOpacity(p_149674_2_, p_149674_3_ + 1, p_149674_4_) > 2)
{
par1World.setBlock(par2, par3, par4, Block.dirt.blockID);
p_149674_1_.func_147449_b(p_149674_2_, p_149674_3_, p_149674_4_, Blocks.dirt);
}
@@ -54,7 +54,7 @@
int k1 = par4 + par5Random.nextInt(3) - 1;
int l1 = par1World.getBlockId(i1, j1 + 1, k1);
@@ -50,7 +50,7 @@
int k1 = p_149674_4_ + p_149674_5_.nextInt(3) - 1;
Block block = p_149674_1_.func_147439_a(i1, j1 + 1, k1);
- if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && Block.lightOpacity[l1] <= 2)
+ if (par1World.getBlockId(i1, j1, k1) == Block.dirt.blockID && par1World.getBlockLightValue(i1, j1 + 1, k1) >= 4 && par1World.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
- if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && block.func_149717_k() <= 2)
+ if (p_149674_1_.func_147439_a(i1, j1, k1) == Blocks.dirt && p_149674_1_.getBlockMetadata(i1, j1, k1) == 0 && p_149674_1_.getBlockLightValue(i1, j1 + 1, k1) >= 4 && p_149674_1_.getBlockLightOpacity(i1, j1 + 1, k1) <= 2)
{
par1World.setBlock(i1, j1, k1, this.blockID);
p_149674_1_.func_147449_b(i1, j1, k1, this);
}

View file

@ -1,80 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherStalk.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherStalk.java
@@ -2,6 +2,8 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -9,6 +11,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
public class BlockNetherStalk extends BlockFlower
{
@@ -38,7 +41,8 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
- return this.canThisPlantGrowOnThisBlockID(par1World.getBlockId(par2, par3 - 1, par4));
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
}
/**
@@ -80,25 +84,7 @@
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
- if (!par1World.isRemote)
- {
- int j1 = 1;
-
- if (par5 >= 3)
- {
- j1 = 2 + par1World.rand.nextInt(3);
-
- if (par7 > 0)
- {
- j1 += par1World.rand.nextInt(par7 + 1);
- }
- }
-
- for (int k1 = 0; k1 < j1; ++k1)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds));
- }
- }
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
}
/**
@@ -142,4 +128,23 @@
this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + "_stage_" + i);
}
}
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int count = 1;
+
+ if (metadata >= 3)
+ {
+ count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ ret.add(new ItemStack(Item.netherStalkSeeds));
+ }
+
+ return ret;
+ }
}

View file

@ -0,0 +1,68 @@
--- ../src-base/minecraft/net/minecraft/block/BlockNetherWart.java
+++ ../src-work/minecraft/net/minecraft/block/BlockNetherWart.java
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -11,6 +12,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
public class BlockNetherWart extends BlockBush
{
@@ -33,7 +35,7 @@
public boolean func_149718_j(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)
{
- return this.func_149854_a(p_149718_1_.func_147439_a(p_149718_2_, p_149718_3_ - 1, p_149718_4_));
+ return super.func_149718_j(p_149718_1_, p_149718_2_, p_149718_3_, p_149718_4_);
}
public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
@@ -62,6 +64,8 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
+ super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+ /*
if (!p_149690_1_.isRemote)
{
int j1 = 1;
@@ -81,6 +85,7 @@
this.func_149642_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, new ItemStack(Items.nether_wart));
}
}
+ */
}
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
@@ -109,4 +114,23 @@
this.field_149883_a[i] = p_149651_1_.registerIcon(this.func_149641_N() + "_stage_" + i);
}
}
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int count = 1;
+
+ if (metadata >= 3)
+ {
+ count = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0);
+ }
+
+ for (int i = 0; i < count; i++)
+ {
+ ret.add(new ItemStack(Items.nether_wart));
+ }
+
+ return ret;
+ }
}

View file

@ -1,27 +1,58 @@
--- ../src-base/minecraft/net/minecraft/block/BlockOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockOre.java
@@ -60,6 +60,11 @@
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
@@ -7,6 +7,7 @@
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.MathHelper;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockOre extends Block
@@ -51,34 +52,40 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+ }
+
- if (this.func_149650_a(p_149690_5_, p_149690_1_.rand, p_149690_7_) != Item.func_150898_a(this))
+ private Random rand = new Random();
+ @Override
+ public int getExpDrop(World par1World, int par5, int par7)
+ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
+ {
if (this.idDropped(par5, par1World.rand, par7) != this.blockID)
+ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this))
{
int j1 = 0;
@@ -84,9 +89,10 @@
if (this == Blocks.coal_ore)
{
j1 = MathHelper.getRandomIntegerInRange(par1World.rand, 2, 5);
- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 0, 2);
+ j1 = MathHelper.getRandomIntegerInRange(rand, 0, 2);
}
-
- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1);
else if (this == Blocks.diamond_ore)
{
- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 3, 7);
+ j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.emerald_ore)
{
- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 3, 7);
+ j1 = MathHelper.getRandomIntegerInRange(rand, 3, 7);
}
else if (this == Blocks.lapis_ore)
{
- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 2, 5);
+ j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
else if (this == Blocks.quartz_ore)
{
- j1 = MathHelper.getRandomIntegerInRange(p_149690_1_.rand, 2, 5);
+ j1 = MathHelper.getRandomIntegerInRange(rand, 2, 5);
}
- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1);
+ return j1;
}
+
+ return 0;
}
/**
public int func_149692_a(int p_149692_1_)

View file

@ -1,51 +1,52 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPane.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPane.java
@@ -13,6 +13,7 @@
import net.minecraft.util.Icon;
@@ -15,6 +15,8 @@
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
public class BlockPane extends Block
{
@@ -90,10 +91,10 @@
*/
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity)
@@ -62,10 +64,10 @@
public void func_149743_a(World p_149743_1_, int p_149743_2_, int p_149743_3_, int p_149743_4_, AxisAlignedBB p_149743_5_, List p_149743_6_, Entity p_149743_7_)
{
- boolean flag = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 - 1));
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2, par3, par4 + 1));
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 - 1, par3, par4));
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1World.getBlockId(par2 + 1, par3, par4));
+ boolean flag = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.NORTH);
+ boolean flag1 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.SOUTH);
+ boolean flag2 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.WEST);
+ boolean flag3 = this.canPaneConnectTo(par1World,par2, par3, par4,ForgeDirection.EAST);
- boolean flag = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ - 1));
- boolean flag1 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_, p_149743_3_, p_149743_4_ + 1));
- boolean flag2 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ - 1, p_149743_3_, p_149743_4_));
- boolean flag3 = this.func_150098_a(p_149743_1_.func_147439_a(p_149743_2_ + 1, p_149743_3_, p_149743_4_));
+ boolean flag = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ - 1, NORTH);
+ boolean flag1 = this.canPaneConnectTo(p_149743_1_, p_149743_2_, p_149743_3_, p_149743_4_ + 1, SOUTH);
+ boolean flag2 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ - 1, p_149743_3_, p_149743_4_, WEST );
+ boolean flag3 = this.canPaneConnectTo(p_149743_1_, p_149743_2_ + 1, p_149743_3_, p_149743_4_, EAST );
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
{
@@ -151,10 +152,10 @@
@@ -117,10 +119,10 @@
float f1 = 0.5625F;
float f2 = 0.4375F;
float f3 = 0.5625F;
- boolean flag = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 - 1));
- boolean flag1 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2, par3, par4 + 1));
- boolean flag2 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 - 1, par3, par4));
- boolean flag3 = this.canThisPaneConnectToThisBlockID(par1IBlockAccess.getBlockId(par2 + 1, par3, par4));
+ boolean flag = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.NORTH);
+ boolean flag1 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.SOUTH);
+ boolean flag2 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.WEST);
+ boolean flag3 = this.canPaneConnectTo(par1IBlockAccess,par2, par3, par4,ForgeDirection.EAST);
- boolean flag = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ - 1));
- boolean flag1 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_, p_149719_3_, p_149719_4_ + 1));
- boolean flag2 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ - 1, p_149719_3_, p_149719_4_));
- boolean flag3 = this.func_150098_a(p_149719_1_.func_147439_a(p_149719_2_ + 1, p_149719_3_, p_149719_4_));
+ boolean flag = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ - 1, NORTH);
+ boolean flag1 = this.canPaneConnectTo(p_149719_1_, p_149719_2_, p_149719_3_, p_149719_4_ + 1, SOUTH);
+ boolean flag2 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ - 1, p_149719_3_, p_149719_4_, WEST );
+ boolean flag3 = this.canPaneConnectTo(p_149719_1_, p_149719_2_ + 1, p_149719_3_, p_149719_4_, EAST );
if ((!flag2 || !flag3) && (flag2 || flag3 || flag || flag1))
{
@@ -240,4 +241,10 @@
this.blockIcon = par1IconRegister.registerIcon(this.field_94402_c);
this.theIcon = par1IconRegister.registerIcon(this.sideTextureIndex);
@@ -186,4 +188,10 @@
this.field_149761_L = p_149651_1_.registerIcon(this.field_150101_M);
this.field_150102_N = p_149651_1_.registerIcon(this.field_150100_a);
}
+
+ // FORGE START
+ public boolean canPaneConnectTo(IBlockAccess access, int x, int y, int z, ForgeDirection dir)
+ public boolean canPaneConnectTo(IBlockAccess world, int x, int y, int z, ForgeDirection dir)
+ {
+ return canThisPaneConnectToThisBlockID(access.getBlockId(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ)) || access.isBlockSolidOnSide(x+dir.offsetX, y+dir.offsetY, z+dir.offsetZ, dir.getOpposite(), false);
+ return func_150098_a(world.func_147439_a(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ)) ||
+ world.isSideSolid(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false);
+ }
}

View file

@ -1,56 +1,65 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -439,7 +439,7 @@
@@ -11,6 +11,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
+import net.minecraft.server.management.PlayerManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityPiston;
import net.minecraft.util.AxisAlignedBB;
@@ -360,7 +361,8 @@
return false;
}
- return !(Block.blocksList[par0] instanceof ITileEntityProvider);
+ return !par1World.blockHasTileEntity(par2, par3, par4);
- return !(p_150080_0_ instanceof ITileEntityProvider);
+ return !(p_150080_1_.func_147439_a(p_150080_2_, p_150080_3_, p_150080_4_).hasTileEntity(p_150080_1_.getBlockMetadata(p_150080_2_, p_150080_3_, p_150080_4_)));
+
}
}
@@ -457,14 +457,14 @@
@@ -375,14 +377,14 @@
{
if (l1 < 13)
{
- if (j1 <= 0 || j1 >= 255)
+ if (j1 <= 0 || j1 >= par0World.getHeight() - 1)
+ if (j1 <= 0 || j1 >= p_150077_0_.getHeight())
{
return false;
}
int i2 = par0World.getBlockId(i1, j1, k1);
Block block = p_150077_0_.func_147439_a(i1, j1, k1);
- if (i2 != 0)
+ if (!par0World.isAirBlock(i1, j1, k1))
- if (block.func_149688_o() != Material.field_151579_a)
+ if (block.isAir(p_150077_0_, i1, j1, k1))
{
if (!canPushBlock(i2, par0World, i1, j1, k1, true))
if (!func_150080_a(block, p_150077_0_, i1, j1, k1, true))
{
@@ -507,14 +507,14 @@
@@ -420,14 +422,14 @@
{
if (l1 < 13)
{
- if (j1 <= 0 || j1 >= 255)
+ if (j1 <= 0 || j1 >= par1World.getHeight() - 1)
+ if (j1 <= 0 || j1 >= p_150079_1_.getHeight())
{
return false;
}
i2 = par1World.getBlockId(i1, j1, k1);
Block block = p_150079_1_.func_147439_a(i1, j1, k1);
- if (i2 != 0)
+ if (!par1World.isAirBlock(i1, j1, k1))
- if (block.func_149688_o() != Material.field_151579_a)
+ if (block.isAir(p_150079_1_, i1, j1, k1))
{
if (!canPushBlock(i2, par1World, i1, j1, k1, true))
if (!func_150080_a(block, p_150079_1_, i1, j1, k1, true))
{
@@ -535,7 +535,9 @@
@@ -448,7 +450,9 @@
continue;
}
- Block.blocksList[i2].dropBlockAsItem(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), 0);
- block.func_149697_b(p_150079_1_, i1, j1, k1, p_150079_1_.getBlockMetadata(i1, j1, k1), 0);
+ //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior.
+ float chance = (Block.blocksList[i2] instanceof BlockSnow ? -1.0f : 1.0f);
+ Block.blocksList[i2].dropBlockAsItemWithChance(par1World, i1, j1, k1, par1World.getBlockMetadata(i1, j1, k1), chance, 0);
par1World.setBlockToAir(i1, j1, k1);
+ float chance = block instanceof BlockSnow ? -1.0f : 1.0f;
+ block.func_149690_a(p_150079_1_, i1, j1, k1, p_150079_1_.getBlockMetadata(i1, j1, k1), chance, 0);
p_150079_1_.func_147468_f(i1, j1, k1);
}
}

View file

@ -1,28 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPortal.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPortal.java
@@ -118,7 +118,7 @@
}
else
{
- if (par1World.getBlockId(par2 - b0, par3, par4 - b1) == 0)
+ if (par1World.isAirBlock(par2 - b0, par3, par4 - b1))
{
par2 -= b0;
par4 -= b1;
@@ -136,6 +136,7 @@
if (l != -1 && l != 2 || i1 != -1 && i1 != 3)
{
int j1 = par1World.getBlockId(par2 + b0 * l, par3 + i1, par4 + b1 * l);
+ boolean isAirBlock = par1World.isAirBlock(par2 + b0 * l, par3 + i1, par4 + b1 * l);
if (flag)
{
@@ -144,7 +145,7 @@
return false;
}
}
- else if (j1 != 0 && j1 != Block.fire.blockID)
+ else if (!isAirBlock && j1 != Block.fire.blockID)
{
return false;
}

View file

@ -1,12 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockPumpkin.java
+++ ../src-work/minecraft/net/minecraft/block/BlockPumpkin.java
@@ -123,7 +123,8 @@
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
@@ -113,7 +113,7 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
int l = par1World.getBlockId(par2, par3, par4);
- return (l == 0 || Block.blocksList[l].blockMaterial.isReplaceable()) && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
+ Block block = Block.blocksList[l];
+ return (block == null || block.isBlockReplaceable(par1World, par2, par3, par4)) && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
- return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).field_149764_J.isReplaceable() && World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_);
+ return p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_).isReplaceable(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && World.func_147466_a(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_);
}
/**
public void func_149689_a(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_)

View file

@ -1,37 +1,37 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRailBase.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRailBase.java
@@ -3,6 +3,7 @@
@@ -5,6 +5,7 @@
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
@@ -28,7 +29,7 @@
*/
public static final boolean isRailBlock(int par0)
@@ -25,7 +26,7 @@
public static final boolean func_150051_a(Block p_150051_0_)
{
- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID || par0 == Block.railActivator.blockID;
+ return Block.blocksList[par0] instanceof BlockRailBase;
- return p_150051_0_ == Blocks.rail || p_150051_0_ == Blocks.golden_rail || p_150051_0_ == Blocks.detector_rail || p_150051_0_ == Blocks.activator_rail;
+ return p_150051_0_ instanceof BlockRailBase;
}
protected BlockRailBase(int par1, boolean par2)
@@ -105,7 +106,7 @@
*/
public int getRenderType()
protected BlockRailBase(boolean p_i45389_1_)
@@ -78,7 +79,7 @@
public int func_149645_b()
{
- return 9;
+ return renderType;
}
/**
@@ -244,4 +245,107 @@
par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, par5);
public int func_149745_a(Random p_149745_1_)
@@ -193,6 +194,111 @@
}
}
+
+ /**
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
@ -40,9 +40,9 @@
+ * @param z The rail Z coordinate.
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(World world, int y, int x, int z)
+ public boolean isFlexibleRail(IBlockAccess world, int y, int x, int z)
+ {
+ return !isPowered;
+ return !func_150050_e();
+ }
+
+ /**
@ -54,7 +54,7 @@
+ * @param z The rail Z coordinate.
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(World world, int x, int y, int z)
+ public boolean canMakeSlopes(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
@ -87,7 +87,7 @@
+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if(isPowered)
+ if(func_150050_e())
+ {
+ meta = meta & 7;
+ }
@ -133,4 +133,76 @@
+ {
+ renderType = value;
+ }
}
+ /* ======================================== FORGE END =====================================*/
+
public class Rail
{
private World field_150660_b;
@@ -202,6 +308,7 @@
private final boolean field_150656_f;
private List field_150657_g = new ArrayList();
private static final String __OBFID = "CL_00000196";
+ private final boolean canMakeSlopes;
public Rail(World p_i45388_2_, int p_i45388_3_, int p_i45388_4_, int p_i45388_5_)
{
@@ -209,19 +316,10 @@
this.field_150661_c = p_i45388_3_;
this.field_150658_d = p_i45388_4_;
this.field_150659_e = p_i45388_5_;
- Block block = p_i45388_2_.func_147439_a(p_i45388_3_, p_i45388_4_, p_i45388_5_);
- int l = p_i45388_2_.getBlockMetadata(p_i45388_3_, p_i45388_4_, p_i45388_5_);
-
- if (((BlockRailBase)block).field_150053_a)
- {
- this.field_150656_f = true;
- l &= -9;
- }
- else
- {
- this.field_150656_f = false;
- }
-
+ BlockRailBase block = (BlockRailBase)p_i45388_2_.func_147439_a(p_i45388_3_, p_i45388_4_, p_i45388_5_);
+ int l = block.getBasicRailMetadata(p_i45388_2_, null, p_i45388_3_, p_i45388_4_, p_i45388_5_);
+ this.field_150656_f = block.isFlexibleRail(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_);
+ canMakeSlopes = block.canMakeSlopes(p_i45388_2_, p_i45388_3_, p_i45388_4_, p_i45388_5_);
this.func_150648_a(l);
}
@@ -412,7 +510,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1))
{
@@ -425,7 +523,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e))
{
@@ -570,7 +668,7 @@
}
}
- if (b0 == 0)
+ if (b0 == 0 && canMakeSlopes)
{
if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c, this.field_150658_d + 1, this.field_150659_e - 1))
{
@@ -583,7 +681,7 @@
}
}
- if (b0 == 1)
+ if (b0 == 1 && canMakeSlopes)
{
if (BlockRailBase.func_150049_b_(this.field_150660_b, this.field_150661_c + 1, this.field_150658_d + 1, this.field_150659_e))
{

View file

@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneComparator.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneComparator.java
@@ -228,4 +228,19 @@
{
return new TileEntityComparator();
}
+
+ @Override
+ public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ)
+ {
+ if (y == tileY && world instanceof World)
+ {
+ func_149695_a((World)world, x, y, z, world.func_147439_a(tileX, tileY, tileZ));
+ }
+ }
+
+ @Override
+ public boolean getWeakChanges(IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
}

View file

@ -1,19 +1,29 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneOre.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneOre.java
@@ -116,11 +116,17 @@
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
@@ -10,6 +10,7 @@
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
public class BlockRedstoneOre extends Block
@@ -88,12 +89,17 @@
public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_)
{
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
+ }
+
+ @Override
+ public int getExpDrop(World par1World, int par5, int par7)
- if (this.func_149650_a(p_149690_5_, p_149690_1_.rand, p_149690_7_) != Item.func_150898_a(this))
+ private Random rand = new Random();
+ @Override // World, meta, fortune
+ public int getExpDrop(IBlockAccess p_149690_1_, int p_149690_5_, int p_149690_7_)
+ {
if (this.idDropped(par5, par1World.rand, par7) != this.blockID)
+ if (this.func_149650_a(p_149690_5_, rand, p_149690_7_) != Item.func_150898_a(this))
{
int j1 = 1 + par1World.rand.nextInt(5);
- this.dropXpOnBlockBreak(par1World, par2, par3, par4, j1);
+ return j1;
- int j1 = 1 + p_149690_1_.rand.nextInt(5);
- this.func_149657_c(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, j1);
+ return 1 + rand.nextInt(5);
}
+ return 0;
}

View file

@ -1,11 +1,11 @@
--- ../src-base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src-work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -475,7 +475,7 @@
@@ -405,7 +405,7 @@
}
else if (!Block.redstoneRepeaterIdle.func_94487_f(i1))
else if (!Blocks.unpowered_repeater.func_149907_e(block))
{
- return Block.blocksList[i1].canProvidePower() && par4 != -1;
+ return (Block.blocksList[i1] != null && Block.blocksList[i1].canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4));
- return block.func_149744_f() && p_150174_4_ != -1;
+ return block.canConnectRedstone(p_150174_0_, p_150174_1_, p_150174_2_, p_150174_3_, p_150174_4_);
}
else
{

View file

@ -1,48 +1,46 @@
--- ../src-base/minecraft/net/minecraft/block/BlockReed.java
+++ ../src-work/minecraft/net/minecraft/block/BlockReed.java
@@ -8,7 +8,11 @@
import net.minecraft.util.AxisAlignedBB;
@@ -11,7 +11,11 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockReed extends Block
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.common.IPlantable;
+
+public class BlockReed extends Block implements IPlantable
{
protected BlockReed(int par1)
private static final String __OBFID = "CL_00000300";
@@ -57,7 +61,7 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
@@ -54,8 +58,8 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- int l = par1World.getBlockId(par2, par3 - 1, par4);
- return l == this.blockID ? true : (l != Block.grass.blockID && l != Block.dirt.blockID && l != Block.sand.blockID ? false : (par1World.getBlockMaterial(par2 - 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2 + 1, par3 - 1, par4) == Material.water ? true : (par1World.getBlockMaterial(par2, par3 - 1, par4 - 1) == Material.water ? true : par1World.getBlockMaterial(par2, par3 - 1, par4 + 1) == Material.water))));
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ return (block != null && block.canSustainPlant(par1World, par2, par3 - 1, par4, ForgeDirection.UP, this));
Block block = p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_);
- return block == this ? true : (block != Blocks.grass && block != Blocks.dirt && block != Blocks.sand ? false : (p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_ - 1, p_149742_4_).func_149688_o() == Material.field_151586_h ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_ - 1, p_149742_4_).func_149688_o() == Material.field_151586_h ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_ - 1).func_149688_o() == Material.field_151586_h ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_ + 1).func_149688_o() == Material.field_151586_h))));
+ return block.canSustainPlant(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_, ForgeDirection.UP, this);
}
/**
@@ -138,4 +142,22 @@
public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
@@ -120,4 +124,22 @@
{
return Item.reed.itemID;
return p_149720_1_.getBiomeGenForCoords(p_149720_2_, p_149720_4_).func_150558_b(p_149720_2_, p_149720_3_, p_149720_4_);
}
+
+ @Override
+ public EnumPlantType getPlantType(World world, int x, int y, int z)
+ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)
+ {
+ return EnumPlantType.Beach;
+ }
+
+ @Override
+ public int getPlantID(World world, int x, int y, int z)
+ public Block getPlant(IBlockAccess world, int x, int y, int z)
+ {
+ return blockID;
+ return this;
+ }
+
+ @Override
+ public int getPlantMetadata(World world, int x, int y, int z)
+ public int getPlantMetadata(IBlockAccess world, int x, int y, int z)
+ {
+ return world.getBlockMetadata(x, y, z);
+ }

View file

@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSand.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSand.java
@@ -105,7 +105,7 @@
{
int l = par0World.getBlockId(par1, par2, par3);
- if (l == 0)
+ if (par0World.isAirBlock(par1, par2, par3))
{
return true;
}

View file

@ -1,20 +1,10 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSapling.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSapling.java
@@ -16,6 +16,8 @@
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
@@ -71,6 +71,7 @@
+import net.minecraftforge.event.terraingen.TerrainGen;
+
public class BlockSapling extends BlockFlower
{
public static final String[] WOOD_TYPES = new String[] {"oak", "spruce", "birch", "jungle"};
@@ -76,6 +78,8 @@
*/
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
public void func_149878_d(World p_149878_1_, int p_149878_2_, int p_149878_3_, int p_149878_4_, Random p_149878_5_)
{
+ if (!TerrainGen.saplingGrowTree(par1World, par5Random, par2, par3, par4)) return;
+
int l = par1World.getBlockMetadata(par2, par3, par4) & 3;
Object object = null;
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_149878_1_, p_149878_5_, p_149878_2_, p_149878_3_, p_149878_4_)) return;
int l = p_149878_1_.getBlockMetadata(p_149878_2_, p_149878_3_, p_149878_4_) & 7;
Object object = p_149878_5_.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
int i1 = 0;

View file

@ -1,77 +1,62 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSkull.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSkull.java
@@ -2,6 +2,8 @@
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@@ -135,11 +137,6 @@
@@ -108,8 +109,6 @@
return p_149692_1_;
}
/**
- * Drops the block items with a specified chance of dropping the specified items
- */
- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) {}
- public void func_149690_a(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_) {}
-
- /**
* Called when the block is attempted to be harvested
*/
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer)
@@ -150,6 +147,8 @@
par1World.setBlockMetadataWithNotify(par2, par3, par4, par5, 4);
public void func_149681_a(World p_149681_1_, int p_149681_2_, int p_149681_3_, int p_149681_4_, int p_149681_5_, EntityPlayer p_149681_6_)
{
if (p_149681_6_.capabilities.isCreativeMode)
@@ -118,29 +117,38 @@
p_149681_1_.setBlockMetadataWithNotify(p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, 4);
}
+ dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
+ this.func_149697_b(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, 0);
+
super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer);
super.func_149681_a(p_149681_1_, p_149681_2_, p_149681_3_, p_149681_4_, p_149681_5_, p_149681_6_);
}
@@ -160,24 +159,30 @@
*/
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
public void func_149749_a(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
- if (!par1World.isRemote)
+ super.breakBlock(par1World, par2, par3, par4, par5, par6);
- if (!p_149749_1_.isRemote)
+ super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ public ArrayList<ItemStack> getDrops(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, int p_149749_6_, int fortune)
+ {
+ ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
+ if ((metadata & 8) == 0)
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
{
- if ((par6 & 8) == 0)
- {
- ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(par1World, par2, par3, par4));
- TileEntitySkull tileentityskull = (TileEntitySkull)par1World.getBlockTileEntity(par2, par3, par4);
+ ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(world, x, y, z));
+ TileEntitySkull tileentityskull = (TileEntitySkull)world.getBlockTileEntity(x, y, z);
if ((p_149749_6_ & 8) == 0)
{
ItemStack itemstack = new ItemStack(Items.skull, 1, this.func_149643_k(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_));
TileEntitySkull tileentityskull = (TileEntitySkull)p_149749_1_.func_147438_o(p_149749_2_, p_149749_3_, p_149749_4_);
- if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0)
- {
- itemstack.setTagCompound(new NBTTagCompound());
- itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType());
- }
-
- this.dropBlockAsItem_do(par1World, par2, par3, par4, itemstack);
+ if (tileentityskull == null)
+ {
+ return drops;
+ if (tileentityskull == null) return ret;
+
if (tileentityskull.func_145904_a() == 3 && tileentityskull.func_145907_c() != null && tileentityskull.func_145907_c().length() > 0)
{
itemstack.setTagCompound(new NBTTagCompound());
itemstack.getTagCompound().setString("SkullOwner", tileentityskull.func_145907_c());
}
- this.func_149642_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, itemstack);
+ ret.add(itemstack);
}
-
- super.breakBlock(par1World, par2, par3, par4, par5, par6);
+ if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0)
+ {
+ itemstack.setTagCompound(new NBTTagCompound());
+ itemstack.getTagCompound().setString("SkullOwner", tileentityskull.getExtraType());
+ }
+ drops.add(itemstack);
- super.func_149749_a(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
}
+ return drops;
+ return ret;
}
/**
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)

View file

@ -1,64 +1,64 @@
--- ../src-base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src-work/minecraft/net/minecraft/block/BlockSnow.java
@@ -96,8 +96,12 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
@@ -73,7 +73,7 @@
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- int l = par1World.getBlockId(par2, par3 - 1, par4);
- return l == 0 ? false : (l == this.blockID && (par1World.getBlockMetadata(par2, par3 - 1, par4) & 7) == 7 ? true : (l != Block.leaves.blockID && !Block.blocksList[l].isOpaqueCube() ? false : par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement()));
+ int l = par1World.getBlockId(par2, par3 - 1, par4);
+ Block block = Block.blocksList[l];
+ if (block == null) return false;
+ if (block == this && (par1World.getBlockMetadata(par2, par3 - 1, par4) & 7) == 7) return true;
+ if (!block.isLeaves(par1World, par2, par3 - 1, par4) && !Block.blocksList[l].isOpaqueCube()) return false;
+ return par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement();
Block block = p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_ - 1, p_149742_4_);
- return block != Blocks.ice && block != Blocks.packed_ice ? (block.func_149688_o() == Material.field_151584_j ? true : (block == this && (p_149742_1_.getBlockMetadata(p_149742_2_, p_149742_3_ - 1, p_149742_4_) & 7) == 7 ? true : block.func_149662_c() && block.field_149764_J.blocksMovement())) : false;
+ return block != Blocks.ice && block != Blocks.packed_ice ? (block.isLeaves(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_) ? true : (block == this && (p_149742_1_.getBlockMetadata(p_149742_2_, p_149742_3_ - 1, p_149742_4_) & 7) == 7 ? true : block.func_149662_c() && block.field_149764_J.blocksMovement())) : false;
}
/**
@@ -116,7 +120,6 @@
public void func_149695_a(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
@@ -85,7 +85,6 @@
{
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
if (!this.func_149742_c(p_150155_1_, p_150155_2_, p_150155_3_, p_150155_4_))
{
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
- this.func_149697_b(p_150155_1_, p_150155_2_, p_150155_3_, p_150155_4_, p_150155_1_.getBlockMetadata(p_150155_2_, p_150155_3_, p_150155_4_), 0);
p_150155_1_.func_147468_f(p_150155_2_, p_150155_3_, p_150155_4_);
return false;
}
@@ -132,11 +135,8 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
@@ -97,10 +96,8 @@
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
{
- int i1 = Item.snowball.itemID;
- int j1 = par6 & 7;
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(i1, j1 + 1, 0));
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
par1World.setBlockToAir(par3, par4, par5);
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- int i1 = p_149636_6_ & 7;
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Items.snowball, i1 + 1, 0));
+ super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
p_149636_1_.func_147468_f(p_149636_3_, p_149636_4_, p_149636_5_);
- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1);
}
/**
@@ -152,7 +152,7 @@
*/
public int quantityDropped(Random par1Random)
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
@@ -110,14 +107,13 @@
public int func_149745_a(Random p_149745_1_)
{
- return 0;
+ return 1;
}
/**
@@ -162,7 +162,6 @@
public void func_149674_a(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
{
if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11)
if (p_149674_1_.getSavedLightValue(EnumSkyBlock.Block, p_149674_2_, p_149674_3_, p_149674_4_) > 11)
{
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockToAir(par2, par3, par4);
- this.func_149697_b(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_1_.getBlockMetadata(p_149674_2_, p_149674_3_, p_149674_4_), 0);
p_149674_1_.func_147468_f(p_149674_2_, p_149674_3_, p_149674_4_);
}
}
@@ -177,4 +176,27 @@
@@ -127,4 +123,34 @@
{
return par5 == 1 ? true : super.shouldSideBeRendered(par1IBlockAccess, par2, par3, par4, par5);
return p_149646_5_ == 1 ? true : super.func_149646_a(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_);
}
+
+ @Override
+ /**
+ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand)
+ * version in 1.1.
+ *
+ * @param meta Blocks Metadata
+ * @param fortune Current item fortune level
+ * @param random Random number generator
+ * @return The number of items to drop
+ */
+ public int quantityDropped(int meta, int fortune, Random random)
+ {
+ return (meta & 7) + 1;
@ -74,10 +74,9 @@
+ * @param z Z position
+ * @return True if the block is replaceable by another block
+ */
+ @Override
+ public boolean isBlockReplaceable(World world, int x, int y, int z)
+ public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ return (meta >= 7 ? false : blockMaterial.isReplaceable());
+ return meta >= 7 ? false : field_149764_J.isReplaceable();
+ }
}

View file

@ -1,85 +1,80 @@
--- ../src-base/minecraft/net/minecraft/block/BlockStem.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStem.java
@@ -2,6 +2,8 @@
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -12,6 +14,8 @@
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -14,6 +15,7 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+import net.minecraftforge.common.ForgeDirection;
+
public class BlockStem extends BlockFlower
public class BlockStem extends BlockBush implements IGrowable
{
/** Defines if it is a Melon or a Pumpkin that the stem is producing. */
@@ -106,7 +110,8 @@
@@ -101,7 +103,7 @@
int l1 = par1World.getBlockId(j1, par3 - 1, k1);
Block block = p_149674_1_.func_147439_a(j1, p_149674_3_ - 1, k1);
- if (par1World.getBlockId(j1, par3, k1) == 0 && (l1 == Block.tilledField.blockID || l1 == Block.dirt.blockID || l1 == Block.grass.blockID))
+ boolean isSoil = (blocksList[l1] != null && blocksList[l1].canSustainPlant(par1World, j1, par3 - 1, k1, ForgeDirection.UP, this));
+ if (par1World.isAirBlock(j1, par3, k1) && (isSoil || l1 == Block.dirt.blockID || l1 == Block.grass.blockID))
- if (p_149674_1_.func_147439_a(j1, p_149674_3_, k1).field_149764_J == Material.field_151579_a && (block == Blocks.farmland || block == Blocks.dirt || block == Blocks.grass))
+ if (p_149674_1_.func_147437_c(j1, p_149674_3_, k1) && (block.canSustainPlant(p_149674_1_, j1, p_149674_3_ - 1, k1, UP, this) || block == Blocks.dirt || block == Blocks.grass))
{
par1World.setBlock(j1, par3, k1, this.fruitType.blockID);
p_149674_1_.func_147449_b(j1, p_149674_3_, k1, this.field_149877_a);
}
@@ -149,11 +154,11 @@
int j3 = par1World.getBlockId(l2, par3 - 1, i3);
@@ -144,11 +146,11 @@
Block block8 = p_149875_1_.func_147439_a(l, p_149875_3_ - 1, i1);
float f1 = 0.0F;
- if (j3 == Block.tilledField.blockID)
+ if (blocksList[j3] != null && blocksList[j3].canSustainPlant(par1World, l2, par3 - 1, i3, ForgeDirection.UP, this))
- if (block8 == Blocks.farmland)
+ if (block8.canSustainPlant(p_149875_1_, l, p_149875_3_ - 1, i1, UP, this))
{
f1 = 1.0F;
- if (par1World.getBlockMetadata(l2, par3 - 1, i3) > 0)
+ if (blocksList[j3].isFertile(par1World, l2, par3 - 1, i3))
- if (p_149875_1_.getBlockMetadata(l, p_149875_3_ - 1, i1) > 0)
+ if (block8.isFertile(p_149875_1_, l, p_149875_3_ - 1, i1))
{
f1 = 3.0F;
}
@@ -245,29 +250,22 @@
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
@@ -215,6 +217,7 @@
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
+ }
super.func_149690_a(p_149690_1_, p_149690_2_, p_149690_3_, p_149690_4_, p_149690_5_, p_149690_6_, p_149690_7_);
- if (!par1World.isRemote)
- {
- Item item = null;
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
- if (this.fruitType == Block.pumpkin)
+ for (int i = 0; i < 3; i++)
+ {
+ if (world.rand.nextInt(15) <= metadata)
{
- item = Item.pumpkinSeeds;
+ ret.add(new ItemStack(fruitType == pumpkin ? Item.pumpkinSeeds : Item.melonSeeds));
+ /*
if (!p_149690_1_.isRemote)
{
Item item = null;
@@ -237,6 +240,7 @@
}
}
-
- if (this.fruitType == Block.melon)
- {
- item = Item.melonSeeds;
- }
-
- for (int j1 = 0; j1 < 3; ++j1)
- {
- if (par1World.rand.nextInt(15) <= par5)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(item));
- }
- }
}
+
+ return ret;
+ */
}
/**
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
@@ -282,4 +286,22 @@
{
this.func_149874_m(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_);
}
+
+
+ @Override
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ Item item = null;
+ item = field_149877_a == Blocks.pumpkin ? Items.pumpkin_seeds : item;
+ item = field_149877_a == Blocks.melon_block ? Items.melon_seeds : item;
+
+ for (int i = 0; item != null && i < 3; i++)
+ {
+ ret.add(new ItemStack(item));
+ }
+
+ return ret;
+ }
}

View file

@ -1,82 +1,71 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTallGrass.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTallGrass.java
@@ -2,6 +2,8 @@
@@ -2,6 +2,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -17,7 +19,10 @@
@@ -17,8 +18,10 @@
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
-public class BlockTallGrass extends BlockFlower
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.IShearable;
+
+public class BlockTallGrass extends BlockFlower implements IShearable
-public class BlockTallGrass extends BlockBush implements IGrowable
+public class BlockTallGrass extends BlockBush implements IGrowable, IShearable
{
private static final String[] grassTypes = new String[] {"deadbush", "tallgrass", "fern"};
private static final String[] field_149871_a = new String[] {"deadbush", "tallgrass", "fern"};
@SideOnly(Side.CLIENT)
@@ -50,7 +55,7 @@
*/
public int idDropped(int par1, Random par2Random, int par3)
@@ -71,7 +74,7 @@
public Item func_149650_a(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
- return par2Random.nextInt(8) == 0 ? Item.seeds.itemID : -1;
+ return -1;
- return p_149650_2_.nextInt(8) == 0 ? Items.wheat_seeds : null;
+ return null;
}
/**
@@ -67,15 +72,7 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
public int func_149679_a(int p_149679_1_, Random p_149679_2_)
@@ -81,13 +84,7 @@
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
{
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID)
- {
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6));
- if (!p_149636_1_.isRemote && p_149636_2_.getCurrentEquippedItem() != null && p_149636_2_.getCurrentEquippedItem().getItem() == Items.shears)
{
- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1);
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.tallgrass, 1, p_149636_6_));
- }
- else
- {
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
}
}
@SideOnly(Side.CLIENT)
@@ -144,4 +141,35 @@
this.iconArray[i] = par1IconRegister.registerIcon(grassTypes[i]);
@@ -143,4 +140,28 @@
Blocks.double_plant.func_149889_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, b0, 2);
}
}
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int meta, int fortune)
+ public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (world.rand.nextInt(8) != 0)
+ {
+ return ret;
+ }
+
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
+ {
+ ret.add(item);
+ }
+ if (world.rand.nextInt(8) != 0) return ret;
+ ItemStack seed = ForgeHooks.getGrassSeed(world);
+ if (seed != null) ret.add(seed);
+ return ret;
+ }
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));

View file

@ -1,112 +1,108 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTorch.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTorch.java
@@ -10,6 +10,9 @@
@@ -10,6 +10,7 @@
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+
public class BlockTorch extends Block
{
protected BlockTorch(int par1)
@@ -65,7 +68,7 @@
@@ -51,13 +52,17 @@
else
{
int l = par1World.getBlockId(par2, par3, par4);
- return l == Block.fence.blockID || l == Block.netherFence.blockID || l == Block.glass.blockID || l == Block.cobblestoneWall.blockID;
+ return (Block.blocksList[l] != null && Block.blocksList[l].canPlaceTorchOnTop(par1World, par2, par3, par4));
Block block = p_150107_1_.func_147439_a(p_150107_2_, p_150107_3_, p_150107_4_);
- return block == Blocks.fence || block == Blocks.nether_brick_fence || block == Blocks.glass || block == Blocks.cobblestone_wall;
+ return block.canPlaceTorchOnTop(p_150107_1_, p_150107_2_, p_150107_3_, p_150107_4_);
}
}
@@ -74,7 +77,11 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) ? true : this.canPlaceTorchOn(par1World, par2, par3 - 1, par4))));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) ||
+ canPlaceTorchOn(par1World, par2, par3 - 1, par4);
- return p_149742_1_.func_147445_c(p_149742_2_ - 1, p_149742_3_, p_149742_4_, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_ + 1, p_149742_3_, p_149742_4_, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_, p_149742_3_, p_149742_4_ - 1, true) ? true : (p_149742_1_.func_147445_c(p_149742_2_, p_149742_3_, p_149742_4_ + 1, true) ? true : this.func_150107_m(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_))));
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST, true) ||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST, true) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH, true) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH, true) ||
+ func_150107_m(p_149742_1_, p_149742_2_, p_149742_3_ - 1, p_149742_4_);
}
/**
@@ -89,22 +96,22 @@
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
@@ -69,22 +74,22 @@
j1 = 5;
}
- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true))
- if (p_149660_5_ == 2 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ + 1, true))
+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH, true))
{
j1 = 4;
}
- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true))
- if (p_149660_5_ == 3 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ - 1, true))
+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH, true))
{
j1 = 3;
}
- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true))
- if (p_149660_5_ == 4 && p_149660_1_.func_147445_c(p_149660_2_ + 1, p_149660_3_, p_149660_4_, true))
+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST, true))
{
j1 = 2;
}
- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true))
- if (p_149660_5_ == 5 && p_149660_1_.func_147445_c(p_149660_2_ - 1, p_149660_3_, p_149660_4_, true))
+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST, true))
{
j1 = 1;
}
@@ -132,19 +139,19 @@
@@ -106,19 +111,19 @@
{
if (par1World.getBlockMetadata(par2, par3, par4) == 0)
if (p_149726_1_.getBlockMetadata(p_149726_2_, p_149726_3_, p_149726_4_) == 0)
{
- if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true))
- if (p_149726_1_.func_147445_c(p_149726_2_ - 1, p_149726_3_, p_149726_4_, true))
+ if (p_149726_1_.isSideSolid(p_149726_2_ - 1, p_149726_3_, p_149726_4_, EAST, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 1, 2);
}
- else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true))
- else if (p_149726_1_.func_147445_c(p_149726_2_ + 1, p_149726_3_, p_149726_4_, true))
+ else if (p_149726_1_.isSideSolid(p_149726_2_ + 1, p_149726_3_, p_149726_4_, WEST, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 2, 2);
}
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true))
- else if (p_149726_1_.func_147445_c(p_149726_2_, p_149726_3_, p_149726_4_ - 1, true))
+ else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ - 1, SOUTH, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 3, 2);
}
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true))
- else if (p_149726_1_.func_147445_c(p_149726_2_, p_149726_3_, p_149726_4_ + 1, true))
+ else if (p_149726_1_.isSideSolid(p_149726_2_, p_149726_3_, p_149726_4_ + 1, NORTH, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
p_149726_1_.setBlockMetadataWithNotify(p_149726_2_, p_149726_3_, p_149726_4_, 4, 2);
}
@@ -173,22 +180,22 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4);
@@ -143,22 +148,22 @@
int l = p_150108_1_.getBlockMetadata(p_150108_2_, p_150108_3_, p_150108_4_);
boolean flag = false;
- if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && i1 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true) && i1 == 1)
- if (!p_150108_1_.func_147445_c(p_150108_2_ - 1, p_150108_3_, p_150108_4_, true) && l == 1)
+ if (!p_150108_1_.isSideSolid(p_150108_2_ - 1, p_150108_3_, p_150108_4_, EAST, true) && l == 1)
{
flag = true;
}
- if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && i1 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true) && i1 == 2)
- if (!p_150108_1_.func_147445_c(p_150108_2_ + 1, p_150108_3_, p_150108_4_, true) && l == 2)
+ if (!p_150108_1_.isSideSolid(p_150108_2_ + 1, p_150108_3_, p_150108_4_, WEST, true) && l == 2)
{
flag = true;
}
- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && i1 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true) && i1 == 3)
- if (!p_150108_1_.func_147445_c(p_150108_2_, p_150108_3_, p_150108_4_ - 1, true) && l == 3)
+ if (!p_150108_1_.isSideSolid(p_150108_2_, p_150108_3_, p_150108_4_ - 1, SOUTH, true) && l == 3)
{
flag = true;
}
- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && i1 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true) && i1 == 4)
- if (!p_150108_1_.func_147445_c(p_150108_2_, p_150108_3_, p_150108_4_ + 1, true) && l == 4)
+ if (!p_150108_1_.isSideSolid(p_150108_2_, p_150108_3_, p_150108_4_ + 1, NORTH, true) && l == 4)
{
flag = true;
}

View file

@ -1,56 +1,49 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTrapDoor.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTrapDoor.java
@@ -11,8 +11,13 @@
@@ -11,9 +11,12 @@
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.common.ForgeDirection;
+
public class BlockTrapDoor extends Block
{
+ /** Set this to allow trapdoors to remain free-floating */
+ public static boolean disableValidation = false;
+
protected BlockTrapDoor(int par1, Material par2Material)
{
super(par1, par2Material);
@@ -194,7 +199,7 @@
--j1;
private static final String __OBFID = "CL_00000327";
protected BlockTrapDoor(Material p_i45434_1_)
@@ -163,7 +166,7 @@
--i1;
}
- if (!isValidSupportBlock(par1World.getBlockId(j1, par3, k1)))
+ if (!(isValidSupportBlock(par1World.getBlockId(j1, par3, k1)) || par1World.isBlockSolidOnSide(j1, par3, k1, ForgeDirection.getOrientation((i1 & 3) + 2))))
- if (!func_150119_a(p_149695_1_.func_147439_a(i1, p_149695_3_, j1)))
+ if (!func_150119_a(p_149695_1_.func_147439_a(i1, p_149695_3_, j1)) || p_149695_1_.isSideSolid(i1, p_149695_3_, j1, ForgeDirection.getOrientation((l & 3) + 2)))
{
par1World.setBlockToAir(par2, par3, par4);
this.dropBlockAsItem(par1World, par2, par3, par4, i1, 0);
@@ -259,6 +264,10 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
p_149695_1_.func_147468_f(p_149695_2_, p_149695_3_, p_149695_4_);
this.func_149697_b(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, l, 0);
@@ -218,6 +221,7 @@
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
+ if (disableValidation)
+ {
+ return true;
+ }
if (par5 == 0)
+ if (disableValidation) return true;
if (p_149707_5_ == 0)
{
return false;
@@ -289,7 +298,7 @@
--par2;
@@ -248,7 +252,7 @@
--p_149707_2_;
}
- return isValidSupportBlock(par1World.getBlockId(par2, par3, par4));
+ return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)) || par1World.isBlockSolidOnSide(par2, par3, par4, ForgeDirection.UP);
- return func_150119_a(p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_));
+ return func_150119_a(p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_)) || p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_, ForgeDirection.UP);
}
}
@@ -304,6 +313,10 @@
*/
private static boolean isValidSupportBlock(int par0)
@@ -259,6 +263,7 @@
private static boolean func_150119_a(Block p_150119_0_)
{
+ if (disableValidation)
+ {
+ return true;
+ }
if (par0 <= 0)
{
return false;
+ if (disableValidation) return true;
return p_150119_0_.field_149764_J.isOpaque() && p_150119_0_.func_149686_d() || p_150119_0_ == Blocks.glowstone || p_150119_0_ instanceof BlockSlab || p_150119_0_ instanceof BlockStairs;
}
}

View file

@ -0,0 +1,96 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireHook.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireHook.java
@@ -9,6 +9,9 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
public class BlockTripWireHook extends Block
{
private static final String __OBFID = "CL_00000329";
@@ -47,34 +50,41 @@
public boolean func_149707_d(World p_149707_1_, int p_149707_2_, int p_149707_3_, int p_149707_4_, int p_149707_5_)
{
- return p_149707_5_ == 2 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ + 1).func_149721_r() ? true : (p_149707_5_ == 3 && p_149707_1_.func_147439_a(p_149707_2_, p_149707_3_, p_149707_4_ - 1).func_149721_r() ? true : (p_149707_5_ == 4 && p_149707_1_.func_147439_a(p_149707_2_ + 1, p_149707_3_, p_149707_4_).func_149721_r() ? true : p_149707_5_ == 5 && p_149707_1_.func_147439_a(p_149707_2_ - 1, p_149707_3_, p_149707_4_).func_149721_r()));
+ ForgeDirection dir = ForgeDirection.getOrientation(p_149707_5_);
+ return (dir == NORTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ + 1, NORTH)) ||
+ (dir == SOUTH && p_149707_1_.isSideSolid(p_149707_2_, p_149707_3_, p_149707_4_ - 1, SOUTH)) ||
+ (dir == WEST && p_149707_1_.isSideSolid(p_149707_2_ + 1, p_149707_3_, p_149707_4_, WEST )) ||
+ (dir == EAST && p_149707_1_.isSideSolid(p_149707_2_ - 1, p_149707_3_, p_149707_4_, EAST ));
}
public boolean func_149742_c(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)
{
- return p_149742_1_.func_147439_a(p_149742_2_ - 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_ + 1, p_149742_3_, p_149742_4_).func_149721_r() ? true : (p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ - 1).func_149721_r() ? true : p_149742_1_.func_147439_a(p_149742_2_, p_149742_3_, p_149742_4_ + 1).func_149721_r()));
+ return p_149742_1_.isSideSolid(p_149742_2_ - 1, p_149742_3_, p_149742_4_, EAST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_ + 1, p_149742_3_, p_149742_4_, WEST ) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ - 1, SOUTH) ||
+ p_149742_1_.isSideSolid(p_149742_2_, p_149742_3_, p_149742_4_ + 1, NORTH);
}
public int func_149660_a(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_)
{
byte b0 = 0;
- if (p_149660_5_ == 2 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ + 1, true))
+ if (p_149660_5_ == 2 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ + 1, NORTH, true))
{
b0 = 2;
}
- if (p_149660_5_ == 3 && p_149660_1_.func_147445_c(p_149660_2_, p_149660_3_, p_149660_4_ - 1, true))
+ if (p_149660_5_ == 3 && p_149660_1_.isSideSolid(p_149660_2_, p_149660_3_, p_149660_4_ - 1, SOUTH, true))
{
b0 = 0;
}
- if (p_149660_5_ == 4 && p_149660_1_.func_147445_c(p_149660_2_ + 1, p_149660_3_, p_149660_4_, true))
+ if (p_149660_5_ == 4 && p_149660_1_.isSideSolid(p_149660_2_ + 1, p_149660_3_, p_149660_4_, WEST, true))
{
b0 = 1;
}
- if (p_149660_5_ == 5 && p_149660_1_.func_147445_c(p_149660_2_ - 1, p_149660_3_, p_149660_4_, true))
+ if (p_149660_5_ == 5 && p_149660_1_.isSideSolid(p_149660_2_ - 1, p_149660_3_, p_149660_4_, EAST, true))
{
b0 = 3;
}
@@ -97,22 +107,22 @@
int i1 = l & 3;
boolean flag = false;
- if (!p_149695_1_.func_147439_a(p_149695_2_ - 1, p_149695_3_, p_149695_4_).func_149721_r() && i1 == 3)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ - 1, p_149695_3_, p_149695_4_, EAST) && i1 == 3)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_ + 1, p_149695_3_, p_149695_4_).func_149721_r() && i1 == 1)
+ if (!p_149695_1_.isSideSolid(p_149695_2_ + 1, p_149695_3_, p_149695_4_, WEST) && i1 == 1)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ - 1).func_149721_r() && i1 == 0)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ - 1, SOUTH) && i1 == 0)
{
flag = true;
}
- if (!p_149695_1_.func_147439_a(p_149695_2_, p_149695_3_, p_149695_4_ + 1).func_149721_r() && i1 == 2)
+ if (!p_149695_1_.isSideSolid(p_149695_2_, p_149695_3_, p_149695_4_ + 1, NORTH) && i1 == 2)
{
flag = true;
}
@@ -133,7 +143,7 @@
boolean flag3 = (p_150136_6_ & 8) == 8;
boolean flag4 = !p_150136_5_;
boolean flag5 = false;
- boolean flag6 = !World.func_147466_a(p_150136_1_, p_150136_2_, p_150136_3_ - 1, p_150136_4_);
+ boolean flag6 = !p_150136_1_.isSideSolid(p_150136_2_, p_150136_3_ - 1, p_150136_4_, UP);
int l1 = Direction.offsetX[k1];
int i2 = Direction.offsetZ[k1];
int j2 = 0;

View file

@ -1,100 +0,0 @@
--- ../src-base/minecraft/net/minecraft/block/BlockTripWireSource.java
+++ ../src-work/minecraft/net/minecraft/block/BlockTripWireSource.java
@@ -8,6 +8,9 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+
public class BlockTripWireSource extends Block
{
public BlockTripWireSource(int par1)
@@ -64,7 +67,11 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)));
+ ForgeDirection dir = ForgeDirection.getOrientation(par5);
+ return (dir == NORTH && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH)) ||
+ (dir == SOUTH && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH)) ||
+ (dir == WEST && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST )) ||
+ (dir == EAST && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ));
}
/**
@@ -72,7 +79,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST ) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST ) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH);
}
/**
@@ -82,22 +92,22 @@
{
byte b0 = 0;
- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true))
{
b0 = 2;
}
- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true))
{
b0 = 0;
}
- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true))
{
b0 = 1;
}
- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true))
{
b0 = 3;
}
@@ -127,22 +137,22 @@
int j1 = i1 & 3;
boolean flag = false;
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && j1 == 3)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST) && j1 == 3)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && j1 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST) && j1 == 1)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && j1 == 0)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH) && j1 == 0)
{
flag = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && j1 == 2)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH) && j1 == 2)
{
flag = true;
}
@@ -163,7 +173,7 @@
boolean flag2 = (par6 & 8) == 8;
boolean flag3 = par5 == Block.tripWireSource.blockID;
boolean flag4 = false;
- boolean flag5 = !par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
+ boolean flag5 = !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP);
int i2 = Direction.offsetX[l1];
int j2 = Direction.offsetZ[l1];
int k2 = 0;

View file

@ -1,61 +1,60 @@
--- ../src-base/minecraft/net/minecraft/block/BlockVine.java
+++ ../src-work/minecraft/net/minecraft/block/BlockVine.java
@@ -2,9 +2,12 @@
@@ -2,9 +2,11 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -15,7 +18,9 @@
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -16,8 +18,10 @@
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.IShearable;
-public class BlockVine extends Block
+import net.minecraftforge.common.IShearable;
+
+public class BlockVine extends Block implements IShearable
{
public BlockVine(int par1)
private static final String __OBFID = "CL_00000330";
@@ -375,14 +379,28 @@
public void func_149636_a(World p_149636_1_, EntityPlayer p_149636_2_, int p_149636_3_, int p_149636_4_, int p_149636_5_, int p_149636_6_)
{
@@ -440,14 +445,26 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.itemID)
- {
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.vine, 1, 0));
- if (!p_149636_1_.isRemote && p_149636_2_.getCurrentEquippedItem() != null && p_149636_2_.getCurrentEquippedItem().getItem() == Items.shears)
{
- p_149636_2_.addStat(StatList.mineBlockStatArray[Block.func_149682_b(this)], 1);
- this.func_149642_a(p_149636_1_, p_149636_3_, p_149636_4_, p_149636_5_, new ItemStack(Blocks.vine, 1, 0));
- }
- else
- {
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
super.func_149636_a(p_149636_1_, p_149636_2_, p_149636_3_, p_149636_4_, p_149636_5_, p_149636_6_);
}
}
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, 0));
+ ret.add(new ItemStack(this, 1));
+ return ret;
+ }
+
+ @Override
+ public boolean isLadder(World world, int x, int y, int z, EntityLivingBase entity)
+ public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity)
+ {
+ return true;
+ }

View file

@ -1,10 +1,9 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -137,6 +137,16 @@
import com.google.common.collect.MapDifference;
+import net.minecraftforge.client.ClientCommandHandler;
@@ -134,6 +134,14 @@
import net.minecraft.world.storage.ISaveFormat;
import net.minecraft.world.storage.ISaveHandler;
import net.minecraft.world.storage.WorldInfo;
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.client.GuiIngameForge;
+import net.minecraftforge.client.event.GuiOpenEvent;
@ -13,20 +12,19 @@
+import net.minecraftforge.event.ForgeEventFactory;
+import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
+import net.minecraftforge.event.world.WorldEvent;
+
@SideOnly(Side.CLIENT)
public class Minecraft implements IPlayerUsage
{
@@ -308,7 +318,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.LWJGLException;
@@ -274,7 +282,7 @@
this.startTimerHackThread();
this.session = par1Session;
this.mcLogAgent.logInfo("Setting user: " + par1Session.getUsername());
- this.mcLogAgent.logInfo("(Session ID is " + par1Session.getSessionID() + ")");
+ //this.mcLogAgent.logInfo("(Session ID is " + par1Session.getSessionID() + ")"); //don't print the session to the console.. that's stupid...
field_147123_G.info("Setting user: " + par1Session.getUsername());
- field_147123_G.info("(Session ID is " + par1Session.getSessionID() + ")");
+ //field_147123_G.info("(Session ID is " + par1Session.getSessionID() + ")"); //don't print the session to the console.. that's stupid...
this.isDemo = par5;
this.displayWidth = par2;
this.displayHeight = par3;
@@ -416,7 +426,7 @@
@@ -447,7 +455,7 @@
try
{
@ -35,7 +33,7 @@
}
catch (LWJGLException lwjglexception)
{
@@ -498,7 +508,7 @@
@@ -547,7 +555,7 @@
this.effectRenderer = new EffectRenderer(this.theWorld, this.renderEngine);
FMLClientHandler.instance().finishMinecraftLoading();
this.checkGLError("Post startup");
@ -44,69 +42,71 @@
if (this.serverName != null)
{
@@ -680,11 +690,6 @@
*/
public void displayGuiScreen(GuiScreen par1GuiScreen)
@@ -733,11 +741,6 @@
public void func_147108_a(GuiScreen p_147108_1_)
{
- if (this.currentScreen != null)
- {
- this.currentScreen.onGuiClosed();
- this.currentScreen.func_146281_b();
- }
-
this.statFileWriter.syncStats();
if (par1GuiScreen == null && this.theWorld == null)
@@ -696,6 +701,20 @@
par1GuiScreen = new GuiGameOver();
if (p_147108_1_ == null && this.theWorld == null)
{
p_147108_1_ = new GuiMainMenu();
@@ -747,6 +750,17 @@
p_147108_1_ = new GuiGameOver();
}
+ GuiScreen old = this.currentScreen;
+ GuiOpenEvent event = new GuiOpenEvent(par1GuiScreen);
+ GuiOpenEvent event = new GuiOpenEvent(p_147108_1_);
+
+ if (MinecraftForge.EVENT_BUS.post(event)) return;
+
+ p_147108_1_ = event.gui;
+ if (old != null && p_147108_1_ != old)
+ {
+ old.func_146281_b();
+ }
+
+ if (MinecraftForge.EVENT_BUS.post(event))
+ {
+ return;
+ }
+
+ par1GuiScreen = event.gui;
+ if (old != null && par1GuiScreen != old)
+ {
+ old.onGuiClosed();
+ }
+
if (par1GuiScreen instanceof GuiMainMenu)
if (p_147108_1_ instanceof GuiMainMenu)
{
this.gameSettings.showDebugInfo = false;
@@ -1301,7 +1320,7 @@
@@ -1337,7 +1351,7 @@
if (this.thePlayer.isCurrentToolAdventureModeExempt(j, k, l))
{
- this.effectRenderer.addBlockHitEffects(j, k, l, this.objectMouseOver.sideHit);
+ this.effectRenderer.addBlockHitEffects(j, k, l, this.objectMouseOver);
this.thePlayer.swingItem();
}
}
@@ -1367,7 +1386,8 @@
{
int j1 = itemstack != null ? itemstack.stackSize : 0;
- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, i1, this.objectMouseOver.hitVec))
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, j, k, l, i1).isCanceled();
+ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, i1, this.objectMouseOver.hitVec))
if (this.thePlayer.isCurrentToolAdventureModeExempt(i, j, k))
{
flag = false;
- this.effectRenderer.addBlockHitEffects(i, j, k, this.objectMouseOver.sideHit);
+ this.effectRenderer.addBlockHitEffects(i, j, k, this.objectMouseOver);
this.thePlayer.swingItem();
@@ -1393,7 +1413,8 @@
{
ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem();
- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1))
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1).isCanceled();
+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1))
{
this.entityRenderer.itemRenderer.resetEquippedProgress2();
}
}
@@ -1575,6 +1596,8 @@
@@ -1418,11 +1432,12 @@
int j = this.objectMouseOver.blockY;
int k = this.objectMouseOver.blockZ;
- if (this.theWorld.func_147439_a(i, j, k).func_149688_o() != Material.field_151579_a)
+ if (!this.theWorld.func_147439_a(i, j, k).isAir(theWorld, i, j, k))
{
int l = itemstack != null ? itemstack.stackSize : 0;
- if (this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, i, j, k, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec))
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_BLOCK, j, k, l, this.objectMouseOver.sideHit).isCanceled();
+ if (result && this.playerController.onPlayerRightClick(this.thePlayer, this.theWorld, itemstack, j, k, l, this.objectMouseOver.sideHit, this.objectMouseOver.hitVec))
{
flag = false;
this.thePlayer.swingItem();
@@ -1449,7 +1464,8 @@
{
ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem();
- if (itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1))
+ boolean result = !ForgeEventFactory.onPlayerInteract(thePlayer, Action.RIGHT_CLICK_AIR, 0, 0, 0, -1).isCanceled();
+ if (result && itemstack1 != null && this.playerController.sendUseItem(this.thePlayer, this.theWorld, itemstack1))
{
this.entityRenderer.itemRenderer.resetEquippedProgress2();
}
@@ -1651,6 +1667,8 @@
while (Mouse.next())
{
@ -115,10 +115,10 @@
i = Mouse.getEventButton();
if (isRunningOnMac && i == 0 && (Keyboard.isKeyDown(29) || Keyboard.isKeyDown(157)))
@@ -2047,6 +2070,11 @@
@@ -2120,6 +2138,11 @@
// JAVADOC METHOD $$ func_71353_a
public void loadWorld(WorldClient par1WorldClient, String par2Str)
{
this.statFileWriter.syncStats();
+ if (theWorld != null)
+ {
+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(theWorld));
@ -126,12 +126,12 @@
+
if (par1WorldClient == null)
{
NetClientHandler netclienthandler = this.getNetHandler();
@@ -2064,6 +2092,18 @@
NetHandlerPlayClient nethandlerplayclient = this.func_147114_u();
@@ -2132,6 +2155,18 @@
if (this.theIntegratedServer != null)
{
this.theIntegratedServer.initiateShutdown();
+ if (loadingScreen!=null)
+ if (loadingScreen != null)
+ {
+ this.loadingScreen.resetProgresAndWorkingMessage("Shutting down internal server...");
+ }
@ -146,76 +146,66 @@
}
this.theIntegratedServer = null;
@@ -2226,7 +2266,7 @@
*/
public boolean handleClientCommand(String par1Str)
{
- return false;
+ return ClientCommandHandler.instance.executeCommand(thePlayer, par1Str) == 1;
}
/**
@@ -2237,108 +2277,13 @@
@@ -2286,113 +2321,10 @@
if (this.objectMouseOver != null)
{
boolean flag = this.thePlayer.capabilities.isCreativeMode;
- int i = 0;
- boolean flag1 = false;
- int j;
int k;
- Item item;
int j;
- if (this.objectMouseOver.typeOfHit == EnumMovingObjectType.TILE)
+ if (!ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld))
{
- k = this.objectMouseOver.blockX;
- int l = this.objectMouseOver.blockY;
- int i1 = this.objectMouseOver.blockZ;
- Block block = Block.blocksList[this.theWorld.getBlockId(k, l, i1)];
- if (this.objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
- {
- j = this.objectMouseOver.blockX;
- int k = this.objectMouseOver.blockY;
- int l = this.objectMouseOver.blockZ;
- Block block = this.theWorld.func_147439_a(j, k, l);
-
- if (block == null)
- if (block.func_149688_o() == Material.field_151579_a)
- {
- return;
- }
-
- j = block.idPicked(this.theWorld, k, l, i1);
- item = block.func_149694_d(this.theWorld, j, k, l);
-
- if (j == 0)
- if (item == null)
- {
- return;
- }
-
- flag1 = Item.itemsList[j].getHasSubtypes();
- int j1 = j < 256 && !Block.blocksList[block.blockID].isFlowerPot() ? j : block.blockID;
- i = Block.blocksList[j1].getDamageValue(this.theWorld, k, l, i1);
+ return;
}
- flag1 = item.getHasSubtypes();
- Block block1 = item instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a(item) : block;
- i = block1.func_149643_k(this.theWorld, j, k, l);
- }
- else
- {
- if (this.objectMouseOver.typeOfHit != EnumMovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag)
- if (this.objectMouseOver.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY || this.objectMouseOver.entityHit == null || !flag)
- {
- return;
- }
-
- if (this.objectMouseOver.entityHit instanceof EntityPainting)
- {
- j = Item.painting.itemID;
- item = Items.painting;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
- {
- j = Item.leash.itemID;
- item = Items.lead;
- }
- else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
- {
- EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
- ItemStack itemstack = entityitemframe.getDisplayedItem();
-
- if (entityitemframe.getDisplayedItem() == null)
- if (itemstack == null)
- {
- j = Item.itemFrame.itemID;
- item = Items.item_frame;
- }
- else
- {
- j = entityitemframe.getDisplayedItem().itemID;
- i = entityitemframe.getDisplayedItem().getItemDamage();
- item = itemstack.getItem();
- i = itemstack.getItemDamage();
- flag1 = true;
- }
- }
@ -225,32 +215,36 @@
-
- if (entityminecart.getMinecartType() == 2)
- {
- j = Item.minecartPowered.itemID;
- item = Items.furnace_minecart;
- }
- else if (entityminecart.getMinecartType() == 1)
- {
- j = Item.minecartCrate.itemID;
- item = Items.chest_minecart;
- }
- else if (entityminecart.getMinecartType() == 3)
- {
- j = Item.minecartTnt.itemID;
- item = Items.tnt_minecart;
- }
- else if (entityminecart.getMinecartType() == 5)
- {
- j = Item.minecartHopper.itemID;
- item = Items.hopper_minecart;
- }
- else if (entityminecart.getMinecartType() == 6)
- {
- item = Items.command_block_minecart;
- }
- else
- {
- j = Item.minecartEmpty.itemID;
- item = Items.minecart;
- }
- }
- else if (this.objectMouseOver.entityHit instanceof EntityBoat)
- {
- j = Item.boat.itemID;
- item = Items.boat;
- }
- else
- {
- j = Item.monsterPlacer.itemID;
- item = Items.spawn_egg;
- i = EntityList.getEntityID(this.objectMouseOver.entityHit);
- flag1 = true;
-
@ -261,20 +255,20 @@
- }
- }
-
- this.thePlayer.inventory.setCurrentItem(j, i, flag1, flag);
- this.thePlayer.inventory.func_146030_a(item, i, flag1, flag);
-
+ if (!ForgeHooks.onPickBlock(this.objectMouseOver, this.thePlayer, this.theWorld)) return;
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
if (flag)
{
k = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + this.thePlayer.inventory.currentItem;
@@ -2420,11 +2365,18 @@
j = this.thePlayer.inventoryContainer.inventorySlots.size() - 9 + this.thePlayer.inventory.currentItem;
@@ -2562,9 +2494,16 @@
par1PlayerUsageSnooper.addData("gl_max_texture_size", Integer.valueOf(getGLMaximumTextureSize()));
}
+ //Forge: Adds a optimization to the getGLMaximumTextureSize, only calculate it once.
+ private static int max_texture_size = -1;
/**
* Used in the usage snooper.
*/
// JAVADOC METHOD $$ func_71369_N
public static int getGLMaximumTextureSize()
{
+ if (max_texture_size != -1)
@ -285,7 +279,7 @@
for (int i = 16384; i > 0; i >>= 1)
{
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
@@ -2432,6 +2384,7 @@
@@ -2572,6 +2511,7 @@
if (j != 0)
{

View file

@ -1,102 +1,30 @@
--- ../src-base/minecraft/net/minecraft/client/audio/SoundManager.java
+++ ../src-work/minecraft/net/minecraft/client/audio/SoundManager.java
@@ -1,5 +1,9 @@
package net.minecraft.client.audio;
@@ -35,6 +35,11 @@
import paulscode.sound.codecs.CodecJOrbis;
import paulscode.sound.libraries.LibraryLWJGLOpenAL;
+import net.minecraftforge.client.*;
+import net.minecraftforge.client.event.sound.*;
+import net.minecraftforge.common.MinecraftForge;
+import static net.minecraftforge.client.event.sound.SoundEvent.*;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
@@ -62,9 +66,11 @@
private Random rand = new Random();
private int ticksBeforeMusic;
+ public static int MUSIC_INTERVAL = 12000;
+
public SoundManager(ResourceManager par1ResourceManager, GameSettings par2GameSettings, File par3File)
{
- this.ticksBeforeMusic = this.rand.nextInt(12000);
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL);
this.options = par2GameSettings;
this.fileAssets = par3File;
this.soundPoolSounds = new SoundPool(par1ResourceManager, "sound", true);
@@ -76,6 +82,7 @@
@SideOnly(Side.CLIENT)
public class SoundManager
{
@@ -69,6 +74,7 @@
{
SoundSystemConfig.addLibrary(LibraryLWJGLOpenAL.class);
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
SoundSystemConfig.setCodec("wav", CodecWav.class);
+ MinecraftForge.EVENT_BUS.post(new SoundSetupEvent(this));
}
catch (SoundSystemException soundsystemexception)
{
@@ -92,6 +99,7 @@
this.stopAllSounds();
this.cleanup();
this.tryToSetLibraryAndCodecs();
@@ -80,6 +86,7 @@
{
this.func_148613_b();
this.func_148608_i();
+ MinecraftForge.EVENT_BUS.post(new SoundLoadEvent(this));
}
private void loadSounds()
@@ -238,10 +246,11 @@
else
{
SoundPoolEntry soundpoolentry = this.soundPoolMusic.getRandomSound();
+ soundpoolentry = SoundEvent.getResult(new PlayBackgroundMusicEvent(this, soundpoolentry));
if (soundpoolentry != null)
{
- this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL;
this.sndSystem.backgroundMusic("BgMusic", soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false);
this.sndSystem.setVolume("BgMusic", this.options.musicVolume);
this.sndSystem.play("BgMusic");
@@ -309,6 +318,7 @@
if (par1Str != null)
{
SoundPoolEntry soundpoolentry = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str);
+ soundpoolentry = SoundEvent.getResult(new PlayStreamingEvent(this, soundpoolentry, par1Str, par2, par3, par4));
if (soundpoolentry != null)
{
@@ -319,6 +329,7 @@
this.sndSystem.newStreamingSource(true, s1, soundpoolentry.getSoundUrl(), soundpoolentry.getSoundName(), false, par2, par3, par4, 2, 64.0F);
this.sndSystem.setVolume(s1, 0.5F * this.options.soundVolume);
+ MinecraftForge.EVENT_BUS.post(new PlayStreamingSourceEvent(this, s1, par2, par3, par4));
this.sndSystem.play(s1);
}
}
@@ -487,6 +498,7 @@
if (this.loaded && this.options.soundVolume != 0.0F)
{
SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
+ soundpoolentry = SoundEvent.getResult(new PlaySoundEvent(this, soundpoolentry, par1Str, par2, par3, par4, par5, par6));
if (soundpoolentry != null && par5 > 0.0F)
{
@@ -508,6 +520,7 @@
this.sndSystem.setPitch(s1, par6);
this.sndSystem.setVolume(s1, par5 * this.options.soundVolume);
+ MinecraftForge.EVENT_BUS.post(new PlaySoundSourceEvent(this, s1, par2, par3, par4));
this.sndSystem.play(s1);
}
}
@@ -522,6 +535,7 @@
if (this.loaded && this.options.soundVolume != 0.0F)
{
SoundPoolEntry soundpoolentry = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
+ soundpoolentry = SoundEvent.getResult(new PlaySoundEffectEvent(this, soundpoolentry, par1Str, par2, par3));
if (soundpoolentry != null && par2 > 0.0F)
{
@@ -537,6 +551,7 @@
par2 *= 0.25F;
this.sndSystem.setPitch(s1, par3);
this.sndSystem.setVolume(s1, par2 * this.options.soundVolume);
+ MinecraftForge.EVENT_BUS.post(new PlaySoundEffectSourceEvent(this, s1));
this.sndSystem.play(s1);
}
}
private synchronized void func_148608_i()

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java
+++ ../src-work/minecraft/net/minecraft/client/entity/EntityOtherPlayerMP.java
@@ -170,7 +170,8 @@
@@ -157,7 +157,8 @@
}
}

View file

@ -1,7 +1,7 @@
--- ../src-base/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
+++ ../src-work/minecraft/net/minecraft/client/entity/EntityPlayerSP.java
@@ -49,6 +49,9 @@
import net.minecraft.util.MovementInput;
@@ -50,6 +50,9 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Session;
import net.minecraft.world.World;
+import net.minecraftforge.client.ForgeHooksClient;
@ -10,7 +10,7 @@
@SideOnly(Side.CLIENT)
public class EntityPlayerSP extends AbstractClientPlayer
@@ -343,7 +346,7 @@
@@ -331,7 +334,7 @@
f *= 1.0F - f1 * 0.15F;
}
@ -18,26 +18,37 @@
+ return ForgeHooksClient.getOffsetFOV(this, f);
}
/**
@@ -570,18 +573,66 @@
*/
protected boolean pushOutOfBlocks(double par1, double par3, double par5)
// JAVADOC METHOD $$ func_71053_j
@@ -494,20 +497,45 @@
return this.worldObj.func_147439_a(par1, par2, par3).func_149721_r();
}
+ private boolean isHeadspaceFree(int x, int y, int z, int height)
+ {
+ for (int i1 = 0; i1 < height; i1++)
+ {
+ if (isBlockTranslucent(x, y + i1, z + 1)) return false;
+ }
+ return true;
+ }
+
protected boolean func_145771_j(double p_145771_1_, double p_145771_3_, double p_145771_5_)
{
+ if (this.noClip)
+ {
+ return false;
+ }
int i = MathHelper.floor_double(par1);
int j = MathHelper.floor_double(par3);
int k = MathHelper.floor_double(par5);
double d3 = par1 - (double)i;
double d4 = par5 - (double)k;
int i = MathHelper.floor_double(p_145771_1_);
int j = MathHelper.floor_double(p_145771_3_);
int k = MathHelper.floor_double(p_145771_5_);
double d3 = p_145771_1_ - (double)i;
double d4 = p_145771_5_ - (double)k;
- if (this.isBlockTranslucent(i, j, k) || this.isBlockTranslucent(i, j + 1, k))
+ int entHeight = Math.max(Math.round(this.height), 1);
+
+
+ boolean inTranslucentBlock = true;
+
+
+ for (int i1 = 0; i1 < entHeight; i1++)
{
- boolean flag = !this.isBlockTranslucent(i - 1, j, k) && !this.isBlockTranslucent(i - 1, j + 1, k);
@ -49,49 +60,17 @@
+ inTranslucentBlock = false;
+ }
+ }
+
+
+ if (inTranslucentBlock)
+ {
+ boolean flag = true;
+ boolean flag1 = true;
+ boolean flag2 = true;
+ boolean flag3 = true;
+ for (int i1 = 0; i1 < entHeight; i1++)
+ {
+ if(this.isBlockTranslucent(i - 1, j + i1, k))
+ {
+ flag = false;
+ break;
+ }
+ }
+ for (int i1 = 0; i1 < entHeight; i1++)
+ {
+ if(this.isBlockTranslucent(i + 1, j + i1, k))
+ {
+ flag1 = false;
+ break;
+ }
+ }
+ for (int i1 = 0; i1 < entHeight; i1++)
+ {
+ if(this.isBlockTranslucent(i, j + i1, k - 1))
+ {
+ flag2 = false;
+ break;
+ }
+ }
+ for (int i1 = 0; i1 < entHeight; i1++)
+ {
+ if(this.isBlockTranslucent(i, j + i1, k + 1))
+ {
+ flag3 = false;
+ break;
+ }
+ }
+ boolean flag = !isHeadspaceFree(i - 1, j, k, entHeight);
+ boolean flag1 = !isHeadspaceFree(i + 1, j, k, entHeight);
+ boolean flag2 = !isHeadspaceFree(i, j, k - 1, entHeight);
+ boolean flag3 = !isHeadspaceFree(i, j, k + 1, entHeight);
byte b0 = -1;
double d5 = 9999.0D;
@@ -685,6 +736,12 @@
@@ -595,6 +623,12 @@
public void playSound(String par1Str, float par2, float par3)
{

View file

@ -1,36 +1,48 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiChat.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiChat.java
@@ -7,8 +7,11 @@
import java.util.Iterator;
import java.util.List;
import net.minecraft.network.packet.Packet203AutoComplete;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.ClientCommandHandler;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -1,6 +1,7 @@
package net.minecraft.client.gui;
import com.google.common.collect.Lists;
+import com.google.common.collect.ObjectArrays;
@SideOnly(Side.CLIENT)
public class GuiChat extends GuiScreen
@@ -278,13 +281,14 @@
this.mc.ingameGUI.getChatGUI().printChatMessageWithOptionalDeletion(stringbuilder.toString(), 1);
}
- this.inputField.writeText((String)this.field_73904_o.get(this.field_73903_n++));
+ this.inputField.writeText(EnumChatFormatting.func_110646_a((String)this.field_73904_o.get(this.field_73903_n++)));
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
@@ -24,6 +25,7 @@
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
+import net.minecraftforge.client.ClientCommandHandler;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.input.Keyboard;
@@ -134,6 +136,7 @@
public void func_146403_a(String p_146403_1_)
{
this.field_146297_k.ingameGUI.func_146158_b().func_146239_a(p_146403_1_);
+ if (ClientCommandHandler.instance.executeCommand(field_146297_k.thePlayer, p_146403_1_) == 1) return;
this.field_146297_k.thePlayer.sendChatMessage(p_146403_1_);
}
private void func_73893_a(String par1Str, String par2Str)
{
if (par1Str.length() >= 1)
{
+ ClientCommandHandler.instance.autoComplete(par1Str, par2Str);
this.mc.thePlayer.sendQueue.addToSendQueue(new Packet203AutoComplete(par1Str));
this.field_73905_m = true;
@@ -309,13 +312,14 @@
this.field_146297_k.ingameGUI.func_146158_b().func_146234_a(new ChatComponentText(stringbuilder.toString()), 1);
}
@@ -347,6 +351,13 @@
String[] astring1 = par1ArrayOfStr;
int i = par1ArrayOfStr.length;
- this.field_146415_a.func_146191_b((String)this.field_146412_t.get(this.field_146413_s++));
+ this.field_146415_a.func_146191_b(EnumChatFormatting.func_110646_a((String)this.field_146412_t.get(this.field_146413_s++)));
}
private void func_146405_a(String p_146405_1_, String p_146405_2_)
{
if (p_146405_1_.length() >= 1)
{
+ ClientCommandHandler.instance.autoComplete(p_146405_1_, p_146405_2_);
this.field_146297_k.thePlayer.sendQueue.func_147297_a(new C14PacketTabComplete(p_146405_1_));
this.field_146414_r = true;
}
@@ -438,6 +442,13 @@
String[] astring1 = p_146406_1_;
int i = p_146406_1_.length;
+ String[] complete = ClientCommandHandler.instance.latestAutoComplete;
+ if (complete != null)

View file

@ -1,114 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiControls.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiControls.java
@@ -7,6 +7,8 @@
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.GuiControlsScrollPanel;
+
@SideOnly(Side.CLIENT)
public class GuiControls extends GuiScreen
{
@@ -24,6 +26,8 @@
/** The ID of the button that has been pressed. */
private int buttonId = -1;
+ private GuiControlsScrollPanel scrollPane;
+
public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings)
{
this.parentScreen = par1GuiScreen;
@@ -43,14 +47,9 @@
*/
public void initGui()
{
- int i = this.getLeftBorder();
-
- for (int j = 0; j < this.options.keyBindings.length; ++j)
- {
- this.buttonList.add(new GuiSmallButton(j, i + j % 2 * 160, this.height / 6 + 24 * (j >> 1), 70, 20, this.options.getOptionDisplayString(j)));
- }
-
- this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.getString("gui.done")));
+ scrollPane = new GuiControlsScrollPanel(this, options, mc);
+ this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, I18n.getString("gui.done")));
+ scrollPane.registerScrollButtons(7, 8);
this.screenTitle = I18n.getString("controls.title");
}
@@ -59,20 +58,10 @@
*/
protected void actionPerformed(GuiButton par1GuiButton)
{
- for (int i = 0; i < this.options.keyBindings.length; ++i)
- {
- ((GuiButton)this.buttonList.get(i)).displayString = this.options.getOptionDisplayString(i);
- }
-
if (par1GuiButton.id == 200)
{
this.mc.displayGuiScreen(this.parentScreen);
}
- else
- {
- this.buttonId = par1GuiButton.id;
- par1GuiButton.displayString = "> " + this.options.getOptionDisplayString(par1GuiButton.id) + " <";
- }
}
/**
@@ -80,17 +69,7 @@
*/
protected void mouseClicked(int par1, int par2, int par3)
{
- if (this.buttonId >= 0)
- {
- this.options.setKeyBinding(this.buttonId, -100 + par3);
- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
- {
- super.mouseClicked(par1, par2, par3);
- }
+ super.mouseClicked(par1, par2, par3);
}
/**
@@ -98,15 +77,8 @@
*/
protected void keyTyped(char par1, int par2)
{
- if (this.buttonId >= 0)
+ if (scrollPane.keyTyped(par1, par2))
{
- this.options.setKeyBinding(this.buttonId, par2);
- ((GuiButton)this.buttonList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
- {
super.keyTyped(par1, par2);
}
}
@@ -117,6 +89,7 @@
public void drawScreen(int par1, int par2, float par3)
{
this.drawDefaultBackground();
+ /* Forge Start: Moved all rendering to GuiControlsScrollPanel
this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215);
int k = this.getLeftBorder();
int l = 0;
@@ -157,6 +130,10 @@
break;
}
}
+ */
+ scrollPane.drawScreen(par1, par2, par3);
+ drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff);
+ //Forge End
super.drawScreen(par1, par2, par3);
}

View file

@ -1,20 +1,20 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
@@ -376,7 +376,7 @@
@@ -322,7 +322,7 @@
}
else if (par1GuiButton.id == 8)
else if (p_146284_1_.field_146127_k == 8)
{
- this.mc.displayGuiScreen(new GuiCreateFlatWorld(this, this.generatorOptionsToUse));
+ WorldType.worldTypes[this.worldTypeId].onCustomizeButton(this.mc, this);
- this.field_146297_k.func_147108_a(new GuiCreateFlatWorld(this, this.field_146334_a));
+ WorldType.worldTypes[field_146331_K].onCustomizeButton(field_146297_k, this);
}
}
}
@@ -394,7 +394,7 @@
this.buttonBonusItems.drawButton = this.moreOptions;
this.buttonWorldType.drawButton = this.moreOptions;
this.buttonAllowCommands.drawButton = this.moreOptions;
- this.buttonCustomize.drawButton = this.moreOptions && WorldType.worldTypes[this.worldTypeId] == WorldType.FLAT;
+ this.buttonCustomize.drawButton = this.moreOptions && (WorldType.worldTypes[this.worldTypeId].isCustomizable());
@@ -340,7 +340,7 @@
this.field_146326_C.field_146125_m = this.field_146344_y;
this.field_146320_D.field_146125_m = this.field_146344_y;
this.field_146321_E.field_146125_m = this.field_146344_y;
- this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.worldTypes[this.field_146331_K] == WorldType.FLAT;
+ this.field_146322_F.field_146125_m = this.field_146344_y && WorldType.worldTypes[this.field_146331_K].isCustomizable();
if (this.moreOptions)
if (this.field_146344_y)
{

View file

@ -1,56 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java
@@ -40,6 +40,8 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+import net.minecraftforge.common.ForgeHooks;
+
@SideOnly(Side.CLIENT)
public class GuiIngame extends Gui
{
@@ -99,9 +101,16 @@
ItemStack itemstack = this.mc.thePlayer.inventory.armorItemInSlot(3);
- if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.itemID == Block.pumpkin.blockID)
+ if (this.mc.gameSettings.thirdPersonView == 0 && itemstack != null && itemstack.getItem() != null)
{
- this.renderPumpkinBlur(k, l);
+ if (itemstack.itemID == Block.pumpkin.blockID)
+ {
+ this.renderPumpkinBlur(k, l);
+ }
+ else
+ {
+ itemstack.getItem().renderHelmetOverlay(itemstack, mc.thePlayer, scaledresolution, par1, par2, par3, par4);
+ }
}
if (!this.mc.thePlayer.isPotionActive(Potion.confusion))
@@ -275,6 +284,16 @@
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24));
+ FontRenderer font = highlightingItemStack.getItem().getFontRenderer(highlightingItemStack);
+ if (font != null)
+ {
+ k1 = (k - font.getStringWidth(s1)) / 2;
+ font.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24));
+ }
+ else
+ {
+ fontrenderer.drawStringWithShadow(s1, k1, i2, 16777215 + (j2 << 24));
+ }
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@@ -563,7 +582,7 @@
int k2 = Math.max(10 - (j2 - 2), 3);
int l2 = i2 - (j2 - 1) * k2 - 10;
float f2 = f1;
- int i3 = this.mc.thePlayer.getTotalArmorValue();
+ int i3 = ForgeHooks.getTotalArmorValue(mc.thePlayer);
int j3 = -1;
if (this.mc.thePlayer.isPotionActive(Potion.regeneration))

View file

@ -0,0 +1,42 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiScreen.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiScreen.java
@@ -113,7 +113,9 @@
}
}
+ FontRenderer font = p_146285_1_.getItem().getFontRenderer(p_146285_1_);
this.func_146283_a(list, p_146285_2_, p_146285_3_);
+ drawHoveringText(list, p_146285_2_, p_146285_3_, (font == null ? field_146289_q : font));
}
protected void func_146279_a(String p_146279_1_, int p_146279_2_, int p_146279_3_)
@@ -123,6 +125,11 @@
protected void func_146283_a(List p_146283_1_, int p_146283_2_, int p_146283_3_)
{
+ drawHoveringText(p_146283_1_, p_146283_2_, p_146283_3_, field_146289_q);
+ }
+
+ protected void drawHoveringText(List p_146283_1_, int p_146283_2_, int p_146283_3_, FontRenderer font)
+ {
if (!p_146283_1_.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
@@ -135,7 +142,7 @@
while (iterator.hasNext())
{
String s = (String)iterator.next();
- int l = this.field_146289_q.getStringWidth(s);
+ int l = font.getStringWidth(s);
if (l > k)
{
@@ -180,7 +187,7 @@
for (int i2 = 0; i2 < p_146283_1_.size(); ++i2)
{
String s1 = (String)p_146283_1_.get(i2);
- this.field_146289_q.drawStringWithShadow(s1, j2, k2, -1);
+ font.drawStringWithShadow(s1, j2, k2, -1);
if (i2 == 0)
{

View file

@ -1,39 +1,39 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSlot.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSlot.java
@@ -331,16 +331,7 @@
@@ -294,16 +294,7 @@
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_FOG);
Tessellator tessellator = Tessellator.instance;
- this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
- this.field_148161_k.getTextureManager().bindTexture(Gui.optionsBackground);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- float f1 = 32.0F;
- tessellator.startDrawingQuads();
- tessellator.setColorOpaque_I(2105376);
- tessellator.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1));
- tessellator.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / f1), (double)((float)(this.bottom + (int)this.amountScrolled) / f1));
- tessellator.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1));
- tessellator.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / f1), (double)((float)(this.top + (int)this.amountScrolled) / f1));
- tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1));
- tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1));
- tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1));
- tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1));
- tessellator.draw();
+ drawContainerBackground(tessellator);
j1 = this.width / 2 - 92 - 16;
k1 = this.top + 4 - (int)this.amountScrolled;
l1 = this.field_148152_e + this.field_148155_a / 2 - this.func_148139_c() / 2 + 2;
i2 = this.field_148153_b + 4 - (int)this.field_148169_q;
@@ -484,4 +475,18 @@
tessellator.addVertexWithUV(0.0D, (double)par1, 0.0D, 0.0D, (double)((float)par1 / f));
tessellator.draw();
@@ -475,4 +466,18 @@
{
return this.field_148149_f;
}
+
+ protected void drawContainerBackground(Tessellator tess)
+ protected void drawContainerBackground(Tessellator tessellator)
+ {
+ this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
+ this.field_148161_k.getTextureManager().bindTexture(Gui.optionsBackground);
+ GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
+ float height = 32.0F;
+ tess.startDrawingQuads();
+ tess.setColorOpaque_I(2105376);
+ tess.addVertexWithUV((double)left, (double)bottom, 0.0D, (double)(left / height), (double)((bottom + (int)amountScrolled) / height));
+ tess.addVertexWithUV((double)right, (double)bottom, 0.0D, (double)(right / height), (double)((bottom + (int)amountScrolled) / height));
+ tess.addVertexWithUV((double)right, (double)top, 0.0D, (double)(right / height), (double)((top + (int)amountScrolled) / height));
+ tess.addVertexWithUV((double)left, (double)top, 0.0D, (double)(left / height), (double)((top + (int)amountScrolled) / height));
+ tess.draw();
+ float f1 = 32.0F;
+ tessellator.startDrawingQuads();
+ tessellator.setColorOpaque_I(2105376);
+ tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1));
+ tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148154_c, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148154_c + (int)this.field_148169_q) / f1));
+ tessellator.addVertexWithUV((double)this.field_148151_d, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148151_d / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1));
+ tessellator.addVertexWithUV((double)this.field_148152_e, (double)this.field_148153_b, 0.0D, (double)((float)this.field_148152_e / f1), (double)((float)(this.field_148153_b + (int)this.field_148169_q) / f1));
+ tessellator.draw();
+ }
}

View file

@ -1,39 +1,30 @@
--- ../src-base/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java
+++ ../src-work/minecraft/net/minecraft/client/gui/achievement/GuiAchievements.java
@@ -2,6 +2,9 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.LinkedList;
+import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -22,6 +25,8 @@
@@ -24,6 +24,9 @@
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+import java.util.LinkedList;
+import java.util.List;
+import net.minecraftforge.common.AchievementPage;
+
@SideOnly(Side.CLIENT)
public class GuiAchievements extends GuiScreen
{
@@ -60,6 +65,10 @@
private int isMouseButtonDown;
private StatFileWriter statFileWriter;
public class GuiAchievements extends GuiScreen implements IProgressMeter
@@ -50,6 +53,10 @@
private boolean field_146558_F = true;
private static final String __OBFID = "CL_00000722";
+ private int currentPage = -1;
+ private GuiSmallButton button;
+ private GuiButton button;
+ private LinkedList<Achievement> minecraftAchievements = new LinkedList<Achievement>();
+
public GuiAchievements(StatFileWriter par1StatFileWriter)
public GuiAchievements(GuiScreen p_i45026_1_, StatFileWriter p_i45026_2_)
{
this.statFileWriter = par1StatFileWriter;
@@ -67,6 +76,14 @@
this.field_146562_a = p_i45026_1_;
@@ -58,6 +65,14 @@
short short2 = 141;
this.field_74117_m = this.guiMapX = this.field_74124_q = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12);
this.field_74115_n = this.guiMapY = this.field_74123_r = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2);
this.field_146569_s = this.field_146567_u = this.field_146565_w = (double)(AchievementList.openInventory.displayColumn * 24 - short1 / 2 - 12);
this.field_146568_t = this.field_146566_v = this.field_146573_x = (double)(AchievementList.openInventory.displayRow * 24 - short2 / 2);
+ minecraftAchievements.clear();
+ for (Object achievement : AchievementList.achievementList)
+ {
@ -44,57 +35,57 @@
+ }
}
/**
@@ -76,6 +93,7 @@
{
this.buttonList.clear();
this.buttonList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, I18n.getString("gui.done")));
+ this.buttonList.add(button = new GuiSmallButton(2, (width - achievementsPaneWidth) / 2 + 24, height / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage)));
// JAVADOC METHOD $$ func_73866_w_
@@ -66,6 +81,7 @@
this.field_146297_k.func_147114_u().func_147297_a(new C16PacketClientStatus(C16PacketClientStatus.EnumState.REQUEST_STATS));
this.field_146292_n.clear();
this.field_146292_n.add(new GuiOptionButton(1, this.field_146294_l / 2 + 24, this.field_146295_m / 2 + 74, 80, 20, I18n.getStringParams("gui.done", new Object[0])));
+ this.field_146292_n.add(button = new GuiButton(2, (field_146294_l - field_146555_f) / 2 + 24, field_146295_m / 2 + 74, 125, 20, AchievementPage.getTitle(currentPage)));
}
/**
@@ -89,6 +107,16 @@
this.mc.setIngameFocus();
}
+ if (par1GuiButton.id == 2)
+ {
+ currentPage++;
+ if (currentPage >= AchievementPage.getAchievementPages().size())
+ {
+ currentPage = -1;
+ }
+ button.displayString = AchievementPage.getTitle(currentPage);
+ }
protected void func_146284_a(GuiButton p_146284_1_)
@@ -76,6 +92,16 @@
{
this.field_146297_k.func_147108_a(this.field_146562_a);
}
+
super.actionPerformed(par1GuiButton);
+ if (p_146284_1_.field_146127_k == 2)
+ {
+ currentPage++;
+ if (currentPage >= AchievementPage.getAchievementPages().size())
+ {
+ currentPage = -1;
+ }
+ button.field_146126_j = AchievementPage.getTitle(currentPage);
+ }
}
}
@@ -314,11 +342,12 @@
@@ -343,11 +369,12 @@
int i4;
int j4;
int j5;
- for (i3 = 0; i3 < AchievementList.achievementList.size(); ++i3)
+ List<Achievement> achievementList = (currentPage == -1 ? minecraftAchievements : AchievementPage.getAchievementPage(currentPage).getAchievements());
+ for (i3 = 0; i3 < achievementList.size(); ++i3)
{
- Achievement achievement = (Achievement)AchievementList.achievementList.get(i3);
+ Achievement achievement = achievementList.get(i3);
- Achievement achievement1 = (Achievement)AchievementList.achievementList.get(i3);
+ Achievement achievement1 = achievementList.get(i3);
- if (achievement.parentAchievement != null)
+ if (achievement.parentAchievement != null && achievementList.contains(achievement.parentAchievement))
- if (achievement1.parentAchievement != null)
+ if (achievement1.parentAchievement != null && achievementList.contains(achievement1.parentAchievement))
{
k3 = achievement.displayColumn * 24 - k + 11 + k1;
j3 = achievement.displayRow * 24 - l + 11 + l1;
@@ -352,9 +381,9 @@
int l4;
j3 = achievement1.displayColumn * 24 - k + 11;
k3 = achievement1.displayRow * 24 - l + 11;
@@ -404,9 +431,9 @@
int i5;
int l4;
- for (k3 = 0; k3 < AchievementList.achievementList.size(); ++k3)
+ for (k3 = 0; k3 < achievementList.size(); ++k3)
- for (j5 = 0; j5 < AchievementList.achievementList.size(); ++j5)
+ for (j5 = 0; j5 < achievementList.size(); ++j5)
{
- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(k3);
+ Achievement achievement2 = (Achievement)achievementList.get(k3);
j4 = achievement2.displayColumn * 24 - k;
l3 = achievement2.displayRow * 24 - l;
- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(j5);
+ Achievement achievement2 = (Achievement)achievementList.get(j5);
l4 = achievement2.displayColumn * 24 - k;
i5 = achievement2.displayRow * 24 - l;

View file

@ -1,76 +1,36 @@
--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
@@ -8,6 +8,7 @@
import java.util.List;
@@ -6,6 +6,7 @@
import java.util.Iterator;
import java.util.Set;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
@@ -143,7 +144,11 @@
@@ -114,7 +115,11 @@
}
}
+ //Forge: Force lighting to be disabled as there are some issue where lighting would
+ //incorrectly be applied based on items that are in the inventory.
+ GL11.glDisable(GL11.GL_LIGHTING);
this.drawGuiContainerForegroundLayer(par1, par2);
this.func_146979_b(par1, par2);
+ GL11.glEnable(GL11.GL_LIGHTING);
InventoryPlayer inventoryplayer = this.mc.thePlayer.inventory;
ItemStack itemstack = this.draggedStack == null ? inventoryplayer.getItemStack() : this.draggedStack;
InventoryPlayer inventoryplayer = this.field_146297_k.thePlayer.inventory;
ItemStack itemstack = this.field_147012_x == null ? inventoryplayer.getItemStack() : this.field_147012_x;
@@ -207,8 +212,11 @@
@@ -178,8 +183,11 @@
GL11.glTranslatef(0.0F, 0.0F, 32.0F);
this.zLevel = 200.0F;
itemRenderer.zLevel = 200.0F;
- itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), par1ItemStack, par2, par3);
- itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str);
field_146296_j.zLevel = 200.0F;
- field_146296_j.renderItemAndEffectIntoGUI(this.field_146289_q, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_);
- field_146296_j.renderItemOverlayIntoGUI(this.field_146289_q, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_);
+ FontRenderer font = null;
+ if (par1ItemStack != null) font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
+ if (font == null) font = fontRenderer;
+ itemRenderer.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), par1ItemStack, par2, par3);
+ itemRenderer.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), par1ItemStack, par2, par3 - (this.draggedStack == null ? 0 : 8), par4Str);
+ if (p_146982_1_ != null) font = p_146982_1_.getItem().getFontRenderer(p_146982_1_);
+ if (font == null) font = field_146289_q;
+ field_146296_j.renderItemAndEffectIntoGUI(font, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_);
+ field_146296_j.renderItemOverlayIntoGUI(font, this.field_146297_k.getTextureManager(), p_146982_1_, p_146982_2_, p_146982_3_ - (this.field_147012_x == null ? 0 : 8), p_146982_4_);
this.zLevel = 0.0F;
itemRenderer.zLevel = 0.0F;
field_146296_j.zLevel = 0.0F;
}
@@ -229,7 +237,8 @@
}
}
- this.func_102021_a(list, par2, par3);
+ FontRenderer font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
+ drawHoveringText(list, par2, par3, (font == null ? fontRenderer : font));
}
/**
@@ -243,6 +252,11 @@
protected void func_102021_a(List par1List, int par2, int par3)
{
+ drawHoveringText(par1List, par2, par3, fontRenderer);
+ }
+
+ protected void drawHoveringText(List par1List, int par2, int par3, FontRenderer font)
+ {
if (!par1List.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
@@ -255,7 +269,7 @@
while (iterator.hasNext())
{
String s = (String)iterator.next();
- int l = this.fontRenderer.getStringWidth(s);
+ int l = font.getStringWidth(s);
if (l > k)
{
@@ -300,7 +314,7 @@
for (int k2 = 0; k2 < par1List.size(); ++k2)
{
String s1 = (String)par1List.get(k2);
- this.fontRenderer.drawStringWithShadow(s1, i1, j1, -1);
+ font.drawStringWithShadow(s1, i1, j1, -1);
if (k2 == 0)
{

View file

@ -1,121 +1,127 @@
--- ../src-base/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
+++ ../src-work/minecraft/net/minecraft/client/gui/inventory/GuiContainerCreative.java
@@ -61,6 +61,8 @@
private Slot field_74235_v;
private boolean field_74234_w;
private CreativeCrafting field_82324_x;
@@ -49,6 +49,8 @@
private boolean field_147057_D;
private CreativeCrafting field_147059_E;
private static final String __OBFID = "CL_00000752";
+ private static int tabPage = 0;
+ private int maxPages = 0;
public GuiContainerCreative(EntityPlayer par1EntityPlayer)
{
@@ -201,7 +203,7 @@
@@ -186,7 +188,7 @@
return;
}
- if (itemstack != null && itemstack2 != null && itemstack.isItemEqual(itemstack2))
+ if (itemstack != null && itemstack2 != null && itemstack.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770
- if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2))
+ if (itemstack1 != null && itemstack2 != null && itemstack1.isItemEqual(itemstack2) && ItemStack.areItemStackTagsEqual(itemstack1, itemstack2)) //Forge: Bugfix, Compare NBT data, allow for deletion of enchanted books, MC-12770
{
if (par3 == 0)
if (p_146984_3_ == 0)
{
@@ -279,6 +281,13 @@
this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]);
this.field_82324_x = new CreativeCrafting(this.mc);
this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_82324_x);
@@ -262,6 +264,13 @@
this.func_147050_b(CreativeTabs.creativeTabArray[i]);
this.field_147059_E = new CreativeCrafting(this.field_146297_k);
this.field_146297_k.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_147059_E);
+ int tabCount = CreativeTabs.creativeTabArray.length;
+ if (tabCount > 12)
+ {
+ buttonList.add(new GuiButton(101, guiLeft, guiTop - 50, 20, 20, "<"));
+ buttonList.add(new GuiButton(102, guiLeft + xSize - 20, guiTop - 50, 20, 20, ">"));
+ field_146292_n.add(new GuiButton(101, field_147003_i, field_147009_r - 50, 20, 20, "<"));
+ field_146292_n.add(new GuiButton(102, field_147003_i + field_146999_f - 20, field_147009_r - 50, 20, 20, ">"));
+ maxPages = ((tabCount - 12) / 10) + 1;
+ }
}
else
{
@@ -306,7 +315,7 @@
*/
@@ -284,7 +293,7 @@
// JAVADOC METHOD $$ func_73869_a
protected void keyTyped(char par1, int par2)
{
- if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex())
+ if (!CreativeTabs.creativeTabArray[selectedTabIndex].hasSearchBar())
- if (field_147058_w != CreativeTabs.tabAllSearch.getTabIndex())
+ if (!CreativeTabs.creativeTabArray[field_147058_w].hasSearchBar())
{
if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat))
if (GameSettings.isKeyDown(this.field_146297_k.gameSettings.keyBindChat))
{
@@ -343,6 +352,15 @@
@@ -321,6 +330,15 @@
{
ContainerCreative containercreative = (ContainerCreative)this.inventorySlots;
containercreative.itemList.clear();
GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
containercreative.field_148330_a.clear();
+
+ CreativeTabs tab = CreativeTabs.creativeTabArray[selectedTabIndex];
+ CreativeTabs tab = CreativeTabs.creativeTabArray[field_147058_w];
+ if (tab.hasSearchBar() && tab != CreativeTabs.tabAllSearch)
+ {
+ tab.displayAllReleventItems(containercreative.itemList);
+ tab.displayAllReleventItems(containercreative.field_148330_a);
+ updateFilteredItems(containercreative);
+ return;
+ }
+
Item[] aitem = Item.itemsList;
int i = aitem.length;
int j;
@@ -369,7 +387,12 @@
Item.enchantedBook.func_92113_a(enchantment, containercreative.itemList);
Iterator iterator = Item.field_150901_e.iterator();
while (iterator.hasNext())
@@ -332,7 +350,13 @@
item.func_150895_a(item, (CreativeTabs)null, containercreative.field_148330_a);
}
}
+ updateFilteredItems(containercreative);
+ }
+ //split from above for custom search tabs
+ private void updateFilteredItems(ContainerCreative containercreative)
+ //split from above for sutom search tabs
+ private void updateFilteredItems(GuiContainerCreative.ContainerCreative containercreative)
+ {
Iterator iterator = containercreative.itemList.iterator();
String s = this.searchField.getText().toLowerCase();
+ Iterator iterator;
Enchantment[] aenchantment = Enchantment.enchantmentsList;
int j = aenchantment.length;
@@ -413,7 +436,7 @@
@@ -386,7 +410,7 @@
{
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[field_147058_w];
- if (creativetabs.drawInForegroundOfTab())
+ if (creativetabs != null && creativetabs.drawInForegroundOfTab())
{
this.fontRenderer.drawString(I18n.getString(creativetabs.getTranslatedTabLabel()), 8, 6, 4210752);
}
@@ -462,7 +485,7 @@
GL11.glDisable(GL11.GL_BLEND);
this.field_146289_q.drawString(I18n.getStringParams(creativetabs.getTranslatedTabLabel(), new Object[0]), 8, 6, 4210752);
@@ -407,7 +431,7 @@
{
CreativeTabs creativetabs = acreativetabs[k1];
- if (this.func_74232_a(creativetabs, l, i1))
+ if (creativetabs != null && func_74232_a(creativetabs, l, i1))
- if (this.func_147049_a(creativetabs, l, i1))
+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1))
{
this.setCurrentCreativeTab(creativetabs);
return;
@@ -478,11 +501,17 @@
*/
private boolean needsScrollBars()
}
@@ -430,7 +454,7 @@
{
CreativeTabs creativetabs = acreativetabs[k1];
- if (this.func_147049_a(creativetabs, l, i1))
+ if (creativetabs != null && this.func_147049_a(creativetabs, l, i1))
{
this.func_147050_b(creativetabs);
return;
@@ -443,11 +467,13 @@
private boolean func_147055_p()
{
+ if (CreativeTabs.creativeTabArray[selectedTabIndex] == null) return false;
return selectedTabIndex != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[selectedTabIndex].shouldHidePlayerInventory() && ((ContainerCreative)this.inventorySlots).hasMoreThan1PageOfItemsInList();
+ if (CreativeTabs.creativeTabArray[field_147058_w] == null) return false;
return field_147058_w != CreativeTabs.tabInventory.getTabIndex() && CreativeTabs.creativeTabArray[field_147058_w].shouldHidePlayerInventory() && ((GuiContainerCreative.ContainerCreative)this.field_147002_h).func_148328_e();
}
private void setCurrentCreativeTab(CreativeTabs par1CreativeTabs)
private void func_147050_b(CreativeTabs p_147050_1_)
{
+ if (par1CreativeTabs == null)
+ {
+ return;
+ }
+
int i = selectedTabIndex;
selectedTabIndex = par1CreativeTabs.getTabIndex();
ContainerCreative containercreative = (ContainerCreative)this.inventorySlots;
@@ -551,7 +580,7 @@
+ if (p_147050_1_ == null) return;
int i = field_147058_w;
field_147058_w = p_147050_1_.getTabIndex();
GuiContainerCreative.ContainerCreative containercreative = (GuiContainerCreative.ContainerCreative)this.field_147002_h;
@@ -516,7 +542,7 @@
if (this.searchField != null)
if (this.field_147062_A != null)
{
- if (par1CreativeTabs == CreativeTabs.tabAllSearch)
+ if (par1CreativeTabs.hasSearchBar())
- if (p_147050_1_ == CreativeTabs.tabAllSearch)
+ if (p_147050_1_.hasSearchBar())
{
this.searchField.setVisible(true);
this.searchField.setCanLoseFocus(false);
@@ -653,23 +682,44 @@
this.field_147062_A.func_146189_e(true);
this.field_147062_A.func_146205_d(false);
@@ -613,23 +639,45 @@
super.drawScreen(par1, par2, par3);
CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray;
@ -130,40 +136,40 @@
{
CreativeTabs creativetabs = acreativetabs[j2];
- if (this.renderCreativeInventoryHoveringText(creativetabs, par1, par2))
+ if (creativetabs != null && this.renderCreativeInventoryHoveringText(creativetabs, par1, par2))
+ if (creativetabs == null) continue;
if (this.func_147052_b(creativetabs, par1, par2))
{
+ rendered = true;
break;
}
}
+ if (!rendered && !renderCreativeInventoryHoveringText(CreativeTabs.tabAllSearch, par1, par2))
+ if (!rendered && func_147052_b(CreativeTabs.tabAllSearch, par1, par2))
+ {
+ renderCreativeInventoryHoveringText(CreativeTabs.tabInventory, par1, par2);
+ func_147052_b(CreativeTabs.tabInventory, par1, par2);
+ }
+
if (this.field_74235_v != null && selectedTabIndex == CreativeTabs.tabInventory.getTabIndex() && this.isPointInRegion(this.field_74235_v.xDisplayPosition, this.field_74235_v.yDisplayPosition, 16, 16, par1, par2))
if (this.field_147064_C != null && field_147058_w == CreativeTabs.tabInventory.getTabIndex() && this.func_146978_c(this.field_147064_C.xDisplayPosition, this.field_147064_C.yDisplayPosition, 16, 16, par1, par2))
{
this.drawCreativeTabHoveringText(I18n.getString("inventory.binSlot"), par1, par2);
this.func_146279_a(I18n.getStringParams("inventory.binSlot", new Object[0]), par1, par2);
}
+ if (maxPages != 0)
+ {
+ String page = String.format("%d / %d", tabPage + 1, maxPages + 1);
+ int width = fontRenderer.getStringWidth(page);
+ int width = field_146289_q.getStringWidth(page);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ this.zLevel = 300.0F;
+ itemRenderer.zLevel = 300.0F;
+ fontRenderer.drawString(page, guiLeft + (xSize / 2) - (width / 2), guiTop - 44, -1);
+ field_146296_j.zLevel = 300.0F;
+ field_146289_q.drawString(page, field_147003_i + (field_146999_f / 2) - (width / 2), field_147009_r - 44, -1);
+ this.zLevel = 0.0F;
+ itemRenderer.zLevel = 0.0F;
+ field_146296_j.zLevel = 0.0F;
+ }
+
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
}
@@ -741,17 +791,35 @@
@@ -698,17 +746,37 @@
int k = acreativetabs.length;
int l;
@ -175,12 +181,13 @@
+ for (l = start; l < k; ++l)
{
CreativeTabs creativetabs1 = acreativetabs[l];
this.mc.getTextureManager().bindTexture(field_110424_t);
this.field_146297_k.getTextureManager().bindTexture(field_147061_u);
- if (creativetabs1.getTabIndex() != selectedTabIndex)
+ if (creativetabs1 != null && creativetabs1.getTabIndex() != selectedTabIndex)
+ if (creativetabs1 == null) continue;
+
if (creativetabs1.getTabIndex() != field_147058_w)
{
this.renderCreativeTab(creativetabs1);
this.func_147051_a(creativetabs1);
}
}
@ -188,21 +195,21 @@
+ {
+ if (creativetabs != CreativeTabs.tabAllSearch)
+ {
+ this.mc.getTextureManager().bindTexture(field_110424_t);
+ renderCreativeTab(CreativeTabs.tabAllSearch);
+ this.field_146297_k.getTextureManager().bindTexture(field_147061_u);
+ func_147051_a(CreativeTabs.tabAllSearch);
+ }
+ if (creativetabs != CreativeTabs.tabInventory)
+ {
+ this.mc.getTextureManager().bindTexture(field_110424_t);
+ renderCreativeTab(CreativeTabs.tabInventory);
+ this.field_146297_k.getTextureManager().bindTexture(field_147061_u);
+ 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();
@@ -766,6 +834,14 @@
this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15);
this.field_146297_k.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));
this.drawTexturedModalRect(this.field_147003_i, this.field_147009_r, 0, 0, this.field_146999_f, this.field_147000_g);
this.field_147062_A.func_146194_f();
@@ -723,6 +791,14 @@
this.drawTexturedModalRect(i1, k + (int)((float)(l - k - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15);
}
+ if (creativetabs == null || creativetabs.getTabPage() != tabPage)
@ -213,55 +220,46 @@
+ }
+ }
+
this.renderCreativeTab(creativetabs);
this.func_147051_a(creativetabs);
if (creativetabs == CreativeTabs.tabInventory)
@@ -776,6 +852,15 @@
@@ -733,6 +809,15 @@
protected boolean func_74232_a(CreativeTabs par1CreativeTabs, int par2, int par3)
protected boolean func_147049_a(CreativeTabs p_147049_1_, int p_147049_2_, int p_147049_3_)
{
+ if (par1CreativeTabs.getTabPage() != tabPage)
+ if (p_147049_1_.getTabPage() != tabPage)
+ {
+ if (par1CreativeTabs != CreativeTabs.tabAllSearch &&
+ par1CreativeTabs != CreativeTabs.tabInventory)
+ if (p_147049_1_ != CreativeTabs.tabAllSearch &&
+ p_147049_1_ != CreativeTabs.tabInventory)
+ {
+ return false;
+ }
+ }
+
int k = par1CreativeTabs.getTabColumn();
int k = p_147049_1_.getTabColumn();
int l = 28 * k;
byte b0 = 0;
@@ -883,6 +968,7 @@
@@ -833,6 +918,7 @@
}
GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glColor3f(1F, 1F, 1F); //Forge: Reset color in case Items change it.
this.drawTexturedModalRect(l, i1, j, k, 28, b0);
this.zLevel = 100.0F;
itemRenderer.zLevel = 100.0F;
@@ -890,7 +976,7 @@
i1 += 8 + (flag1 ? 1 : -1);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- ItemStack itemstack = new ItemStack(par1CreativeTabs.getTabIconItem());
+ ItemStack itemstack = par1CreativeTabs.getIconItemStack();
itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.getTextureManager(), itemstack, l, i1);
itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.getTextureManager(), itemstack, l, i1);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -912,6 +998,15 @@
field_146296_j.zLevel = 100.0F;
@@ -859,6 +945,15 @@
{
this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter));
this.field_146297_k.func_147108_a(new GuiStats(this, this.field_146297_k.thePlayer.func_146107_m()));
}
+
+ if (par1GuiButton.id == 101)
+ if (p_146284_1_.field_146127_k == 101)
+ {
+ tabPage = Math.max(tabPage - 1, 0);
+ }
+ else if (par1GuiButton.id == 102)
+ else if (p_146284_1_.field_146127_k == 102)
+ {
+ tabPage = Math.min(tabPage + 1, maxPages);
+ }
}
/**
public int func_147056_g()

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/gui/mco/GuiScreenCreateOnlineWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/mco/GuiScreenCreateOnlineWorld.java
@@ -207,7 +207,7 @@
GuiScreenCreateOnlineWorld.field_146765_a.error("Couldn\'t create world");
this.func_148416_a(unsupportedencodingexception.getLocalizedMessage());
}
- catch (IOException ioexception)
+ catch (@SuppressWarnings("hiding") IOException ioexception)
{
GuiScreenCreateOnlineWorld.field_146765_a.error("Could not parse response creating world");
this.func_148416_a(ioexception.getLocalizedMessage());

View file

@ -7,11 +7,11 @@
-@SideOnly(Side.CLIENT)
public class ModelBox
{
/**
@@ -96,6 +95,7 @@
/**
* Draw the six sided box defined by this ModelBox
*/
// JAVADOC FIELD $$ field_78253_h
@@ -86,6 +85,7 @@
}
// JAVADOC METHOD $$ func_78245_a
+ @SideOnly(Side.CLIENT)
public void render(Tessellator par1Tessellator, float par2)
{

View file

@ -7,18 +7,16 @@
-@SideOnly(Side.CLIENT)
public class ModelRenderer
{
/** The size of the texture file's width in pixels. */
@@ -117,7 +116,8 @@
this.rotationPointY = par2;
// JAVADOC FIELD $$ field_78801_a
@@ -110,6 +109,7 @@
this.rotationPointZ = par3;
}
-
+
+ @SideOnly(Side.CLIENT)
public void render(float par1)
{
if (!this.isHidden)
@@ -200,6 +200,7 @@
@@ -192,6 +192,7 @@
}
}
@ -26,18 +24,18 @@
public void renderWithRotation(float par1)
{
if (!this.isHidden)
@@ -238,6 +239,7 @@
/**
* Allows the changing of Angles after a box has been rendered
*/
@@ -228,6 +229,7 @@
}
// JAVADOC METHOD $$ func_78794_c
+ @SideOnly(Side.CLIENT)
public void postRender(float par1)
{
if (!this.isHidden)
@@ -282,6 +284,7 @@
/**
* Compiles a GL display list for this model
*/
@@ -270,6 +272,7 @@
}
// JAVADOC METHOD $$ func_78788_d
+ @SideOnly(Side.CLIENT)
private void compileDisplayList(float par1)
{

View file

@ -1,7 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java
+++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java
@@ -4,7 +4,6 @@
import cpw.mods.fml.relauncher.SideOnly;
@@ -1,10 +1,7 @@
package net.minecraft.client.model;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.util.Vec3;
-@SideOnly(Side.CLIENT)

View file

@ -1,6 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java
+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java
@@ -5,7 +5,6 @@
@@ -1,11 +1,8 @@
package net.minecraft.client.model;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.Vec3;

View file

@ -1,19 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
@@ -13,6 +13,8 @@
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.EmptyChunk;
import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.world.ChunkEvent;
@SideOnly(Side.CLIENT)
public class ChunkProviderClient implements IChunkProvider
@@ -75,6 +77,7 @@
{
@@ -63,6 +63,7 @@
Chunk chunk = new Chunk(this.worldObj, par1, par2);
this.chunkMapping.add(ChunkCoordIntPair.chunkXZ2Int(par1, par2), chunk);
+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(chunk));
this.chunkListing.add(chunk);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk));
chunk.isChunkLoaded = true;
return chunk;
}

View file

@ -1,47 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java
@@ -191,6 +191,11 @@
import net.minecraft.world.storage.MapStorage;
import org.lwjgl.input.Keyboard;
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge;
+
@SideOnly(Side.CLIENT)
public class NetClientHandler extends NetHandler
{
@@ -784,7 +789,7 @@
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
{
- this.netManager.networkShutdown("disconnect.kicked", new Object[0]);
+ this.netManager.networkShutdown("disconnect.kicked", par1Packet255KickDisconnect.reason);
this.disconnected = true;
this.mc.loadWorld((WorldClient)null);
@@ -870,7 +875,11 @@
{
return;
}
- this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.createFromJson(par1Packet3Chat.message).toStringWithFormatting(true));
+ ClientChatReceivedEvent event = new ClientChatReceivedEvent(par1Packet3Chat.message);
+ if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null)
+ {
+ this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.createFromJson(event.message).toStringWithFormatting(true));
+ }
}
public void handleAnimation(Packet18Animation par1Packet18Animation)
@@ -1358,6 +1367,10 @@
{
tileentity.readFromNBT(par1Packet132TileEntityData.data);
}
+ else
+ {
+ tileentity.onDataPacket(netManager, par1Packet132TileEntityData);
+ }
}
}
}

View file

@ -1,8 +1,8 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -22,6 +22,10 @@
import net.minecraft.world.EnumGameType;
@@ -28,6 +28,10 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge;
@ -11,8 +11,8 @@
@SideOnly(Side.CLIENT)
public class PlayerControllerMP
{
@@ -125,6 +129,12 @@
*/
@@ -104,6 +108,12 @@
// JAVADOC METHOD $$ func_78751_a
public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4)
{
+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
@ -24,32 +24,37 @@
if (this.currentGameType.isAdventure() && !this.mc.thePlayer.isCurrentToolAdventureModeExempt(par1, par2, par3))
{
return false;
@@ -146,7 +156,7 @@
@@ -125,7 +135,7 @@
{
worldclient.playAuxSFX(2001, par1, par2, par3, block.blockID + (worldclient.getBlockMetadata(par1, par2, par3) << 12));
worldclient.playAuxSFX(2001, par1, par2, par3, Block.func_149682_b(block) + (worldclient.getBlockMetadata(par1, par2, par3) << 12));
int i1 = worldclient.getBlockMetadata(par1, par2, par3);
- boolean flag = worldclient.setBlockToAir(par1, par2, par3);
+ boolean flag = block.removeBlockByPlayer(worldclient, mc.thePlayer, par1, par2, par3);
- boolean flag = worldclient.func_147468_f(par1, par2, par3);
+ boolean flag = block.removedByPlayer(worldclient, mc.thePlayer, par1, par2, par3);
if (flag)
{
@@ -347,8 +357,14 @@
@@ -326,11 +336,18 @@
float f2 = (float)par8Vec3.zCoord - (float)par6;
boolean flag = false;
int i1;
- if ((!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null) && par2World.func_147439_a(par4, par5, par6).func_149727_a(par2World, par4, par5, par6, par1EntityPlayer, par7, f, f1, f2))
+ if (par3ItemStack != null &&
+ par3ItemStack.getItem() != null &&
+ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7, f, f1, f2))
+ {
+ return true;
+ }
- if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null)
+ if (!par1EntityPlayer.isSneaking() || (par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().shouldPassSneakingClickToBlock(par2World, par4, par5, par6)))
{
i1 = par2World.getBlockId(par4, par5, par6);
- flag = true;
+ return true;
}
@@ -389,7 +405,15 @@
+ if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null || par1EntityPlayer.getHeldItem().getItem().doesSneakBypassUse(par2World, par4, par5, par6, par1EntityPlayer))
+ {
+ flag = par2World.func_147439_a(par4, par5, par6).func_149727_a(par2World, par4, par5, par6, par1EntityPlayer, par7, f, f1, f2);
+ }
+
if (!flag && par3ItemStack != null && par3ItemStack.getItem() instanceof ItemBlock)
{
ItemBlock itemblock = (ItemBlock)par3ItemStack.getItem();
@@ -362,7 +379,15 @@
}
else
{
@ -66,7 +71,7 @@
}
}
@@ -411,9 +435,10 @@
@@ -382,9 +407,10 @@
{
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = itemstack1;

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java
@@ -29,6 +29,9 @@
@@ -34,6 +34,9 @@
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.storage.SaveHandlerMP;
@ -10,21 +10,21 @@
@SideOnly(Side.CLIENT)
public class WorldClient extends World
{
@@ -59,8 +62,11 @@
super(new SaveHandlerMP(), "MpServer", WorldProvider.getProviderForDimension(par3), par2WorldSettings, par5Profiler, par6ILogAgent);
this.sendQueue = par1NetClientHandler;
this.difficultySetting = par4;
@@ -56,8 +59,11 @@
super(new SaveHandlerMP(), "MpServer", WorldProvider.getProviderForDimension(p_i45063_3_), p_i45063_2_, p_i45063_5_);
this.sendQueue = p_i45063_1_;
this.difficultySetting = p_i45063_4_;
- this.setSpawnLocation(8, 64, 8);
this.mapStorage = par1NetClientHandler.mapStorage;
this.mapStorage = p_i45063_1_.field_147305_a;
+ this.isRemote = true;
+ finishSetup();
+ this.finishSetup();
+ this.setSpawnLocation(8, 64, 8);
+ MinecraftForge.EVENT_BUS.post(new WorldEvent.Load(this));
}
/**
@@ -290,6 +296,12 @@
*/
// JAVADOC METHOD $$ func_72835_b
@@ -275,6 +281,12 @@
// JAVADOC METHOD $$ func_72979_l
protected void updateWeather()
{
+ super.updateWeather();
@ -35,4 +35,4 @@
+ {
if (!this.provider.hasNoSky)
{
this.prevRainingStrength = this.rainingStrength;
;

View file

@ -0,0 +1,35 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
@@ -190,6 +190,8 @@
import net.minecraft.world.storage.ISaveHandler;
import net.minecraft.world.storage.MapData;
import net.minecraft.world.storage.MapStorage;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -673,7 +675,11 @@
public void func_147251_a(S02PacketChat p_147251_1_)
{
- this.field_147299_f.ingameGUI.func_146158_b().func_146227_a(p_147251_1_.func_148915_c());
+ ClientChatReceivedEvent event = new ClientChatReceivedEvent(p_147251_1_.func_148915_c());
+ if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null)
+ {
+ this.field_147299_f.ingameGUI.func_146158_b().func_146227_a(event.message);
+ }
}
public void func_147279_a(S0BPacketAnimation p_147279_1_)
@@ -1113,6 +1119,10 @@
{
tileentity.func_145839_a(p_147273_1_.func_148857_g());
}
+ else
+ {
+ tileentity.onDataPacket(field_147302_e, p_147273_1_);
+ }
}
}
}

View file

@ -1,39 +1,47 @@
--- ../src-base/minecraft/net/minecraft/client/particle/EffectRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/particle/EffectRenderer.java
@@ -12,6 +12,7 @@
import net.minecraft.client.renderer.texture.TextureMap;
@@ -16,9 +16,11 @@
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
+
import org.lwjgl.opengl.GL11;
@@ -63,10 +64,14 @@
for (int j = 0; j < this.fxLayers[i].size(); ++j)
{
EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j);
- entityfx.onUpdate();
@SideOnly(Side.CLIENT)
@@ -72,7 +74,10 @@
try
{
- entityfx.onUpdate();
+ if (entityfx != null)
+ {
+ entityfx.onUpdate();
+ }
}
catch (Throwable throwable)
{
@@ -97,7 +102,7 @@
throw new ReportedException(crashreport);
}
- if (entityfx.isDead)
+ if (entityfx != null)
{
+ entityfx.onUpdate();
+ }
+
+ if (entityfx == null || entityfx.isDead)
+ {
{
this.fxLayers[i].remove(j--);
}
}
@@ -115,6 +120,7 @@
@@ -147,6 +152,7 @@
for (int j = 0; j < this.fxLayers[i].size(); ++j)
{
EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j);
final EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j);
+ if (entityfx == null) continue;
tessellator.setBrightness(entityfx.getBrightnessForRender(par2));
entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4);
}
@@ -145,6 +151,7 @@
try
@@ -203,6 +209,7 @@
for (int i = 0; i < list.size(); ++i)
{
EntityFX entityfx = (EntityFX)list.get(i);
@ -41,27 +49,24 @@
tessellator.setBrightness(entityfx.getBrightnessForRender(par2));
entityfx.renderParticle(tessellator, par2, f2, f6, f3, f4, f5);
}
@@ -163,9 +170,9 @@
@@ -221,7 +228,7 @@
public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5)
public void func_147215_a(int p_147215_1_, int p_147215_2_, int p_147215_3_, Block p_147215_4_, int p_147215_5_)
{
- if (par4 != 0)
+ Block block = Block.blocksList[par4];
+ if (block != null && !block.addBlockDestroyEffects(worldObj, par1, par2, par3, par5, this))
- if (p_147215_4_.func_149688_o() != Material.field_151579_a)
+ if (!p_147215_4_.isAir(worldObj, p_147215_1_, p_147215_2_, p_147215_3_) && !p_147215_4_.addDestroyEffects(worldObj, p_147215_1_, p_147215_2_, p_147215_3_, p_147215_5_, this))
{
- Block block = Block.blocksList[par4];
byte b0 = 4;
for (int j1 = 0; j1 < b0; ++j1)
@@ -237,4 +244,13 @@
@@ -291,4 +298,13 @@
{
return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size());
}
+
+ public void addBlockHitEffects(int x, int y, int z, MovingObjectPosition target)
+ {
+ Block block = Block.blocksList[worldObj.getBlockId(x, y, z)];
+ if (block != null && !block.addBlockHitEffects(worldObj, target, this))
+ Block block = worldObj.func_147439_a(x, y, z);
+ if (block != null && !block.addHitEffects(worldObj, target, this))
+ {
+ addBlockHitEffects(x, y, z, target.sideHit);
+ }

View file

@ -1,9 +1,9 @@
--- ../src-base/minecraft/net/minecraft/client/particle/EntityDiggingFX.java
+++ ../src-work/minecraft/net/minecraft/client/particle/EntityDiggingFX.java
@@ -10,15 +10,22 @@
public class EntityDiggingFX extends EntityFX
@@ -12,21 +12,28 @@
{
private Block blockInstance;
private Block field_145784_a;
private static final String __OBFID = "CL_00000932";
+ private int side;
public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15)
@ -14,22 +14,20 @@
+ public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int side)
+ {
super(par1World, par2, par4, par6, par8, par10, par12);
this.blockInstance = par14Block;
- this.setParticleIcon(par14Block.getIcon(0, par15));
+ this.setParticleIcon(par14Block.getIcon(side, par15));
this.particleGravity = par14Block.blockParticleGravity;
this.field_145784_a = par14Block;
- this.setParticleIcon(par14Block.func_149691_a(0, par15));
+ this.setParticleIcon(par14Block.func_149691_a(side, par15));
this.particleGravity = par14Block.field_149763_I;
this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
this.particleScale /= 2.0F;
+ this.side = side;
}
/**
@@ -26,7 +33,7 @@
*/
// JAVADOC METHOD $$ func_70596_a
public EntityDiggingFX applyColourMultiplier(int par1, int par2, int par3)
{
- if (this.blockInstance == Block.grass)
+ if (this.blockInstance == Block.grass && this.side != 1)
- if (this.field_145784_a == Blocks.grass)
+ if (this.field_145784_a == Blocks.grass && this.side != 1)
{
return this;
}

View file

@ -1,16 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java
+++ ../src-work/minecraft/net/minecraft/client/particle/EntityFireworkStarterFX.java
@@ -30,11 +30,11 @@
{
this.fireworkExplosions = par15NBTTagCompound.getTagList("Explosions");
- if (this.fireworkExplosions.tagCount() == 0)
+ if (this.fireworkExplosions != null && this.fireworkExplosions.tagCount() == 0)
{
this.fireworkExplosions = null;
}
- else
+ else if (this.fireworkExplosions != null)
{
this.particleMaxAge = this.fireworkExplosions.tagCount() * 2 - 1;

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java
@@ -40,6 +40,11 @@
@@ -52,6 +52,11 @@
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.Project;
@ -10,9 +10,9 @@
+import net.minecraftforge.common.MinecraftForge;
+
@SideOnly(Side.CLIENT)
public class EntityRenderer
public class EntityRenderer implements IResourceManagerReloadListener
{
@@ -319,7 +324,7 @@
@@ -397,7 +402,7 @@
if (d3 < d2 || d2 == 0.0D)
{
@ -21,8 +21,8 @@
{
if (d2 == 0.0D)
{
@@ -354,8 +359,15 @@
*/
@@ -432,8 +437,15 @@
// JAVADOC METHOD $$ func_78477_e
private void updateFovModifierHand()
{
- EntityPlayerSP entityplayersp = (EntityPlayerSP)this.mc.renderViewEntity;
@ -39,7 +39,7 @@
this.fovModifierHandPrev = this.fovModifierHand;
this.fovModifierHand += (this.fovMultiplierTemp - this.fovModifierHand) * 0.5F;
@@ -381,7 +393,7 @@
@@ -457,7 +469,7 @@
}
else
{
@ -48,42 +48,35 @@
float f1 = 70.0F;
if (par2)
@@ -468,15 +480,7 @@
@@ -540,15 +552,7 @@
if (!this.mc.gameSettings.debugCamEnable)
{
- int i = this.mc.theWorld.getBlockId(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ));
- Block block = this.mc.theWorld.func_147439_a(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ));
-
- if (i == Block.bed.blockID)
- if (block == Blocks.bed)
- {
- int j = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ));
- int k = j & 3;
- GL11.glRotatef((float)(k * 90), 0.0F, 1.0F, 0.0F);
- int i = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(entitylivingbase.posX), MathHelper.floor_double(entitylivingbase.posY), MathHelper.floor_double(entitylivingbase.posZ));
- int j = i & 3;
- GL11.glRotatef((float)(j * 90), 0.0F, 1.0F, 0.0F);
- }
-
+ ForgeHooksClient.orientBedCamera(mc, entitylivingbase);
GL11.glRotatef(entitylivingbase.prevRotationYaw + (entitylivingbase.rotationYaw - entitylivingbase.prevRotationYaw) * par1 + 180.0F, 0.0F, -1.0F, 0.0F);
GL11.glRotatef(entitylivingbase.prevRotationPitch + (entitylivingbase.rotationPitch - entitylivingbase.prevRotationPitch) * par1, -1.0F, 0.0F, 0.0F);
}
@@ -1152,7 +1156,10 @@
{
@@ -1253,7 +1257,10 @@
GL11.glPushMatrix();
RenderHelper.enableStandardItemLighting();
this.mc.mcProfiler.endStartSection("entities");
+ ForgeHooksClient.setRenderPass(0);
renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1);
renderglobal.func_147589_a(entitylivingbase, frustrum, par1);
+ ForgeHooksClient.setRenderPass(0);
+ /* Forge: Moved down
+ // ToDo: Try and figure out how to make particles render sorted correctly.. {They render behind water}
this.enableLightmap((double)par1);
this.mc.mcProfiler.endStartSection("litParticles");
effectrenderer.renderLitParticles(entitylivingbase, par1);
@@ -1161,13 +1168,17 @@
this.mc.mcProfiler.endStartSection("particles");
effectrenderer.renderParticles(entitylivingbase, par1);
this.disableLightmap((double)par1);
+ */
if (this.mc.objectMouseOver != null && entitylivingbase.isInsideOfMaterial(Material.water) && entitylivingbase instanceof EntityPlayer && !this.mc.gameSettings.hideGUI)
{
@@ -1271,7 +1278,10 @@
entityplayer = (EntityPlayer)entitylivingbase;
GL11.glDisable(GL11.GL_ALPHA_TEST);
this.mc.mcProfiler.endStartSection("outline");
@ -95,25 +88,7 @@
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
}
@@ -1222,6 +1233,17 @@
renderglobal.sortAndRender(entitylivingbase, 1, (double)par1);
}
+
+ if (this.debugViewDirection == 0) //Only render if render pass 0 happens as well.
+ {
+ RenderHelper.enableStandardItemLighting();
+ this.mc.mcProfiler.endStartSection("entities");
+ ForgeHooksClient.setRenderPass(1);
+ renderglobal.renderEntities(entitylivingbase.getPosition(par1), frustrum, par1);
+ ForgeHooksClient.setRenderPass(-1);
+ RenderHelper.disableStandardItemLighting();
+ }
+
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
@@ -1231,14 +1253,17 @@
@@ -1284,14 +1294,17 @@
entityplayer = (EntityPlayer)entitylivingbase;
GL11.glDisable(GL11.GL_ALPHA_TEST);
this.mc.mcProfiler.endStartSection("outline");
@ -127,30 +102,26 @@
this.mc.mcProfiler.endStartSection("destroyProgress");
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
OpenGlHelper.func_148821_a(770, 1, 1, 0);
- renderglobal.drawBlockDamageTexture(Tessellator.instance, (EntityPlayer)entitylivingbase, par1);
+ renderglobal.drawBlockDamageTexture(Tessellator.instance, entitylivingbase, par1);
GL11.glDisable(GL11.GL_BLEND);
this.mc.mcProfiler.endStartSection("weather");
this.renderRainSnow(par1);
@@ -1249,6 +1274,20 @@
this.renderCloudsCheck(renderglobal, par1);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_CULL_FACE);
@@ -1346,6 +1359,16 @@
renderglobal.sortAndRender(entitylivingbase, 1, (double)par1);
}
+ //Forge: Moved section from above, now particles are the last thing to render.
+ this.enableLightmap((double)par1);
+ this.mc.mcProfiler.endStartSection("litParticles");
+ effectrenderer.renderLitParticles(entitylivingbase, par1);
+ RenderHelper.disableStandardItemLighting();
+ this.setupFog(0, par1);
+ this.mc.mcProfiler.endStartSection("particles");
+ effectrenderer.renderParticles(entitylivingbase, par1);
+ this.disableLightmap((double)par1);
+ //Forge: End Move
+ if (this.debugViewDirection == 0) //Only render if render pass 0 happens as well.
+ {
+ RenderHelper.enableStandardItemLighting();
+ this.mc.mcProfiler.endStartSection("entities");
+ ForgeHooksClient.setRenderPass(1);
+ renderglobal.func_147589_a(entitylivingbase, frustrum, par1);
+ ForgeHooksClient.setRenderPass(-1);
+ RenderHelper.disableStandardItemLighting();
+ }
+
+ this.mc.mcProfiler.endStartSection("FRenderLast");
+ ForgeHooksClient.dispatchRenderLast(renderglobal, par1);
+
this.mc.mcProfiler.endStartSection("hand");
if (this.cameraZoom == 1.0D)
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);

View file

@ -1,15 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java
@@ -16,6 +16,8 @@
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
@@ -20,6 +20,7 @@
import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemCloth;
+import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
@@ -24,6 +26,13 @@
@@ -28,6 +29,13 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -23,65 +22,56 @@
@SideOnly(Side.CLIENT)
public class ItemRenderer
{
@@ -54,16 +63,33 @@
this.mapItemRenderer = new MapItemRenderer(par1Minecraft.gameSettings, par1Minecraft.getTextureManager());
}
+ public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3)
+ {
+ this.renderItem(par1EntityLivingBase, par2ItemStack, par3, ItemRenderType.EQUIPPED);
@@ -53,13 +61,25 @@
// JAVADOC METHOD $$ func_78443_a
public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3)
{
+ this.renderItem(par1EntityLivingBase, par2ItemStack, par3, EQUIPPED);
+ }
+
/**
* Renders the item stack for being in an entity's hand Args: itemStack
*/
- public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3)
+ // JAVADOC METHOD $$ func_78443_a
+ public void renderItem(EntityLivingBase par1EntityLivingBase, ItemStack par2ItemStack, int par3, ItemRenderType type)
{
+ {
GL11.glPushMatrix();
TextureManager texturemanager = this.mc.getTextureManager();
Item item = par2ItemStack.getItem();
Block block = Block.func_149634_a(item);
- if (par2ItemStack.getItemSpriteNumber() == 0 && par2ItemStack.itemID < Block.blocksList.length && Block.blocksList[par2ItemStack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
+ Block block = null;
+ if (par2ItemStack.getItem() instanceof ItemBlock && par2ItemStack.itemID < Block.blocksList.length)
{
+ block = Block.blocksList[par2ItemStack.itemID];
+ }
+
- if (par2ItemStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.func_147739_a(block.func_149645_b()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, type);
+ if (customRenderer != null)
+ {
{
+ texturemanager.bindTexture(texturemanager.getResourceLocation(par2ItemStack.getItemSpriteNumber()));
+ ForgeHooksClient.renderEquippedItem(type, customRenderer, renderBlocksInstance, par1EntityLivingBase, par2ItemStack);
+ ForgeHooksClient.renderEquippedItem(type, customRenderer, field_147720_h, par1EntityLivingBase, par2ItemStack);
+ }
+ else if (block != null && par2ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
+ else if (par2ItemStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.func_147739_a(block.func_149645_b()))
+ {
texturemanager.bindTexture(texturemanager.getResourceLocation(0));
this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
}
@@ -94,7 +120,7 @@
if (par2ItemStack != null && par2ItemStack.getItem() instanceof ItemCloth)
@@ -104,7 +124,7 @@
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F);
- if (par2ItemStack.hasEffect() && par3 == 0)
+ if (par2ItemStack.hasEffect(par3))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -266,7 +292,7 @@
Render render;
@@ -279,7 +299,7 @@
RenderPlayer renderplayer;
Render render;
- if (itemstack != null && itemstack.itemID == Item.map.itemID)
- if (itemstack != null && itemstack.getItem() == Items.filled_map)
+ if (itemstack != null && itemstack.getItem() instanceof ItemMap)
{
GL11.glPushMatrix();
f12 = 0.8F;
@@ -333,12 +359,21 @@
f13 = 0.8F;
@@ -346,12 +366,21 @@
tessellator.addVertexWithUV((double)(128 + b0), (double)(0 - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double)(0 - b0), (double)(0 - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
- MapData mapdata = Item.map.getMapData(itemstack, this.mc.theWorld);
- MapData mapdata = Items.filled_map.getMapData(itemstack, this.mc.theWorld);
- if (mapdata != null)
+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
@ -89,10 +79,10 @@
+
+ if (custom == null)
{
- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), mapdata);
- this.mc.entityRenderer.func_147701_i().func_148250_a(mapdata, false);
+ if (mapdata != null)
+ {
+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.getTextureManager(), mapdata);
+ this.mc.entityRenderer.func_147701_i().func_148250_a(mapdata, false);
+ }
}
+ else
@ -102,32 +92,32 @@
GL11.glPopMatrix();
}
@@ -439,17 +474,20 @@
@@ -452,17 +481,20 @@
if (itemstack.getItem().requiresMultipleRenderPasses())
{
- this.renderItem(entityclientplayermp, itemstack, 0);
- int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 1);
- f11 = (float)(i1 >> 16 & 255) / 255.0F;
- f13 = (float)(i1 >> 8 & 255) / 255.0F;
- f14 = (float)(i1 & 255) / 255.0F;
- GL11.glColor4f(f5 * f11, f5 * f13, f5 * f14, 1.0F);
- int j1 = itemstack.getItem().getColorFromItemStack(itemstack, 1);
- f10 = (float)(j1 >> 16 & 255) / 255.0F;
- f11 = (float)(j1 >> 8 & 255) / 255.0F;
- f12 = (float)(j1 & 255) / 255.0F;
- GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F);
- this.renderItem(entityclientplayermp, itemstack, 1);
+ this.renderItem(entityclientplayermp, itemstack, 0, ItemRenderType.EQUIPPED_FIRST_PERSON);
+ this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
+ for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
+ {
+ int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, x);
+ f11 = (float)(i1 >> 16 & 255) / 255.0F;
+ f13 = (float)(i1 >> 8 & 255) / 255.0F;
+ f14 = (float)(i1 & 255) / 255.0F;
+ GL11.glColor4f(f5 * f11, f5 * f13, f5 * f14, 1.0F);
+ this.renderItem(entityclientplayermp, itemstack, x, ItemRenderType.EQUIPPED_FIRST_PERSON);
+ int j1 = itemstack.getItem().getColorFromItemStack(itemstack, x);
+ f10 = (float)(j1 >> 16 & 255) / 255.0F;
+ f11 = (float)(j1 >> 8 & 255) / 255.0F;
+ f12 = (float)(j1 & 255) / 255.0F;
+ GL11.glColor4f(1.0F * f10, 1.0F * f11, 1.0F * f12, 1.0F);
+ this.renderItem(entityclientplayermp, itemstack, 1, EQUIPPED_FIRST_PERSON);
+ }
}
else
{
- this.renderItem(entityclientplayermp, itemstack, 0);
+ this.renderItem(entityclientplayermp, itemstack, 0, ItemRenderType.EQUIPPED_FIRST_PERSON);
+ this.renderItem(entityclientplayermp, itemstack, 0, EQUIPPED_FIRST_PERSON);
}
GL11.glPopMatrix();

View file

@ -1,17 +1,17 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
@@ -26,6 +26,10 @@
*/
private static boolean useMultitextureARB;
@@ -27,6 +27,10 @@
public static boolean field_148824_g;
private static final String __OBFID = "CL_00001179";
+ /* Stores the last values sent into setLightmapTextureCoords */
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
+
/**
* Initializes the texture constants to be used when rendering lightmap values
*/
@@ -88,5 +92,11 @@
// JAVADOC METHOD $$ func_77474_a
public static void initializeTextures()
{
@@ -89,6 +93,12 @@
{
GL13.glMultiTexCoord2f(par0, par1, par2);
}
@ -22,4 +22,5 @@
+ lastBrightnessY = par2;
+ }
}
}
public static void func_148821_a(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_)

View file

@ -1,108 +1,109 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/RenderBlocks.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderBlocks.java
@@ -45,6 +45,8 @@
@@ -52,6 +52,8 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+import static net.minecraftforge.common.ForgeDirection.*;
+import static net.minecraftforge.common.util.ForgeDirection.*;
+
@SideOnly(Side.CLIENT)
public class RenderBlocks
{
@@ -534,9 +536,8 @@
public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4)
@@ -336,9 +338,9 @@
private boolean func_147773_v(Block p_147773_1_, int p_147773_2_, int p_147773_3_, int p_147773_4_)
{
Tessellator tessellator = Tessellator.instance;
- int l = this.blockAccess.getBlockMetadata(par2, par3, par4);
- int i1 = BlockBed.getDirection(l);
- boolean flag = BlockBed.isBlockHeadOfBed(l);
+ int i1 = par1Block.getBedDirection(blockAccess, par2, par3, par4);
+ boolean flag = par1Block.isBedFoot(blockAccess, par2, par3, par4);
- int l = this.field_147845_a.getBlockMetadata(p_147773_2_, p_147773_3_, p_147773_4_);
- int i1 = BlockBed.func_149895_l(l);
- boolean flag = BlockBed.func_149975_b(l);
+ Block bed = this.field_147845_a.func_147439_a(p_147773_2_, p_147773_3_, p_147773_4_);
+ int i1 = bed.getBedDirection(field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_);
+ boolean flag = bed.isBedFoot(field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_);
float f = 0.5F;
float f1 = 1.0F;
float f2 = 0.8F;
@@ -545,6 +546,7 @@
@@ -347,6 +349,7 @@
tessellator.setBrightness(j1);
tessellator.setColorOpaque_F(f, f, f);
Icon icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 0);
+ if (hasOverrideBlockTexture()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside
double d0 = (double)icon.getMinU();
double d1 = (double)icon.getMaxU();
double d2 = (double)icon.getMinV();
@@ -561,6 +563,7 @@
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4));
IIcon iicon = this.func_147793_a(p_147773_1_, this.field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_, 0);
+ if (func_147744_b()) iicon = field_147840_d; //BugFix Proper breaking texture on underside
double d0 = (double)iicon.getMinU();
double d1 = (double)iicon.getMaxU();
double d2 = (double)iicon.getMinV();
@@ -363,6 +366,7 @@
tessellator.setBrightness(p_147773_1_.func_149677_c(this.field_147845_a, p_147773_2_, p_147773_3_ + 1, p_147773_4_));
tessellator.setColorOpaque_F(f1, f1, f1);
icon = this.getBlockIcon(par1Block, this.blockAccess, par2, par3, par4, 1);
+ if (hasOverrideBlockTexture()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside
d0 = (double)icon.getMinU();
d1 = (double)icon.getMaxU();
d2 = (double)icon.getMinV();
@@ -2358,7 +2361,7 @@
iicon = this.func_147793_a(p_147773_1_, this.field_147845_a, p_147773_2_, p_147773_3_, p_147773_4_, 1);
+ if (func_147744_b()) iicon = field_147840_d; //BugFix Proper breaking texture on underside
d0 = (double)iicon.getMinU();
d1 = (double)iicon.getMaxU();
d2 = (double)iicon.getMinV();
@@ -2037,7 +2041,7 @@
double d9;
double d10;
- if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4))
+ if (!this.blockAccess.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4, UP))
- if (!World.func_147466_a(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_) && !Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_))
+ if (!World.func_147466_a(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_) && !Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_ - 1, p_147801_4_, UP))
{
float f1 = 0.2F;
float f2 = 0.0625F;
@@ -2378,7 +2381,7 @@
float f2 = 0.2F;
float f1 = 0.0625F;
@@ -2057,7 +2061,7 @@
d0 = d5;
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, EAST))
- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_ - 1, p_147801_3_, p_147801_4_))
+ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_ - 1, p_147801_3_, p_147801_4_, EAST))
{
tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1);
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d2, d3);
@@ -2390,7 +2393,7 @@
tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1);
tessellator.addVertexWithUV((double)((float)p_147801_2_ + f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 1), d2, d1);
tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 1), d2, d3);
@@ -2069,7 +2073,7 @@
tessellator.addVertexWithUV((double)((float)p_147801_2_ + f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 1), d2, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, WEST))
- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_ + 1, p_147801_3_, p_147801_4_))
+ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_ + 1, p_147801_3_, p_147801_4_, WEST))
{
tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1);
tessellator.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d0, d3);
@@ -2402,7 +2405,7 @@
tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1);
tessellator.addVertexWithUV((double)((float)(p_147801_2_ + 1) - f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 0), d0, d1);
tessellator.addVertexWithUV((double)(p_147801_2_ + 1 - 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 0), d0, d3);
@@ -2081,7 +2085,7 @@
tessellator.addVertexWithUV((double)((float)(p_147801_2_ + 1) - f2), (double)((float)p_147801_3_ + f + f1), (double)(p_147801_4_ + 0), d0, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, SOUTH))
- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ - 1))
+ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ - 1, SOUTH))
{
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1);
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d2, d3);
@@ -2414,7 +2417,7 @@
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1);
tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)p_147801_3_ + f + f1), (double)((float)p_147801_4_ + f2), d2, d1);
tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 0), d2, d3);
@@ -2093,7 +2097,7 @@
tessellator.addVertexWithUV((double)(p_147801_2_ + 0), (double)((float)p_147801_3_ + f + f1), (double)((float)p_147801_4_ + f2), d2, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, NORTH))
- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ + 1))
+ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_, p_147801_4_ + 1, NORTH))
{
tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1);
tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + f2), (double)(par4 + 1 - 0), d0, d3);
@@ -2426,7 +2429,7 @@
tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1);
tessellator.addVertexWithUV((double)(p_147801_2_ + 1), (double)((float)p_147801_3_ + f + f1), (double)((float)(p_147801_4_ + 1) - f2), d0, d1);
tessellator.addVertexWithUV((double)(p_147801_2_ + 1), (double)((float)(p_147801_3_ + 0) + f1), (double)(p_147801_4_ + 1 - 0), d0, d3);
@@ -2105,7 +2109,7 @@
tessellator.addVertexWithUV((double)(p_147801_2_ + 1), (double)((float)p_147801_3_ + f + f1), (double)((float)(p_147801_4_ + 1) - f2), d0, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4, DOWN))
- if (Blocks.fire.func_149844_e(this.field_147845_a, p_147801_2_, p_147801_3_ + 1, p_147801_4_))
+ if (Blocks.fire.canCatchFire(this.field_147845_a, p_147801_2_, p_147801_3_ + 1, p_147801_4_, DOWN))
{
d5 = (double)par2 + 0.5D + 0.5D;
d6 = (double)par2 + 0.5D - 0.5D;
@@ -3057,10 +3060,10 @@
double d17 = (double)par2 + 0.5D + 0.0625D;
double d18 = (double)par4 + 0.5D - 0.0625D;
double d19 = (double)par4 + 0.5D + 0.0625D;
- boolean flag = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 - 1));
- boolean flag1 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2, par3, par4 + 1));
- boolean flag2 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 - 1, par3, par4));
- boolean flag3 = par1BlockPane.canThisPaneConnectToThisBlockID(this.blockAccess.getBlockId(par2 + 1, par3, par4));
+ boolean flag = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, NORTH);
+ boolean flag1 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, SOUTH);
+ boolean flag2 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, WEST);
+ boolean flag3 = par1BlockPane.canPaneConnectTo(this.blockAccess,par2, par3, par4, EAST);
boolean flag4 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 + 1, par4, 1);
boolean flag5 = par1BlockPane.shouldSideBeRendered(this.blockAccess, par2, par3 - 1, par4, 0);
double d20 = 0.01D;
d5 = (double)p_147801_2_ + 0.5D + 0.5D;
d6 = (double)p_147801_2_ + 0.5D - 0.5D;
@@ -3118,10 +3122,10 @@
double d16 = (double)p_147767_2_ + 0.5D + 0.0625D;
double d17 = (double)p_147767_4_ + 0.5D - 0.0625D;
double d18 = (double)p_147767_4_ + 0.5D + 0.0625D;
- boolean flag = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_, p_147767_3_, p_147767_4_ - 1));
- boolean flag1 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_, p_147767_3_, p_147767_4_ + 1));
- boolean flag2 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_ - 1, p_147767_3_, p_147767_4_));
- boolean flag3 = p_147767_1_.func_150098_a(this.field_147845_a.func_147439_a(p_147767_2_ + 1, p_147767_3_, p_147767_4_));
+ boolean flag = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_, p_147767_3_, p_147767_4_ - 1, NORTH);
+ boolean flag1 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_, p_147767_3_, p_147767_4_ + 1, SOUTH);
+ boolean flag2 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_ - 1, p_147767_3_, p_147767_4_, WEST );
+ boolean flag3 = p_147767_1_.canPaneConnectTo(this.field_147845_a, p_147767_2_ + 1, p_147767_3_, p_147767_4_, EAST );
boolean flag4 = p_147767_1_.func_149646_a(this.field_147845_a, p_147767_2_, p_147767_3_ + 1, p_147767_4_, 1);
boolean flag5 = p_147767_1_.func_149646_a(this.field_147845_a, p_147767_2_, p_147767_3_ - 1, p_147767_4_, 0);
double d19 = 0.01D;

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java
@@ -68,6 +68,9 @@
@@ -79,6 +79,9 @@
import org.lwjgl.opengl.ARBOcclusionQuery;
import org.lwjgl.opengl.GL11;
@ -10,43 +10,40 @@
@SideOnly(Side.CLIENT)
public class RenderGlobal implements IWorldAccess
{
@@ -447,8 +450,13 @@
*/
public void renderEntities(Vec3 par1Vec3, ICamera par2ICamera, float par3)
@@ -411,8 +414,10 @@
public void func_147589_a(EntityLivingBase p_147589_1_, ICamera p_147589_2_, float p_147589_3_)
{
+ int pass = MinecraftForgeClient.getRenderPass();
if (this.renderEntitiesStartupCounter > 0)
{
+ if (pass > 0)
+ {
+ return;
+ }
+ if (pass > 0) return;
--this.renderEntitiesStartupCounter;
}
else
@@ -456,6 +464,8 @@
@@ -423,9 +428,12 @@
this.theWorld.theProfiler.startSection("prepare");
TileEntityRenderer.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, par3);
RenderManager.instance.cacheActiveRenderInfo(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.pointedEntityLiving, this.mc.gameSettings, par3);
TileEntityRendererDispatcher.field_147556_a.func_147542_a(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, p_147589_3_);
RenderManager.instance.func_147938_a(this.theWorld, this.mc.getTextureManager(), this.mc.fontRenderer, this.mc.renderViewEntity, this.mc.field_147125_j, this.mc.gameSettings, p_147589_3_);
+ if (pass == 0) // no indentation to shrink patch
+ {
this.countEntitiesTotal = 0;
this.countEntitiesRendered = 0;
this.countEntitiesHidden = 0;
@@ -466,16 +476,21 @@
TileEntityRenderer.staticPlayerX = entitylivingbase.lastTickPosX + (entitylivingbase.posX - entitylivingbase.lastTickPosX) * (double)par3;
TileEntityRenderer.staticPlayerY = entitylivingbase.lastTickPosY + (entitylivingbase.posY - entitylivingbase.lastTickPosY) * (double)par3;
TileEntityRenderer.staticPlayerZ = entitylivingbase.lastTickPosZ + (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * (double)par3;
+ }
this.mc.entityRenderer.enableLightmap((double)par3);
EntityLivingBase entitylivingbase1 = this.mc.renderViewEntity;
double d3 = entitylivingbase1.lastTickPosX + (entitylivingbase1.posX - entitylivingbase1.lastTickPosX) * (double)p_147589_3_;
double d4 = entitylivingbase1.lastTickPosY + (entitylivingbase1.posY - entitylivingbase1.lastTickPosY) * (double)p_147589_3_;
@@ -454,13 +462,17 @@
this.mc.entityRenderer.enableLightmap((double)p_147589_3_);
this.theWorld.theProfiler.endStartSection("global");
List list = this.theWorld.getLoadedEntityList();
+ if (pass == 0) // no indentation for smaller patch size
+ {
this.countEntitiesTotal = list.size();
+ }
int i;
Entity entity;
int i;
for (i = 0; i < this.theWorld.weatherEffects.size(); ++i)
{
@ -54,30 +51,30 @@
+ if (!entity.shouldRenderInPass(pass)) continue;
++this.countEntitiesRendered;
if (entity.isInRangeToRenderVec3D(par1Vec3))
@@ -489,6 +504,7 @@
if (entity.func_145770_h(d0, d1, d2))
@@ -474,6 +486,7 @@
for (i = 0; i < list.size(); ++i)
{
entity = (Entity)list.get(i);
+ if (!entity.shouldRenderInPass(pass)) continue;
boolean flag = entity.isInRangeToRenderVec3D(par1Vec3) && (entity.ignoreFrustumCheck || par2ICamera.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer);
boolean flag = entity.func_145770_h(d0, d1, d2) && (entity.ignoreFrustumCheck || p_147589_2_.isBoundingBoxInFrustum(entity.boundingBox) || entity.riddenByEntity == this.mc.thePlayer);
if (!flag && entity instanceof EntityLiving)
@@ -514,7 +530,11 @@
@@ -499,7 +512,11 @@
for (i = 0; i < this.tileEntities.size(); ++i)
for (i = 0; i < this.field_147598_a.size(); ++i)
{
- TileEntityRenderer.instance.renderTileEntity((TileEntity)this.tileEntities.get(i), par3);
+ TileEntity tile = (TileEntity)tileEntities.get(i);
+ if (tile.shouldRenderInPass(pass) && par2ICamera.isBoundingBoxInFrustum(tile.getRenderBoundingBox()))
- TileEntityRendererDispatcher.field_147556_a.func_147544_a((TileEntity)this.field_147598_a.get(i), p_147589_3_);
+ TileEntity tile = (TileEntity)this.field_147598_a.get(i);
+ if (tile.shouldRenderInPass(pass) && p_147589_2_.isBoundingBoxInFrustum(tile.getRenderBoundingBox()))
+ {
+ TileEntityRenderer.instance.renderTileEntity(tile, par3);
+ TileEntityRendererDispatcher.field_147556_a.func_147544_a(tile, p_147589_3_);
+ }
}
this.mc.entityRenderer.disableLightmap((double)par3);
@@ -949,6 +969,12 @@
*/
this.mc.entityRenderer.disableLightmap((double)p_147589_3_);
@@ -976,6 +993,12 @@
// JAVADOC METHOD $$ func_72714_a
public void renderSky(float par1)
{
+ IRenderHandler skyProvider = null;
@ -89,7 +86,7 @@
if (this.mc.theWorld.provider.dimensionId == 1)
{
GL11.glDisable(GL11.GL_FOG);
@@ -1187,6 +1213,13 @@
@@ -1214,6 +1237,12 @@
public void renderClouds(float par1)
{
@ -99,11 +96,10 @@
+ renderer.render(par1, theWorld, mc);
+ return;
+ }
+
if (this.mc.theWorld.provider.isSurfaceWorld())
{
if (this.mc.gameSettings.fancyGraphics)
@@ -1596,6 +1629,11 @@
@@ -1617,6 +1646,11 @@
public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3)
{

View file

@ -1,15 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/Tessellator.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/Tessellator.java
@@ -7,6 +7,8 @@
@@ -7,6 +7,7 @@
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
+import java.util.Arrays;
+
import org.lwjgl.opengl.ARBVertexBufferObject;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
@@ -14,6 +16,12 @@
import java.util.PriorityQueue;
import net.minecraft.client.shader.TesselatorVertexState;
import net.minecraft.client.util.QuadComparator;
@@ -15,11 +16,18 @@
@SideOnly(Side.CLIENT)
public class Tessellator
{
@ -19,84 +18,44 @@
+ public boolean defaultTexture = false;
+ private int rawBufferSize = 0;
+ public int textureID = 0;
/**
* Boolean used to check whether quads should be drawn as two triangles. Initialized to false and never changed.
*/
@@ -25,16 +33,16 @@
private static boolean tryVBO;
/** The byte buffer used for GL allocation. */
+
// JAVADOC FIELD $$ field_78394_d
- private ByteBuffer byteBuffer;
- private IntBuffer field_147568_c;
- private FloatBuffer field_147566_d;
- private ShortBuffer field_147567_e;
+ private static ByteBuffer byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4);
/** The same memory as byteBuffer, but referenced as an integer buffer. */
- private IntBuffer intBuffer;
+ private static IntBuffer intBuffer = byteBuffer.asIntBuffer();
/** The same memory as byteBuffer, but referenced as an float buffer. */
- private FloatBuffer floatBuffer;
+ private static FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
/** Short buffer */
- private ShortBuffer shortBuffer;
+ private static ShortBuffer shortBuffer = byteBuffer.asShortBuffer();
/** Raw integer array. */
+ private static IntBuffer field_147568_c = byteBuffer.asIntBuffer();
+ private static FloatBuffer field_147566_d = byteBuffer.asFloatBuffer();
+ private static ShortBuffer field_147567_e = byteBuffer.asShortBuffer();
// JAVADOC FIELD $$ field_78405_h
private int[] rawBuffer;
@@ -110,10 +118,10 @@
public boolean isDrawing;
/** Whether we are currently using VBO or not. */
- private boolean useVBO;
+ private static boolean useVBO = false;
/** An IntBuffer used to store the indices of vertex buffer objects. */
- private IntBuffer vertexBuffers;
+ private static IntBuffer vertexBuffers;
/**
* The index of the last VBO used. This is used in round-robin fashion, sequentially, through the vboCount vertex
@@ -122,25 +130,28 @@
private int vboIndex;
/** Number of vertex buffer objects allocated for use. */
- private int vboCount = 10;
+ private static int vboCount = 10;
/** The size of the buffers used (in integers). */
private int bufferSize;
// JAVADOC FIELD $$ field_78406_i
@@ -63,14 +71,17 @@
private Tessellator(int par1)
{
- this.bufferSize = par1;
- this.byteBuffer = GLAllocation.createDirectByteBuffer(par1 * 4);
- this.intBuffer = this.byteBuffer.asIntBuffer();
- this.floatBuffer = this.byteBuffer.asFloatBuffer();
- this.shortBuffer = this.byteBuffer.asShortBuffer();
- this.field_147568_c = this.byteBuffer.asIntBuffer();
- this.field_147566_d = this.byteBuffer.asFloatBuffer();
- this.field_147567_e = this.byteBuffer.asShortBuffer();
- this.rawBuffer = new int[par1];
- this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
+ }
+
}
+ public Tessellator()
+ {
+ }
+
+
+ static
+ {
+ instance.defaultTexture = true;
+ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
- if (this.useVBO)
+ if (useVBO)
{
- this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount);
- ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers);
+ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
+ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
}
}
@@ -157,12 +168,23 @@
+ }
+
// JAVADOC METHOD $$ func_78381_a
public int draw()
{
@@ -82,12 +93,15 @@
{
this.isDrawing = false;
@ -104,57 +63,44 @@
+ int offs = 0;
+ while (offs < vertexCount)
{
+ int vtc = 0;
+ if (drawMode == 7 && convertQuadsToTriangles)
+ {
+ vtc = Math.min(vertexCount - offs, trivertsInBuffer);
+ }
+ else
+ {
+ vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5);
+ }
this.intBuffer.clear();
- this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex);
+ this.intBuffer.put(this.rawBuffer, offs * 8, vtc * 8);
+ int vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5);
this.field_147568_c.clear();
- this.field_147568_c.put(this.rawBuffer, 0, this.field_147569_p);
+ this.field_147568_c.put(this.rawBuffer, offs * 8, vtc * 8);
this.byteBuffer.position(0);
- this.byteBuffer.limit(this.rawBufferIndex * 4);
- this.byteBuffer.limit(this.field_147569_p * 4);
+ this.byteBuffer.limit(vtc * 32);
+ offs += vtc;
if (this.useVBO)
if (this.hasTexture)
{
@@ -248,11 +270,11 @@
if (this.drawMode == 7 && convertQuadsToTriangles)
{
- GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, this.vertexCount);
+ GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vtc);
}
else
{
- GL11.glDrawArrays(this.drawMode, 0, this.vertexCount);
+ GL11.glDrawArrays(this.drawMode, 0, vtc);
}
@@ -122,7 +136,7 @@
this.field_147566_d.position(0);
GL11.glVertexPointer(3, 32, this.field_147566_d);
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
- GL11.glDrawArrays(this.drawMode, 0, this.vertexCount);
+ GL11.glDrawArrays(this.drawMode, 0, vtc);
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
@@ -280,6 +302,12 @@
if (this.hasTexture)
@@ -148,6 +162,12 @@
}
}
+ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3))
+ if (rawBufferSize > 0x20000 && field_147569_p < (rawBufferSize << 3))
+ {
+ rawBufferSize = 0;
+ field_147569_p = 0;
+ rawBuffer = null;
+ }
+
int i = this.rawBufferIndex * 4;
int i = this.field_147569_p * 4;
this.reset();
return i;
@@ -442,6 +470,19 @@
*/
@@ -326,6 +346,19 @@
// JAVADOC METHOD $$ func_78377_a
public void addVertex(double par1, double par3, double par5)
{
+ if (rawBufferIndex >= rawBufferSize - 32)
+ if (field_147569_p >= rawBufferSize - 32)
+ {
+ if (rawBufferSize == 0)
+ {
@ -169,17 +115,17 @@
+ }
++this.addedVertices;
if (this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0)
@@ -500,12 +541,6 @@
this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(par5 + this.zOffset));
this.rawBufferIndex += 8;
if (this.hasTexture)
@@ -354,12 +387,6 @@
this.rawBuffer[this.field_147569_p + 2] = Float.floatToRawIntBits((float)(par5 + this.zOffset));
this.field_147569_p += 8;
++this.vertexCount;
-
- if (this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32)
- if (this.vertexCount % 4 == 0 && this.field_147569_p >= this.bufferSize - 32)
- {
- this.draw();
- this.isDrawing = true;
- }
}
/**
// JAVADOC METHOD $$ func_78378_d

View file

@ -1,7 +1,7 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/WorldRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldRenderer.java
@@ -23,7 +23,7 @@
/** Reference to the World object. */
@@ -29,7 +29,7 @@
// JAVADOC FIELD $$ field_78924_a
public World worldObj;
private int glRenderList = -1;
- private static Tessellator tessellator = Tessellator.instance;
@ -9,56 +9,60 @@
public static int chunksUpdated;
public int posX;
public int posY;
@@ -192,15 +192,16 @@
GL11.glTranslatef(-8.0F, -8.0F, -8.0F);
GL11.glScalef(f, f, f);
GL11.glTranslatef(8.0F, 8.0F, 8.0F);
- tessellator.startDrawingQuads();
- tessellator.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
+ //ForgeHooksClient.beforeRenderPass(l1); Noop fo now, TODO: Event if anyone needs
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
@@ -177,7 +177,7 @@
this.func_147890_b(k2);
}
Block block = Block.blocksList[l2];
if (block != null)
- if (k2 == 0 && block.func_149716_u())
+ if (k2 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(j3, l2, i3)))
{
- if (l1 == 0 && block.hasTileEntity())
+ if (l1 == 0 && block.hasTileEntity(chunkcache.getBlockMetadata(k2, i2, j2)))
{
TileEntity tileentity = chunkcache.getBlockTileEntity(k2, i2, j2);
TileEntity tileentity = chunkcache.func_147438_o(j3, l2, i3);
@@ -212,14 +213,15 @@
int i3 = block.getRenderBlockPass();
- if (i3 != l1)
+ if (i3 > l1)
{
flag = true;
}
- else if (i3 == l1)
+ if (!block.canRenderInPass(l1))
{
- flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2);
+ continue;
}
+ flag1 |= renderblocks.renderBlockByRenderType(block, k2, i2, j2);
@@ -193,7 +193,9 @@
{
flag = true;
}
}
}
@@ -228,10 +230,11 @@
- else if (k3 == k2)
+
+ if (!block.canRenderInPass(k2)) continue;
+
{
flag1 |= renderblocks.func_147805_b(block, j3, l2, i3);
if (flag2)
{
- this.bytesDrawn += tessellator.draw();
+ //ForgeHooksClient.afterRenderPass(l1); Noop fo now, TODO: Event if anyone needs
+ this.bytesDrawn += Tessellator.instance.draw();
GL11.glPopMatrix();
GL11.glEndList();
- tessellator.setTranslation(0.0D, 0.0D, 0.0D);
+ Tessellator.instance.setTranslation(0.0D, 0.0D, 0.0D);
}
else
{
@@ -252,21 +254,22 @@
GL11.glTranslatef(-8.0F, -8.0F, -8.0F);
GL11.glScalef(f, f, f);
GL11.glTranslatef(8.0F, 8.0F, 8.0F);
- tessellator.startDrawingQuads();
- tessellator.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
+ Tessellator.instance.startDrawingQuads();
+ Tessellator.instance.setTranslation((double)(-this.posX), (double)(-this.posY), (double)(-this.posZ));
}
private void func_147891_a(int p_147891_1_, EntityLivingBase p_147891_2_)
{
if (p_147891_1_ == 1 && !this.skipRenderPass[p_147891_1_])
{
- this.field_147894_y = tessellator.func_147564_a((float)p_147891_2_.posX, (float)p_147891_2_.posY, (float)p_147891_2_.posZ);
+ this.field_147894_y = Tessellator.instance.func_147564_a((float)p_147891_2_.posX, (float)p_147891_2_.posY, (float)p_147891_2_.posZ);
}
- this.bytesDrawn += tessellator.draw();
+ //ForgeHooksClient.afterRenderPass(l1); Noop fo now, TODO: Event if anyone needs
+ this.bytesDrawn += Tessellator.instance.draw();
GL11.glPopMatrix();
GL11.glEndList();
- tessellator.setTranslation(0.0D, 0.0D, 0.0D);
+ Tessellator.instance.setTranslation(0.0D, 0.0D, 0.0D);
}
public void func_147889_b(EntityLivingBase p_147889_1_)
@@ -274,7 +277,7 @@
if (this.field_147894_y != null && !this.skipRenderPass[1])
{
this.func_147890_b(1);
- tessellator.func_147565_a(this.field_147894_y);
+ Tessellator.instance.func_147565_a(this.field_147894_y);
this.func_147891_a(1, p_147889_1_);
}
}

View file

@ -1,9 +1,9 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderBiped.java
@@ -14,9 +14,15 @@
import net.minecraft.item.EnumArmorMaterial;
@@ -15,9 +15,15 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
@ -16,24 +16,101 @@
@SideOnly(Side.CLIENT)
public class RenderBiped extends RenderLiving
@@ -49,11 +55,13 @@
@@ -50,11 +56,13 @@
this.field_82425_h = new ModelBiped(0.5F);
}
+ @Deprecated //Use the more sensitve version getArmorResource below
+ @Deprecated //Use the more sensitive version getArmorResource below
public static ResourceLocation func_110857_a(ItemArmor par0ItemArmor, int par1)
{
return func_110858_a(par0ItemArmor, par1, (String)null);
}
+ @Deprecated //Use the more sensitve version getArmorResource below
+ @Deprecated //Use the more sensitive version getArmorResource below
public static ResourceLocation func_110858_a(ItemArmor par0ItemArmor, int par1, String par2Str)
{
String s1 = String.format("textures/models/armor/%s_layer_%d%s.png", new Object[] {bipedArmorFilenamePrefix[par0ItemArmor.renderIndex], Integer.valueOf(par1 == 2 ? 2 : 1), par2Str == null ? "" : String.format("_%s", new Object[]{par2Str})});
@@ -68,6 +76,33 @@
return resourcelocation;
}
@@ -81,7 +89,7 @@
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
- this.bindTexture(func_110857_a(itemarmor, par2));
+ this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, null));
ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g;
modelbiped.bipedHead.showModel = par2 == 0;
modelbiped.bipedHeadwear.showModel = par2 == 0;
@@ -90,14 +98,16 @@
modelbiped.bipedLeftArm.showModel = par2 == 1;
modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
+ modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped);
this.setRenderPassModel(modelbiped);
modelbiped.onGround = this.mainModel.onGround;
modelbiped.isRiding = this.mainModel.isRiding;
modelbiped.isChild = this.mainModel.isChild;
- if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.CLOTH)
+ //Move out of if to allow for more then just CLOTH to have color
+ int j = itemarmor.getColor(itemstack);
+ if (j != -1)
{
- int j = itemarmor.getColor(itemstack);
float f1 = (float)(j >> 16 & 255) / 255.0F;
float f2 = (float)(j >> 8 & 255) / 255.0F;
float f3 = (float)(j & 255) / 255.0F;
@@ -135,7 +145,7 @@
if (item instanceof ItemArmor)
{
- this.bindTexture(func_110858_a((ItemArmor)item, par2, "overlay"));
+ this.bindTexture(getArmorResource(par1EntityLivingBase, itemstack, par2, "overlay"));
float f1 = 1.0F;
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
@@ -188,9 +198,12 @@
this.modelBipedMain.bipedHead.postRender(0.0625F);
item = itemstack1.getItem();
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));
+
if (item instanceof ItemBlock)
{
- if (RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b()))
+ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b()))
{
f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
@@ -233,7 +246,10 @@
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
- if (item instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
+
+ if (item instanceof ItemBlock && (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(item).func_149645_b())))
{
f1 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -289,7 +305,10 @@
f3 = (float)(i >> 8 & 255) / 255.0F;
float f4 = (float)(i & 255) / 255.0F;
GL11.glColor4f(f2, f3, f4, 1.0F);
- this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, j);
+ for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
+ {
+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x);
+ }
}
}
else
@@ -344,4 +363,33 @@
{
this.doRender((EntityLiving)par1Entity, par2, par4, par6, par8, par9);
}
+
+ /*=================================== FORGE START =========================================*/
+ /**
+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide.
+ *
@ -60,84 +137,5 @@
+
+ return resourcelocation;
+ }
+
protected int func_130006_a(EntityLiving par1EntityLiving, int par2, float par3)
{
ItemStack itemstack = par1EntityLiving.func_130225_q(3 - par2);
@@ -79,7 +114,7 @@
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
- this.bindTexture(func_110857_a(itemarmor, par2));
+ this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, null));
ModelBiped modelbiped = par2 == 2 ? this.field_82425_h : this.field_82423_g;
modelbiped.bipedHead.showModel = par2 == 0;
modelbiped.bipedHeadwear.showModel = par2 == 0;
@@ -88,15 +123,17 @@
modelbiped.bipedLeftArm.showModel = par2 == 1;
modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
+ modelbiped = ForgeHooksClient.getArmorModel(par1EntityLiving, itemstack, par2, modelbiped);
this.setRenderPassModel(modelbiped);
modelbiped.onGround = this.mainModel.onGround;
modelbiped.isRiding = this.mainModel.isRiding;
modelbiped.isChild = this.mainModel.isChild;
float f1 = 1.0F;
- if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH)
+ //Move out of if to allow for more then just CLOTH to have color
+ int j = itemarmor.getColor(itemstack);
+ if (j != -1)
{
- int j = itemarmor.getColor(itemstack);
float f2 = (float)(j >> 16 & 255) / 255.0F;
float f3 = (float)(j >> 8 & 255) / 255.0F;
float f4 = (float)(j & 255) / 255.0F;
@@ -134,7 +171,7 @@
if (item instanceof ItemArmor)
{
- this.bindTexture(func_110858_a((ItemArmor)item, par2, "overlay"));
+ this.bindTexture(getArmorResource(par1EntityLiving, itemstack, par2, "overlay"));
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
}
@@ -185,9 +222,12 @@
GL11.glPushMatrix();
this.modelBipedMain.bipedHead.postRender(0.0625F);
- if (itemstack1.getItem().itemID < 256)
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));
+
+ if (itemstack1.getItem() instanceof ItemBlock)
{
- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
@@ -229,7 +269,10 @@
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
- if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
+
+ if (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType())))
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -276,7 +319,10 @@
if (itemstack.getItem().requiresMultipleRenderPasses())
{
- this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 1);
+ for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++)
+ {
+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x);
+ }
}
GL11.glPopMatrix();
+ /*=================================== FORGE END ===========================================*/
}

View file

@ -1,6 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java
@@ -21,6 +21,8 @@
@@ -17,6 +17,7 @@
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemCloth;
import net.minecraft.item.ItemStack;
@@ -27,6 +28,8 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -9,276 +17,226 @@
@SideOnly(Side.CLIENT)
public class RenderItem extends Render
{
@@ -53,30 +55,10 @@
if (itemstack.getItem() != null)
{
@@ -56,7 +59,7 @@
this.bindEntityTexture(par1EntityItem);
this.random.setSeed(187L);
GL11.glPushMatrix();
- float f2 = MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F;
+ float f2 = shouldBob() ? MathHelper.sin(((float)par1EntityItem.age + par9) / 10.0F + par1EntityItem.hoverStart) * 0.1F + 0.1F : 0F;
float f3 = (((float)par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI);
- byte b0 = 1;
+ byte b0 = getMiniBlockCount(itemstack);
byte b0 = 1;
- if (par1EntityItem.getEntityItem().stackSize > 1)
- {
- b0 = 2;
- }
-
- if (par1EntityItem.getEntityItem().stackSize > 5)
- {
- b0 = 3;
- }
-
- if (par1EntityItem.getEntityItem().stackSize > 20)
- {
- b0 = 4;
- }
-
- if (par1EntityItem.getEntityItem().stackSize > 40)
- {
- b0 = 5;
- }
-
@@ -80,12 +83,19 @@
b0 = 5;
}
+ b0 = getMiniBlockCount(itemstack, b0);
+
GL11.glTranslatef((float)par2, (float)par4 + f2, (float)par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
float f4;
@@ -84,9 +66,18 @@
float f7;
float f6;
int i;
int k;
- if (itemstack.getItemSpriteNumber() == 0 && itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ Block block = null;
+ if (itemstack.itemID < Block.blocksList.length)
{
- Block block = Block.blocksList[itemstack.itemID];
+ block = Block.blocksList[itemstack.itemID];
+ }
+
+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks))
+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, field_147909_c, b0))
+ {
+ ;
+ }
+ else if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ {
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
if (renderInFrame)
@@ -127,7 +118,7 @@
+ else // Code Style break here to prevent the patch from editing this line
if (itemstack.getItemSpriteNumber() == 0 && itemstack.getItem() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b()))
{
float f8;
Block block = Block.func_149634_a(itemstack.getItem());
@@ -140,7 +150,7 @@
{
float f5;
- if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
+ if (itemstack.getItem().requiresMultipleRenderPasses())
+ if (/*itemstack.getItemSpriteNumber() == 1 &&*/ itemstack.getItem().requiresMultipleRenderPasses())
{
if (renderInFrame)
{
@@ -139,10 +130,10 @@
@@ -152,10 +162,10 @@
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
- for (int k = 0; k <= 1; ++k)
+ for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
- for (int j = 0; j <= 1; ++j)
+ for (int j = 0; j <= itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++j)
{
this.random.setSeed(187L);
- Icon icon = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), k);
+ Icon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
- IIcon iicon1 = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), j);
+ IIcon iicon1 = itemstack.getItem().getIcon(itemstack, j);
if (this.renderWithColor)
@@ -152,11 +143,11 @@
f4 = (float)(i >> 8 & 255) / 255.0F;
f6 = (float)(i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
- this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8);
+ this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
{
@@ -164,11 +174,11 @@
f6 = (float)(k >> 8 & 255) / 255.0F;
f7 = (float)(k & 255) / 255.0F;
GL11.glColor4f(f5, f6, f7, 1.0F);
- this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, f5, f6, f7);
+ this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, f5, f6, f7, j);
}
else
{
- this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F);
+ this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
- this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, 1.0F, 1.0F, 1.0F);
+ this.renderDroppedItem(par1EntityItem, iicon1, b0, par9, 1.0F, 1.0F, 1.0F, j);
}
}
}
@@ -205,6 +196,10 @@
*/
private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7)
@@ -227,6 +237,12 @@
// JAVADOC METHOD $$ func_77020_a
private void renderDroppedItem(EntityItem par1EntityItem, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7)
{
+ renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0);
+ this.renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0);
+ }
+ private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
+
+ // JAVADOC METHOD $$ func_77020_a
+ private void renderDroppedItem(EntityItem par1EntityItem, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
+ {
Tessellator tessellator = Tessellator.instance;
if (par2Icon == null)
@@ -240,32 +235,26 @@
f11 = 0.021875F;
ItemStack itemstack = par1EntityItem.getEntityItem();
int j = itemstack.stackSize;
- byte b0;
+ byte b0 = getMiniItemCount(itemstack);
@@ -281,11 +297,24 @@
b0 = 4;
}
- if (j < 2)
- {
- b0 = 1;
- }
- else if (j < 16)
- {
- b0 = 2;
- }
- else if (j < 32)
- {
- b0 = 3;
- }
- else
- {
- b0 = 4;
- }
-
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float)b0 / 2.0F));
+ b0 = getMiniItemCount(itemstack, b0);
+
GL11.glTranslatef(-f7, -f8, -((f9 + f10) * (float)b0 / 2.0F));
for (int k = 0; k < b0; ++k)
{
- GL11.glTranslatef(0.0F, 0.0F, f12 + f11);
- GL11.glTranslatef(0.0F, 0.0F, f9 + f10);
+ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
+ if (k > 0 && shouldSpreadItems())
+ {
+ float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
+ float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
+ float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
+ GL11.glTranslatef(x, y, f12 + f11);
+ GL11.glTranslatef(x, y, f9 + f10);
+ }
+ else
+ {
+ GL11.glTranslatef(0f, 0f, f12 + f11);
+ GL11.glTranslatef(0f, 0f, f9 + f10);
+ }
- if (itemstack.getItemSpriteNumber() == 0 && Block.blocksList[itemstack.itemID] != null)
+ if (itemstack.getItemSpriteNumber() == 0)
if (itemstack.getItemSpriteNumber() == 0)
{
this.bindTexture(TextureMap.locationBlocksTexture);
}
@@ -277,7 +266,7 @@
@@ -299,7 +328,7 @@
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((Icon)par2Icon).getIconWidth(), ((Icon)par2Icon).getIconHeight(), f12);
ItemRenderer.renderItemIn2D(tessellator, f15, f4, f14, f5, ((IIcon)par2Icon).getIconWidth(), ((IIcon)par2Icon).getIconHeight(), f9);
- if (itemstack.hasEffect())
+ if (itemstack.hasEffect(pass))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -348,6 +337,10 @@
*/
@@ -368,6 +397,12 @@
// JAVADOC METHOD $$ func_77015_a
public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
{
+ renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
+ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
+ }
+
+ // JAVADOC METHOD $$ func_77015_a
+ public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
+ {
int k = par3ItemStack.itemID;
int l = par3ItemStack.getItemDamage();
int k = par3ItemStack.getItemDamage();
Object object = par3ItemStack.getIconIndex();
@@ -356,10 +349,10 @@
float f1;
float f2;
GL11.glEnable(GL11.GL_BLEND);
@@ -428,9 +463,11 @@
GL11.glEnable(GL11.GL_ALPHA_TEST);
OpenGlHelper.func_148821_a(770, 771, 1, 0);
- if (par3ItemStack.getItemSpriteNumber() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
+ Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
+ if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
{
par2TextureManager.bindTexture(TextureMap.locationBlocksTexture);
- Block block = Block.blocksList[k];
GL11.glPushMatrix();
GL11.glTranslatef((float)(par4 - 2), (float)(par5 + 3), -3.0F + this.zLevel);
GL11.glScalef(10.0F, 10.0F, 10.0F);
@@ -386,11 +379,11 @@
else if (Item.itemsList[k].requiresMultipleRenderPasses())
{
GL11.glDisable(GL11.GL_LIGHTING);
- par2TextureManager.bindTexture(TextureMap.locationItemsTexture);
- for (int j1 = 0; j1 <= 1; ++j1)
+ for (int j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
- for (l = 0; l <= 1; ++l)
+ Item item = par3ItemStack.getItem();
+ for (l = 0; l <= item.getRenderPasses(k); ++l)
{
- Icon icon = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1);
+ par2TextureManager.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
+ Icon icon = Item.itemsList[k].getIcon(par3ItemStack, j1);
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
f1 = (float)(k1 >> 16 & 255) / 255.0F;
f2 = (float)(k1 >> 8 & 255) / 255.0F;
@@ -402,6 +395,11 @@
- IIcon iicon = par3ItemStack.getItem().getIconFromDamageForRenderPass(k, l);
+ par2TextureManager.bindTexture(item.getSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
+ IIcon iicon = item.getIcon(par3ItemStack, l);
int i1 = par3ItemStack.getItem().getColorFromItemStack(par3ItemStack, l);
f = (float)(i1 >> 16 & 255) / 255.0F;
float f1 = (float)(i1 >> 8 & 255) / 255.0F;
@@ -442,6 +479,11 @@
}
this.renderIcon(par4, par5, icon, 16, 16);
this.renderIcon(par4, par5, iicon, 16, 16);
+
+ if (par3ItemStack.hasEffect(j1))
+ if (renderEffect && par3ItemStack.hasEffect(l))
+ {
+ renderEffect(par2TextureManager, par4, par5);
+ }
}
GL11.glEnable(GL11.GL_LIGHTING);
@@ -429,11 +427,34 @@
GL11.glDisable(GL11.GL_ALPHA_TEST);
@@ -469,6 +511,11 @@
}
this.renderIcon(par4, par5, (Icon)object, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
this.renderIcon(par4, par5, (IIcon)object, 16, 16);
+
+ if (par3ItemStack.hasEffect(0))
+ if (renderEffect && par3ItemStack.hasEffect(0))
+ {
+ renderEffect(par2TextureManager, par4, par5);
+ }
GL11.glEnable(GL11.GL_LIGHTING);
}
GL11.glEnable(GL11.GL_CULL_FACE);
}
@@ -484,7 +531,10 @@
+ private void renderEffect(TextureManager manager, int x, int y)
+ {
+ GL11.glDepthFunc(GL11.GL_GREATER);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDepthMask(false);
+ manager.bindTexture(RES_ITEM_GLINT);
+ this.zLevel -= 50.0F;
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
+ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
+ this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glDepthMask(true);
+ this.zLevel += 50.0F;
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ }
+
/**
* Render the item's icon or block into the GUI, including the glint effect.
*/
@@ -441,8 +462,12 @@
{
if (par3ItemStack != null)
{
- this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
+ if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5))
+ {
+ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
+ }
try
{
- this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
+ if (!ForgeHooksClient.renderInventoryItem(this.field_147909_c, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float)par4, (float)par5))
+ {
+ this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
+ }
}
catch (Throwable throwable)
{
@@ -525,6 +575,7 @@
throw new ReportedException(crashreport);
}
+ /* Modders must handle this themselves if they use custom renderers!
+ /* Forge: Bugfix, Move this to a per-render pass, modders must handle themselves
if (par3ItemStack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_GREATER);
@@ -460,6 +485,7 @@
GL11.glDepthFunc(GL11.GL_EQUAL);
@@ -540,11 +591,28 @@
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
+ */
this.zLevel -= 50.0F;
}
}
@@ -586,4 +612,47 @@
+ public void renderEffect(TextureManager manager, int x, int y)
+ {
+ GL11.glDepthFunc(GL11.GL_EQUAL);
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDepthMask(false);
+ manager.bindTexture(RES_ITEM_GLINT);
+ GL11.glEnable(GL11.GL_ALPHA_TEST);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
+ this.renderGlint(x * 431278612 + y * 32178161, x - 2, y - 2, 20, 20);
+ GL11.glDepthMask(true);
+ GL11.glDisable(GL11.GL_ALPHA_TEST);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glDepthFunc(GL11.GL_LEQUAL);
+ }
+
private void renderGlint(int par1, int par2, int par3, int par4, int par5)
{
this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9);
for (int j1 = 0; j1 < 2; ++j1)
@@ -649,4 +717,42 @@
{
this.doRender((EntityItem)par1Entity, par2, par4, par6, par8, par9);
}
+
+ /*==================================== FORGE START ===========================================*/
+
+ /**
+ * Items should spread out when rendered in 3d?
+ * @return
@ -297,28 +255,21 @@
+ return true;
+ }
+
+ public byte getMiniBlockCount(ItemStack stack)
+ public byte getMiniBlockCount(ItemStack stack, byte original)
+ {
+ byte ret = 1;
+ if (stack.stackSize > 1 ) ret = 2;
+ if (stack.stackSize > 5 ) ret = 3;
+ if (stack.stackSize > 20) ret = 4;
+ if (stack.stackSize > 40) ret = 5;
+ return ret;
+ return original;
+ }
+
+ /**
+ * Allows for a subclass to override how many rendered items appear in a
+ * "mini item 3d stack"
+ * @param stack
+ * @param stack The item stack
+ * @param original The default amount vanilla would use
+ * @return
+ */
+ public byte getMiniItemCount(ItemStack stack)
+ public byte getMiniItemCount(ItemStack stack, byte original)
+ {
+ byte ret = 1;
+ if (stack.stackSize > 1) ret = 2;
+ if (stack.stackSize > 15) ret = 3;
+ if (stack.stackSize > 31) ret = 4;
+ return ret;
+ return original;
+ }
+ /*==================================== FORGE END =============================================*/
}

View file

@ -1,21 +1,19 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
@@ -223,12 +223,14 @@
if (par4EntityLivingBase.isPlayerSleeping())
@@ -218,11 +218,13 @@
if (p_147938_4_.isPlayerSleeping())
{
- int i = par1World.getBlockId(MathHelper.floor_double(par4EntityLivingBase.posX), MathHelper.floor_double(par4EntityLivingBase.posY), MathHelper.floor_double(par4EntityLivingBase.posZ));
+ int x = MathHelper.floor_double(par4EntityLivingBase.posX);
+ int y = MathHelper.floor_double(par4EntityLivingBase.posY);
+ int z = MathHelper.floor_double(par4EntityLivingBase.posZ);
+ Block block = Block.blocksList[par1World.getBlockId(x, y, z)];
Block block = p_147938_1_.func_147439_a(MathHelper.floor_double(p_147938_4_.posX), MathHelper.floor_double(p_147938_4_.posY), MathHelper.floor_double(p_147938_4_.posZ));
+ int x = MathHelper.floor_double(p_147938_4_.posX);
+ int y = MathHelper.floor_double(p_147938_4_.posY);
+ int z = MathHelper.floor_double(p_147938_4_.posZ);
- if (i == Block.bed.blockID)
+ if (block != null && block.isBed(par1World, x, y, z, par4EntityLivingBase))
- if (block == Blocks.bed)
+ if (block.isBed(p_147938_1_, x, y, z, p_147938_4_))
{
- int j = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLivingBase.posX), MathHelper.floor_double(par4EntityLivingBase.posY), MathHelper.floor_double(par4EntityLivingBase.posZ));
- int k = j & 3;
+ int k = block.getBedDirection(par1World, x, y, z);
this.playerViewY = (float)(k * 90 + 180);
- int i = p_147938_1_.getBlockMetadata(MathHelper.floor_double(p_147938_4_.posX), MathHelper.floor_double(p_147938_4_.posY), MathHelper.floor_double(p_147938_4_.posZ));
- int j = i & 3;
+ int j = block.getBedDirection(p_147938_1_, x, y, z);
this.playerViewY = (float)(j * 90 + 180);
this.playerViewX = 0.0F;
}

View file

@ -1,9 +1,9 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
@@ -15,13 +15,22 @@
import net.minecraft.item.EnumArmorMaterial;
@@ -16,13 +16,22 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
@ -46,7 +46,7 @@
ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate;
modelbiped.bipedHead.showModel = par2 == 0;
modelbiped.bipedHeadwear.showModel = par2 == 0;
@@ -62,15 +78,17 @@
@@ -62,14 +78,16 @@
modelbiped.bipedLeftArm.showModel = par2 == 1;
modelbiped.bipedRightLeg.showModel = par2 == 2 || par2 == 3;
modelbiped.bipedLeftLeg.showModel = par2 == 2 || par2 == 3;
@ -55,45 +55,44 @@
modelbiped.onGround = this.mainModel.onGround;
modelbiped.isRiding = this.mainModel.isRiding;
modelbiped.isChild = this.mainModel.isChild;
float f1 = 1.0F;
- if (itemarmor.getArmorMaterial() == EnumArmorMaterial.CLOTH)
- if (itemarmor.getArmorMaterial() == ItemArmor.ArmorMaterial.CLOTH)
+ //Move outside if to allow for more then just CLOTH
+ int j = itemarmor.getColor(itemstack);
+ if (j != -1)
{
- int j = itemarmor.getColor(itemstack);
float f2 = (float)(j >> 16 & 255) / 255.0F;
float f3 = (float)(j >> 8 & 255) / 255.0F;
float f4 = (float)(j & 255) / 255.0F;
@@ -108,7 +126,7 @@
float f1 = (float)(j >> 16 & 255) / 255.0F;
float f2 = (float)(j >> 8 & 255) / 255.0F;
float f3 = (float)(j & 255) / 255.0F;
@@ -107,7 +125,7 @@
if (item instanceof ItemArmor)
{
- this.bindTexture(RenderBiped.func_110858_a((ItemArmor)item, par2, "overlay"));
+ this.bindTexture(RenderBiped.getArmorResource(par1AbstractClientPlayer, itemstack, par2, "overlay"));
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
@@ -117,6 +135,7 @@
public void func_130009_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9)
}
@@ -116,6 +134,7 @@
// JAVADOC METHOD $$ func_76986_a
public void doRender(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9)
{
+ if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1AbstractClientPlayer, this, par9))) return;
float f2 = 1.0F;
GL11.glColor3f(f2, f2, f2);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem();
@@ -148,6 +167,7 @@
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = itemstack != null ? 1 : 0;
@@ -146,6 +165,7 @@
this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false;
this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false;
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0;
+ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this, par9));
}
protected ResourceLocation func_110817_a(AbstractClientPlayer par1AbstractClientPlayer)
@@ -160,21 +180,30 @@
*/
protected void renderSpecials(AbstractClientPlayer par1AbstractClientPlayer, float par2)
// JAVADOC METHOD $$ func_110775_a
@@ -156,12 +176,18 @@
protected void renderEquippedItems(AbstractClientPlayer par1AbstractClientPlayer, float par2)
{
+ RenderPlayerEvent.Specials.Pre event = new RenderPlayerEvent.Specials.Pre(par1AbstractClientPlayer, this, par2);
+ if (MinecraftForge.EVENT_BUS.post(event))
@ -101,8 +100,7 @@
+ return;
+ }
+
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
GL11.glColor3f(1.0F, 1.0F, 1.0F);
super.renderEquippedItems(par1AbstractClientPlayer, par2);
super.renderArrowsStuckInEntity(par1AbstractClientPlayer, par2);
ItemStack itemstack = par1AbstractClientPlayer.inventory.armorItemInSlot(3);
@ -112,28 +110,27 @@
{
GL11.glPushMatrix();
this.modelBipedMain.bipedHead.postRender(0.0625F);
float f2;
@@ -169,7 +195,10 @@
- if (itemstack.getItem().itemID < 256)
+ if (itemstack != null && itemstack.getItem() instanceof ItemBlock)
if (itemstack.getItem() instanceof ItemBlock)
{
- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
- if (RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
+
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b()))
{
f2 = 0.625F;
f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
@@ -226,6 +255,7 @@
boolean flag = par1AbstractClientPlayer.getTextureCape().isTextureUploaded();
boolean flag1 = !par1AbstractClientPlayer.isInvisible();
boolean flag2 = !par1AbstractClientPlayer.getHideCape();
+ flag = event.renderCape && flag;
float f6;
@@ -221,6 +250,7 @@
}
if (flag && flag1 && flag2)
@@ -277,7 +307,7 @@
boolean flag = par1AbstractClientPlayer.getTextureCape().isTextureUploaded();
+ flag = event.renderCape && flag;
float f5;
if (flag && !par1AbstractClientPlayer.isInvisible() && !par1AbstractClientPlayer.getHideCape())
@@ -272,7 +302,7 @@
ItemStack itemstack1 = par1AbstractClientPlayer.inventory.getCurrentItem();
@ -142,33 +139,32 @@
{
GL11.glPushMatrix();
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
@@ -297,7 +327,11 @@
@@ -290,7 +320,10 @@
enumaction = itemstack1.getItemUseAction();
}
float f11;
- if (itemstack1.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType()))
- if (itemstack1.getItem() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack1.getItem()).func_149645_b()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));
+ boolean isBlock = itemstack1.itemID < Block.blocksList.length && itemstack1.getItemSpriteNumber() == 0;
+
+ if (is3D || (isBlock && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())))
+ if (is3D || itemstack1.getItem() instanceof ItemBlock && RenderBlocks.func_147739_a(Block.func_149634_a(itemstack1.getItem()).func_149645_b()))
{
f11 = 0.5F;
f3 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -354,7 +388,7 @@
@@ -347,7 +380,7 @@
if (itemstack1.getItem().requiresMultipleRenderPasses())
{
- for (j = 0; j <= 1; ++j)
+ for (j = 0; j < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++j)
- for (k = 0; k <= 1; ++k)
+ for (k = 0; k <= itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k)
{
int k = itemstack1.getItem().getColorFromItemStack(itemstack1, j);
f13 = (float)(k >> 16 & 255) / 255.0F;
@@ -376,6 +410,7 @@
int i = itemstack1.getItem().getColorFromItemStack(itemstack1, k);
f12 = (float)(i >> 16 & 255) / 255.0F;
@@ -369,6 +402,7 @@
GL11.glPopMatrix();
}
+ MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Specials.Post(par1AbstractClientPlayer, this, par2));
}
protected void renderPlayerScale(AbstractClientPlayer par1AbstractClientPlayer, float par2)
// JAVADOC METHOD $$ func_77041_b

View file

@ -1,10 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderSnowMan.java
@@ -8,9 +8,14 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySnowman;
+import net.minecraft.item.ItemBlock;
@@ -13,6 +13,10 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@ -15,21 +11,15 @@
@SideOnly(Side.CLIENT)
public class RenderSnowMan extends RenderLiving
@@ -35,12 +40,15 @@
super.renderEquippedItems(par1EntitySnowman, par2);
ItemStack itemstack = new ItemStack(Block.pumpkin, 1);
- if (itemstack != null && itemstack.getItem().itemID < 256)
+ if (itemstack != null && itemstack.getItem() instanceof ItemBlock)
{
@@ -39,7 +43,10 @@
GL11.glPushMatrix();
this.snowmanModel.head.postRender(0.0625F);
- if (RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
- if (RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D));
+
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ if (is3D || RenderBlocks.func_147739_a(Block.func_149634_a(itemstack.getItem()).func_149645_b()))
{
float f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);

View file

@ -1,18 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RendererLivingEntity.java
@@ -18,6 +18,9 @@
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
@@ -20,6 +20,9 @@
import net.minecraft.util.ResourceLocation;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import net.minecraftforge.client.event.RenderLivingEvent;
+import net.minecraftforge.common.MinecraftForge;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -30,6 +33,9 @@
/** The model to be used during the render passes. */
@@ -33,6 +36,9 @@
protected ModelBase renderPassModel;
private static final String __OBFID = "CL_00001012";
+ public static float NAME_TAG_RANGE = 64.0f;
+ public static float NAME_TAG_RANGE_SNEAK = 32.0f;
@ -20,29 +20,31 @@
public RendererLivingEntity(ModelBase par1ModelBase, float par2)
{
this.mainModel = par1ModelBase;
@@ -69,6 +75,7 @@
public void doRenderLiving(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
@@ -66,6 +72,7 @@
// JAVADOC METHOD $$ func_76986_a
public void doRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this))) return;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
this.mainModel.onGround = this.renderSwingProgress(par1EntityLivingBase, par9);
@@ -278,6 +285,7 @@
@@ -275,6 +282,7 @@
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
this.passSpecialRender(par1EntityLivingBase, par2, par4, par6);
+ MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this));
}
/**
@@ -448,12 +456,13 @@
*/
// JAVADOC METHOD $$ func_77036_a
@@ -428,6 +436,7 @@
// JAVADOC METHOD $$ func_77033_b
protected void passSpecialRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6)
{
+ if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Specials.Pre(par1EntityLivingBase, this))) return;
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
if (this.func_110813_b(par1EntityLivingBase))
{
@@ -435,7 +444,7 @@
float f = 1.6F;
float f1 = 0.016666668F * f;
double d3 = par1EntityLivingBase.getDistanceSqToEntity(this.renderManager.livingPlayer);
@ -51,7 +53,7 @@
if (d3 < (double)(f2 * f2))
{
@@ -497,6 +506,7 @@
@@ -479,6 +488,7 @@
}
}
}

View file

@ -1,10 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
@@ -187,7 +187,7 @@
@@ -164,7 +164,7 @@
if (flag4 ^ flag5)
{
- flag1 = flag4 && flag2;
- flag1 = !flag4;
+ flag1 = flag5 && flag3; //Forge: Bug fix: Attempt to fill all downward space before expanding width
}
else

View file

@ -1,33 +1,46 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
@@ -11,9 +11,11 @@
@@ -8,12 +8,14 @@
import java.util.Iterator;
import java.util.List;
import javax.imageio.ImageIO;
import net.minecraft.client.resources.Resource;
+import net.minecraft.client.resources.ResourceManager;
import java.util.concurrent.Callable;
+import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.resources.data.AnimationFrame;
import net.minecraft.client.resources.data.AnimationMetadataSection;
import net.minecraft.util.Icon;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.util.IIcon;
import net.minecraft.util.ReportedException;
+import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class TextureAtlasSprite implements Icon
@@ -297,4 +299,18 @@
public class TextureAtlasSprite implements IIcon
@@ -437,4 +439,28 @@
{
return "TextureAtlasSprite{name=\'" + this.iconName + '\'' + ", frameCount=" + this.framesTextureData.size() + ", rotated=" + this.rotated + ", x=" + this.originX + ", y=" + this.originY + ", height=" + this.height + ", width=" + this.width + ", u0=" + this.minU + ", u1=" + this.maxU + ", v0=" + this.minV + ", v1=" + this.maxV + '}';
}
+
+ /**
+ * The result of this function determines is the below 'load' function is called, and the
+ * default vanilla loading code is bypassed completely.
+ * @param manager
+ * @param location
+ * @return True to use your own custom load code and bypass vanilla loading.
+ */
+ public boolean hasCustomLoader(IResourceManager manager, ResourceLocation location)
+ {
+ return false;
+ }
+
+ /**
+ * Load the specified resource as this sprite's data.
+ * Returning false from this function will prevent this icon from being stitched onto the master texture.
+ * @param manager Main resource manager
+ * @param location File resource location
+ * @return False to prevent this Icon from being stitched
+ * @throws IOException
+ */
+ public boolean load(ResourceManager manager, ResourceLocation location) throws IOException
+ public boolean load(IResourceManager manager, ResourceLocation location)
+ {
+ loadSprite(manager.getResource(location));
+ return true;
+ }
}

View file

@ -1,55 +1,56 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
@@ -21,6 +21,7 @@
import net.minecraft.util.Icon;
@@ -29,6 +29,7 @@
import net.minecraft.util.MathHelper;
import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.ForgeHooksClient;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@SideOnly(Side.CLIENT)
public class TextureMap extends AbstractTexture implements TickableTextureObject, IconRegister
@@ -58,10 +59,13 @@
@@ -92,11 +93,14 @@
public void loadTextureAtlas(ResourceManager par1ResourceManager)
public void loadTextureAtlas(IResourceManager par1ResourceManager)
{
+ registerIcons(); //Re-gather list of Icons, allows for addition/removal of blocks/items after this map was initially constructed.
+
int i = Minecraft.getGLMaximumTextureSize();
Stitcher stitcher = new Stitcher(i, i, true);
Stitcher stitcher = new Stitcher(i, i, true, 0, this.field_147636_j);
this.mapUploadedSprites.clear();
this.listAnimatedSprites.clear();
int j = Integer.MAX_VALUE;
+ ForgeHooksClient.onTextureStitchedPre(this);
Iterator iterator = this.mapRegisteredSprites.entrySet().iterator();
TextureAtlasSprite textureatlassprite;
while (iterator.hasNext())
@@ -73,7 +77,7 @@
@@ -107,6 +111,16 @@
textureatlassprite = (TextureAtlasSprite)entry.getValue();
ResourceLocation resourcelocation1 = this.func_147634_a(resourcelocation, 0);
+ if (textureatlassprite.hasCustomLoader(par1ResourceManager, resourcelocation))
+ {
+ if (!textureatlassprite.load(par1ResourceManager, resourcelocation))
+ {
+ j = Math.min(j, Math.min(textureatlassprite.getIconWidth(), textureatlassprite.getIconHeight()));
+ stitcher.addSprite(textureatlassprite);
+ }
+ continue;
+ }
+
try
{
- textureatlassprite.loadSprite(par1ResourceManager.getResource(resourcelocation1));
+ if (!textureatlassprite.load(par1ResourceManager, resourcelocation1)) continue;
}
catch (RuntimeException runtimeexception)
{
@@ -142,6 +146,7 @@
textureatlassprite1 = (TextureAtlasSprite)iterator1.next();
textureatlassprite1.copyFrom(this.missingImage);
IResource iresource = par1ResourceManager.getResource(resourcelocation1);
@@ -275,6 +289,7 @@
textureatlassprite = (TextureAtlasSprite)iterator2.next();
textureatlassprite.copyFrom(this.missingImage);
}
+ ForgeHooksClient.onTextureStitchedPost(this);
}
private void registerIcons()
@@ -212,6 +217,7 @@
if (par1Str == null)
{
(new RuntimeException("Don\'t register null!")).printStackTrace();
+ par1Str = "null"; //Don't allow things to actually register null..
}
Object object = (TextureAtlasSprite)this.mapRegisteredSprites.get(par1Str);
@@ -253,4 +259,37 @@
private ResourceLocation func_147634_a(ResourceLocation p_147634_1_, int p_147634_2_)
@@ -404,4 +419,37 @@
{
this.updateAnimations();
this.field_147637_k = p_147632_1_;
}
+
+ //===================================================================================================

View file

@ -7,20 +7,18 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Calendar;
@@ -60,7 +61,15 @@
@@ -52,7 +53,14 @@
if (block instanceof BlockChest && i == 0)
{
- ((BlockChest)block).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord);
+ try
+ {
+ ((BlockChest)block).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord);
((BlockChest)block).func_149954_e(p_147502_1_.func_145831_w(), p_147502_1_.field_145851_c, p_147502_1_.field_145848_d, p_147502_1_.field_145849_e);
+ }
+ catch (ClassCastException e)
+ {
+ FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest",
+ par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord);
+ FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest", p_147502_1_.field_145851_c, p_147502_1_.field_145848_d, p_147502_1_.field_145849_e);
+ }
i = par1TileEntityChest.getBlockMetadata();
i = p_147502_1_.func_145832_p();
}

View file

@ -1,16 +1,16 @@
--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java
+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java
@@ -12,6 +12,9 @@
import net.minecraft.util.ChatMessageComponent;
import net.minecraft.util.EnumChatFormatting;
@@ -14,6 +14,9 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.CommandEvent;
+
public class CommandHandler implements ICommandManager
{
/** Map of Strings to the ICommand objects they represent */
@@ -45,6 +48,16 @@
private static final Logger field_147175_a = LogManager.getLogger();
@@ -49,6 +52,16 @@
if (icommand.canCommandSenderUseCommand(par1ICommandSender))
{

View file

@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/crash/CallableSuspiciousClasses.java
+++ ../src-work/minecraft/net/minecraft/crash/CallableSuspiciousClasses.java
@@ -130,6 +130,6 @@
public Object call()
{
- return "FML is installed";
+ return "FML and Forge are installed";
}
}

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/crash/CrashReport.java
+++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java
@@ -245,7 +245,8 @@
@@ -328,7 +328,8 @@
StackTraceElement stacktraceelement = null;
StackTraceElement stacktraceelement1 = null;

View file

@ -1,16 +1,16 @@
--- ../src-base/minecraft/net/minecraft/crash/CrashReportCategory.java
+++ ../src-work/minecraft/net/minecraft/crash/CrashReportCategory.java
@@ -130,8 +130,11 @@
public int func_85073_a(int par1)
{
StackTraceElement[] astacktraceelement = Thread.currentThread().getStackTrace();
- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - par1];
- System.arraycopy(astacktraceelement, 3 + par1, this.stackTrace, 0, this.stackTrace.length);
+ //BugFix: Causes AIOOB for stacks < 3 + par1
+ int len = astacktraceelement.length - 3 - par1;
+ if (len <= 0) len = astacktraceelement.length;
+ this.stackTrace = new StackTraceElement[len];
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length);
return this.stackTrace.length;
@@ -131,8 +131,11 @@
}
else
{
- this.stackTrace = new StackTraceElement[astacktraceelement.length - 3 - par1];
- System.arraycopy(astacktraceelement, 3 + par1, this.stackTrace, 0, this.stackTrace.length);
+ int len = astacktraceelement.length - 3 - par1;
+ // Really Mojang, Still, god damn...
+ if (len <= 0) len = astacktraceelement.length;
+ this.stackTrace = new StackTraceElement[len];
+ System.arraycopy(astacktraceelement, astacktraceelement.length - len, this.stackTrace, 0, this.stackTrace.length);
return this.stackTrace.length;
}
}

View file

@ -1,20 +1,12 @@
--- ../src-base/minecraft/net/minecraft/creativetab/CreativeTabs.java
+++ ../src-work/minecraft/net/minecraft/creativetab/CreativeTabs.java
@@ -7,6 +7,7 @@
import net.minecraft.enchantment.EnchantmentData;
import net.minecraft.enchantment.EnumEnchantmentType;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
@@ -140,8 +140,22 @@
private ItemStack field_151245_t;
private static final String __OBFID = "CL_00000005";
public class CreativeTabs
{
@@ -34,8 +35,22 @@
private boolean drawTitle = true;
private EnumEnchantmentType[] field_111230_s;
+ public CreativeTabs(String label)
+ public CreativeTabs(String lable)
+ {
+ this(getNextID(), label);
+ this(getNextID(), lable);
+ }
+
public CreativeTabs(int par1, String par2Str)
@ -31,8 +23,8 @@
this.tabIndex = par1;
this.tabLabel = par2Str;
creativeTabArray[par1] = this;
@@ -122,6 +137,10 @@
*/
@@ -226,6 +240,10 @@
@SideOnly(Side.CLIENT)
public int getTabColumn()
{
+ if (tabIndex > 11)
@ -42,8 +34,8 @@
return this.tabIndex % 6;
}
@@ -132,6 +151,10 @@
*/
@@ -233,6 +251,10 @@
@SideOnly(Side.CLIENT)
public boolean isTabInFirstRow()
{
+ if (tabIndex > 11)
@ -53,14 +45,14 @@
return this.tabIndex < 6;
}
@@ -187,10 +210,18 @@
@@ -284,10 +306,18 @@
{
Item item = aitem[j];
Item item = (Item)iterator.next();
- if (item != null && item.getCreativeTab() == this)
+ if (item == null)
{
- item.getSubItems(item.itemID, this, par1List);
- item.func_150895_a(item, this, par1List);
+ continue;
}
+
@ -68,13 +60,13 @@
+ {
+ if (tab == this)
+ {
+ item.getSubItems(item.itemID, this, par1List);
+ item.func_150895_a(item, this, par1List);
+ }
+ }
}
if (this.func_111225_m() != null)
@@ -232,4 +263,36 @@
@@ -326,4 +356,28 @@
}
}
}
@ -94,14 +86,6 @@
+ }
+
+ /**
+ * Get the ItemStack that will be rendered to the tab.
+ */
+ public ItemStack getIconItemStack()
+ {
+ return new ItemStack(getTabIconItem());
+ }
+
+ /**
+ * Determines if the search bar should be shown for this tab.
+ *
+ * @return True to show the bar

View file

@ -1,18 +1,8 @@
--- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java
+++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java
@@ -1,6 +1,9 @@
package net.minecraft.enchantment;
@@ -157,6 +157,36 @@
import java.util.ArrayList;
+
+import com.google.common.collect.ObjectArrays;
+
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
@@ -207,6 +210,36 @@
return this.type.canEnchantItem(par1ItemStack.getItem());
}
public void func_151367_b(EntityLivingBase p_151367_1_, Entity p_151367_2_, int p_151367_3_) {}
+ /**
+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)}
@ -32,7 +22,7 @@
+ */
+ public static void addToBookList(Enchantment enchantment)
+ {
+ ObjectArrays.concat(enchantmentsBookList, enchantment);
+ com.google.common.collect.ObjectArrays.concat(enchantmentsBookList, enchantment);
+ }
+
+ /**
@ -46,4 +36,4 @@
+
static
{
ArrayList arraylist = new ArrayList();
ArrayList var0 = new ArrayList();

View file

@ -1,14 +1,12 @@
--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
@@ -463,7 +463,10 @@
@@ -461,7 +461,8 @@
{
Enchantment enchantment = aenchantment[k];
- if (enchantment != null && (enchantment.type.canEnchantItem(item) || flag))
+ if (enchantment == null) continue;
+
+ flag = (par1ItemStack.itemID == Item.book.itemID) && enchantment.isAllowedOnBooks();
+ if (enchantment.canApplyAtEnchantingTable(par1ItemStack) || flag)
+ if (enchantment.canApplyAtEnchantingTable(par1ItemStack) || ((item == Items.book) && enchantment.isAllowedOnBooks()))
{
for (int l = enchantment.getMinLevel(); l <= enchantment.getMaxLevel(); ++l)
{

View file

@ -1,22 +1,17 @@
--- ../src-base/minecraft/net/minecraft/entity/Entity.java
+++ ../src-work/minecraft/net/minecraft/entity/Entity.java
@@ -1,10 +1,15 @@
@@ -1,7 +1,10 @@
package net.minecraft.entity;
+import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.UUID;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockFluid;
import net.minecraft.block.StepSound;
@@ -13,8 +18,13 @@
@@ -13,9 +16,14 @@
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.enchantment.EnchantmentProtection;
import net.minecraft.entity.effect.EntityLightningBolt;
@ -26,13 +21,14 @@
+import net.minecraft.entity.item.EntityMinecart;
+import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
@@ -26,12 +36,18 @@
import net.minecraft.util.DamageSource;
@@ -30,12 +38,17 @@
import net.minecraft.util.Direction;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ReportedException;
@ -44,15 +40,14 @@
+import net.minecraftforge.common.IExtendedEntityProperties;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.EntityEvent;
+import net.minecraftforge.fluids.Fluid;
+import net.minecraftforge.fluids.IFluidBlock;
public abstract class Entity
{
@@ -218,7 +234,14 @@
private boolean invulnerable;
private UUID entityUniqueID;
public EnumEntitySize myEntitySize;
@@ -152,7 +165,14 @@
protected UUID entityUniqueID;
public Entity.EnumEntitySize myEntitySize;
private static final String __OBFID = "CL_00001533";
+ /** Forge: Used to store custom data for each entity. */
+ private NBTTagCompound customEntityData;
+ public boolean captureDrops = false;
@ -61,10 +56,10 @@
+ private HashMap<String, IExtendedEntityProperties> extendedProperties;
+
public Entity(World par1World)
public int func_145782_y()
{
this.entityId = nextEntityID++;
@@ -245,6 +268,15 @@
return this.field_145783_c;
@@ -189,6 +209,15 @@
this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
this.dataWatcher.addObject(1, Short.valueOf((short)300));
this.entityInit();
@ -80,18 +75,19 @@
}
protected abstract void entityInit();
@@ -1164,11 +1196,20 @@
int k = MathHelper.floor_double(this.posZ);
int l = this.worldObj.getBlockId(i, j, k);
@@ -1051,9 +1080,22 @@
- if (l != 0 && Block.blocksList[l].blockMaterial == par1Material)
+ Block block = Block.blocksList[l];
+ if (block != null && block.blockMaterial == par1Material)
if (block.func_149688_o() == par1Material)
{
- float f = BlockFluid.getFluidHeightPercent(this.worldObj.getBlockMetadata(i, j, k)) - 0.11111111F;
- float f = BlockLiquid.func_149801_b(this.worldObj.getBlockMetadata(i, j, k)) - 0.11111111F;
- float f1 = (float)(j + 1) - f;
- return d0 < (double)f1;
+ double filled = block.getFilledPercentage(worldObj, i, j, k);
+ double filled = 1.0f; //If it's not a liquid assume it's a solid block
+ if (block instanceof IFluidBlock)
+ {
+ filled = ((IFluidBlock)block).getFilledPercentage(worldObj, i, j, k);
+ }
+
+ if (filled < 0)
+ {
+ filled *= -1;
@ -105,29 +101,36 @@
}
else
{
@@ -1529,6 +1570,21 @@
@@ -1360,8 +1402,27 @@
par1NBTTagCompound.setInteger("PortalCooldown", this.timeUntilPortal);
par1NBTTagCompound.setLong("UUIDMost", this.entityUniqueID.getMostSignificantBits());
par1NBTTagCompound.setLong("UUIDLeast", this.entityUniqueID.getLeastSignificantBits());
par1NBTTagCompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
par1NBTTagCompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
- this.writeEntityToNBT(par1NBTTagCompound);
+ if (customEntityData != null)
+ {
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
+ par1NBTTagCompound.setTag("ForgeData", customEntityData);
+ }
+
+ for (String identifier : this.extendedProperties.keySet()){
+ try{
+ for (String identifier : this.extendedProperties.keySet())
+ {
+ try
+ {
+ IExtendedEntityProperties props = this.extendedProperties.get(identifier);
+ props.saveNBTData(par1NBTTagCompound);
+ }catch (Throwable t){
+ }
+ catch (Throwable t)
+ {
+ FMLLog.severe("Failed to save extended properties for %s. This is a mod issue.", identifier);
+ t.printStackTrace();
+ }
+ }
+
this.writeEntityToNBT(par1NBTTagCompound);
+ this.writeEntityToNBT(par1NBTTagCompound);
+
if (this.ridingEntity != null)
@@ -1599,6 +1655,26 @@
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -1428,6 +1489,30 @@
this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch);
@ -136,11 +139,15 @@
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
+ }
+
+ for (String identifier : this.extendedProperties.keySet()){
+ try{
+ for (String identifier : this.extendedProperties.keySet())
+ {
+ try
+ {
+ IExtendedEntityProperties props = this.extendedProperties.get(identifier);
+ props.loadNBTData(par1NBTTagCompound);
+ }catch (Throwable t){
+ }
+ catch (Throwable t)
+ {
+ FMLLog.severe("Failed to load extended properties for %s. This is a mod issue.", identifier);
+ t.printStackTrace();
+ }
@ -154,10 +161,10 @@
this.readEntityFromNBT(par1NBTTagCompound);
if (this.shouldSetPosAfterLoading())
@@ -1711,7 +1787,14 @@
@@ -1512,7 +1597,14 @@
{
EntityItem entityitem = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
entityitem.delayBeforeCanPickup = 10;
entityitem.field_145804_b = 10;
- this.worldObj.spawnEntityInWorld(entityitem);
+ if (captureDrops)
+ {
@ -169,30 +176,29 @@
+ }
return entityitem;
}
}
@@ -2010,7 +2093,7 @@
*/
else
@@ -1782,7 +1874,7 @@
// JAVADOC METHOD $$ func_70115_ae
public boolean isRiding()
{
- return this.ridingEntity != null;
+ return this.ridingEntity != null && ridingEntity.shouldRiderSit();
}
/**
@@ -2385,7 +2468,7 @@
*/
public float getBlockExplosionResistance(Explosion par1Explosion, World par2World, int par3, int par4, int par5, Block par6Block)
// JAVADOC METHOD $$ func_70093_af
@@ -2103,7 +2195,7 @@
public float func_145772_a(Explosion p_145772_1_, World p_145772_2_, int p_145772_3_, int p_145772_4_, int p_145772_5_, Block p_145772_6_)
{
- return par6Block.getExplosionResistance(this);
+ return par6Block.getExplosionResistance(this, par2World, par3, par4, par5, posX, posY + (double)getEyeHeight(), posZ);
- return p_145772_6_.func_149638_a(this);
+ return p_145772_6_.getExplosionResistance(this, p_145772_2_, p_145772_3_, p_145772_3_, p_145772_4_, posX, posY + getEyeHeight(), posZ);
}
public boolean shouldExplodeBlock(Explosion par1Explosion, World par2World, int par3, int par4, int par5, int par6, float par7)
@@ -2451,4 +2534,170 @@
{
return this.getEntityName();
}
+
public boolean func_145774_a(Explosion p_145774_1_, World p_145774_2_, int p_145774_3_, int p_145774_4_, int p_145774_5_, Block p_145774_6_, float p_145774_7_)
@@ -2175,6 +2267,174 @@
public void func_145781_i(int p_145781_1_) {}
+ /* ================================== Forge Start =====================================*/
+ /**
+ * Returns a NBTTagCompound that can be used to store custom data for this entity.
@ -227,7 +233,23 @@
+ {
+ if (this instanceof EntityPainting)
+ {
+ return new ItemStack(Item.painting);
+ return new ItemStack(Items.painting);
+ }
+ else if (this instanceof EntityLeashKnot)
+ {
+ return new ItemStack(Items.lead);
+ }
+ else if (this instanceof EntityItemFrame)
+ {
+ ItemStack held = ((EntityItemFrame)this).getDisplayedItem();
+ if (held == null)
+ {
+ return new ItemStack(Items.item_frame);
+ }
+ else
+ {
+ return held.copy();
+ }
+ }
+ else if (this instanceof EntityMinecart)
+ {
@ -235,30 +257,14 @@
+ }
+ else if (this instanceof EntityBoat)
+ {
+ return new ItemStack(Item.boat);
+ }
+ else if (this instanceof EntityItemFrame)
+ {
+ ItemStack held = ((EntityItemFrame)this).getDisplayedItem();
+ if (held == null)
+ {
+ return new ItemStack(Item.itemFrame);
+ }
+ else
+ {
+ return held.copy();
+ }
+ }
+ else if (this instanceof EntityLeashKnot)
+ {
+ return new ItemStack(Item.leash);
+ return new ItemStack(Items.boat);
+ }
+ else
+ {
+ int id = EntityList.getEntityID(this);
+ if (id > 0 && EntityList.entityEggs.containsKey(id))
+ {
+ return new ItemStack(Item.monsterPlacer, 1, id);
+ return new ItemStack(Items.spawn_egg, 1, id);
+ }
+ }
+ return null;
@ -274,7 +280,7 @@
+ */
+ public final void resetEntityId()
+ {
+ this.entityId = nextEntityID++;
+ this.field_145783_c = nextEntityID++;
+ }
+
+ public boolean shouldRenderInPass(int pass)
@ -355,7 +361,12 @@
+ * @param rider The entity that is riding
+ * @return if the entity should be dismounted when under water
+ */
+ public boolean shouldDismountInWater(Entity rider){
+ public boolean shouldDismountInWater(Entity rider)
+ {
+ return this instanceof EntityLivingBase;
+ }
}
+ /* ================================== Forge End =====================================*/
+
public static enum EnumEntitySize
{
SIZE_1,

View file

@ -1,27 +1,25 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java
@@ -31,6 +31,11 @@
import net.minecraft.util.MathHelper;
@@ -34,6 +34,9 @@
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.Event.Result;
+import cpw.mods.fml.common.eventhandler.Event.Result;
+import net.minecraftforge.event.ForgeEventFactory;
+import net.minecraftforge.event.entity.living.LivingSpawnEvent.AllowDespawn;
public abstract class EntityLiving extends EntityLivingBase
{
@@ -141,6 +146,7 @@
@@ -130,6 +133,7 @@
public void setAttackTarget(EntityLivingBase par1EntityLivingBase)
{
this.attackTarget = par1EntityLivingBase;
+ ForgeHooks.onLivingSetAttackTarget(this, par1EntityLivingBase);
}
/**
@@ -547,10 +553,22 @@
*/
// JAVADOC METHOD $$ func_70686_a
@@ -506,10 +510,22 @@
// JAVADOC METHOD $$ func_70623_bb
protected void despawnEntity()
{
+ Result result = null;
@ -43,12 +41,11 @@
else
{
EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, -1.0D);
@@ -726,8 +744,6 @@
return this.worldObj.checkNoEntityCollision(this.boundingBox) && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox);
@@ -677,7 +693,6 @@
}
// JAVADOC METHOD $$ func_70603_bj
- @SideOnly(Side.CLIENT)
-
/**
* Returns render size modifier
*/
public float getRenderSizeModifier()
{
return 1.0F;

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