First patches updae to 1.5, Many rendeirng related changes, most notibly removed Item/Block's getTextureFile() functions.

This commit is contained in:
LexManos 2013-01-12 05:11:08 -08:00
parent c229018c9e
commit 4ea34fe6af
92 changed files with 763 additions and 2416 deletions

View file

@ -63,7 +63,7 @@ public class ForgeHooks
{
return;
}
world.setBlockAndMetadataWithNotify(x, y, z, grass.block.blockID, grass.metadata);
world.setBlockAndMetadataWithNotify(x, y, z, grass.block.blockID, grass.metadata, 3);
}
public static ItemStack getGrassSeed(World world)

View file

@ -1,15 +1,20 @@
--- ../src_base/minecraft/net/minecraft/block/Block.java
+++ ../src_work/minecraft/net/minecraft/block/Block.java
@@ -2,13 +2,17 @@
@@ -1,15 +1,20 @@
package net.minecraft.block;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
+import static net.minecraftforge.common.ForgeDirection.DOWN;
+import static net.minecraftforge.common.ForgeDirection.UP;
+
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
+
import net.minecraft.block.material.Material;
+import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
@ -18,7 +23,7 @@
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
@@ -24,17 +28,27 @@
@@ -25,8 +30,10 @@
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
@ -26,16 +31,20 @@
import net.minecraft.tileentity.TileEntitySign;
import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.Icon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3;
@@ -34,9 +41,20 @@
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraft.world.WorldProviderEnd;
+
+import net.minecraftforge.common.*;
+import static net.minecraftforge.common.ForgeDirection.*;
+import net.minecraftforge.common.EnumPlantType;
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.IPlantable;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
public class Block
{
@ -46,7 +55,7 @@
/**
* used as foreach item, if item.tab = current tab, display it on the screen
*/
@@ -321,6 +335,7 @@
@@ -328,6 +346,7 @@
lightOpacity[par1] = this.isOpaqueCube() ? 255 : 0;
canBlockGrass[par1] = !par2Material.getCanBlockGrass();
}
@ -54,7 +63,7 @@
}
/**
@@ -459,9 +474,10 @@
@@ -450,9 +469,10 @@
return this.needsRandomTick;
}
@ -66,7 +75,7 @@
}
/**
@@ -484,7 +500,7 @@
@@ -475,7 +495,7 @@
*/
public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
@ -75,7 +84,7 @@
}
@SideOnly(Side.CLIENT)
@@ -494,7 +510,7 @@
@@ -485,7 +505,7 @@
*/
public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
@ -84,7 +93,7 @@
}
@SideOnly(Side.CLIENT)
@@ -639,7 +655,13 @@
@@ -623,7 +643,13 @@
/**
* ejects contained items into the world, and notifies neighbours of an update, as appropriate
*/
@ -99,7 +108,7 @@
/**
* Returns the quantity of items to drop on block destruction.
@@ -663,8 +685,7 @@
@@ -647,8 +673,7 @@
*/
public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5)
{
@ -109,7 +118,7 @@
}
/**
@@ -682,18 +703,13 @@
@@ -666,18 +691,13 @@
{
if (!par1World.isRemote)
{
@ -132,7 +141,7 @@
}
}
}
@@ -1081,7 +1097,7 @@
@@ -1067,7 +1087,7 @@
par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
par2EntityPlayer.addExhaustion(0.025F);
@ -141,7 +150,7 @@
{
ItemStack itemstack = this.createStackedBlock(par6);
@@ -1364,4 +1380,840 @@
@@ -1384,4 +1404,846 @@
canBlockGrass[0] = true;
StatList.initBreakableStats();
}
@ -222,6 +231,10 @@
+ boolean flipped = ((meta & 4) != 0);
+ return ((meta & 3) + side.ordinal() == 5) || (side == UP && flipped);
+ }
+ else if (this instanceof BlockHopper && side == UP)
+ {
+ return true;
+ }
+ return isBlockNormalCube(world, x, y, z);
+ }
+
@ -304,7 +317,7 @@
+ */
+ public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z)
+ {
+ return world.setBlockWithNotify(x, y, z, 0);
+ return world.func_94571_i(x, y, z);
+ }
+
+ /**
@ -674,9 +687,11 @@
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param target The generic target block the gen is looking for, Standards define stone
+ * for overworld generation, and neatherack for the nether.
+ * @return True to allow this block to be replaced by a ore
+ */
+ public boolean isGenMineableReplaceable(World world, int x, int y, int z)
+ public boolean isGenMineableReplaceable(World world, int x, int y, int z, int target)
+ {
+ return blockID == stone.blockID;
+ }

View file

@ -1,13 +1,13 @@
--- ../src_base/minecraft/net/minecraft/block/BlockButton.java
+++ ../src_work/minecraft/net/minecraft/block/BlockButton.java
@@ -11,6 +11,9 @@
@@ -14,6 +14,9 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+
public class BlockButton extends Block
public abstract class BlockButton extends Block
{
/** Whether this button is sensible to arrows, used by wooden buttons. */
@@ -63,7 +66,11 @@

View file

@ -1,7 +1,7 @@
--- ../src_base/minecraft/net/minecraft/block/BlockCactus.java
+++ ../src_work/minecraft/net/minecraft/block/BlockCactus.java
@@ -10,7 +10,11 @@
import net.minecraft.util.DamageSource;
@@ -12,7 +12,11 @@
import net.minecraft.util.Icon;
import net.minecraft.world.World;
-public class BlockCactus extends Block
@ -11,9 +11,9 @@
+
+public class BlockCactus extends Block implements IPlantable
{
protected BlockCactus(int par1, int par2)
{
@@ -149,7 +153,7 @@
@SideOnly(Side.CLIENT)
private Icon field_94380_a;
@@ -158,7 +162,7 @@
else
{
int l = par1World.getBlockId(par2, par3 - 1, par4);
@ -22,9 +22,9 @@
}
}
@@ -160,4 +164,22 @@
{
par5Entity.attackEntityFrom(DamageSource.cactus, 1);
@@ -177,4 +181,22 @@
this.field_94380_a = par1IconRegister.func_94245_a("cactus_top");
this.field_94379_b = par1IconRegister.func_94245_a("cactus_bottom");
}
+
+ @Override

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockChest.java
+++ ../src_work/minecraft/net/minecraft/block/BlockChest.java
@@ -21,6 +21,8 @@
@@ -23,6 +23,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -8,46 +8,46 @@
+
public class BlockChest extends BlockContainer
{
private Random random = new Random();
@@ -427,7 +429,7 @@
private final Random random = new Random();
@@ -436,7 +438,7 @@
{
return true;
return null;
}
- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
{
return true;
return null;
}
@@ -435,19 +437,19 @@
@@ -444,19 +446,19 @@
{
return true;
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)))
- {
- return true;
- 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)))
- {
- return true;
- 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)))
- {
- return true;
- 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 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
+ {
+ return true;
+ return null;
+ }
+ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
+ {
+ return true;
+ return null;
+ }
+ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
+ {
+ return true;
+ return null;
+ }
+ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
{
return true;
return null;
}

View file

@ -8,8 +8,8 @@
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
@@ -175,7 +177,14 @@
import net.minecraft.client.renderer.texture.IconRegister;
@@ -197,7 +199,14 @@
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
@ -25,7 +25,7 @@
byte b0 = 1;
if (j1 >= 2)
@@ -185,8 +194,9 @@
@@ -207,8 +216,9 @@
for (int k1 = 0; k1 < b0; ++k1)
{
@ -37,9 +37,9 @@
}
@SideOnly(Side.CLIENT)
@@ -206,4 +216,10 @@
{
return 3;
@@ -239,4 +249,10 @@
this.field_94469_b[i] = par1IconRegister.func_94245_a(field_94470_a[i]);
}
}
+
+ @Override

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockContainer.java
+++ ../src_work/minecraft/net/minecraft/block/BlockContainer.java
@@ -24,7 +24,7 @@
@@ -18,7 +18,7 @@
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
super.onBlockAdded(par1World, par2, par3, par4);
@ -9,7 +9,7 @@
}
/**
@@ -40,6 +40,12 @@
@@ -34,6 +34,12 @@
* Returns a new instance of a block's tile entity class. Called on placing the block.
*/
public abstract TileEntity createNewTileEntity(World world);

View file

@ -1,21 +1,22 @@
--- ../src_base/minecraft/net/minecraft/block/BlockCrops.java
+++ ../src_work/minecraft/net/minecraft/block/BlockCrops.java
@@ -2,11 +2,14 @@
@@ -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;
import net.minecraft.item.Item;
@@ -9,6 +10,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
public class BlockCrops extends BlockFlower
{
@@ -92,11 +95,11 @@
@@ -95,11 +97,11 @@
int j3 = par1World.getBlockId(l2, par3 - 1, i3);
float f1 = 0.0F;
@ -29,7 +30,7 @@
{
f1 = 3.0F;
}
@@ -162,22 +165,25 @@
@@ -167,22 +169,25 @@
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, 0);

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockDoor.java
+++ ../src_work/minecraft/net/minecraft/block/BlockDoor.java
@@ -268,7 +268,7 @@
@@ -231,7 +231,7 @@
{
if (this.blockMaterial == Material.iron)
{

View file

@ -1,8 +1,8 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFarmland.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFarmland.java
@@ -8,6 +8,9 @@
import net.minecraft.entity.player.EntityPlayer;
@@ -10,6 +10,9 @@
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
+
+import net.minecraftforge.common.ForgeDirection;
@ -10,7 +10,7 @@
public class BlockFarmland extends Block
{
@@ -107,7 +110,8 @@
@@ -115,7 +118,8 @@
{
int j1 = par1World.getBlockId(l, par3 + 1, i1);

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFire.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFire.java
@@ -9,6 +9,9 @@
@@ -11,6 +11,9 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderEnd;
@ -10,7 +10,7 @@
public class BlockFire extends Block
{
/** The chance this block will encourage nearby blocks to catch on fire */
@@ -32,6 +35,8 @@
@@ -36,6 +39,8 @@
*/
public void initializeBlock()
{
@ -19,7 +19,7 @@
this.setBurnRate(Block.planks.blockID, 5, 20);
this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20);
this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20);
@@ -56,8 +61,7 @@
@@ -60,8 +65,7 @@
*/
private void setBurnRate(int par1, int par2, int par3)
{
@ -29,7 +29,7 @@
}
/**
@@ -117,12 +121,8 @@
@@ -118,12 +122,8 @@
{
if (par1World.getGameRules().getGameRuleBooleanValue("doFireTick"))
{
@ -44,16 +44,16 @@
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
@@ -151,7 +151,7 @@
par1World.setBlockWithNotify(par2, par3, par4, 0);
@@ -152,7 +152,7 @@
par1World.func_94571_i(par2, par3, par4);
}
}
- 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)
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
par1World.func_94571_i(par2, par3, par4);
}
@@ -165,12 +165,12 @@
@@ -166,12 +166,12 @@
b0 = -50;
}
@ -72,7 +72,7 @@
for (int i1 = par2 - 1; i1 <= par2 + 1; ++i1)
{
@@ -224,9 +224,20 @@
@@ -225,9 +225,20 @@
return false;
}
@ -94,7 +94,7 @@
if (par6Random.nextInt(par5) < j1)
{
@@ -260,7 +271,12 @@
@@ -261,7 +272,12 @@
*/
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
{
@ -108,7 +108,7 @@
}
/**
@@ -276,12 +292,12 @@
@@ -277,12 +293,12 @@
}
else
{
@ -127,7 +127,7 @@
return l;
}
}
@@ -296,21 +312,24 @@
@@ -297,21 +313,24 @@
/**
* Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
@ -157,7 +157,7 @@
}
/**
@@ -368,9 +387,9 @@
@@ -369,9 +388,9 @@
float f1;
float f2;
@ -170,7 +170,7 @@
{
for (l = 0; l < 2; ++l)
{
@@ -381,7 +400,7 @@
@@ -382,7 +401,7 @@
}
}
@ -179,7 +179,7 @@
{
for (l = 0; l < 2; ++l)
{
@@ -392,7 +411,7 @@
@@ -393,7 +412,7 @@
}
}
@ -188,7 +188,7 @@
{
for (l = 0; l < 2; ++l)
{
@@ -403,7 +422,7 @@
@@ -404,7 +423,7 @@
}
}
@ -197,7 +197,7 @@
{
for (l = 0; l < 2; ++l)
{
@@ -414,7 +433,7 @@
@@ -415,7 +434,7 @@
}
}
@ -206,9 +206,9 @@
{
for (l = 0; l < 2; ++l)
{
@@ -436,4 +455,46 @@
}
}
@@ -459,4 +478,46 @@
{
return this.field_94439_c[0];
}
+
+ /**

View file

@ -12,9 +12,9 @@
+
+public class BlockFlower extends Block implements IPlantable
{
protected BlockFlower(int par1, int par2, Material par3Material)
protected BlockFlower(int par1, Material par2Material)
{
@@ -28,7 +33,7 @@
@@ -27,7 +32,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
@ -23,7 +23,7 @@
}
/**
@@ -72,7 +77,9 @@
@@ -71,7 +76,9 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
@ -34,7 +34,7 @@
}
/**
@@ -108,4 +115,32 @@
@@ -107,4 +114,32 @@
{
return 1;
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockFluid.java
+++ ../src_work/minecraft/net/minecraft/block/BlockFluid.java
@@ -54,7 +54,7 @@
@@ -59,7 +59,7 @@
{
for (int l1 = -1; l1 <= 1; ++l1)
{

View file

@ -1,20 +1,20 @@
--- ../src_base/minecraft/net/minecraft/block/BlockGrass.java
+++ ../src_work/minecraft/net/minecraft/block/BlockGrass.java
@@ -100,7 +100,7 @@
@@ -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.setBlockWithNotify(par2, par3, par4, Block.dirt.blockID);
par1World.func_94575_c(par2, par3, par4, Block.dirt.blockID);
}
@@ -113,7 +113,7 @@
@@ -57,7 +57,7 @@
int k1 = par4 + par5Random.nextInt(3) - 1;
int l1 = par1World.getBlockId(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)
{
par1World.setBlockWithNotify(i1, j1, k1, Block.grass.blockID);
par1World.func_94575_c(i1, j1, k1, Block.grass.blockID);
}

View file

@ -9,7 +9,7 @@
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -14,7 +16,9 @@
@@ -16,7 +18,9 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -18,8 +18,8 @@
+
+public class BlockLeaves extends BlockLeavesBase implements IShearable
{
/**
* The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can
public static final String[] LEAF_TYPES = new String[] {"oak", "spruce", "birch", "jungle"};
public static final String[][] field_94396_b = new String[][] {{"leaves", "leaves_spruce", "leaves", "leaves_jungle"}, {"leaves_opaque", "leaves_spruce_opaque", "leaves_opaque", "leaves_jungle_opaque"}};
@@ -107,10 +111,9 @@
{
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
@ -28,7 +28,7 @@
+ if (Block.blocksList[j2] != null)
{
- int k2 = par1World.getBlockMetadata(par2 + k1, par3 + l1, par4 + i2);
- par1World.setBlockMetadata(par2 + k1, par3 + l1, par4 + i2, k2 | 8);
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
}
}
@ -66,9 +66,9 @@
}
/**
@@ -371,4 +368,30 @@
{
return new ItemStack(this.blockID, 1, par1 & 3);
@@ -387,4 +384,30 @@
}
}
}
+
+ @Override
@ -88,7 +88,7 @@
+ @Override
+ public void beginLeavesDecay(World world, int x, int y, int z)
+ {
+ world.setBlockMetadata(x, y, z, world.getBlockMetadata(x, y, z) | 8);
+ world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) | 8, 4);
+ }
+
+ @Override

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockLever.java
+++ ../src_work/minecraft/net/minecraft/block/BlockLever.java
@@ -7,6 +7,9 @@
@@ -10,6 +10,9 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -9,8 +9,8 @@
+
public class BlockLever extends Block
{
protected BlockLever(int par1, int par2)
@@ -54,7 +57,13 @@
protected BlockLever(int par1)
@@ -57,7 +60,13 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
@ -25,7 +25,7 @@
}
/**
@@ -62,7 +71,12 @@
@@ -65,7 +74,12 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
@ -39,46 +39,46 @@
}
/**
@@ -74,32 +88,32 @@
@@ -77,32 +91,32 @@
int k1 = par9 & 7;
k1 = -1;
byte b0 = -1;
- if (par5 == 0 && par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ if (par5 == 0 && par1World.isBlockSolidOnSide(par2, par3 + 1, par4, DOWN))
{
k1 = par1World.rand.nextBoolean() ? 0 : 7;
b0 = 0;
}
- if (par5 == 1 && par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
+ if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP))
{
k1 = 5 + par1World.rand.nextInt(2);
b0 = 5;
}
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH))
{
k1 = 4;
b0 = 4;
}
- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH))
{
k1 = 3;
b0 = 3;
}
- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST))
{
k1 = 2;
b0 = 2;
}
- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST))
{
k1 = 1;
b0 = 1;
}
@@ -142,42 +156,42 @@
@@ -178,42 +192,42 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4) & 7;
boolean flag = false;

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockLog.java
+++ ../src_work/minecraft/net/minecraft/block/BlockLog.java
@@ -63,14 +63,9 @@
@@ -69,14 +69,9 @@
{
int j2 = par1World.getBlockId(par2 + k1, par3 + l1, par4 + i2);
@ -11,15 +11,15 @@
-
- if ((k2 & 8) == 0)
- {
- par1World.setBlockMetadata(par2 + k1, par3 + l1, par4 + i2, k2 | 8);
- par1World.setBlockMetadataWithNotify(par2 + k1, par3 + l1, par4 + i2, k2 | 8, 4);
- }
+ Block.blocksList[j2].beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2);
}
}
}
@@ -151,4 +146,16 @@
{
return new ItemStack(this.blockID, 1, limitToValidMetadata(par1));
@@ -171,4 +166,16 @@
this.field_94390_c[i] = par1IconRegister.func_94245_a(field_94389_b[i]);
}
}
+
+ @Override

View file

@ -1,7 +1,7 @@
--- ../src_base/minecraft/net/minecraft/block/BlockMushroom.java
+++ ../src_work/minecraft/net/minecraft/block/BlockMushroom.java
@@ -3,6 +3,8 @@
import java.util.Random;
@@ -6,6 +6,8 @@
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
+
@ -9,7 +9,7 @@
public class BlockMushroom extends BlockFlower
{
@@ -96,7 +98,9 @@
@@ -102,7 +104,9 @@
if (par3 >= 0 && par3 < 256)
{
int l = par1World.getBlockId(par2, par3 - 1, par4);

View file

@ -1,20 +1,20 @@
--- ../src_base/minecraft/net/minecraft/block/BlockMycelium.java
+++ ../src_work/minecraft/net/minecraft/block/BlockMycelium.java
@@ -55,7 +55,7 @@
@@ -41,7 +41,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.setBlockWithNotify(par2, par3, par4, Block.dirt.blockID);
par1World.func_94575_c(par2, par3, par4, Block.dirt.blockID);
}
@@ -68,7 +68,7 @@
@@ -54,7 +54,7 @@
int k1 = par4 + par5Random.nextInt(3) - 1;
int l1 = par1World.getBlockId(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)
{
par1World.setBlockWithNotify(i1, j1, k1, this.blockID);
par1World.func_94575_c(i1, j1, k1, this.blockID);
}

View file

@ -1,21 +1,23 @@
--- ../src_base/minecraft/net/minecraft/block/BlockNetherStalk.java
+++ ../src_work/minecraft/net/minecraft/block/BlockNetherStalk.java
@@ -2,11 +2,14 @@
@@ -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;
import net.minecraft.item.Item;
@@ -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
{
@@ -33,7 +36,8 @@
@@ -39,7 +42,8 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
@ -25,7 +27,7 @@
}
/**
@@ -73,25 +77,7 @@
@@ -81,25 +85,7 @@
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
@ -52,9 +54,9 @@
}
/**
@@ -119,4 +105,23 @@
{
return Item.netherStalkSeeds.itemID;
@@ -138,4 +124,23 @@
this.field_94372_b[i] = par1IconRegister.func_94245_a(field_94373_a[i]);
}
}
+
+ @Override

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockPistonBase.java
+++ ../src_work/minecraft/net/minecraft/block/BlockPistonBase.java
@@ -380,7 +380,7 @@
@@ -406,7 +406,7 @@
return false;
}
@ -9,7 +9,7 @@
}
}
@@ -398,7 +398,7 @@
@@ -424,7 +424,7 @@
{
if (l1 < 13)
{
@ -18,7 +18,7 @@
{
return false;
}
@@ -448,7 +448,7 @@
@@ -474,7 +474,7 @@
if (l1 < 13)
{

View file

@ -1,225 +0,0 @@
--- ../src_base/minecraft/net/minecraft/block/BlockRail.java
+++ ../src_work/minecraft/net/minecraft/block/BlockRail.java
@@ -3,12 +3,16 @@
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
+import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
+import net.minecraftforge.common.ForgeDirection;
+import static net.minecraftforge.common.ForgeDirection.*;
+
public class BlockRail extends Block
{
/** Power related rails have this field at true. */
@@ -21,7 +25,7 @@
public static final boolean isRailBlockAt(World par0World, int par1, int par2, int par3)
{
int l = par0World.getBlockId(par1, par2, par3);
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
+ return isRailBlock(l);
}
/**
@@ -29,7 +33,7 @@
*/
public static final boolean isRailBlock(int par0)
{
- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID;
+ return Block.blocksList[par0] instanceof BlockRail;
}
protected BlockRail(int par1, int par2, boolean par3)
@@ -126,7 +130,7 @@
*/
public int getRenderType()
{
- return 9;
+ return renderType;
}
/**
@@ -142,7 +146,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4);
+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP);
}
/**
@@ -179,27 +183,27 @@
boolean flag = false;
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP))
{
flag = true;
}
- if (j1 == 2 && !par1World.doesBlockHaveSolidTopSurface(par2 + 1, par3, par4))
+ if (j1 == 2 && !par1World.isBlockSolidOnSide(par2 + 1, par3, par4, UP))
{
flag = true;
}
- if (j1 == 3 && !par1World.doesBlockHaveSolidTopSurface(par2 - 1, par3, par4))
+ if (j1 == 3 && !par1World.isBlockSolidOnSide(par2 - 1, par3, par4, UP))
{
flag = true;
}
- if (j1 == 4 && !par1World.doesBlockHaveSolidTopSurface(par2, par3, par4 - 1))
+ if (j1 == 4 && !par1World.isBlockSolidOnSide(par2, par3, par4 - 1, UP))
{
flag = true;
}
- if (j1 == 5 && !par1World.doesBlockHaveSolidTopSurface(par2, par3, par4 + 1))
+ if (j1 == 5 && !par1World.isBlockSolidOnSide(par2, par3, par4 + 1, UP))
{
flag = true;
}
@@ -400,9 +404,135 @@
/**
* Return true if the blocks passed is a power related rail.
- */
+ * @deprecated
+ * This function is no longer called by Minecraft
+ */
+ @Deprecated
static boolean isPoweredBlockRail(BlockRail par0BlockRail)
{
return par0BlockRail.isPowered;
}
+
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @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)
+ {
+ return !isPowered;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @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)
+ {
+ return true;
+ }
+
+ /**
+ * Return the rails metadata (without the power bit if the rail uses one).
+ * Can be used to make the cart think the rail something other than it is,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * Valid rail metadata is defined as follows:
+ * 0x0: flat track going North-South
+ * 0x1: flat track going West-East
+ * 0x2: track ascending to the East
+ * 0x3: track ascending to the West
+ * 0x4: track ascending to the North
+ * 0x5: track ascending to the South
+ * 0x6: WestNorth corner (connecting East and South)
+ * 0x7: EastNorth corner (connecting West and South)
+ * 0x8: EastSouth corner (connecting West and North)
+ * 0x9: WestSouth corner (connecting East and North)
+ *
+ * All directions are Notch defined.
+ * In MC Beta 1.8.3 the Sun rises in the North.
+ * In MC 1.0.0 the Sun rises in the East.
+ *
+ * @param world The world.
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @param y The rail X coordinate.
+ * @param x The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return The metadata.
+ */
+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if(isPowered)
+ {
+ meta = meta & 7;
+ }
+ return meta;
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)
+ {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param y The rail X coordinate.
+ * @param x The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ */
+ public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z)
+ {
+ }
+
+ /**
+ * Return true if this rail uses the 4th bit as a power bit.
+ * Avoid using this function when getBasicRailMetadata() can be used instead.
+ * The only reason to use this function is if you wish to change the rails metadata.
+ * @param world The world.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return True if the 4th bit is a power bit.
+ */
+ public boolean hasPowerBit(World world, int x, int y, int z)
+ {
+ return isPowered;
+ }
+
+
+ /**
+ * Forge: Moved render type to a field and a setter.
+ * This allows for a mod to change the render type
+ * for vanilla rails, and any mod rails that extend
+ * this class.
+ */
+ private int renderType = 9;
+
+ public void setRenderType(int value)
+ {
+ renderType = value;
+ }
}

View file

@ -1,8 +1,8 @@
--- ../src_base/minecraft/net/minecraft/block/BlockRedstoneWire.java
+++ ../src_work/minecraft/net/minecraft/block/BlockRedstoneWire.java
@@ -565,7 +565,7 @@
@@ -521,7 +521,7 @@
}
else if (i1 != Block.redstoneRepeaterIdle.blockID && i1 != Block.redstoneRepeaterActive.blockID)
else if (!Block.redstoneRepeaterIdle.func_94487_f(i1))
{
- return Block.blocksList[i1].canProvidePower() && par4 != -1;
+ return (Block.blocksList[i1] != null && Block.blocksList[i1].canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4));

View file

@ -11,9 +11,9 @@
+
+public class BlockReed extends Block implements IPlantable
{
protected BlockReed(int par1, int par2)
protected BlockReed(int par1)
{
@@ -55,8 +59,8 @@
@@ -54,8 +58,8 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
@ -24,7 +24,7 @@
}
/**
@@ -139,4 +143,22 @@
@@ -138,4 +142,22 @@
{
return Item.reed.itemID;
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockSapling.java
+++ ../src_work/minecraft/net/minecraft/block/BlockSapling.java
@@ -13,6 +13,8 @@
@@ -15,6 +15,8 @@
import net.minecraft.world.gen.feature.WorldGenTaiga2;
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
@ -9,7 +9,7 @@
public class BlockSapling extends BlockFlower
{
@@ -65,6 +67,8 @@
@@ -72,6 +74,8 @@
*/
public void growTree(World par1World, int par2, int par3, int par4, Random par5Random)
{

View file

@ -8,8 +8,8 @@
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLiving;
@@ -133,11 +135,6 @@
import net.minecraft.client.renderer.texture.IconRegister;
@@ -134,11 +136,6 @@
}
/**
@ -21,8 +21,8 @@
* Called when the block is attempted to be harvested
*/
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer)
@@ -148,6 +145,8 @@
par1World.setBlockMetadataWithNotify(par2, par3, par4, par5);
@@ -149,6 +146,8 @@
par1World.setBlockMetadataWithNotify(par2, par3, par4, par5, 4);
}
+ dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
@ -30,28 +30,13 @@
super.onBlockHarvested(par1World, par2, par3, par4, par5, par6EntityPlayer);
}
@@ -156,24 +155,30 @@
@@ -157,24 +156,30 @@
*/
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
{
- if (!par1World.isRemote)
- {
- 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);
-
- 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);
- }
-
- super.breakBlock(par1World, par2, par3, par4, par5, par6);
- }
+ super.breakBlock(par1World, par2, par3, par4, par5, par6);
+ }
+
@ -65,9 +50,22 @@
+ TileEntitySkull tileentityskull = (TileEntitySkull)world.getBlockTileEntity(x, y, z);
+
+ if (tileentityskull == null)
+ {
{
- ItemStack itemstack = new ItemStack(Item.skull.itemID, 1, this.getDamageValue(par1World, par2, par3, par4));
- TileEntitySkull tileentityskull = (TileEntitySkull)par1World.getBlockTileEntity(par2, par3, par4);
-
- 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);
+ return drops;
+ }
}
-
- super.breakBlock(par1World, par2, par3, par4, par5, par6);
- }
+ if (tileentityskull.getSkullType() == 3 && tileentityskull.getExtraType() != null && tileentityskull.getExtraType().length() > 0)
+ {
+ itemstack.setTagCompound(new NBTTagCompound());

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/block/BlockSnow.java
+++ ../src_work/minecraft/net/minecraft/block/BlockSnow.java
@@ -67,7 +67,8 @@
@@ -74,7 +74,8 @@
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
int l = par1World.getBlockId(par2, par3 - 1, par4);
@ -10,27 +10,27 @@
}
/**
@@ -86,7 +87,6 @@
@@ -93,7 +94,6 @@
{
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
par1World.func_94571_i(par2, par3, par4);
return false;
}
@@ -102,10 +102,8 @@
@@ -109,10 +109,8 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- int i1 = Item.snowball.itemID;
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(i1, 1, 0));
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
par1World.setBlockWithNotify(par3, par4, par5, 0);
par1World.func_94571_i(par3, par4, par5);
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
}
/**
@@ -121,7 +119,7 @@
@@ -128,7 +126,7 @@
*/
public int quantityDropped(Random par1Random)
{
@ -39,11 +39,11 @@
}
/**
@@ -131,7 +129,6 @@
@@ -138,7 +136,6 @@
{
if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11)
{
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
par1World.func_94571_i(par2, par3, par4);
}
}

View file

@ -7,9 +7,9 @@
+
+import java.util.ArrayList;
import java.util.Random;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -9,6 +11,8 @@
@@ -11,6 +13,8 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -18,7 +18,7 @@
public class BlockStem extends BlockFlower
{
/** Defines if it is a Melon or a Pumpkin that the stem is producing. */
@@ -101,7 +105,8 @@
@@ -105,7 +109,8 @@
int l1 = par1World.getBlockId(j1, par3 - 1, k1);
@ -26,9 +26,9 @@
+ boolean isSoil = (blocksList[l1] != null && blocksList[l1].canSustainPlant(par1World, j1, par3 - 1, k1, ForgeDirection.UP, this));
+ if (par1World.getBlockId(j1, par3, k1) == 0 && (isSoil || l1 == Block.dirt.blockID || l1 == Block.grass.blockID))
{
par1World.setBlockWithNotify(j1, par3, k1, this.fruitType.blockID);
par1World.func_94575_c(j1, par3, k1, this.fruitType.blockID);
}
@@ -137,11 +142,11 @@
@@ -141,11 +146,11 @@
int j3 = par1World.getBlockId(l2, par3 - 1, i3);
float f1 = 0.0F;
@ -42,16 +42,12 @@
{
f1 = 3.0F;
}
@@ -241,29 +246,22 @@
@@ -237,29 +242,22 @@
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);
-
- if (!par1World.isRemote)
- {
- Item item = null;
-
- if (this.fruitType == Block.pumpkin)
+ }
+
+ @Override
@ -60,12 +56,14 @@
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ for (int i = 0; i < 3; i++)
+ {
{
- Item item = null;
-
- if (this.fruitType == Block.pumpkin)
+ if (world.rand.nextInt(15) <= metadata)
{
- item = Item.pumpkinSeeds;
+ ret.add(new ItemStack(fruitType == pumpkin ? Item.pumpkinSeeds : Item.melonSeeds));
}
- }
-
- if (this.fruitType == Block.melon)
- {
@ -78,9 +76,9 @@
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(item));
- }
- }
- }
+ }
+ ret.add(new ItemStack(fruitType == pumpkin ? Item.pumpkinSeeds : Item.melonSeeds));
}
}
+
+ return ret;
}

View file

@ -9,7 +9,7 @@
import java.util.List;
import java.util.Random;
import net.minecraft.block.material.Material;
@@ -15,7 +17,10 @@
@@ -17,7 +19,10 @@
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
@ -19,9 +19,9 @@
+
+public class BlockTallGrass extends BlockFlower implements IShearable
{
protected BlockTallGrass(int par1, int par2)
{
@@ -37,7 +42,7 @@
private static final String[] field_94367_a = new String[] {"deadbush", "tallgrass", "fern"};
@SideOnly(Side.CLIENT)
@@ -50,7 +55,7 @@
*/
public int idDropped(int par1, Random par2Random, int par3)
{
@ -30,7 +30,7 @@
}
/**
@@ -54,15 +59,7 @@
@@ -67,15 +72,7 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
@ -47,8 +47,8 @@
}
@SideOnly(Side.CLIENT)
@@ -115,4 +112,35 @@
par3List.add(new ItemStack(par1, 1, j));
@@ -139,4 +136,35 @@
this.field_94366_b[i] = par1IconRegister.func_94245_a(field_94367_a[i]);
}
}
+

View file

@ -9,7 +9,7 @@
+
public class BlockTorch extends Block
{
protected BlockTorch(int par1, int par2)
protected BlockTorch(int par1)
@@ -65,7 +68,7 @@
else
{
@ -66,24 +66,24 @@
- if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1);
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
}
- else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
}
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, SOUTH, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
}
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, NORTH, true))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
}
@@ -168,22 +175,22 @@
@@ -173,22 +180,22 @@
int i1 = par1World.getBlockMetadata(par2, par3, par4);
boolean flag = false;

View file

@ -14,16 +14,16 @@
protected BlockTrapDoor(int par1, Material par2Material)
{
super(par1, par2Material);
@@ -201,7 +206,7 @@
@@ -194,7 +199,7 @@
--j1;
}
- if (!isValidSupportBlock(par1World.getBlockId(j1, par3, k1)))
+ if (!(isValidSupportBlock(par1World.getBlockId(j1, par3, k1)) || par1World.isBlockSolidOnSide(j1, par3, k1, ForgeDirection.getOrientation((i1 & 3) + 2))))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
par1World.func_94571_i(par2, par3, par4);
this.dropBlockAsItem(par1World, par2, par3, par4, i1, 0);
@@ -266,6 +271,10 @@
@@ -259,6 +264,10 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
@ -34,7 +34,7 @@
if (par5 == 0)
{
return false;
@@ -296,7 +305,7 @@
@@ -289,7 +298,7 @@
--par2;
}
@ -43,7 +43,7 @@
}
}
@@ -311,6 +320,10 @@
@@ -304,6 +313,10 @@
*/
private static boolean isValidSupportBlock(int par0)
{

View file

@ -10,7 +10,7 @@
public class BlockTripWireSource extends Block
{
public BlockTripWireSource(int par1)
@@ -64,7 +67,11 @@
@@ -61,7 +64,11 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
@ -23,7 +23,7 @@
}
/**
@@ -72,7 +79,10 @@
@@ -69,7 +76,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
@ -35,7 +35,7 @@
}
/**
@@ -82,22 +92,22 @@
@@ -79,22 +89,22 @@
{
byte b0 = 0;
@ -62,7 +62,7 @@
{
b0 = 3;
}
@@ -127,22 +137,22 @@
@@ -124,22 +134,22 @@
int j1 = i1 & 3;
boolean flag = false;
@ -89,7 +89,7 @@
{
flag = true;
}
@@ -163,7 +173,7 @@
@@ -160,7 +170,7 @@
boolean flag2 = (par6 & 8) == 8;
boolean flag3 = par5 == Block.tripWireSource.blockID;
boolean flag4 = false;

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src_work/minecraft/net/minecraft/client/Minecraft.java
@@ -128,6 +128,10 @@
@@ -122,6 +122,10 @@
import com.google.common.collect.MapDifference;
@ -11,7 +11,7 @@
@SideOnly(Side.CLIENT)
public abstract class Minecraft implements Runnable, IPlayerUsage
{
@@ -1253,7 +1257,7 @@
@@ -1239,7 +1243,7 @@
if (this.thePlayer.canCurrentToolHarvestBlock(j, k, l))
{
@ -20,7 +20,7 @@
this.thePlayer.swingItem();
}
}
@@ -1319,7 +1323,8 @@
@@ -1305,7 +1309,8 @@
{
int j1 = itemstack != null ? itemstack.stackSize : 0;
@ -30,7 +30,7 @@
{
flag = false;
this.thePlayer.swingItem();
@@ -1345,7 +1350,8 @@
@@ -1331,7 +1336,8 @@
{
ItemStack itemstack1 = this.thePlayer.inventory.getCurrentItem();
@ -38,9 +38,9 @@
+ 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.func_78445_c();
this.entityRenderer.itemRenderer.resetEquippedProgress2();
}
@@ -2041,6 +2047,18 @@
@@ -2028,6 +2034,18 @@
if (this.theIntegratedServer != null)
{
this.theIntegratedServer.initiateShutdown();
@ -59,7 +59,7 @@
}
this.theIntegratedServer = null;
@@ -2350,95 +2368,12 @@
@@ -2339,95 +2357,12 @@
if (this.objectMouseOver != null)
{
boolean flag = this.thePlayer.capabilities.isCreativeMode;
@ -121,11 +121,11 @@
- {
- EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
-
- if (entityminecart.minecartType == 2)
- if (entityminecart.func_94087_l() == 2)
- {
- j = Item.minecartPowered.itemID;
- }
- else if (entityminecart.minecartType == 1)
- else if (entityminecart.func_94087_l() == 1)
- {
- j = Item.minecartCrate.itemID;
- }

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/gui/GuiIngame.java
+++ ../src_work/minecraft/net/minecraft/client/gui/GuiIngame.java
@@ -26,6 +26,8 @@
@@ -27,6 +27,8 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -9,7 +9,7 @@
@SideOnly(Side.CLIENT)
public class GuiIngame extends Gui
{
@@ -159,7 +161,7 @@
@@ -160,7 +162,7 @@
j3 = l - 39;
l2 = j3 - 10;

View file

@ -10,7 +10,7 @@
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -19,6 +22,8 @@
@@ -20,6 +23,8 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -19,7 +19,7 @@
@SideOnly(Side.CLIENT)
public class GuiAchievements extends GuiScreen
{
@@ -55,6 +60,10 @@
@@ -56,6 +61,10 @@
/** Whether the Mouse Button is down or not */
private int isMouseButtonDown = 0;
private StatFileWriter statFileWriter;
@ -30,7 +30,7 @@
public GuiAchievements(StatFileWriter par1StatFileWriter)
{
@@ -63,6 +72,14 @@
@@ -64,6 +73,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);
@ -45,7 +45,7 @@
}
/**
@@ -72,6 +89,7 @@
@@ -73,6 +90,7 @@
{
this.controlList.clear();
this.controlList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, StatCollector.translateToLocal("gui.done")));
@ -53,7 +53,7 @@
}
/**
@@ -83,6 +101,16 @@
@@ -84,6 +102,16 @@
{
this.mc.displayGuiScreen((GuiScreen)null);
this.mc.setIngameFocus();
@ -70,7 +70,7 @@
}
super.actionPerformed(par1GuiButton);
@@ -307,11 +335,12 @@
@@ -308,11 +336,12 @@
int k4;
int l4;
@ -88,7 +88,7 @@
{
i4 = achievement.displayColumn * 24 - k + 11 + i2;
l3 = achievement.displayRow * 24 - l + 11 + j2;
@@ -345,9 +374,9 @@
@@ -346,9 +375,9 @@
int j5;
int k5;
@ -97,7 +97,7 @@
- Achievement achievement2 = (Achievement)AchievementList.achievementList.get(i4);
+ for (i4 = 0; i4 < achievementList.size(); ++i4)
+ {
+ Achievement achievement2 = achievementList.get(i4);
j4 = achievement2.displayColumn * 24 - k;
k4 = achievement2.displayRow * 24 - l;
+ Achievement achievement2 = (Achievement)achievementList.get(i4);
l4 = achievement2.displayColumn * 24 - k;
j4 = achievement2.displayRow * 24 - l;

View file

@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
+++ ../src_work/minecraft/net/minecraft/client/gui/inventory/GuiContainer.java
@@ -333,7 +333,7 @@
if (k >= 0)
{
GL11.glDisable(GL11.GL_LIGHTING);
- this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/gui/items.png"));
+ this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture(par1Slot.getBackgroundIconTexture()));
this.drawTexturedModalRect(i, j, k % 16 * 16, k / 16 * 16, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
flag = true;

View file

@ -9,7 +9,7 @@
public GuiContainerCreative(EntityPlayer par1EntityPlayer)
{
@@ -229,6 +231,13 @@
@@ -266,6 +268,13 @@
this.setCurrentCreativeTab(CreativeTabs.creativeTabArray[i]);
this.field_82324_x = new CreativeCrafting(this.mc);
this.mc.thePlayer.inventoryContainer.addCraftingToCrafters(this.field_82324_x);
@ -23,7 +23,7 @@
}
else
{
@@ -363,7 +372,7 @@
@@ -400,7 +409,7 @@
{
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
@ -32,7 +32,7 @@
{
this.fontRenderer.drawString(creativetabs.getTranslatedTabLabel(), 8, 6, 4210752);
}
@@ -385,7 +394,7 @@
@@ -449,7 +458,7 @@
{
CreativeTabs creativetabs = acreativetabs[k1];
@ -41,7 +41,7 @@
{
this.setCurrentCreativeTab(creativetabs);
return;
@@ -401,11 +410,17 @@
@@ -465,11 +474,17 @@
*/
private boolean needsScrollBars()
{
@ -59,7 +59,7 @@
int i = selectedTabIndex;
selectedTabIndex = par1CreativeTabs.getTabIndex();
ContainerCreative containercreative = (ContainerCreative)this.inventorySlots;
@@ -575,21 +590,42 @@
@@ -640,21 +655,42 @@
super.drawScreen(par1, par2, par3);
CreativeTabs[] acreativetabs = CreativeTabs.creativeTabArray;
@ -107,7 +107,7 @@
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
@@ -610,14 +646,32 @@
@@ -675,14 +711,32 @@
int i1 = acreativetabs.length;
int j1;
@ -142,7 +142,7 @@
}
}
@@ -635,6 +689,14 @@
@@ -700,6 +754,14 @@
this.drawTexturedModalRect(k1, i1 + (int)((float)(j1 - i1 - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15);
}
@ -157,7 +157,7 @@
this.renderCreativeTab(creativetabs);
if (creativetabs == CreativeTabs.tabInventory)
@@ -645,6 +707,15 @@
@@ -710,6 +772,15 @@
protected boolean func_74232_a(CreativeTabs par1CreativeTabs, int par2, int par3)
{
@ -173,7 +173,7 @@
int k = par1CreativeTabs.getTabColumn();
int l = 28 * k;
byte b0 = 0;
@@ -759,7 +830,7 @@
@@ -824,7 +895,7 @@
i1 += 8 + (flag1 ? 1 : -1);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
@ -182,7 +182,7 @@
itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, l, i1);
itemRenderer.renderItemOverlayIntoGUI(this.fontRenderer, this.mc.renderEngine, itemstack, l, i1);
GL11.glDisable(GL11.GL_LIGHTING);
@@ -781,6 +852,15 @@
@@ -846,6 +917,15 @@
{
this.mc.displayGuiScreen(new GuiStats(this, this.mc.statFileWriter));
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java
+++ ../src_work/minecraft/net/minecraft/client/multiplayer/NetClientHandler.java
@@ -160,6 +160,11 @@
@@ -161,6 +161,11 @@
import net.minecraft.world.storage.MapStorage;
import org.lwjgl.input.Keyboard;
@ -12,7 +12,7 @@
@SideOnly(Side.CLIENT)
public class NetClientHandler extends NetHandler
{
@@ -744,7 +749,7 @@
@@ -737,7 +742,7 @@
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
{
@ -21,7 +21,7 @@
this.disconnected = true;
this.mc.loadWorld((WorldClient)null);
this.mc.displayGuiScreen(new GuiDisconnected("disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
@@ -810,7 +815,11 @@
@@ -803,7 +808,11 @@
public void handleChat(Packet3Chat par1Packet3Chat)
{
par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat);
@ -34,7 +34,7 @@
}
public void handleAnimation(Packet18Animation par1Packet18Animation)
@@ -1192,6 +1201,10 @@
@@ -1217,6 +1226,10 @@
{
tileentity.readFromNBT(par1Packet132TileEntityData.customParam1);
}

View file

@ -11,7 +11,7 @@
@SideOnly(Side.CLIENT)
public class PlayerControllerMP
{
@@ -121,6 +125,12 @@
@@ -118,6 +122,12 @@
*/
public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4)
{
@ -24,16 +24,16 @@
if (this.currentGameType.isAdventure() && !this.mc.thePlayer.canCurrentToolHarvestBlock(par1, par2, par3))
{
return false;
@@ -138,7 +148,7 @@
@@ -135,7 +145,7 @@
{
worldclient.playAuxSFX(2001, par1, par2, par3, block.blockID + (worldclient.getBlockMetadata(par1, par2, par3) << 12));
int i1 = worldclient.getBlockMetadata(par1, par2, par3);
- boolean flag = worldclient.setBlockWithNotify(par1, par2, par3, 0);
- boolean flag = worldclient.func_94571_i(par1, par2, par3);
+ boolean flag = block.removeBlockByPlayer(worldclient, mc.thePlayer, par1, par2, par3);
if (flag)
{
@@ -334,6 +344,12 @@
@@ -328,6 +338,12 @@
float f2 = (float)par8Vec3.zCoord - (float)par6;
boolean flag = false;
int i1;
@ -46,15 +46,7 @@
if (!par1EntityPlayer.isSneaking() || par1EntityPlayer.getHeldItem() == null)
{
@@ -344,6 +360,7 @@
flag = true;
}
}
+
if (!flag && par3ItemStack != null && par3ItemStack.getItem() instanceof ItemBlock)
{
@@ -376,7 +393,15 @@
@@ -370,7 +386,15 @@
}
else
{
@ -71,7 +63,7 @@
}
}
@@ -398,9 +423,10 @@
@@ -392,9 +416,10 @@
{
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = itemstack1;

View file

@ -23,7 +23,7 @@
}
/**
@@ -290,6 +296,12 @@
@@ -289,6 +295,12 @@
*/
protected void updateWeather()
{

View file

@ -1,41 +1,14 @@
--- ../src_base/minecraft/net/minecraft/client/particle/EffectRenderer.java
+++ ../src_work/minecraft/net/minecraft/client/particle/EffectRenderer.java
@@ -3,16 +3,25 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map.Entry;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.RenderEngine;
@@ -11,6 +11,7 @@
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
+import net.minecraft.item.Item;
import net.minecraft.util.MathHelper;
+import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
+
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.common.ForgeHooks;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
@SideOnly(Side.CLIENT)
public class EffectRenderer
@@ -25,6 +34,8 @@
/** RNG. */
private Random rand = new Random();
+ private Multimap<String, EntityFX> effectList = ArrayListMultimap.create();
+
public EffectRenderer(World par1World, RenderEngine par2RenderEngine)
{
if (par1World != null)
@@ -59,12 +70,27 @@
@@ -59,9 +60,13 @@
for (int j = 0; j < this.fxLayers[i].size(); ++j)
{
EntityFX entityfx = (EntityFX)this.fxLayers[i].get(j);
@ -52,21 +25,7 @@
{
this.fxLayers[i].remove(j--);
}
+ }
+ }
+
+ Iterator<Entry<String, EntityFX>> itr = effectList.entries().iterator();
+ while (itr.hasNext())
+ {
+ EntityFX fx = itr.next().getValue();
+ fx.onUpdate();
+ if (fx.isDead)
+ {
+ itr.remove();
}
}
}
@@ -115,6 +141,7 @@
@@ -115,6 +120,7 @@
for (int k = 0; k < this.fxLayers[i].size(); ++k)
{
EntityFX entityfx = (EntityFX)this.fxLayers[i].get(k);
@ -74,35 +33,7 @@
tessellator.setBrightness(entityfx.getBrightnessForRender(par2));
entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4);
}
@@ -123,6 +150,27 @@
GL11.glDisable(GL11.GL_BLEND);
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
}
+ }
+
+ for (String key : effectList.keySet())
+ {
+ ForgeHooksClient.bindTexture(key, 0);
+ for (EntityFX entry : effectList.get(key))
+ {
+ if (entry == null) continue;
+ Tessellator tessallator = Tessellator.instance;
+ //GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderer.getTexture(key));
+ tessallator.startDrawingQuads();
+
+ if (entry.getFXLayer() != 3)
+ {
+ tessallator.setBrightness(entry.getBrightnessForRender(par2));
+ entry.renderParticle(tessallator, par2, f1, f5, f2, f3, f4);
+ }
+
+ tessallator.draw();
+ }
+ ForgeHooksClient.unbindTexture();
}
}
@@ -142,6 +190,7 @@
@@ -142,6 +148,7 @@
for (int i = 0; i < this.fxLayers[b0].size(); ++i)
{
EntityFX entityfx = (EntityFX)this.fxLayers[b0].get(i);
@ -110,13 +41,7 @@
tessellator.setBrightness(entityfx.getBrightnessForRender(par2));
entityfx.renderParticle(tessellator, par2, f1, f5, f2, f3, f4);
}
@@ -156,13 +205,15 @@
{
this.fxLayers[i].clear();
}
+
+ effectList.clear();
}
@@ -160,9 +167,9 @@
public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5)
{
@ -129,68 +54,10 @@
byte b0 = 4;
for (int j1 = 0; j1 < b0; ++j1)
@@ -175,7 +226,7 @@
double d1 = (double)par2 + ((double)k1 + 0.5D) / (double)b0;
double d2 = (double)par3 + ((double)l1 + 0.5D) / (double)b0;
int i2 = this.rand.nextInt(6);
- this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, d0 - (double)par1 - 0.5D, d1 - (double)par2 - 0.5D, d2 - (double)par3 - 0.5D, block, i2, par5)).func_70596_a(par1, par2, par3));
+ this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, d0 - (double)par1 - 0.5D, d1 - (double)par2 - 0.5D, d2 - (double)par3 - 0.5D, block, i2, par5)).func_70596_a(par1, par2, par3), block);
}
}
}
@@ -227,12 +278,60 @@
d0 = (double)par1 + block.getBlockBoundsMaxX() + (double)f;
}
- this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_70596_a(par1, par2, par3).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
+ this.addEffect((new EntityDiggingFX(this.worldObj, d0, d1, d2, 0.0D, 0.0D, 0.0D, block, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_70596_a(par1, par2, par3).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F), block);
}
}
public String getStatistics()
@@ -235,4 +242,13 @@
{
- return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size());
+ int size = 0;
+ for (List x : fxLayers)
+ {
+ size += x.size();
+ }
+ size += effectList.size();
+ return Integer.toString(size);
+ }
+
+ public void addEffect(EntityFX effect, Object obj)
+ {
+ if (obj == null || !(obj instanceof Block || obj instanceof Item))
+ {
+ addEffect(effect);
+ return;
+ }
+
+ if (obj instanceof Item && ((Item)obj).isDefaultTexture)
+ {
+ addEffect(effect);
+ return;
+ }
+
+ if (obj instanceof Block && ((Block)obj).isDefaultTexture)
+ {
+ addEffect(effect);
+ return;
+ }
+
+ String texture = "/terrain.png";
+ if (effect.getFXLayer() == 0)
+ {
+ texture = "/particles.png";
+ }
+ else if (effect.getFXLayer() == 2)
+ {
+ texture = "/gui/items.png";
+ }
+ texture = ForgeHooks.getTexture(texture, obj);
+ effectList.put(texture, effect);
+ }
return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size());
}
+
+ public void addBlockHitEffects(int x, int y, int z, MovingObjectPosition target)
+ {
@ -199,5 +66,5 @@
+ {
+ addBlockHitEffects(x, y, z, target.sideHit);
+ }
}
+ }
}

View file

@ -1,17 +1,17 @@
--- ../src_base/minecraft/net/minecraft/client/particle/EntityDiggingFX.java
+++ ../src_work/minecraft/net/minecraft/client/particle/EntityDiggingFX.java
@@ -10,20 +10,22 @@
@@ -11,20 +11,22 @@
public class EntityDiggingFX extends EntityFX
{
private Block blockInstance;
+ private int side;
public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int par16)
public EntityDiggingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Block par14Block, int par15, int par16, RenderEngine par17RenderEngine)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.blockInstance = par14Block;
- this.setParticleTextureIndex(par14Block.getBlockTextureFromSideAndMetadata(0, par16));
+ this.setParticleTextureIndex(par14Block.getBlockTextureFromSideAndMetadata(par15, par16));
- this.func_94052_a(par17RenderEngine, par14Block.getBlockTextureFromSideAndMetadata(0, par16));
+ this.func_94052_a(par17RenderEngine, par14Block.getBlockTextureFromSideAndMetadata(par15, par16));
this.particleGravity = par14Block.blockParticleGravity;
this.particleRed = this.particleGreen = this.particleBlue = 0.6F;
this.particleScale /= 2.0F;

View file

@ -1,39 +1,40 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/ItemRenderer.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/ItemRenderer.java
@@ -15,11 +15,19 @@
@@ -15,6 +15,8 @@
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemMap;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.storage.MapData;
@@ -22,6 +24,12 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+
+import net.minecraftforge.client.ForgeHooksClient;
+import net.minecraftforge.client.IItemRenderer;
+import net.minecraftforge.client.MinecraftForgeClient;
+import static net.minecraftforge.client.IItemRenderer.ItemRenderType.*;
+import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.*;
+
@SideOnly(Side.CLIENT)
public class ItemRenderer
@@ -54,27 +62,21 @@
{
@@ -54,8 +62,21 @@
public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3)
{
GL11.glPushMatrix();
- Block block = null;
- if (par2ItemStack.itemID < Block.blocksList.length)
- {
- block = Block.blocksList[par2ItemStack.itemID];
- }
-
- if (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
- this.renderBlocksInstance.renderBlockAsItem(block, par2ItemStack.getItemDamage(), 1.0F);
- if (par2ItemStack.func_94608_d() == 0 && 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];
+ }
+
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED);
+
+ if (customRenderer != null)
@ -41,38 +42,20 @@
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
+ ForgeHooksClient.renderEquippedItem(customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack);
+ }
+ else if (par2ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
+ {
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
+ this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
}
else
+ else if (block != null && par2ItemStack.func_94608_d() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
{
- if (block != null)
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
- }
- else
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png"));
- }
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
Tessellator tessellator = Tessellator.instance;
int j = par1EntityLiving.getItemIcon(par2ItemStack, par3);
@@ -279,8 +281,9 @@
GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
@@ -274,7 +295,7 @@
Render render;
RenderPlayer renderplayer;
- if (itemstack != null && itemstack.itemID == Item.map.itemID)
- {
+ if (itemstack != null && itemstack.getItem() instanceof ItemMap)
+ {
+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
{
GL11.glPushMatrix();
f4 = 0.8F;
f7 = entityclientplayermp.getSwingProgress(par1);
@@ -346,11 +349,17 @@
@@ -341,11 +362,20 @@
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();
@ -81,7 +64,10 @@
- if (mapdata != null)
- {
- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, mapdata);
+
+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
+ MapData mapdata = ((ItemMap)itemstack.getItem()).getMapData(itemstack, this.mc.theWorld);
+
+ if (custom == null)
+ {
+ if (mapdata != null)
@ -95,7 +81,7 @@
}
GL11.glPopMatrix();
@@ -453,12 +462,15 @@
@@ -448,12 +478,15 @@
if (itemstack.getItem().requiresMultipleRenderPasses())
{
this.renderItem(entityclientplayermp, itemstack, 0);

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/RenderBlocks.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/RenderBlocks.java
@@ -37,6 +37,8 @@
@@ -43,6 +43,8 @@
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -9,7 +9,7 @@
@SideOnly(Side.CLIENT)
public class RenderBlocks
@@ -620,9 +622,8 @@
@@ -629,9 +631,8 @@
public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4)
{
Tessellator tessellator = Tessellator.instance;
@ -21,23 +21,23 @@
float f = 0.5F;
float f1 = 1.0F;
float f2 = 0.8F;
@@ -631,6 +632,7 @@
@@ -640,6 +641,7 @@
tessellator.setBrightness(j1);
tessellator.setColorOpaque_F(f, f, f);
int k1 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 0);
+ if (overrideBlockTexture >= 0) k1 = overrideBlockTexture; //BugFix Proper breaking texture on underside
int l1 = (k1 & 15) << 4;
int i2 = k1 & 240;
double d0 = (double)((float)l1 / 256.0F);
@@ -649,6 +651,7 @@
Icon icon = this.func_94170_a(par1Block, this.blockAccess, par2, par3, par4, 0);
+ if (func_94167_b()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside
double d0 = (double)icon.func_94209_e();
double d1 = (double)icon.func_94212_f();
double d2 = (double)icon.func_94206_g();
@@ -656,6 +658,7 @@
tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(this.blockAccess, par2, par3 + 1, par4));
tessellator.setColorOpaque_F(f1, f1, f1);
k1 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 1);
+ if (overrideBlockTexture >= 0) k1 = overrideBlockTexture; //BugFix Proper breaking texture on top
l1 = (k1 & 15) << 4;
i2 = k1 & 240;
d0 = (double)((float)l1 / 256.0F);
@@ -2387,7 +2390,7 @@
icon = this.func_94170_a(par1Block, this.blockAccess, par2, par3, par4, 1);
+ if (func_94167_b()) icon = overrideBlockTexture; //BugFix Proper breaking texture on underside
d0 = (double)icon.func_94209_e();
d1 = (double)icon.func_94212_f();
d2 = (double)icon.func_94206_g();
@@ -2444,7 +2447,7 @@
double d9;
double d10;
@ -46,44 +46,44 @@
{
float f1 = 0.2F;
float f2 = 0.0625F;
@@ -2407,7 +2410,7 @@
@@ -2464,7 +2467,7 @@
d0 = d5;
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, EAST))
{
tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d1, d2);
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 1), d1, d3);
@@ -2419,7 +2422,7 @@
tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d1, d2);
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);
@@ -2476,7 +2479,7 @@
tessellator.addVertexWithUV((double)((float)par2 + f1), (double)((float)par3 + f + f2), (double)(par4 + 1), d2, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, WEST))
{
tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d2);
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);
@@ -2431,7 +2434,7 @@
tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d2);
@@ -2488,7 +2491,7 @@
tessellator.addVertexWithUV((double)((float)(par2 + 1) - f1), (double)((float)par3 + f + f2), (double)(par4 + 0), d0, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, SOUTH))
{
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d1, d2);
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + f2), (double)(par4 + 0), d1, d3);
@@ -2443,7 +2446,7 @@
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d1, d2);
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);
@@ -2500,7 +2503,7 @@
tessellator.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + f + f2), (double)((float)par4 + f1), d2, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, NORTH))
{
tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d2);
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);
@@ -2455,7 +2458,7 @@
tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d2);
@@ -2512,7 +2515,7 @@
tessellator.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + f + f2), (double)((float)(par4 + 1) - f1), d0, d1);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4))
@ -91,75 +91,3 @@
{
d5 = (double)par2 + 0.5D + 0.5D;
d6 = (double)par2 + 0.5D - 0.5D;
@@ -4654,7 +4657,7 @@
k2 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, k2);
- if (fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -4777,7 +4780,7 @@
k2 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3));
- if (fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -4900,7 +4903,7 @@
k2 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, k2);
- if (fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -5023,7 +5026,7 @@
k2 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, k2);
- if (fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && k2 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -5135,7 +5138,7 @@
i1 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, i1);
- if (fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f11 * par5, f14 * par6, f17 * par7);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -5151,7 +5154,7 @@
i1 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, i1);
- if (fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f11 * par5, f14 * par6, f17 * par7);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -5167,7 +5170,7 @@
i1 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, i1);
- if (fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f12 * par5, f15 * par6, f18 * par7);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -5183,7 +5186,7 @@
i1 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, i1);
- if (fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && fancyGrass && i1 == 3 && this.overrideBlockTexture < 0)
{
tessellator.setColorOpaque_F(f12 * par5, f15 * par6, f18 * par7);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, 38);

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/RenderEngine.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/RenderEngine.java
@@ -29,6 +29,8 @@
@@ -27,6 +27,8 @@
import net.minecraft.util.IntHashMap;
import org.lwjgl.opengl.GL11;
@ -9,19 +9,19 @@
@SideOnly(Side.CLIENT)
public class RenderEngine
{
@@ -172,6 +174,7 @@
@@ -199,6 +201,7 @@
try
{
+ ForgeHooksClient.onTextureLoadPre(par1Str);
this.singleIntBuffer.clear();
GLAllocation.generateTextureNames(this.singleIntBuffer);
int i = this.singleIntBuffer.get(0);
@@ -215,6 +218,7 @@
try
{
+ ForgeHooksClient.onTextureLoadPre(par1Str);
this.singleIntBuffer.clear();
GLAllocation.generateTextureNames(this.singleIntBuffer);
int i = this.singleIntBuffer.get(0);
@@ -242,6 +245,7 @@
}
this.textureMap.put(par1Str, Integer.valueOf(i));
+ ForgeHooksClient.onTextureLoad(par1Str, itexturepack);
return i;
}
this.textureMap.put(par1Str, Integer.valueOf(i));
+ ForgeHooksClient.onTextureLoad(par1Str, itexturepack);
return i;
}
catch (Exception exception)
catch (Exception exception)

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/RenderGlobal.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/RenderGlobal.java
@@ -62,6 +62,8 @@
@@ -64,6 +64,8 @@
import org.lwjgl.opengl.ARBOcclusionQuery;
import org.lwjgl.opengl.GL11;
@ -9,7 +9,7 @@
@SideOnly(Side.CLIENT)
public class RenderGlobal implements IWorldAccess
{
@@ -929,6 +931,12 @@
@@ -932,6 +934,12 @@
*/
public void renderSky(float par1)
{
@ -22,7 +22,7 @@
if (this.mc.theWorld.provider.dimensionId == 1)
{
GL11.glDisable(GL11.GL_FOG);
@@ -1167,6 +1175,13 @@
@@ -1170,6 +1178,13 @@
public void renderClouds(float par1)
{
@ -36,7 +36,7 @@
if (this.mc.theWorld.provider.isSurfaceWorld())
{
if (this.mc.gameSettings.fancyGraphics)
@@ -1596,6 +1611,11 @@
@@ -1599,6 +1614,11 @@
}
public void drawBlockDamageTexture(Tessellator par1Tessellator, EntityPlayer par2EntityPlayer, float par3)
@ -48,49 +48,3 @@
{
double d0 = par2EntityPlayer.lastTickPosX + (par2EntityPlayer.posX - par2EntityPlayer.lastTickPosX) * (double)par3;
double d1 = par2EntityPlayer.lastTickPosY + (par2EntityPlayer.posY - par2EntityPlayer.lastTickPosY) * (double)par3;
@@ -1873,6 +1893,7 @@
double d7 = this.mc.renderViewEntity.posY - par4;
double d8 = this.mc.renderViewEntity.posZ - par6;
EntityFX entityfx = null;
+ Object effectObject = null;
if (par1Str.equals("hugeexplosion"))
{
@@ -2009,6 +2030,7 @@
else if (par1Str.equals("snowballpoof"))
{
entityfx = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.snowball);
+ effectObject = Item.snowball;
}
else if (par1Str.equals("dripWater"))
{
@@ -2025,6 +2047,7 @@
else if (par1Str.equals("slime"))
{
entityfx = new EntityBreakingFX(this.theWorld, par2, par4, par6, Item.slimeBall);
+ effectObject = Item.slimeBall;
}
else if (par1Str.equals("heart"))
{
@@ -2046,6 +2069,7 @@
{
int j = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1));
entityfx = new EntityBreakingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Item.itemsList[j]);
+ effectObject = Item.itemsList[j];
}
else if (par1Str.startsWith("tilecrack_"))
{
@@ -2053,11 +2077,12 @@
int k = Integer.parseInt(astring[1]);
int l = Integer.parseInt(astring[2]);
entityfx = (new EntityDiggingFX(this.theWorld, par2, par4, par6, par8, par10, par12, Block.blocksList[k], 0, l)).applyRenderColor(l);
+ effectObject = Block.blocksList[k];
}
if (entityfx != null)
{
- this.mc.effectRenderer.addEffect((EntityFX)entityfx);
+ this.mc.effectRenderer.addEffect((EntityFX)entityfx, effectObject);
}
return (EntityFX)entityfx;

View file

@ -1,12 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderItem.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderItem.java
@@ -13,11 +13,14 @@
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.ItemStack;
import net.minecraft.util.MathHelper;
@@ -19,6 +19,8 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@ -15,7 +9,7 @@
@SideOnly(Side.CLIENT)
public class RenderItem extends Render
{
@@ -48,39 +51,22 @@
@@ -49,29 +51,9 @@
if (itemstack.getItem() != null)
{
GL11.glPushMatrix();
@ -24,114 +18,79 @@
float f3 = (((float)par1EntityItem.age + par9) / 20.0F + par1EntityItem.hoverStart) * (180F / (float)Math.PI);
- byte b0 = 1;
-
- if (par1EntityItem.func_92014_d().stackSize > 1)
- if (par1EntityItem.getEntityItem().stackSize > 1)
- {
- b0 = 2;
- }
-
- if (par1EntityItem.func_92014_d().stackSize > 5)
- if (par1EntityItem.getEntityItem().stackSize > 5)
- {
- b0 = 3;
- }
-
- if (par1EntityItem.func_92014_d().stackSize > 20)
- if (par1EntityItem.getEntityItem().stackSize > 20)
- {
- b0 = 4;
- }
-
- if (par1EntityItem.func_92014_d().stackSize > 40)
- if (par1EntityItem.getEntityItem().stackSize > 40)
- {
- b0 = 5;
- }
+ byte b0 = getMiniBlockCountForItemStack(itemstack);
+ byte b0 = getMiniBlockCount(itemstack);
GL11.glTranslatef((float)par2, (float)par4 + f2, (float)par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
- Block block = Block.blocksList[itemstack.itemID];
int i;
float f4;
@@ -80,9 +62,18 @@
float f5;
float f6;
- if (block != null && RenderBlocks.renderItemIn3d(block.getRenderType()))
- if (itemstack.func_94608_d() == 0 && Block.blocksList[itemstack.itemID] != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
- {
- Block block = Block.blocksList[itemstack.itemID];
+ Block block = null;
+ if (itemstack.itemID < Block.blocksList.length)
+ {
+ block = Block.blocksList[itemstack.itemID];
+ }
+
+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, renderBlocks))
+ {
+ ;
+ }
+ else if (itemstack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
{
+ else if (itemstack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
+ {
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
@@ -91,9 +77,9 @@
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
if (field_82407_g)
@@ -138,10 +129,10 @@
- this.loadTexture("/terrain.png");
+ this.loadTexture(Block.blocksList[itemstack.itemID].getTextureFile());
float f7 = 0.25F;
- i = block.getRenderType();
+ i = Block.blocksList[itemstack.itemID].getRenderType();
this.loadTexture("/gui/items.png");
if (i == 1 || i == 19 || i == 12 || i == 2)
{
@@ -115,7 +101,7 @@
}
f6 = 1.0F;
- this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f6);
+ this.itemRenderBlocks.renderBlockAsItem(Block.blocksList[itemstack.itemID], itemstack.getItemDamage(), f6);
GL11.glPopMatrix();
}
}
@@ -136,12 +122,12 @@
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
- this.loadTexture("/gui/items.png");
-
- for (k = 0; k <= 1; ++k)
- {
+
+ for (k = 0; k <= itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
+ {
+ this.loadTexture(Item.itemsList[itemstack.itemID].getTextureFile());
- for (int k = 0; k <= 1; ++k)
+ for (int k = 0; k <= itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
{
this.random.setSeed(187L);
- i = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), k);
+ i = itemstack.getItem().getIconIndex(itemstack, k);
- Icon icon = itemstack.getItem().getIconFromDamageForRenderPass(itemstack.getItemDamage(), k);
+ Icon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.field_77024_a)
@@ -173,14 +159,7 @@
k = itemstack.getIconIndex();
- if (block != null)
- {
- this.loadTexture("/terrain.png");
- }
- else
- {
- this.loadTexture("/gui/items.png");
- }
+ this.loadTexture(itemstack.getItem().getTextureFile());
if (this.field_77024_a)
{
@@ -232,39 +211,27 @@
@@ -232,32 +223,26 @@
f11 = 0.021875F;
ItemStack itemstack = par1EntityItem.func_92014_d();
int k = itemstack.stackSize;
ItemStack itemstack = par1EntityItem.getEntityItem();
int j = itemstack.stackSize;
- byte b0;
-
- if (k < 2)
- if (j < 2)
- {
- b0 = 1;
- }
- else if (k < 16)
- else if (j < 16)
- {
- b0 = 2;
- }
- else if (k < 32)
- else if (j < 32)
- {
- b0 = 3;
- }
@ -139,85 +98,62 @@
- {
- b0 = 4;
- }
+ byte b0 = getMiniItemCountForItemStack(itemstack);
+
+ byte b0 = getMiniItemCount(itemstack);
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float)b0 / 2.0F));
for (int l = 0; l < b0; ++l)
for (int k = 0; k < b0; ++k)
{
- GL11.glTranslatef(0.0F, 0.0F, f12 + f11);
-
- if (Block.blocksList[itemstack.itemID] != null)
- {
- this.loadTexture("/terrain.png");
- if (itemstack.func_94608_d() == 0 && Block.blocksList[itemstack.itemID] != null)
+ // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug...
+ if (l > 0 && shouldSpreadItems())
+ 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);
}
else
{
- this.loadTexture("/gui/items.png");
- }
+ }
+ else
+ {
+ GL11.glTranslatef(0f, 0f, f12 + f11);
+ }
+
+ this.loadTexture(Item.itemsList[itemstack.itemID].getTextureFile());
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, f12);
@@ -348,10 +315,10 @@
+ if (itemstack.func_94608_d() == 0 && itemstack.itemID < Block.blocksList.length && Block.blocksList[itemstack.itemID] != null)
{
this.loadTexture("/terrain.png");
}
@@ -346,11 +331,12 @@
float f;
float f1;
float f2;
- if (k < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png"));
+ if (par3ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par3ItemStack.itemID].getRenderType()))
+ {
Block block = Block.blocksList[k];
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(block.getTextureFile()));
-
- if (par3ItemStack.func_94608_d() == 0 && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
+
+ Block block = (k < Block.blocksList.length ? Block.blocksList[k] : null);
+
+ if (par3ItemStack.func_94608_d() == 0 && block != null && RenderBlocks.renderItemIn3d(Block.blocksList[k].getRenderType()))
{
par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png"));
- 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);
@@ -382,11 +349,11 @@
if (Item.itemsList[k].requiresMultipleRenderPasses())
{
@@ -383,9 +369,9 @@
GL11.glDisable(GL11.GL_LIGHTING);
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
-
- for (k1 = 0; k1 <= 1; ++k1)
par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
- for (j1 = 0; j1 <= 1; ++j1)
- {
- j1 = Item.itemsList[k].getIconFromDamageForRenderPass(l, k1);
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Item.itemsList[k].getTextureFile()));
+
+ for (k1 = 0; k1 < Item.itemsList[k].getRenderPasses(l); ++k1)
- Icon icon1 = Item.itemsList[k].getIconFromDamageForRenderPass(l, j1);
+ for (j1 = 0; j1 < Item.itemsList[k].getRenderPasses(l); ++j1)
+ {
+ j1 = Item.itemsList[k].getIconIndex(par3ItemStack, k1);
int l1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, k1);
f = (float)(l1 >> 16 & 255) / 255.0F;
f1 = (float)(l1 >> 8 & 255) / 255.0F;
@@ -406,14 +373,7 @@
{
GL11.glDisable(GL11.GL_LIGHTING);
- if (k < 256)
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png"));
- }
- else
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
- }
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(par3ItemStack.getItem().getTextureFile()));
k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, 0);
float f4 = (float)(k1 >> 16 & 255) / 255.0F;
@@ -440,7 +400,10 @@
+ Icon icon1 = Item.itemsList[k].getIcon(par3ItemStack, j1);
int k1 = Item.itemsList[k].getColorFromItemStack(par3ItemStack, j1);
f = (float)(k1 >> 16 & 255) / 255.0F;
f1 = (float)(k1 >> 8 & 255) / 255.0F;
@@ -439,7 +425,10 @@
{
if (par3ItemStack != null)
{
@ -229,12 +165,11 @@
if (par3ItemStack != null && par3ItemStack.hasEffect())
{
@@ -578,4 +541,77 @@
@@ -576,4 +565,47 @@
{
this.doRenderItem((EntityItem)par1Entity, par2, par4, par6, par8, par9);
}
+
+ /* ==== Forge start ===== */
+ /**
+ * Items should spread out when rendered in 3d?
+ * @return
@ -253,29 +188,14 @@
+ return true;
+ }
+
+ public byte getMiniBlockCountForItemStack(ItemStack stack)
+ public byte getMiniBlockCount(ItemStack stack)
+ {
+ byte b0 = 1;
+ if (stack.stackSize > 1)
+ {
+ b0 = 2;
+ }
+
+ if (stack.stackSize > 5)
+ {
+ b0 = 3;
+ }
+
+ if (stack.stackSize > 20)
+ {
+ b0 = 4;
+ }
+
+ if (stack.stackSize > 40)
+ {
+ b0 = 5;
+ }
+ return b0;
+ 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;
+ }
+
+ /**
@ -284,26 +204,12 @@
+ * @param stack
+ * @return
+ */
+ public byte getMiniItemCountForItemStack(ItemStack stack)
+ public byte getMiniItemCount(ItemStack stack)
+ {
+ byte b0;
+ int i = stack.stackSize;
+ if (i < 2)
+ {
+ b0 = 1;
+ }
+ else if (i < 16)
+ {
+ b0 = 2;
+ }
+ else if (i < 32)
+ {
+ b0 = 3;
+ }
+ else
+ {
+ b0 = 4;
+ }
+ return b0;
+ byte ret = 1;
+ if (stack.stackSize > 1) ret = 2;
+ if (stack.stackSize > 15) ret = 3;
+ if (stack.stackSize > 31) ret = 4;
+ return ret;
+ }
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
@@ -213,12 +213,14 @@
@@ -216,12 +216,14 @@
if (par4EntityLiving.isPlayerSleeping())
{

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
@@ -16,10 +16,17 @@
@@ -13,10 +13,17 @@
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumArmorMaterial;
import net.minecraft.item.Item;
@ -18,7 +18,7 @@
@SideOnly(Side.CLIENT)
public class RenderPlayer extends RenderLiving
@@ -28,6 +35,8 @@
@@ -25,6 +32,8 @@
private ModelBiped modelArmorChestplate;
private ModelBiped modelArmor;
public static String[] armorFilenamePrefix = new String[] {"cloth", "chain", "iron", "diamond", "gold"};
@ -27,7 +27,7 @@
public RenderPlayer()
{
@@ -51,7 +60,7 @@
@@ -48,7 +57,7 @@
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
@ -36,7 +36,7 @@
ModelBiped modelbiped = par2 == 2 ? this.modelArmor : this.modelArmorChestplate;
modelbiped.bipedHead.showModel = par2 == 0;
modelbiped.bipedHeadwear.showModel = par2 == 0;
@@ -120,7 +129,7 @@
@@ -117,7 +126,7 @@
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
@ -45,16 +45,7 @@
float f1 = 1.0F;
GL11.glColor3f(f1, f1, f1);
}
@@ -172,7 +181,7 @@
float f = 1.6F;
float f1 = 0.016666668F * f;
double d3 = par1EntityPlayer.getDistanceSqToEntity(this.renderManager.livingPlayer);
- float f2 = par1EntityPlayer.isSneaking() ? 32.0F : 64.0F;
+ float f2 = par1EntityPlayer.isSneaking() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE;
if (d3 < (double)(f2 * f2))
{
@@ -239,9 +248,12 @@
@@ -176,9 +185,12 @@
this.modelBipedMain.bipedHead.postRender(0.0625F);
float f2;
@ -70,7 +61,7 @@
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
@@ -359,7 +371,10 @@
@@ -296,7 +308,10 @@
enumaction = itemstack1.getItemUseAction();
}
@ -82,7 +73,7 @@
{
f3 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -416,7 +431,7 @@
@@ -353,7 +368,7 @@
if (itemstack1.getItem().requiresMultipleRenderPasses())
{

View file

@ -1,27 +0,0 @@
--- ../src_base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererPiston.java
+++ ../src_work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererPiston.java
@@ -12,6 +12,8 @@
import net.minecraft.tileentity.TileEntityPiston;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
+
+import net.minecraftforge.client.ForgeHooksClient;
@SideOnly(Side.CLIENT)
public class TileEntityRendererPiston extends TileEntitySpecialRenderer
@@ -41,6 +43,7 @@
GL11.glShadeModel(GL11.GL_FLAT);
}
+ ForgeHooksClient.beforeBlockRender(block, blockRenderer);
tessellator.startDrawingQuads();
tessellator.setTranslation((double)((float)par2 - (float)par1TileEntityPiston.xCoord + par1TileEntityPiston.getOffsetX(par8)), (double)((float)par4 - (float)par1TileEntityPiston.yCoord + par1TileEntityPiston.getOffsetY(par8)), (double)((float)par6 - (float)par1TileEntityPiston.zCoord + par1TileEntityPiston.getOffsetZ(par8)));
tessellator.setColorOpaque(1, 1, 1);
@@ -64,6 +67,7 @@
tessellator.setTranslation(0.0D, 0.0D, 0.0D);
tessellator.draw();
+ ForgeHooksClient.afterBlockRender(block, blockRenderer);
RenderHelper.enableStandardItemLighting();
}
}

View file

@ -32,7 +32,7 @@
+ */
+ public static void addToBookList(Enchantment enchantment)
+ {
+ ObjectArrays.concat(field_92038_c, enchantment);
+ ObjectArrays.concat(field_92090_c, enchantment);
+ }
+
static

View file

@ -8,7 +8,7 @@
import net.minecraft.entity.passive.EntityWolf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
@@ -45,6 +46,11 @@
@@ -47,6 +48,11 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@ -20,7 +20,7 @@
public abstract class EntityLiving extends Entity
{
/**
@@ -387,6 +393,7 @@
@@ -390,6 +396,7 @@
public void setAttackTarget(EntityLiving par1EntityLiving)
{
this.attackTarget = par1EntityLiving;
@ -28,15 +28,15 @@
}
/**
@@ -483,6 +490,7 @@
@@ -486,6 +493,7 @@
{
this.entityLivingToAttack = par1EntityLiving;
this.revengeTimer = this.entityLivingToAttack != null ? 60 : 0;
this.revengeTimer = this.entityLivingToAttack != null ? 100 : 0;
+ ForgeHooks.onLivingSetAttackTarget(this, par1EntityLiving);
}
protected void entityInit()
@@ -792,6 +800,11 @@
@@ -797,6 +805,11 @@
*/
public void onUpdate()
{
@ -48,7 +48,7 @@
super.onUpdate();
if (!this.worldObj.isRemote)
@@ -977,6 +990,11 @@
@@ -982,6 +995,11 @@
*/
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
@ -60,7 +60,7 @@
if (this.isEntityInvulnerable())
{
return false;
@@ -1188,6 +1206,11 @@
@@ -1193,6 +1211,11 @@
{
if (!this.isEntityInvulnerable())
{
@ -71,8 +71,8 @@
+ }
par2 = this.applyArmorCalculations(par1DamageSource, par2);
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.health -= par2;
@@ -1252,6 +1275,11 @@
int j = this.getHealth();
@@ -1259,6 +1282,11 @@
*/
public void onDeath(DamageSource par1DamageSource)
{
@ -84,7 +84,7 @@
Entity entity = par1DamageSource.getEntity();
if (this.scoreValue >= 0 && entity != null)
@@ -1274,6 +1302,10 @@
@@ -1281,6 +1309,10 @@
{
i = EnchantmentHelper.getLootingModifier((EntityLiving)entity);
}
@ -95,7 +95,7 @@
if (!this.isChild() && this.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
{
@@ -1282,7 +1314,7 @@
@@ -1289,7 +1321,7 @@
if (this.recentlyHit > 0)
{
@ -104,7 +104,7 @@
if (j < 5)
{
@@ -1290,6 +1322,16 @@
@@ -1297,6 +1329,16 @@
}
}
}
@ -121,7 +121,7 @@
}
this.worldObj.setEntityState(this, (byte)3);
@@ -1334,6 +1376,12 @@
@@ -1341,6 +1383,12 @@
*/
protected void fall(float par1)
{
@ -134,7 +134,7 @@
super.fall(par1);
int i = MathHelper.ceiling_float_int(par1 - 3.0F);
@@ -1536,7 +1584,7 @@
@@ -1543,7 +1591,7 @@
int j = MathHelper.floor_double(this.boundingBox.minY);
int k = MathHelper.floor_double(this.posZ);
int l = this.worldObj.getBlockId(i, j, k);
@ -143,7 +143,7 @@
}
/**
@@ -1949,6 +1997,7 @@
@@ -1965,6 +2013,7 @@
}
this.isAirBorne = true;
@ -151,7 +151,7 @@
}
/**
@@ -2486,8 +2535,6 @@
@@ -2502,8 +2551,6 @@
return this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD;
}
@ -160,9 +160,9 @@
/**
* Remove the speified potion effect from this entity.
*/
@@ -2944,4 +2991,42 @@
@@ -3004,4 +3051,42 @@
{
this.dataWatcher.updateObject(10, Byte.valueOf((byte)par1));
return this.func_94062_bN();
}
+
+ /***

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/entity/boss/EntityDragon.java
+++ ../src_work/minecraft/net/minecraft/entity/boss/EntityDragon.java
@@ -530,10 +530,11 @@
@@ -531,10 +531,11 @@
for (int i2 = k; i2 <= j1; ++i2)
{
int j2 = this.worldObj.getBlockId(k1, l1, i2);
@ -13,5 +13,5 @@
- if (j2 != Block.obsidian.blockID && j2 != Block.whiteStone.blockID && j2 != Block.bedrock.blockID)
+ if (block.canDragonDestroy(worldObj, k1, l1, i2))
{
flag1 = true;
this.worldObj.setBlockWithNotify(k1, l1, i2, 0);
flag1 = this.worldObj.func_94571_i(k1, l1, i2) || flag1;
}

View file

@ -12,22 +12,22 @@
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
@@ -29,6 +34,11 @@
@@ -30,6 +35,11 @@
/** The EntityItem's random initial float height. */
public float hoverStart;
+
+ /**
+ * The maximum age of this EntityItem. The item is expired once this is reached.
+ */
+ public int lifespan = 6000;
+
public EntityItem(World par1World, double par2, double par4, double par6)
{
super(par1World);
@@ -49,6 +59,7 @@
{
this(par1World, par2, par4, par6);
this.func_92013_a(par8ItemStack);
this.func_92058_a(par8ItemStack);
+ this.lifespan = (par8ItemStack.getItem() == null ? 6000 : par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World));
}
@ -69,13 +69,13 @@
par1NBTTagCompound.setShort("Age", (short)this.age);
+ par1NBTTagCompound.setInteger("Lifespan", lifespan);
if (this.func_92014_d() != null)
if (this.getEntityItem() != null)
{
@@ -280,10 +314,17 @@
NBTTagCompound nbttagcompound1 = par1NBTTagCompound.getCompoundTag("Item");
this.func_92013_a(ItemStack.loadItemStackFromNBT(nbttagcompound1));
this.func_92058_a(ItemStack.loadItemStackFromNBT(nbttagcompound1));
- if (this.func_92014_d() == null)
- if (this.getEntityItem() == null)
+ ItemStack item = getDataWatcher().getWatchableObjectItemStack(10);
+
+ if (item == null || item.stackSize <= 0)
@ -106,7 +106,7 @@
+ return;
+ }
+
ItemStack itemstack = this.func_92014_d();
ItemStack itemstack = this.getEntityItem();
int i = itemstack.stackSize;
- if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(itemstack))

View file

@ -1,948 +0,0 @@
--- ../src_base/minecraft/net/minecraft/entity/item/EntityMinecart.java
+++ ../src_work/minecraft/net/minecraft/entity/item/EntityMinecart.java
@@ -2,6 +2,8 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRail;
@@ -23,6 +25,11 @@
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
+import net.minecraftforge.common.IMinecartCollisionHandler;
+import net.minecraftforge.common.MinecartRegistry;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.minecart.*;
+
public class EntityMinecart extends Entity implements IInventory
{
/** Array of item stacks stored in minecart (for storage minecarts). */
@@ -54,6 +61,25 @@
@SideOnly(Side.CLIENT)
protected double velocityZ;
+ /* Forge: Minecart Compatibility Layer Integration. */
+ public static float defaultMaxSpeedRail = 0.4f;
+ public static float defaultMaxSpeedGround = 0.4f;
+ public static float defaultMaxSpeedAirLateral = 0.4f;
+ public static float defaultMaxSpeedAirVertical = -1f;
+ public static double defaultDragRidden = 0.996999979019165D;
+ public static double defaultDragEmpty = 0.9599999785423279D;
+ public static double defaultDragAir = 0.94999998807907104D;
+ protected boolean canUseRail = true;
+ protected boolean canBePushed = true;
+ private static IMinecartCollisionHandler collisionHandler = null;
+
+ /* Instance versions of the above physics properties */
+ protected float maxSpeedRail;
+ protected float maxSpeedGround;
+ protected float maxSpeedAirLateral;
+ protected float maxSpeedAirVertical;
+ protected double dragAir;
+
public EntityMinecart(World par1World)
{
super(par1World);
@@ -65,6 +91,18 @@
this.setSize(0.98F, 0.7F);
this.yOffset = this.height / 2.0F;
this.field_82344_g = par1World != null ? par1World.func_82735_a(this) : null;
+
+ maxSpeedRail = defaultMaxSpeedRail;
+ maxSpeedGround = defaultMaxSpeedGround;
+ maxSpeedAirLateral = defaultMaxSpeedAirLateral;
+ maxSpeedAirVertical = defaultMaxSpeedAirVertical;
+ dragAir = defaultDragAir;
+ }
+
+ public EntityMinecart(World world, int type)
+ {
+ this(world);
+ minecartType = type;
}
/**
@@ -90,6 +128,10 @@
*/
public AxisAlignedBB getCollisionBox(Entity par1Entity)
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getCollisionBox(this, par1Entity);
+ }
return par1Entity.canBePushed() ? par1Entity.boundingBox : null;
}
@@ -98,6 +140,10 @@
*/
public AxisAlignedBB getBoundingBox()
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getBoundingBox(this);
+ }
return null;
}
@@ -106,7 +152,7 @@
*/
public boolean canBePushed()
{
- return true;
+ return canBePushed;
}
public EntityMinecart(World par1World, double par2, double par4, double par6, int par8)
@@ -161,48 +207,7 @@
}
this.setDead();
- this.dropItemWithOffset(Item.minecartEmpty.itemID, 1, 0.0F);
-
- if (this.minecartType == 1)
- {
- EntityMinecart entityminecart = this;
-
- for (int j = 0; j < entityminecart.getSizeInventory(); ++j)
- {
- ItemStack itemstack = entityminecart.getStackInSlot(j);
-
- if (itemstack != null)
- {
- float f = this.rand.nextFloat() * 0.8F + 0.1F;
- float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
- float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
-
- while (itemstack.stackSize > 0)
- {
- int k = this.rand.nextInt(21) + 10;
-
- if (k > itemstack.stackSize)
- {
- k = itemstack.stackSize;
- }
-
- itemstack.stackSize -= k;
- EntityItem entityitem = new EntityItem(this.worldObj, this.posX + (double)f, this.posY + (double)f1, this.posZ + (double)f2, new ItemStack(itemstack.itemID, k, itemstack.getItemDamage()));
- float f3 = 0.05F;
- entityitem.motionX = (double)((float)this.rand.nextGaussian() * f3);
- entityitem.motionY = (double)((float)this.rand.nextGaussian() * f3 + 0.2F);
- entityitem.motionZ = (double)((float)this.rand.nextGaussian() * f3);
- this.worldObj.spawnEntityInWorld(entityitem);
- }
- }
- }
-
- this.dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
- }
- else if (this.minecartType == 2)
- {
- this.dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
- }
+ dropCartAsItem();
}
return true;
@@ -320,7 +325,7 @@
this.kill();
}
- if (this.isMinecartPowered() && this.rand.nextInt(4) == 0)
+ if (this.isMinecartPowered() && this.rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
{
this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D);
}
@@ -418,18 +423,18 @@
double d5 = 0.0078125D;
int l = this.worldObj.getBlockId(d45, i, d47);
- if (BlockRail.isRailBlock(l))
+ if (canUseRail() && BlockRail.isRailBlock(l))
{
this.fallDistance = 0.0F;
Vec3 vec3 = this.func_70489_a(this.posX, this.posY, this.posZ);
- int i1 = this.worldObj.getBlockMetadata(d45, i, d47);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, d45, i, d47);
this.posY = (double)i;
boolean flag = false;
boolean flag1 = false;
if (l == Block.railPowered.blockID)
{
- flag = (i1 & 8) != 0;
+ flag = (worldObj.getBlockMetadata(d45, i, d47) & 8) != 0;
flag1 = !flag;
}
@@ -443,25 +448,7 @@
this.posY = (double)(i + 1);
}
- if (i1 == 2)
- {
- this.motionX -= d5;
- }
-
- if (i1 == 3)
- {
- this.motionX += d5;
- }
-
- if (i1 == 4)
- {
- this.motionZ += d5;
- }
-
- if (i1 == 5)
- {
- this.motionZ -= d5;
- }
+ adjustSlopeVelocities(i1);
int[][] aint = matrix[i1];
double d6 = (double)(aint[1][0] - aint[0][0]);
@@ -494,7 +481,7 @@
}
}
- if (flag1)
+ if (flag1 && shouldDoRailFunctions())
{
d11 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
@@ -542,36 +529,8 @@
this.posX = d12 + d6 * d11;
this.posZ = d13 + d7 * d11;
this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ);
- d16 = this.motionX;
- d17 = this.motionZ;
-
- if (this.riddenByEntity != null)
- {
- d16 *= 0.75D;
- d17 *= 0.75D;
- }
-
- if (d16 < -d4)
- {
- d16 = -d4;
- }
-
- if (d16 > d4)
- {
- d16 = d4;
- }
-
- if (d17 < -d4)
- {
- d17 = -d4;
- }
-
- if (d17 > d4)
- {
- d17 = d4;
- }
-
- this.moveEntity(d16, 0.0D, d17);
+
+ moveMinecartOnRail(d45, i, d47);
if (aint[0][1] != 0 && MathHelper.floor_double(this.posX) - d45 == aint[0][0] && MathHelper.floor_double(this.posZ) - d47 == aint[0][2])
{
@@ -582,42 +541,7 @@
this.setPosition(this.posX, this.posY + (double)aint[1][1], this.posZ);
}
- if (this.riddenByEntity != null)
- {
- this.motionX *= 0.996999979019165D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.996999979019165D;
- }
- else
- {
- if (this.minecartType == 2)
- {
- double d18 = this.pushX * this.pushX + this.pushZ * this.pushZ;
-
- if (d18 > 1.0E-4D)
- {
- d18 = (double)MathHelper.sqrt_double(d18);
- this.pushX /= d18;
- this.pushZ /= d18;
- double d19 = 0.04D;
- this.motionX *= 0.800000011920929D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.800000011920929D;
- this.motionX += this.pushX * d19;
- this.motionZ += this.pushZ * d19;
- }
- else
- {
- this.motionX *= 0.8999999761581421D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.8999999761581421D;
- }
- }
-
- this.motionX *= 0.9599999785423279D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.9599999785423279D;
- }
+ applyDragAndPushForces();
Vec3 vec31 = this.func_70489_a(this.posX, this.posY, this.posZ);
@@ -647,30 +571,14 @@
double d21;
- if (this.minecartType == 2)
- {
- d21 = this.pushX * this.pushX + this.pushZ * this.pushZ;
-
- if (d21 > 1.0E-4D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D)
- {
- d21 = (double)MathHelper.sqrt_double(d21);
- this.pushX /= d21;
- this.pushZ /= d21;
-
- if (this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D)
- {
- this.pushX = 0.0D;
- this.pushZ = 0.0D;
- }
- else
- {
- this.pushX = this.motionX;
- this.pushZ = this.motionZ;
- }
- }
- }
-
- if (flag)
+ updatePushForces();
+
+ if(shouldDoRailFunctions())
+ {
+ ((BlockRail)Block.blocksList[l]).onMinecartPass(worldObj, this, d45, i, d47);
+ }
+
+ if (flag && shouldDoRailFunctions())
{
d21 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
@@ -706,41 +614,7 @@
}
else
{
- if (this.motionX < -d4)
- {
- this.motionX = -d4;
- }
-
- if (this.motionX > d4)
- {
- this.motionX = d4;
- }
-
- if (this.motionZ < -d4)
- {
- this.motionZ = -d4;
- }
-
- if (this.motionZ > d4)
- {
- this.motionZ = d4;
- }
-
- if (this.onGround)
- {
- this.motionX *= 0.5D;
- this.motionY *= 0.5D;
- this.motionZ *= 0.5D;
- }
-
- this.moveEntity(this.motionX, this.motionY, this.motionZ);
-
- if (!this.onGround)
- {
- this.motionX *= 0.949999988079071D;
- this.motionY *= 0.949999988079071D;
- this.motionZ *= 0.949999988079071D;
- }
+ moveMinecartOffRail(d45, i, d47);
}
this.doBlockCollisions();
@@ -767,7 +641,18 @@
}
this.setRotation(this.rotationYaw, this.rotationPitch);
- List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ AxisAlignedBB box = null;
+ if (getCollisionHandler() != null)
+ {
+ box = getCollisionHandler().getMinecartCollisionBox(this);
+ }
+ else
+ {
+ box = boundingBox.expand(0.2D, 0.0D, 0.2D);
+ }
+
+ List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box);
if (list != null && !list.isEmpty())
{
@@ -792,17 +677,8 @@
this.riddenByEntity = null;
}
- if (this.fuel > 0)
- {
- --this.fuel;
- }
-
- if (this.fuel <= 0)
- {
- this.pushX = this.pushZ = 0.0D;
- }
-
- this.setMinecartPowered(this.fuel > 0);
+ updateFuel();
+ MinecraftForge.EVENT_BUS.post(new MinecartUpdateEvent(this, d45, i, d47));
}
}
@@ -826,12 +702,7 @@
}
else
{
- int i1 = this.worldObj.getBlockMetadata(i, j, k);
-
- if (((BlockRail)Block.blocksList[l]).isPowered())
- {
- i1 &= 7;
- }
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
par3 = (double)j;
@@ -877,13 +748,8 @@
if (BlockRail.isRailBlock(l))
{
- int i1 = this.worldObj.getBlockMetadata(i, j, k);
+ int i1 = ((BlockRail)Block.blocksList[l]).getBasicRailMetadata(worldObj, this, i, j, k);
par3 = (double)j;
-
- if (((BlockRail)Block.blocksList[l]).isPowered())
- {
- i1 &= 7;
- }
if (i1 >= 2 && i1 <= 5)
{
@@ -948,13 +814,14 @@
{
par1NBTTagCompound.setInteger("Type", this.minecartType);
- if (this.minecartType == 2)
+ if (isPoweredCart())
{
par1NBTTagCompound.setDouble("PushX", this.pushX);
par1NBTTagCompound.setDouble("PushZ", this.pushZ);
- par1NBTTagCompound.setShort("Fuel", (short)this.fuel);
- }
- else if (this.minecartType == 1)
+ par1NBTTagCompound.setInteger("Fuel", this.fuel);
+ }
+
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = new NBTTagList();
@@ -980,13 +847,21 @@
{
this.minecartType = par1NBTTagCompound.getInteger("Type");
- if (this.minecartType == 2)
+ if (isPoweredCart())
{
this.pushX = par1NBTTagCompound.getDouble("PushX");
this.pushZ = par1NBTTagCompound.getDouble("PushZ");
- this.fuel = par1NBTTagCompound.getShort("Fuel");
- }
- else if (this.minecartType == 1)
+ try
+ {
+ this.fuel = par1NBTTagCompound.getInteger("Fuel");
+ }
+ catch (ClassCastException e)
+ {
+ this.fuel = par1NBTTagCompound.getShort("Fuel");
+ }
+ }
+
+ if (getSizeInventory() > 0)
{
NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items");
this.cargoItems = new ItemStack[this.getSizeInventory()];
@@ -1015,11 +890,17 @@
*/
public void applyEntityCollision(Entity par1Entity)
{
+ MinecraftForge.EVENT_BUS.post(new MinecartCollisionEvent(this, par1Entity));
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, par1Entity);
+ return;
+ }
if (!this.worldObj.isRemote)
{
if (par1Entity != this.riddenByEntity)
{
- if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.minecartType == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null)
+ if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null)
{
par1Entity.mountEntity(this);
}
@@ -1065,7 +946,7 @@
double d7 = par1Entity.motionX + this.motionX;
double d8 = par1Entity.motionZ + this.motionZ;
- if (((EntityMinecart)par1Entity).minecartType == 2 && this.minecartType != 2)
+ if (((EntityMinecart)par1Entity).isPoweredCart() && !isPoweredCart())
{
this.motionX *= 0.20000000298023224D;
this.motionZ *= 0.20000000298023224D;
@@ -1073,7 +954,7 @@
par1Entity.motionX *= 0.949999988079071D;
par1Entity.motionZ *= 0.949999988079071D;
}
- else if (((EntityMinecart)par1Entity).minecartType != 2 && this.minecartType == 2)
+ else if (!((EntityMinecart)par1Entity).isPoweredCart() && isPoweredCart())
{
par1Entity.motionX *= 0.20000000298023224D;
par1Entity.motionZ *= 0.20000000298023224D;
@@ -1108,7 +989,7 @@
*/
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
/**
@@ -1211,7 +1092,12 @@
*/
public boolean interact(EntityPlayer par1EntityPlayer)
{
- if (this.minecartType == 0)
+ if (MinecraftForge.EVENT_BUS.post(new MinecartInteractEvent(this, par1EntityPlayer)))
+ {
+ return true;
+ }
+
+ if (canBeRidden())
{
if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer)
{
@@ -1223,14 +1109,14 @@
par1EntityPlayer.mountEntity(this);
}
}
- else if (this.minecartType == 1)
+ else if (getSizeInventory() > 0)
{
if (!this.worldObj.isRemote)
{
par1EntityPlayer.displayGUIChest(this);
}
}
- else if (this.minecartType == 2)
+ else if (this.minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack itemstack = par1EntityPlayer.inventory.getCurrentItem();
@@ -1354,4 +1240,375 @@
{
return this.dataWatcher.getWatchableObjectInt(18);
}
+
+ /**
+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped().
+ */
+ public void dropCartAsItem()
+ {
+ for(ItemStack item : getItemsDropped())
+ {
+ entityDropItem(item, 0);
+ }
+ }
+
+ /**
+ * Override this to define which items your cart drops when broken.
+ * This does not include items contained in the inventory,
+ * that is handled elsewhere.
+ * @return A list of items dropped.
+ */
+ public List<ItemStack> getItemsDropped()
+ {
+ List<ItemStack> items = new ArrayList<ItemStack>();
+ items.add(new ItemStack(Item.minecartEmpty));
+
+ switch(minecartType)
+ {
+ case 1:
+ items.add(new ItemStack(Block.chest));
+ break;
+ case 2:
+ items.add(new ItemStack(Block.stoneOvenIdle));
+ break;
+ }
+ return items;
+ }
+
+ /**
+ * This function returns an ItemStack that represents this cart.
+ * This should be an ItemStack that can be used by the player to place the cart.
+ * This is the item that was registered with the cart via the registerMinecart function,
+ * but is not necessary the item the cart drops when destroyed.
+ * @return An ItemStack that can be used to place the cart.
+ */
+ public ItemStack getCartItem()
+ {
+ return MinecartRegistry.getItemForCart(this);
+ }
+
+ /**
+ * Returns true if this cart is self propelled.
+ * @return True if powered.
+ */
+ public boolean isPoweredCart()
+ {
+ return minecartType == 2 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart is a storage cart
+ * Some carts may have inventories but not be storage carts
+ * and some carts without inventories may be storage carts.
+ * @return True if this cart should be classified as a storage cart.
+ */
+ public boolean isStorageCart()
+ {
+ return minecartType == 1 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart can be ridden by an Entity.
+ * @return True if this cart can be ridden.
+ */
+ public boolean canBeRidden()
+ {
+ if(minecartType == 0 && getClass() == EntityMinecart.class)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this cart can currently use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @return True if the minecart can use rails.
+ */
+ public boolean canUseRail()
+ {
+ return canUseRail;
+ }
+
+ /**
+ * Set whether the minecart can use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @param use Whether the minecart can currently use rails.
+ */
+ public void setCanUseRail(boolean use)
+ {
+ canUseRail = use;
+ }
+
+ /**
+ * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails.
+ * @return True if this cart should call IRail.onMinecartPass().
+ */
+ public boolean shouldDoRailFunctions()
+ {
+ return true;
+ }
+
+ /**
+ * Simply returns the minecartType variable.
+ * @return minecartType
+ */
+ public int getMinecartType()
+ {
+ return minecartType;
+ }
+
+ /**
+ * Gets the current global Minecart Collision handler if none
+ * is registered, returns null
+ * @return The collision handler or null
+ */
+ public static IMinecartCollisionHandler getCollisionHandler()
+ {
+ return collisionHandler;
+ }
+
+ /**
+ * Sets the global Minecart Collision handler, overwrites any
+ * that is currently set.
+ * @param handler The new handler
+ */
+ public static void setCollisionHandler(IMinecartCollisionHandler handler)
+ {
+ collisionHandler = handler;
+ }
+
+ /**
+ * Carts should return their drag factor here
+ * @return The drag rate.
+ */
+ protected double getDrag()
+ {
+ return riddenByEntity != null ? defaultDragRidden : defaultDragEmpty;
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies drag and updates push forces.
+ */
+ protected void applyDragAndPushForces()
+ {
+ if(isPoweredCart())
+ {
+ double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(d27 > 0.01D)
+ {
+ pushX /= d27;
+ pushZ /= d27;
+ double d29 = 0.04;
+ motionX *= 0.8D;
+ motionY *= 0.0D;
+ motionZ *= 0.8D;
+ motionX += pushX * d29;
+ motionZ += pushZ * d29;
+ }
+ else
+ {
+ motionX *= 0.9D;
+ motionY *= 0.0D;
+ motionZ *= 0.9D;
+ }
+ }
+ motionX *= getDrag();
+ motionY *= 0.0D;
+ motionZ *= getDrag();
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code updates push forces.
+ */
+ protected void updatePushForces()
+ {
+ if(isPoweredCart())
+ {
+ double push = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(push > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
+ {
+ pushX /= push;
+ pushZ /= push;
+ if(pushX * motionX + pushZ * motionZ < 0.0D)
+ {
+ pushX = 0.0D;
+ pushZ = 0.0D;
+ }
+ else
+ {
+ pushX = motionX;
+ pushZ = motionZ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when on a rail.
+ */
+ protected void moveMinecartOnRail(int i, int j, int k)
+ {
+ int id = worldObj.getBlockId(i, j, k);
+ if (!BlockRail.isRailBlock(id))
+ {
+ return;
+ }
+ float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k);
+
+ double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail());
+ double mX = motionX;
+ double mZ = motionZ;
+ if(riddenByEntity != null)
+ {
+ mX *= 0.75D;
+ mZ *= 0.75D;
+ }
+ if(mX < -maxSpeed) mX = -maxSpeed;
+ if(mX > maxSpeed) mX = maxSpeed;
+ if(mZ < -maxSpeed) mZ = -maxSpeed;
+ if(mZ > maxSpeed) mZ = maxSpeed;
+ moveEntity(mX, 0.0D, mZ);
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when not on a rail.
+ */
+ protected void moveMinecartOffRail(int i, int j, int k)
+ {
+ double d2 = getMaxSpeedGround();
+ if(!onGround)
+ {
+ d2 = getMaxSpeedAirLateral();
+ }
+ if(motionX < -d2) motionX = -d2;
+ if(motionX > d2) motionX = d2;
+ if(motionZ < -d2) motionZ = -d2;
+ if(motionZ > d2) motionZ = d2;
+ double moveY = motionY;
+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical())
+ {
+ moveY = getMaxSpeedAirVertical();
+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f)
+ {
+ moveY = 0.15f;
+ motionY = moveY;
+ }
+ }
+ if(onGround)
+ {
+ motionX *= 0.5D;
+ motionY *= 0.5D;
+ motionZ *= 0.5D;
+ }
+ moveEntity(motionX, moveY, motionZ);
+ if(!onGround)
+ {
+ motionX *= getDragAir();
+ motionY *= getDragAir();
+ motionZ *= getDragAir();
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies fuel consumption.
+ */
+ protected void updateFuel()
+ {
+ if (fuel > 0) fuel--;
+ if (fuel <= 0) pushX = pushZ = 0.0D;
+ setMinecartPowered(fuel > 0);
+ }
+
+ /**
+ * Moved to allow overrides, This code handle slopes affecting velocity.
+ * @param metadata The blocks position metadata
+ */
+ protected void adjustSlopeVelocities(int metadata)
+ {
+ double acceleration = 0.0078125D;
+ if (metadata == 2)
+ {
+ motionX -= acceleration;
+ }
+ else if (metadata == 3)
+ {
+ motionX += acceleration;
+ }
+ else if (metadata == 4)
+ {
+ motionZ += acceleration;
+ }
+ else if (metadata == 5)
+ {
+ motionZ -= acceleration;
+ }
+ }
+
+ /**
+ * Getters/setters for physics variables
+ */
+
+ /**
+ * Returns the carts max speed.
+ * Carts going faster than 1.1 cause issues with chunk loading.
+ * Carts cant traverse slopes or corners at greater than 0.5 - 0.6.
+ * This value is compared with the rails max speed to determine
+ * the carts current max speed. A normal rails max speed is 0.4.
+ * @return Carts max speed.
+ */
+ public float getMaxSpeedRail()
+ {
+ return maxSpeedRail;
+ }
+
+ public void setMaxSpeedRail(float value)
+ {
+ maxSpeedRail = value;
+ }
+
+ public float getMaxSpeedGround()
+ {
+ return maxSpeedGround;
+ }
+
+ public void setMaxSpeedGround(float value)
+ {
+ maxSpeedGround = value;
+ }
+
+ public float getMaxSpeedAirLateral()
+ {
+ return maxSpeedAirLateral;
+ }
+
+ public void setMaxSpeedAirLateral(float value)
+ {
+ maxSpeedAirLateral = value;
+ }
+
+ public float getMaxSpeedAirVertical()
+ {
+ return maxSpeedAirVertical;
+ }
+
+ public void setMaxSpeedAirVertical(float value)
+ {
+ maxSpeedAirVertical = value;
+ }
+
+ public double getDragAir()
+ {
+ return dragAir;
+ }
+
+ public void setDragAir(double value)
+ {
+ dragAir = value;
+ }
}

View file

@ -45,10 +45,10 @@
+ return super.interact(par1EntityPlayer);
}
/**
@@ -78,4 +58,29 @@
public EntityMooshroom func_94900_c(EntityAgeable par1EntityAgeable)
@@ -83,4 +63,29 @@
{
return this.spawnBabyAnimal(par1EntityAgeable);
return this.func_94900_c(par1EntityAgeable);
}
+
+ @Override

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/entity/player/EntityPlayer.java
+++ ../src_work/minecraft/net/minecraft/entity/player/EntityPlayer.java
@@ -55,8 +55,21 @@
@@ -57,8 +57,21 @@
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
@ -22,7 +22,7 @@
/** Inventory of the player */
public InventoryPlayer inventory = new InventoryPlayer(this);
private InventoryEnderChest theInventoryEnderChest = new InventoryEnderChest();
@@ -259,6 +272,7 @@
@@ -261,6 +274,7 @@
if (itemstack == this.itemInUse)
{
@ -30,7 +30,7 @@
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
{
this.updateItemUse(itemstack, 5);
@@ -497,11 +511,11 @@
@@ -499,11 +513,11 @@
this.cameraYaw = 0.0F;
this.addMountedMovementStat(this.posX - d0, this.posY - d1, this.posZ - d2);
@ -44,7 +44,7 @@
}
}
@@ -630,6 +644,9 @@
@@ -632,6 +646,9 @@
this.setPosition(this.posX, this.posY, this.posZ);
this.motionY = 0.10000000149011612D;
@ -54,7 +54,7 @@
if (this.username.equals("Notch"))
{
this.dropPlayerItemWithRandomChoice(new ItemStack(Item.appleRed, 1), true);
@@ -638,6 +655,20 @@
@@ -640,6 +657,20 @@
if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
{
this.inventory.dropAllItems();
@ -75,7 +75,7 @@
}
if (par1DamageSource != null)
@@ -677,7 +708,20 @@
@@ -679,7 +710,20 @@
*/
public EntityItem dropOneItem(boolean par1)
{
@ -97,7 +97,7 @@
}
/**
@@ -686,7 +730,7 @@
@@ -688,7 +732,7 @@
*/
public EntityItem dropPlayerItem(ItemStack par1ItemStack)
{
@ -106,7 +106,7 @@
}
/**
@@ -738,23 +782,39 @@
@@ -740,23 +784,39 @@
*/
public void joinEntityItemWithWorld(EntityItem par1EntityItem)
{
@ -151,7 +151,7 @@
{
f += f1 * 0.08F;
}
@@ -784,7 +844,8 @@
@@ -786,7 +846,8 @@
f /= 5.0F;
}
@ -161,7 +161,7 @@
}
/**
@@ -792,7 +853,7 @@
@@ -794,7 +855,7 @@
*/
public boolean canHarvestBlock(Block par1Block)
{
@ -170,7 +170,7 @@
}
/**
@@ -1079,12 +1140,22 @@
@@ -1083,12 +1144,22 @@
{
if (!this.isEntityInvulnerable())
{
@ -193,8 +193,8 @@
+ }
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.addExhaustion(par1DamageSource.getHungerDamage());
this.health -= par2;
@@ -1125,6 +1196,10 @@
int j = this.getHealth();
@@ -1131,6 +1202,10 @@
public boolean interactWith(Entity par1Entity)
{
@ -205,7 +205,7 @@
if (par1Entity.interact(this))
{
return true;
@@ -1168,7 +1243,9 @@
@@ -1174,7 +1249,9 @@
*/
public void destroyCurrentEquippedItem()
{
@ -215,7 +215,7 @@
}
/**
@@ -1185,6 +1262,15 @@
@@ -1191,6 +1268,15 @@
*/
public void attackTargetEntityWithCurrentItem(Entity par1Entity)
{
@ -231,7 +231,7 @@
if (par1Entity.canAttackWithItem())
{
if (!par1Entity.func_85031_j(this))
@@ -1348,6 +1434,12 @@
@@ -1354,6 +1440,12 @@
*/
public EnumStatus sleepInBedAt(int par1, int par2, int par3)
{
@ -244,7 +244,7 @@
if (!this.worldObj.isRemote)
{
if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1387,6 +1479,11 @@
@@ -1393,6 +1485,11 @@
{
int l = this.worldObj.getBlockMetadata(par1, par2, par3);
int i1 = BlockBed.getDirection(l);
@ -256,7 +256,7 @@
float f = 0.5F;
float f1 = 0.5F;
@@ -1457,10 +1554,12 @@
@@ -1463,10 +1560,12 @@
ChunkCoordinates chunkcoordinates = this.playerLocation;
ChunkCoordinates chunkcoordinates1 = this.playerLocation;
@ -273,7 +273,7 @@
if (chunkcoordinates1 == null)
{
@@ -1497,7 +1596,9 @@
@@ -1503,7 +1602,9 @@
*/
private boolean isInBed()
{
@ -284,7 +284,7 @@
}
/**
@@ -1512,9 +1613,12 @@
@@ -1518,9 +1619,12 @@
ichunkprovider.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
ichunkprovider.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
@ -300,7 +300,7 @@
return chunkcoordinates1;
}
else
@@ -1536,10 +1640,13 @@
@@ -1542,10 +1646,13 @@
{
if (this.playerLocation != null)
{
@ -318,24 +318,24 @@
{
case 0:
return 90.0F;
@@ -1846,7 +1953,7 @@
@@ -1852,7 +1959,7 @@
{
if (par1ItemStack.getItem().requiresMultipleRenderPasses())
{
- return par1ItemStack.getItem().getIconFromDamageForRenderPass(par1ItemStack.getItemDamage(), par2);
+ return par1ItemStack.getItem().getIconIndex(par1ItemStack, par2);
+ return par1ItemStack.getItem().getIcon(par1ItemStack, par2);
}
if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID)
@@ -1868,6 +1975,7 @@
return 101;
@@ -1874,6 +1981,7 @@
return Item.bow.func_94599_c(0);
}
}
+ j = par1ItemStack.getItem().getIconIndex(par1ItemStack, par2, this, itemInUse, itemInUseCount);
+ icon = par1ItemStack.getItem().getIcon(par1ItemStack, par2, this, itemInUse, itemInUseCount);
}
return j;
@@ -2088,6 +2196,14 @@
return icon;
@@ -2105,6 +2213,14 @@
}
this.theInventoryEnderChest = par1EntityPlayer.theInventoryEnderChest;

View file

@ -8,7 +8,7 @@
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerBeacon;
@@ -74,6 +75,11 @@
@@ -76,6 +77,11 @@
import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk;
@ -20,7 +20,7 @@
public class EntityPlayerMP extends EntityPlayer implements ICrafting
{
private StringTranslate translator = new StringTranslate("en_US");
@@ -145,18 +151,10 @@
@@ -147,18 +153,10 @@
par4ItemInWorldManager.thisPlayerMP = this;
this.theItemInWorldManager = par4ItemInWorldManager;
this.renderDistance = par1MinecraftServer.getConfigurationManager().getViewDistance();
@ -40,7 +40,7 @@
this.setLocationAndAngles((double)i + 0.5D, (double)k, (double)j + 0.5D, 0.0F, 0.0F);
this.mcServer = par1MinecraftServer;
@@ -253,7 +251,10 @@
@@ -255,7 +253,10 @@
if (chunkcoordintpair != null && this.worldObj.blockExists(chunkcoordintpair.chunkXPos << 4, 0, chunkcoordintpair.chunkZPos << 4))
{
arraylist.add(this.worldObj.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos));
@ -52,7 +52,7 @@
}
}
@@ -274,6 +275,7 @@
@@ -276,6 +277,7 @@
{
Chunk chunk = (Chunk)iterator2.next();
this.getServerForPlayer().getEntityTracker().func_85172_a(this, chunk);
@ -60,7 +60,7 @@
}
}
}
@@ -318,11 +320,29 @@
@@ -320,11 +322,29 @@
*/
public void onDeath(DamageSource par1DamageSource)
{
@ -69,7 +69,7 @@
+ return;
+ }
+
this.mcServer.getConfigurationManager().func_92027_k(par1DamageSource.getDeathMessage(this));
this.mcServer.getConfigurationManager().sendChatMsg(this.field_94063_bt.func_94546_b());
if (!this.worldObj.getGameRules().getGameRuleBooleanValue("keepInventory"))
{

View file

@ -1,25 +1,25 @@
--- ../src_base/minecraft/net/minecraft/inventory/Slot.java
+++ ../src_work/minecraft/net/minecraft/inventory/Slot.java
@@ -21,6 +21,12 @@
@@ -22,6 +22,12 @@
/** display position of the inventory slot on the screen y axis */
public int yDisplayPosition;
+
+ /** Position within background texture file, normally -1 which causes no background to be drawn. */
+ protected int backgroundIconIndex = -1;
+ protected Icon backgroundIcon = null;
+
+ /** Background texture file assigned to this slot, if any. Vanilla "/gui/items.png" is used if this is null. */
+ protected String texture = "/gui/items.png";
public Slot(IInventory par1IInventory, int par2, int par3, int par4)
{
@@ -147,6 +153,44 @@
@@ -148,6 +154,45 @@
*/
public int getBackgroundIconIndex()
public Icon getBackgroundIconIndex()
{
- return -1;
+ return backgroundIconIndex;
+ }
- return null;
+ return backgroundIcon;
}
+
+ /**
+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI.
@ -32,11 +32,11 @@
+
+ /**
+ * Sets which icon index to use as the background image of the slot when it's empty.
+ * @param iconIndex int: The index into the texture file, 0-255, or -1 for no background.
+ * @param icon The icon to use, null for none
+ */
+ public void setBackgroundIconIndex(int iconIndex)
+ public void setBackgroundIconIndex(Icon icon)
+ {
+ backgroundIconIndex = iconIndex;
+ backgroundIcon = icon;
+ }
+
+ /**
@ -57,5 +57,6 @@
+ public int getSlotIndex()
+ {
+ return slotIndex;
}
+ }
+
}

View file

@ -17,14 +17,14 @@
{
- ItemStack itemstack2 = new ItemStack(itemstack1.getItem().getContainerItem());
+ ItemStack itemstack2 = itemstack1.getItem().getContainerItemStack(itemstack1);
+
- if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))
+ if (itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage())
+ {
+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(thePlayer, itemstack2));
+ itemstack2 = null;
+ }
- if (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2))
+
+ if (itemstack2 != null && (!itemstack1.getItem().doesContainerItemLeaveCraftingGrid(itemstack1) || !this.thePlayer.inventory.addItemStackToInventory(itemstack2)))
{
if (this.craftMatrix.getStackInSlot(i) == null)

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/item/Item.java
+++ ../src_work/minecraft/net/minecraft/item/Item.java
@@ -13,6 +13,7 @@
@@ -14,6 +14,7 @@
import net.minecraft.entity.item.EntityItemFrame;
import net.minecraft.entity.item.EntityPainting;
import net.minecraft.entity.player.EntityPlayer;
@ -8,7 +8,7 @@
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionHelper;
import net.minecraft.stats.StatList;
@@ -21,7 +22,9 @@
@@ -23,7 +24,9 @@
import net.minecraft.util.StatCollector;
import net.minecraft.util.StringTranslate;
import net.minecraft.util.Vec3;
@ -18,9 +18,9 @@
public class Item
{
@@ -230,18 +233,26 @@
/** full name of item from language file */
private String itemName;
@@ -237,13 +240,16 @@
/** Icon index in the icons table. */
protected Icon iconIndex;
+ /** FORGE: To disable repair recipes. */
+ protected boolean canRepair = true;
@ -36,17 +36,7 @@
}
itemsList[256 + par1] = this;
GameData.newItemAdded(this);
+
+ if (!(this instanceof ItemBlock))
+ {
+ isDefaultTexture = "/gui/items.png".equals(getTextureFile());
+ }
}
/**
@@ -627,6 +638,10 @@
@@ -621,6 +627,10 @@
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = 5.0D;
@ -57,15 +47,12 @@
Vec3 vec31 = vec3.addVector((double)f7 * d3, (double)f6 * d3, (double)f8 * d3);
return par1World.rayTraceBlocks_do_do(vec3, vec31, par3, !par3);
}
@@ -701,4 +716,304 @@
@@ -701,4 +711,266 @@
{
StatList.initStats();
}
+
+ /* =========================================================== FORGE START ===============================================================*/
+ public boolean isDefaultTexture = true;
+ private String currentTexture = "/gui/items.png";
+
+ /**
+ * Called when a player drops the item into the world,
+ * returning false from this will prevent the item from
@ -179,19 +166,9 @@
+ * @param useRemaining The ticks remaining for the active item.
+ * @return The icon index
+ */
+ public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
+ public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
+ {
+ /*
+ * Here is an example usage for Vanilla bows.
+ if (usingItem != null && usingItem.getItem().shiftedIndex == Item.bow.shiftedIndex)
+ {
+ int k = usingItem.getMaxItemUseDuration() - useRemaining;
+ if (k >= 18) return 133;
+ if (k > 13) return 117;
+ if (k > 0) return 101;
+ }
+ */
+ return getIconIndex(stack);
+ return getIcon(stack, renderPass);
+ }
+
+ /**
@ -208,31 +185,6 @@
+ }
+
+ /**
+ * Grabs the current texture file used for this block
+ */
+ public String getTextureFile()
+ {
+ if (this instanceof ItemBlock)
+ {
+ return Block.blocksList[((ItemBlock)this).getBlockID()].getTextureFile();
+ }
+ return currentTexture;
+ }
+
+ /**
+ * Sets the current texture file for this item, used when rendering.
+ * Default is "/gui/items.png"
+ *
+ * @param texture The texture file
+ */
+ public Item setTextureFile(String texture)
+ {
+ currentTexture = texture;
+ isDefaultTexture = false;
+ return this;
+ }
+
+ /**
+ * ItemStack sensitive version of getContainerItem.
+ * Returns a full ItemStack instance of the result.
+ *
@ -320,9 +272,9 @@
+ * Defers to {@link #getIconFromDamageForRenderPass(int, int)}
+ * @param stack to render for
+ * @param pass the multi-render pass
+ * @return the icon index
+ * @return the icon
+ */
+ public int getIconIndex(ItemStack stack, int pass)
+ public Icon getIcon(ItemStack stack, int pass)
+ {
+ return getIconFromDamageForRenderPass(stack.getItemDamage(), pass);
+ }
@ -340,7 +292,7 @@
+ {
+ if (this instanceof ItemEnchantedBook)
+ {
+ return ((ItemEnchantedBook)this).func_92058_a(rnd,
+ return ((ItemEnchantedBook)this).func_92112_a(rnd,
+ original.theMinimumChanceToGenerateItem,
+ original.theMaximumChanceToGenerateItem, original.itemWeight);
+ }

View file

@ -1,14 +1,6 @@
--- ../src_base/minecraft/net/minecraft/item/ItemBlock.java
+++ ../src_work/minecraft/net/minecraft/item/ItemBlock.java
@@ -19,6 +19,7 @@
super(par1);
this.blockID = par1 + 256;
this.setIconIndex(Block.blocksList[par1 + 256].getBlockTextureFromSide(2));
+ isDefaultTexture = Block.blocksList[par1 + 256].isDefaultTexture;
}
/**
@@ -41,7 +42,8 @@
@@ -60,7 +60,8 @@
{
par7 = 1;
}
@ -18,15 +10,15 @@
{
if (par7 == 0)
{
@@ -92,14 +94,8 @@
@@ -111,14 +112,8 @@
int j1 = this.getMetadata(par1ItemStack.getItemDamage());
int k1 = Block.blocksList[this.blockID].onBlockPlaced(par3World, par4, par5, par6, par7, par8, par9, par10, j1);
- if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, this.blockID, k1))
- if (par3World.setBlockAndMetadataWithNotify(par4, par5, par6, this.blockID, k1, 3))
- {
- if (par3World.getBlockId(par4, par5, par6) == this.blockID)
- {
- Block.blocksList[this.blockID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer);
- Block.blocksList[this.blockID].onBlockPlacedBy(par3World, par4, par5, par6, par2EntityPlayer, par1ItemStack);
- Block.blocksList[this.blockID].onPostBlockPlaced(par3World, par4, par5, par6, k1);
- }
-
@ -35,7 +27,7 @@
par3World.playSoundEffect((double)((float)par4 + 0.5F), (double)((float)par5 + 0.5F), (double)((float)par6 + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F);
--par1ItemStack.stackSize;
}
@@ -125,7 +121,8 @@
@@ -144,7 +139,8 @@
{
par5 = 1;
}
@ -45,9 +37,9 @@
{
if (par5 == 0)
{
@@ -190,4 +187,28 @@
{
Block.blocksList[this.blockID].getSubBlocks(par1, par2CreativeTabs, par3List);
@@ -220,4 +216,28 @@
this.field_94588_b = par1IconRegister.func_94245_a(s);
}
}
+
+ /**
@ -60,14 +52,14 @@
+ */
+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
+ {
+ if (!world.setBlockAndMetadataWithNotify(x, y, z, this.blockID, metadata))
+ if (!world.setBlockAndMetadataWithNotify(x, y, z, this.blockID, metadata, 3))
+ {
+ return false;
+ return false;
+ }
+
+ if (world.getBlockId(x, y, z) == this.blockID)
+ {
+ Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player);
+ Block.blocksList[this.blockID].onBlockPlacedBy(world, x, y, z, player, stack);
+ Block.blocksList[this.blockID].onPostBlockPlaced(world, x, y, z, metadata);
+ }
+

View file

@ -1,8 +1,8 @@
--- ../src_base/minecraft/net/minecraft/item/ItemBow.java
+++ ../src_work/minecraft/net/minecraft/item/ItemBow.java
@@ -6,6 +6,10 @@
import net.minecraft.entity.player.EntityPlayer;
@@ -10,6 +10,10 @@
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
+
+import net.minecraftforge.common.MinecraftForge;
@ -11,7 +11,7 @@
public class ItemBow extends Item
{
@@ -22,11 +26,20 @@
@@ -30,11 +34,20 @@
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
@ -33,7 +33,7 @@
float f = (float)j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
@@ -111,6 +124,13 @@
@@ -119,6 +132,13 @@
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/item/ItemDye.java
+++ ../src_work/minecraft/net/minecraft/item/ItemDye.java
@@ -18,6 +18,11 @@
@@ -20,6 +20,11 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
@ -12,7 +12,7 @@
public class ItemDye extends Item
{
/** List of dye color names */
@@ -68,6 +73,21 @@
@@ -73,6 +78,21 @@
if (par1ItemStack.getItemDamage() == 15)
{
i1 = par3World.getBlockId(par4, par5, par6);
@ -34,8 +34,8 @@
if (i1 == Block.sapling.blockID)
{
@@ -167,16 +187,9 @@
par3World.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
@@ -172,16 +192,9 @@
par3World.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1, 3);
}
}
- else if (itemRand.nextInt(3) != 0)
@ -43,12 +43,12 @@
{
- if (Block.plantYellow.canBlockStay(par3World, k1, l1, i2))
- {
- par3World.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
- par3World.func_94575_c(k1, l1, i2, Block.plantYellow.blockID);
- }
- }
- else if (Block.plantRed.canBlockStay(par3World, k1, l1, i2))
- {
- par3World.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
- par3World.func_94575_c(k1, l1, i2, Block.plantRed.blockID);
+ ForgeHooks.plantGrass(par3World, k1, l1, i2);
}
}

View file

@ -77,7 +77,7 @@
block.onBlockHarvested(this.theWorld, par1, par2, par3, l, this.thisPlayerMP);
}
- boolean flag = this.theWorld.setBlockWithNotify(par1, par2, par3, 0);
- boolean flag = this.theWorld.func_94571_i(par1, par2, par3);
+ boolean flag = (block != null && block.removeBlockByPlayer(theWorld, thisPlayerMP, par1, par2, par3));
if (block != null && flag)

View file

@ -26,7 +26,7 @@
- if (i1 == this.soilBlockID && par3World.isAirBlock(par4, par5 + 1, par6))
+ if (soil != null && soil.canSustainPlant(par3World, par4, par5, par6, ForgeDirection.UP, this) && par3World.isAirBlock(par4, par5 + 1, par6))
{
par3World.setBlockWithNotify(par4, par5 + 1, par6, this.blockType);
par3World.func_94575_c(par4, par5 + 1, par6, this.blockType);
--par1ItemStack.stackSize;
@@ -52,4 +58,22 @@
return false;

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/item/crafting/CraftingManager.java
+++ ../src_work/minecraft/net/minecraft/item/crafting/CraftingManager.java
@@ -269,7 +269,7 @@
@@ -279,7 +279,7 @@
}
}

View file

@ -18,7 +18,7 @@
/**
* Used to call methods addSmelting and getSmeltingResult.
@@ -54,7 +58,9 @@
@@ -56,7 +60,9 @@
/**
* Returns the smelting result of an item.
@ -28,7 +28,7 @@
public ItemStack getSmeltingResult(int par1)
{
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
@@ -65,8 +71,63 @@
@@ -67,8 +73,63 @@
return this.smeltingList;
}

View file

@ -2,7 +2,7 @@
+++ ../src_work/minecraft/net/minecraft/item/crafting/RecipeFireworks.java
@@ -91,9 +91,9 @@
{
this.field_92050_a = new ItemStack(Item.field_92052_bU);
this.field_92102_a = new ItemStack(Item.firework);
+ nbttagcompound = new NBTTagCompound();
if (l > 0)
@ -15,12 +15,12 @@
nbttagcompound1.setTag("Explosions", nbttaglist);
nbttagcompound1.setByte("Flight", (byte)j);
nbttagcompound.setTag("Fireworks", nbttagcompound1);
- this.field_92050_a.setTagCompound(nbttagcompound);
- this.field_92102_a.setTagCompound(nbttagcompound);
- }
-
+ }
+
+ this.field_92050_a.setTagCompound(nbttagcompound);
+ this.field_92102_a.setTagCompound(nbttagcompound);
return true;
}
else if (j == 1 && i == 0 && l == 0 && k > 0 && j1 <= 1)

View file

@ -10,7 +10,7 @@
import java.util.zip.Inflater;
@@ -26,6 +27,9 @@
private int dataLength;
private boolean field_92024_h;
private boolean field_92076_h;
private static byte[] chunkDataNotCompressed = new byte[0];
+ private int maxLen = 0;
+
@ -83,4 +83,4 @@
+
par1DataOutputStream.writeShort(this.chunkPostX.length);
par1DataOutputStream.writeInt(this.dataLength);
par1DataOutputStream.writeBoolean(this.field_92024_h);
par1DataOutputStream.writeBoolean(this.field_92076_h);

View file

@ -29,7 +29,7 @@
private KeyPair serverKeyPair;
/** Username of the server owner (for integrated servers) */
@@ -238,8 +244,6 @@
@@ -239,8 +245,6 @@
{
this.convertMapIfNeeded(par1Str);
this.setUserMessage("menu.loadingLevel");
@ -38,7 +38,7 @@
ISaveHandler isavehandler = this.anvilConverterForAnvilFile.getSaveLoader(par1Str, true);
WorldInfo worldinfo = isavehandler.loadWorldInfo();
WorldSettings worldsettings;
@@ -259,46 +263,23 @@
@@ -260,46 +264,23 @@
worldsettings.enableBonusChest();
}
@ -96,7 +96,7 @@
this.setDifficultyForAllWorlds(this.getDifficulty());
this.initialWorldChunkLoad();
}
@@ -427,7 +408,14 @@
@@ -428,7 +409,14 @@
for (int i = 0; i < this.worldServers.length; ++i)
{
WorldServer worldserver = this.worldServers[i];
@ -111,7 +111,7 @@
}
if (this.usageSnooper != null && this.usageSnooper.isSnooperRunning())
@@ -651,13 +639,15 @@
@@ -652,13 +640,15 @@
this.theProfiler.startSection("levels");
int i;
@ -132,7 +132,7 @@
this.theProfiler.startSection(worldserver.getWorldInfo().getWorldName());
this.theProfiler.startSection("pools");
worldserver.getWorldVec3Pool().clear();
@@ -704,9 +694,11 @@
@@ -705,9 +695,11 @@
this.theProfiler.endSection();
}
@ -147,7 +147,7 @@
this.theProfiler.endStartSection("connection");
this.getNetworkThread().networkTick();
this.theProfiler.endStartSection("players");
@@ -760,7 +752,13 @@
@@ -761,7 +753,13 @@
*/
public WorldServer worldServerForDimension(int par1)
{
@ -162,7 +162,7 @@
}
@SideOnly(Side.SERVER)
@@ -1131,6 +1129,7 @@
@@ -1132,6 +1130,7 @@
if (worldserver != null)
{

View file

@ -25,8 +25,8 @@
+ int j = 0;
+ for (Integer id : DimensionManager.getIDs())
{
- this.displayStrings[5 + j] = "Lvl " + j + " tick: " + field_79020_a.format(this.func_79015_a(this.field_79017_e.timeOfLastDimensionTick[j]) * 1.0E-6D) + " ms";
+ this.displayStrings[5 + j] = "Lvl " + id + " tick: " + field_79020_a.format(this.func_79015_a(this.field_79017_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms";
- this.displayStrings[5 + j] = "Lvl " + j + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.timeOfLastDimensionTick[j]) * 1.0E-6D) + " ms";
+ this.displayStrings[5 + j] = "Lvl " + id + " tick: " + field_79020_a.format(this.calcArrayAverage(this.field_79017_e.worldTickTimes.get(id)) * 1.0E-6D) + " ms";
- if (this.field_79017_e.worldServers[j] != null && this.field_79017_e.worldServers[j].theChunkProviderServer != null)
+ WorldServer world = DimensionManager.getWorld(id);

View file

@ -40,7 +40,7 @@
entityplayermp1.entityId = par1EntityPlayerMP.entityId;
WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
this.func_72381_a(entityplayermp1, par1EntityPlayerMP, worldserver);
@@ -388,14 +403,20 @@
@@ -388,6 +403,11 @@
public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2)
{
@ -52,17 +52,16 @@
int j = par1EntityPlayerMP.dimension;
WorldServer worldserver = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
par1EntityPlayerMP.dimension = par2;
WorldServer worldserver1 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
+
@@ -395,7 +415,7 @@
par1EntityPlayerMP.playerNetServerHandler.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, worldserver1.getWorldInfo().getTerrainType(), worldserver1.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
worldserver.removeEntity(par1EntityPlayerMP);
worldserver.removePlayerEntityDangerously(par1EntityPlayerMP);
par1EntityPlayerMP.isDead = false;
- this.transferEntityToWorld(par1EntityPlayerMP, j, worldserver, worldserver1);
+ this.transferEntityToWorld(par1EntityPlayerMP, j, worldserver, worldserver1, teleporter);
this.func_72375_a(par1EntityPlayerMP, worldserver);
par1EntityPlayerMP.playerNetServerHandler.setPlayerLocation(par1EntityPlayerMP.posX, par1EntityPlayerMP.posY, par1EntityPlayerMP.posZ, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
par1EntityPlayerMP.theItemInWorldManager.setWorld(worldserver1);
@@ -417,38 +438,23 @@
@@ -417,38 +437,23 @@
*/
public void transferEntityToWorld(Entity par1Entity, int par2, WorldServer par3WorldServer, WorldServer par4WorldServer)
{
@ -112,7 +111,7 @@
{
ChunkCoordinates chunkcoordinates;
@@ -485,7 +491,7 @@
@@ -485,7 +490,7 @@
par4WorldServer.spawnEntityInWorld(par1Entity);
par1Entity.setLocationAndAngles(d0, par1Entity.posY, d1, par1Entity.rotationYaw, par1Entity.rotationPitch);
par4WorldServer.updateEntityWithOptionalForce(par1Entity, false);

View file

@ -10,9 +10,9 @@
import net.minecraft.world.World;
public class TileEntity
@@ -296,4 +298,52 @@
addMapping(TileEntityBeacon.class, "Beacon");
addMapping(TileEntitySkull.class, "Skull");
@@ -300,4 +302,52 @@
addMapping(TileEntityDaylightDetector.class, "DLDetector");
addMapping(TileEntityHopper.class, "Hopper");
}
+
+ /**

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/tileentity/TileEntityBeacon.java
+++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityBeacon.java
@@ -114,8 +114,9 @@
@@ -116,8 +116,9 @@
for (int l = this.zCoord - i; l <= this.zCoord + i; ++l)
{
int i1 = this.worldObj.getBlockId(k, j, l);

View file

@ -1,18 +1,6 @@
--- ../src_base/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java
+++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityBrewingStand.java
@@ -12,7 +12,10 @@
import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.PotionHelper;
-public class TileEntityBrewingStand extends TileEntity implements IInventory
+import net.minecraftforge.common.ISidedInventory;
+import net.minecraftforge.common.ForgeDirection;
+
+public class TileEntityBrewingStand extends TileEntity implements IInventory, ISidedInventory
{
/** The itemstacks currently placed in the slots of the brewing stand */
private ItemStack[] brewingItemStacks = new ItemStack[4];
@@ -166,7 +169,7 @@
@@ -177,7 +177,7 @@
if (Item.itemsList[itemstack.itemID].hasContainerItem())
{
@ -21,20 +9,3 @@
}
else
{
@@ -333,4 +336,16 @@
return i;
}
+
+ @Override
+ public int getStartInventorySide(ForgeDirection side)
+ {
+ return (side == ForgeDirection.UP ? 3 : 0);
+ }
+
+ @Override
+ public int getSizeInventorySide(ForgeDirection side)
+ {
+ return (side == ForgeDirection.UP ? 1 : 3);
+ }
}

View file

@ -2,7 +2,7 @@
+++ ../src_work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
@@ -9,6 +9,7 @@
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ContainerWorldly;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemHoe;
@ -12,15 +12,15 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
-public class TileEntityFurnace extends TileEntity implements IInventory
-public class TileEntityFurnace extends TileEntity implements ContainerWorldly
+import net.minecraftforge.common.ForgeDirection;
+import net.minecraftforge.common.ISidedInventory;
+
+public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory
+public class TileEntityFurnace extends TileEntity implements ContainerWorldly, ISidedInventory
{
/**
* The ItemStacks that hold the items currently being used in the furnace
@@ -247,8 +251,7 @@
@@ -268,8 +272,7 @@
if (this.furnaceItemStacks[1].stackSize == 0)
{
@ -30,7 +30,7 @@
}
}
}
@@ -294,8 +297,12 @@
@@ -315,8 +318,12 @@
}
else
{
@ -45,7 +45,7 @@
}
}
@@ -306,15 +313,15 @@
@@ -327,15 +334,15 @@
{
if (this.canSmelt())
{
@ -65,7 +65,7 @@
}
--this.furnaceItemStacks[0].stackSize;
@@ -341,7 +348,7 @@
@@ -362,7 +369,7 @@
int i = par0ItemStack.getItem().itemID;
Item item = par0ItemStack.getItem();
@ -74,10 +74,33 @@
{
Block block = Block.blocksList[i];
@@ -387,4 +394,18 @@
public void openChest() {}
public void closeChest() {}
@@ -423,4 +430,41 @@
{
return 1;
}
+
+ /***********************************************************************************
+ * This function is here for compatibilities sake, Modders should Check for
+ * Sided before ContainerWorldly, Vanilla Minecraft does not follow the sided standard
+ * that Modding has for a while.
+ *
+ * In vanilla:
+ *
+ * Top: Ores
+ * Sides: Fuel
+ * Bottom: Output
+ *
+ * Standard Modding:
+ * Top: Ores
+ * Sides: Output
+ * Bottom: Fuel
+ *
+ * The Modding one is designed after the GUI, the vanilla one is designed because its
+ * intended use is for the hopper, which logically would take things in from the top.
+ *
+ * This will possibly be removed in future updates, and make vanilla the definitive
+ * standard.
+ */
+
+ @Override
+ public int getStartInventorySide(ForgeDirection side)

View file

@ -1,59 +1,41 @@
--- ../src_base/minecraft/net/minecraft/util/WeightedRandomChestContent.java
+++ ../src_work/minecraft/net/minecraft/util/WeightedRandomChestContent.java
@@ -1,9 +1,13 @@
package net.minecraft.util;
import java.util.Random;
+
+import cpw.mods.fml.common.FMLLog;
@@ -4,6 +4,9 @@
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityDispenser;
+import net.minecraftforge.common.ChestGenHooks;
+import net.minecraftforge.common.DungeonHooks;
+import cpw.mods.fml.common.FMLLog;
public class WeightedRandomChestContent extends WeightedRandomItem
{
@@ -35,27 +39,26 @@
/**
* Generates the Chest contents.
*/
+ @SuppressWarnings("deprecation")
public static void generateChestContents(Random par0Random, WeightedRandomChestContent[] par1ArrayOfWeightedRandomChestContent, TileEntityChest par2TileEntityChest, int par3)
{
for (int j = 0; j < par3; ++j)
{
@@ -42,20 +45,11 @@
WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent);
- int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + par0Random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1);
int k = weightedrandomchestcontent.theMinimumChanceToGenerateItem + par0Random.nextInt(weightedrandomchestcontent.theMaximumChanceToGenerateItem - weightedrandomchestcontent.theMinimumChanceToGenerateItem + 1);
- if (weightedrandomchestcontent.theItemId.getMaxStackSize() >= k)
+ if (weightedrandomchestcontent instanceof DungeonHooks.DungeonLoot)
{
- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy();
- itemstack.stackSize = k;
- par2TileEntityChest.setInventorySlotContents(par0Random.nextInt(par2TileEntityChest.getSizeInventory()), itemstack);
+ DungeonHooks.DungeonLoot loot = (DungeonHooks.DungeonLoot)weightedrandomchestcontent;
+ par2TileEntityChest.setInventorySlotContents(par0Random.nextInt(par2TileEntityChest.getSizeInventory()), loot.generateStack(par0Random));
+ FMLLog.warning("Some mod is still using DungeonHooks.DungonLoot, tell them to stop! %s", loot);
+ continue;
}
- else
+
+ ItemStack[] stacks = ChestGenHooks.generateStacks(par0Random, weightedrandomchestcontent.theItemId, weightedrandomchestcontent.theMinimumChanceToGenerateItem, weightedrandomchestcontent.theMaximumChanceToGenerateItem);
+
+ for (ItemStack item : stacks)
{
- ItemStack itemstack = weightedrandomchestcontent.theItemId.copy();
- itemstack.stackSize = k;
- par2IInventory.setInventorySlotContents(par0Random.nextInt(par2IInventory.getSizeInventory()), itemstack);
- }
- else
- {
- for (int l = 0; l < k; ++l)
- {
- ItemStack itemstack1 = weightedrandomchestcontent.theItemId.copy();
- itemstack1.stackSize = 1;
- par2TileEntityChest.setInventorySlotContents(par0Random.nextInt(par2TileEntityChest.getSizeInventory()), itemstack1);
- par2IInventory.setInventorySlotContents(par0Random.nextInt(par2IInventory.getSizeInventory()), itemstack1);
- }
+ par2TileEntityChest.setInventorySlotContents(par0Random.nextInt(par2TileEntityChest.getSizeInventory()), item);
+ par2IInventory.setInventorySlotContents(par0Random.nextInt(par2IInventory.getSizeInventory()), item);
}
}
}
@@ -68,22 +71,11 @@
@@ -68,22 +62,11 @@
for (int j = 0; j < par3; ++j)
{
WeightedRandomChestContent weightedrandomchestcontent = (WeightedRandomChestContent)WeightedRandom.getRandomItem(par0Random, par1ArrayOfWeightedRandomChestContent);

View file

@ -17,7 +17,7 @@
}
@SideOnly(Side.CLIENT)
@@ -247,7 +255,12 @@
@@ -150,7 +158,12 @@
{
int l = (par1 >> 4) - this.chunkX;
int i1 = (par3 >> 4) - this.chunkZ;

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/world/Explosion.java
+++ ../src_work/minecraft/net/minecraft/world/Explosion.java
@@ -90,7 +90,7 @@
@@ -92,7 +92,7 @@
if (k1 > 0)
{
Block block = Block.blocksList[k1];

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/world/World.java
+++ ../src_work/minecraft/net/minecraft/world/World.java
@@ -44,8 +44,30 @@
@@ -47,8 +47,30 @@
import net.minecraft.world.storage.MapStorage;
import net.minecraft.world.storage.WorldInfo;
@ -138,8 +138,8 @@
+ return Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta);
}
public int func_85175_e(int par1, int par2, int par3)
@@ -1127,7 +1183,7 @@
/**
@@ -1085,7 +1141,7 @@
*/
public boolean isDaytime()
{
@ -148,7 +148,7 @@
}
/**
@@ -1159,7 +1215,7 @@
@@ -1117,7 +1173,7 @@
int l1 = this.getBlockMetadata(l, i1, j1);
Block block = Block.blocksList[k1];
@ -157,7 +157,7 @@
{
MovingObjectPosition movingobjectposition = block.collisionRayTrace(this, l, i1, j1, par1Vec3, par2Vec3);
@@ -1359,6 +1415,12 @@
@@ -1317,6 +1373,12 @@
*/
public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4)
{
@ -170,7 +170,7 @@
if (par1Entity != null && par2Str != null)
{
for (int i = 0; i < this.worldAccesses.size(); ++i)
@@ -1373,6 +1435,12 @@
@@ -1331,6 +1393,12 @@
*/
public void playSoundToNearExcept(EntityPlayer par1EntityPlayer, String par2Str, float par3, float par4)
{
@ -183,7 +183,7 @@
if (par1EntityPlayer != null && par2Str != null)
{
for (int i = 0; i < this.worldAccesses.size(); ++i)
@@ -1459,6 +1527,11 @@
@@ -1417,6 +1485,11 @@
EntityPlayer entityplayer = (EntityPlayer)par1Entity;
this.playerEntities.add(entityplayer);
this.updateAllPlayersSleepingFlag();
@ -195,7 +195,7 @@
}
this.getChunkFromChunkCoords(i, j).addEntity(par1Entity);
@@ -1706,6 +1779,12 @@
@@ -1663,6 +1736,12 @@
* Calculates the color for the skybox
*/
public Vec3 getSkyColor(Entity par1Entity, float par2)
@ -208,7 +208,7 @@
{
float f1 = this.getCelestialAngle(par2);
float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
@@ -1801,6 +1880,12 @@
@@ -1756,6 +1835,12 @@
@SideOnly(Side.CLIENT)
public Vec3 drawClouds(float par1)
{
@ -221,7 +221,7 @@
float f1 = this.getCelestialAngle(par1);
float f2 = MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.5F;
@@ -1879,7 +1964,7 @@
@@ -1834,7 +1919,7 @@
{
int l = chunk.getBlockID(par1, k, par2);
@ -230,7 +230,7 @@
{
return k + 1;
}
@@ -1894,6 +1979,12 @@
@@ -1849,6 +1934,12 @@
* How bright are stars in the sky
*/
public float getStarBrightness(float par1)
@ -243,7 +243,7 @@
{
float f1 = this.getCelestialAngle(par1);
float f2 = 1.0F - (MathHelper.cos(f1 * (float)Math.PI * 2.0F) * 2.0F + 0.25F);
@@ -2038,16 +2129,8 @@
@@ -1984,16 +2075,8 @@
if (entity.isDead)
{
@ -262,7 +262,7 @@
}
this.theProfiler.endSection();
@@ -2095,7 +2178,7 @@
@@ -2032,7 +2115,7 @@
if (chunk != null)
{
@ -271,7 +271,7 @@
}
}
}
@@ -2104,6 +2187,10 @@
@@ -2041,6 +2124,10 @@
if (!this.entityRemoval.isEmpty())
{
@ -282,7 +282,7 @@
this.loadedTileEntityList.removeAll(this.entityRemoval);
this.entityRemoval.clear();
}
@@ -2124,18 +2211,18 @@
@@ -2061,18 +2148,18 @@
{
this.loadedTileEntityList.add(tileentity1);
}
@ -305,7 +305,7 @@
}
}
@@ -2148,13 +2235,13 @@
@@ -2085,13 +2172,13 @@
public void addTileEntity(Collection par1Collection)
{
@ -326,7 +326,7 @@
}
}
@@ -2174,9 +2261,17 @@
@@ -2111,9 +2198,17 @@
{
int i = MathHelper.floor_double(par1Entity.posX);
int j = MathHelper.floor_double(par1Entity.posZ);
@ -347,7 +347,7 @@
{
par1Entity.lastTickPosX = par1Entity.posX;
par1Entity.lastTickPosY = par1Entity.posY;
@@ -2409,6 +2504,14 @@
@@ -2346,6 +2441,14 @@
{
return true;
}
@ -362,7 +362,7 @@
}
}
}
@@ -2714,25 +2817,21 @@
@@ -2651,25 +2754,21 @@
*/
public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity)
{
@ -403,7 +403,7 @@
}
}
@@ -2741,27 +2840,10 @@
@@ -2678,27 +2777,10 @@
*/
public void removeBlockTileEntity(int par1, int par2, int par3)
{
@ -435,7 +435,7 @@
}
}
@@ -2787,7 +2869,8 @@
@@ -2724,7 +2806,8 @@
*/
public boolean isBlockNormalCube(int par1, int par2, int par3)
{
@ -445,17 +445,17 @@
}
public boolean func_85174_u(int par1, int par2, int par3)
@@ -2810,8 +2893,7 @@
@@ -2747,8 +2830,7 @@
*/
public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3)
{
- Block block = Block.blocksList[this.getBlockId(par1, par2, par3)];
- return block == null ? false : (block.blockMaterial.isOpaque() && block.renderAsNormalBlock() ? true : (block instanceof BlockStairs ? (this.getBlockMetadata(par1, par2, par3) & 4) == 4 : (block instanceof BlockHalfSlab ? (this.getBlockMetadata(par1, par2, par3) & 8) == 8 : false)));
- return block == null ? false : (block.blockMaterial.isOpaque() && block.renderAsNormalBlock() ? true : (block instanceof BlockStairs ? (this.getBlockMetadata(par1, par2, par3) & 4) == 4 : (block instanceof BlockHalfSlab ? (this.getBlockMetadata(par1, par2, par3) & 8) == 8 : block instanceof BlockHopper)));
+ return isBlockSolidOnSide(par1, par2, par3, ForgeDirection.UP);
}
/**
@@ -2827,7 +2909,7 @@
@@ -2764,7 +2846,7 @@
if (chunk != null && !chunk.isEmpty())
{
Block block = Block.blocksList[this.getBlockId(par1, par2, par3)];
@ -464,7 +464,7 @@
}
else
{
@@ -2858,8 +2940,7 @@
@@ -2795,8 +2877,7 @@
*/
public void setAllowedSpawnTypes(boolean par1, boolean par2)
{
@ -474,7 +474,7 @@
}
/**
@@ -2875,6 +2956,11 @@
@@ -2812,6 +2893,11 @@
*/
private void calculateInitialWeather()
{
@ -486,7 +486,7 @@
if (this.worldInfo.isRaining())
{
this.rainingStrength = 1.0F;
@@ -2890,6 +2976,11 @@
@@ -2827,6 +2913,11 @@
* Updates all weather states.
*/
protected void updateWeather()
@ -498,7 +498,7 @@
{
if (!this.provider.hasNoSky)
{
@@ -2987,12 +3078,14 @@
@@ -2924,12 +3015,14 @@
public void toggleRain()
{
@ -514,7 +514,7 @@
this.theProfiler.startSection("buildList");
int i;
EntityPlayer entityplayer;
@@ -3099,6 +3192,11 @@
@@ -3036,6 +3129,11 @@
*/
public boolean canBlockFreeze(int par1, int par2, int par3, boolean par4)
{
@ -526,7 +526,7 @@
BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3);
float f = biomegenbase.getFloatTemperature();
@@ -3156,6 +3254,11 @@
@@ -3093,6 +3191,11 @@
* Tests whether or not snow can be placed at a given location
*/
public boolean canSnowAt(int par1, int par2, int par3)
@ -538,7 +538,7 @@
{
BiomeGenBase biomegenbase = this.getBiomeGenForCoords(par1, par3);
float f = biomegenbase.getFloatTemperature();
@@ -3249,7 +3352,7 @@
@@ -3186,7 +3289,7 @@
private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6)
{
@ -547,7 +547,7 @@
int l1 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6;
int i2 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6;
int j2 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6;
@@ -3384,7 +3487,7 @@
@@ -3321,7 +3424,7 @@
int k4 = i2 + (i4 / 2 + 1) % 3 / 2 * l3;
int l4 = j2 + (i4 / 2 + 2) % 3 / 2 * l3;
l2 = this.getSavedLightValue(par1EnumSkyBlock, j4, k4, l4);
@ -556,7 +556,7 @@
if (i5 == 0)
{
@@ -3415,7 +3518,7 @@
@@ -3352,7 +3455,7 @@
j2 = (k1 >> 12 & 63) - 32 + par4;
k2 = this.getSavedLightValue(par1EnumSkyBlock, l1, i2, j2);
l2 = this.getBlockId(l1, i2, j2);
@ -565,8 +565,8 @@
if (i3 == 0)
{
@@ -3517,10 +3620,10 @@
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB)
@@ -3459,10 +3562,10 @@
public List func_94576_a(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
this.entitiesWithinAABBExcludingEntity.clear();
- int i = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D);
@ -580,7 +580,7 @@
for (int i1 = i; i1 <= j; ++i1)
{
@@ -3546,10 +3649,10 @@
@@ -3488,10 +3591,10 @@
public List selectEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, IEntitySelector par3IEntitySelector)
{
@ -595,7 +595,7 @@
ArrayList arraylist = new ArrayList();
for (int i1 = i; i1 <= j; ++i1)
@@ -3642,11 +3745,14 @@
@@ -3584,11 +3687,14 @@
*/
public void addLoadedEntities(List par1List)
{
@ -613,7 +613,7 @@
}
}
@@ -3680,6 +3786,11 @@
@@ -3619,6 +3725,11 @@
else
{
if (block != null && (block == Block.waterMoving || block == Block.waterStill || block == Block.lavaMoving || block == Block.lavaStill || block == Block.fire || block.blockMaterial.isReplaceable()))
@ -625,7 +625,7 @@
{
block = null;
}
@@ -3897,7 +4008,7 @@
@@ -3907,7 +4018,7 @@
*/
public long getSeed()
{
@ -634,7 +634,7 @@
}
public long getTotalWorldTime()
@@ -3907,7 +4018,7 @@
@@ -3917,7 +4028,7 @@
public long getWorldTime()
{
@ -643,7 +643,7 @@
}
/**
@@ -3915,7 +4026,7 @@
@@ -3925,7 +4036,7 @@
*/
public void setWorldTime(long par1)
{
@ -652,7 +652,7 @@
}
/**
@@ -3923,13 +4034,13 @@
@@ -3933,13 +4044,13 @@
*/
public ChunkCoordinates getSpawnPoint()
{
@ -668,7 +668,7 @@
}
@SideOnly(Side.CLIENT)
@@ -3953,7 +4064,10 @@
@@ -3963,7 +4074,10 @@
if (!this.loadedEntityList.contains(par1Entity))
{
@ -680,7 +680,7 @@
}
}
@@ -3961,6 +4075,11 @@
@@ -3971,6 +4085,11 @@
* Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here.
*/
public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4)
@ -692,7 +692,7 @@
{
return true;
}
@@ -4081,8 +4200,7 @@
@@ -4091,8 +4210,7 @@
*/
public boolean isBlockHighHumidity(int par1, int par2, int par3)
{
@ -702,7 +702,7 @@
}
/**
@@ -4157,7 +4275,7 @@
@@ -4167,7 +4285,7 @@
*/
public int getHeight()
{
@ -711,7 +711,7 @@
}
/**
@@ -4165,7 +4283,7 @@
@@ -4175,7 +4293,7 @@
*/
public int getActualHeight()
{
@ -720,7 +720,7 @@
}
public IUpdatePlayerListBox func_82735_a(EntityMinecart par1EntityMinecart)
@@ -4208,7 +4326,7 @@
@@ -4218,7 +4336,7 @@
*/
public double getHorizon()
{
@ -729,7 +729,7 @@
}
/**
@@ -4269,4 +4387,75 @@
@@ -4279,4 +4397,75 @@
@SideOnly(Side.CLIENT)
public void func_92088_a(double par1, double par3, double par5, double par7, double par9, double par11, NBTTagCompound par13NBTTagCompound) {}

View file

@ -28,7 +28,7 @@
public class WorldServer extends World
{
@@ -85,6 +94,10 @@
@@ -86,6 +95,10 @@
/** An IntHashMap of entity IDs (integers) to their Entity objects. */
private IntHashMap entityIdMap;
@ -39,7 +39,7 @@
public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings, Profiler par6Profiler)
{
super(par2ISaveHandler, par3Str, par5WorldSettings, WorldProvider.getProviderForDimension(par4), par6Profiler);
@@ -108,6 +121,7 @@
@@ -109,6 +122,7 @@
}
this.field_85177_Q = new Teleporter(this);
@ -47,7 +47,7 @@
}
/**
@@ -171,6 +185,10 @@
@@ -172,6 +186,10 @@
this.villageSiegeObj.tick();
this.theProfiler.endStartSection("portalForcer");
this.field_85177_Q.func_85189_a(this.getTotalWorldTime());
@ -58,7 +58,7 @@
this.theProfiler.endSection();
this.sendAndApplyBlockEvents();
}
@@ -224,10 +242,7 @@
@@ -225,10 +243,7 @@
private void resetRainAndThunder()
{
@ -70,7 +70,7 @@
}
public boolean areAllPlayersAsleep()
@@ -298,6 +313,14 @@
@@ -299,6 +314,14 @@
int i = 0;
int j = 0;
Iterator iterator = this.activeChunkSet.iterator();
@ -85,7 +85,7 @@
while (iterator.hasNext())
{
@@ -308,14 +331,18 @@
@@ -309,14 +332,18 @@
Chunk chunk = this.getChunkFromChunkCoords(chunkcoordintpair.chunkXPos, chunkcoordintpair.chunkZPos);
this.moodSoundAndLightCheck(k, l, chunk);
this.theProfiler.endStartSection("tickChunk");
@ -106,7 +106,7 @@
{
this.updateLCG = this.updateLCG * 3 + 1013904223;
i1 = this.updateLCG >> 2;
@@ -332,7 +359,7 @@
@@ -333,7 +360,7 @@
this.theProfiler.endStartSection("iceandsnow");
int i2;
@ -115,7 +115,7 @@
{
this.updateLCG = this.updateLCG * 3 + 1013904223;
i1 = this.updateLCG >> 2;
@@ -411,7 +438,8 @@
@@ -418,7 +445,8 @@
public void func_82740_a(int par1, int par2, int par3, int par4, int par5, int par6)
{
NextTickListEntry nextticklistentry = new NextTickListEntry(par1, par2, par3, par4);
@ -125,7 +125,7 @@
if (this.scheduledUpdatesAreImmediate && par4 > 0)
{
@@ -473,7 +501,7 @@
@@ -480,7 +508,7 @@
*/
public void updateEntities()
{
@ -134,17 +134,17 @@
{
if (this.updateEntityTick++ >= 1200)
{
@@ -525,7 +553,8 @@
this.pendingTickListEntries.remove(nextticklistentry);
this.field_73064_N.remove(nextticklistentry);
@@ -546,7 +574,8 @@
{
nextticklistentry = (NextTickListEntry)iterator.next();
iterator.remove();
- byte b0 = 8;
+ boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(nextticklistentry.xCoord >> 4, nextticklistentry.zCoord >> 4));
+ byte b0 = isForced ? (byte)0 : 8;
if (this.checkChunksExist(nextticklistentry.xCoord - b0, nextticklistentry.yCoord - b0, nextticklistentry.zCoord - b0, nextticklistentry.xCoord + b0, nextticklistentry.yCoord + b0, nextticklistentry.zCoord + b0))
{
@@ -644,16 +673,28 @@
@@ -667,16 +696,28 @@
{
ArrayList arraylist = new ArrayList();
@ -183,7 +183,7 @@
return arraylist;
}
@@ -661,6 +702,11 @@
@@ -684,6 +725,11 @@
* Called when checking if a certain block can be mined or not. The 'spawn safe zone' check is located here.
*/
public boolean canMineBlock(EntityPlayer par1EntityPlayer, int par2, int par3, int par4)
@ -195,7 +195,7 @@
{
int l = MathHelper.abs_int(par2 - this.worldInfo.getSpawnX());
int i1 = MathHelper.abs_int(par4 - this.worldInfo.getSpawnZ());
@@ -670,7 +716,7 @@
@@ -693,7 +739,7 @@
i1 = l;
}
@ -204,7 +204,7 @@
}
protected void initialize(WorldSettings par1WorldSettings)
@@ -753,7 +799,7 @@
@@ -776,7 +822,7 @@
*/
protected void createBonusChest()
{
@ -213,7 +213,7 @@
for (int i = 0; i < 10; ++i)
{
@@ -796,6 +842,7 @@
@@ -819,6 +865,7 @@
}
this.chunkProvider.saveChunks(par1, par2IProgressUpdate);
@ -221,7 +221,7 @@
}
}
@@ -807,6 +854,7 @@
@@ -830,6 +877,7 @@
this.checkSessionLock();
this.saveHandler.saveWorldInfoWithPlayer(this.worldInfo, this.mcServer.getConfigurationManager().getTagsFromLastWrite());
this.mapStorage.saveAllData();
@ -229,7 +229,7 @@
}
/**
@@ -1029,4 +1077,9 @@
@@ -1052,4 +1100,9 @@
{
return this.field_85177_Q;
}

View file

@ -152,7 +152,7 @@
{
return 0;
}
@@ -592,6 +685,11 @@
@@ -584,6 +677,11 @@
}
else
{
@ -164,7 +164,7 @@
ExtendedBlockStorage extendedblockstorage = this.storageArrays[par2 >> 4];
boolean flag = false;
@@ -622,9 +720,13 @@
@@ -614,9 +712,13 @@
{
Block.blocksList[l1].breakBlock(this.worldObj, j2, par2, k2, l1, i2);
}
@ -181,7 +181,7 @@
}
}
@@ -642,7 +744,7 @@
@@ -634,7 +736,7 @@
}
else
{
@ -190,7 +190,7 @@
{
if (par2 >= k1)
{
@@ -666,29 +768,21 @@
@@ -658,29 +760,21 @@
Block.blocksList[par4].onBlockAdded(this.worldObj, j2, par2, k2);
}
@ -223,7 +223,7 @@
}
}
@@ -703,7 +797,7 @@
@@ -695,7 +789,7 @@
*/
public boolean setBlockMetadata(int par1, int par2, int par3, int par4)
{
@ -232,7 +232,7 @@
if (extendedblockstorage == null)
{
@@ -723,7 +817,7 @@
@@ -715,7 +809,7 @@
extendedblockstorage.setExtBlockMetadata(par1, par2 & 15, par3, par4);
int j1 = extendedblockstorage.getExtBlockID(par1, par2 & 15, par3);
@ -241,7 +241,7 @@
{
TileEntity tileentity = this.getChunkBlockTileEntity(par1, par2, par3);
@@ -744,7 +838,7 @@
@@ -736,7 +830,7 @@
*/
public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
{
@ -250,7 +250,7 @@
return extendedblockstorage == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? (this.worldObj.provider.hasNoSky ? 0 : extendedblockstorage.getExtSkylightValue(par2, par3 & 15, par4)) : (par1EnumSkyBlock == EnumSkyBlock.Block ? extendedblockstorage.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
}
@@ -754,6 +848,11 @@
@@ -746,6 +840,11 @@
*/
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
{
@ -262,7 +262,7 @@
ExtendedBlockStorage extendedblockstorage = this.storageArrays[par3 >> 4];
if (extendedblockstorage == null)
@@ -782,7 +881,7 @@
@@ -774,7 +873,7 @@
*/
public int getBlockLightValue(int par1, int par2, int par3, int par4)
{
@ -271,7 +271,7 @@
if (extendedblockstorage == null)
{
@@ -835,7 +934,7 @@
@@ -827,7 +926,7 @@
{
k = this.entityLists.length - 1;
}
@ -280,7 +280,7 @@
par1Entity.addedToChunk = true;
par1Entity.chunkCoordX = this.xPosition;
par1Entity.chunkCoordY = k;
@@ -885,33 +984,33 @@
@@ -877,33 +976,33 @@
ChunkPosition chunkposition = new ChunkPosition(par1, par2, par3);
TileEntity tileentity = (TileEntity)this.chunkTileEntityMap.get(chunkposition);
@ -325,7 +325,7 @@
}
/**
@@ -926,7 +1025,7 @@
@@ -918,7 +1017,7 @@
if (this.isChunkLoaded)
{
@ -334,7 +334,7 @@
}
}
@@ -941,8 +1040,14 @@
@@ -933,8 +1032,14 @@
par4TileEntity.yCoord = par2;
par4TileEntity.zCoord = this.zPosition * 16 + par3;
@ -351,7 +351,7 @@
par4TileEntity.validate();
this.chunkTileEntityMap.put(chunkposition, par4TileEntity);
}
@@ -978,6 +1083,7 @@
@@ -970,6 +1075,7 @@
{
this.worldObj.addLoadedEntities(this.entityLists[i]);
}
@ -359,7 +359,7 @@
}
/**
@@ -998,6 +1104,7 @@
@@ -990,6 +1096,7 @@
{
this.worldObj.unloadEntities(this.entityLists[i]);
}
@ -367,9 +367,9 @@
}
/**
@@ -1014,8 +1121,8 @@
@@ -1006,8 +1113,8 @@
*/
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List)
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector)
{
- int i = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
- int j = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);
@ -378,7 +378,7 @@
if (i < 0)
{
@@ -1062,8 +1169,8 @@
@@ -1054,8 +1161,8 @@
*/
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List, IEntitySelector par4IEntitySelector)
{
@ -389,7 +389,7 @@
if (i < 0)
{
@@ -1246,6 +1353,15 @@
@@ -1238,6 +1345,15 @@
*/
public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4)
{
@ -405,7 +405,7 @@
int k = 0;
boolean flag1 = !this.worldObj.provider.hasNoSky;
int l;
@@ -1346,12 +1462,26 @@
@@ -1338,12 +1454,26 @@
}
this.generateHeightMap();
@ -436,7 +436,7 @@
}
}
@@ -1460,4 +1590,18 @@
@@ -1452,4 +1582,18 @@
}
}
}

View file

@ -1,7 +1,7 @@
--- ../src_base/minecraft/net/minecraft/world/gen/ChunkProviderHell.java
+++ ../src_work/minecraft/net/minecraft/world/gen/ChunkProviderHell.java
@@ -18,6 +18,13 @@
import net.minecraft.world.gen.feature.WorldGenHellLava;
@@ -19,6 +19,13 @@
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraft.world.gen.structure.MapGenNetherBridge;
+import static net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType.*;
@ -14,7 +14,7 @@
public class ChunkProviderHell implements IChunkProvider
{
private Random hellRNG;
@@ -58,6 +65,11 @@
@@ -59,6 +66,11 @@
double[] noiseData3;
double[] noiseData4;
double[] noiseData5;
@ -26,7 +26,7 @@
public ChunkProviderHell(World par1World, long par2)
{
@@ -70,6 +82,16 @@
@@ -71,6 +83,16 @@
this.netherrackExculsivityNoiseGen = new NoiseGeneratorOctaves(this.hellRNG, 4);
this.netherNoiseGen6 = new NoiseGeneratorOctaves(this.hellRNG, 10);
this.netherNoiseGen7 = new NoiseGeneratorOctaves(this.hellRNG, 16);
@ -43,7 +43,7 @@
}
/**
@@ -154,6 +176,10 @@
@@ -155,6 +177,10 @@
*/
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte)
{
@ -54,7 +54,7 @@
byte b0 = 64;
double d0 = 0.03125D;
this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0, d0, 1.0D);
@@ -289,6 +315,9 @@
@@ -290,6 +316,9 @@
*/
private double[] initializeNoiseField(double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7)
{
@ -64,7 +64,7 @@
if (par1ArrayOfDouble == null)
{
par1ArrayOfDouble = new double[par5 * par6 * par7];
@@ -441,6 +470,9 @@
@@ -442,6 +471,9 @@
public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
{
BlockSand.fallInstantly = true;
@ -74,7 +74,7 @@
int k = par2 * 16;
int l = par3 * 16;
this.genNetherBridge.generateStructuresInChunk(this.worldObj, this.hellRNG, par2, par3);
@@ -449,7 +481,8 @@
@@ -450,7 +482,8 @@
int k1;
int l1;
@ -84,7 +84,7 @@
{
j1 = k + this.hellRNG.nextInt(16) + 8;
k1 = this.hellRNG.nextInt(120) + 4;
@@ -460,7 +493,8 @@
@@ -461,7 +494,8 @@
i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1) + 1;
int i2;
@ -94,7 +94,7 @@
{
k1 = k + this.hellRNG.nextInt(16) + 8;
l1 = this.hellRNG.nextInt(120) + 4;
@@ -470,7 +504,8 @@
@@ -471,7 +505,8 @@
i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1);
@ -104,7 +104,7 @@
{
k1 = k + this.hellRNG.nextInt(16) + 8;
l1 = this.hellRNG.nextInt(120) + 4;
@@ -478,7 +513,7 @@
@@ -479,7 +514,7 @@
(new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, k1, l1, i2);
}
@ -113,7 +113,7 @@
{
k1 = k + this.hellRNG.nextInt(16) + 8;
l1 = this.hellRNG.nextInt(128);
@@ -486,7 +521,10 @@
@@ -487,7 +522,10 @@
(new WorldGenGlowStone2()).generate(this.worldObj, this.hellRNG, k1, l1, i2);
}
@ -125,7 +125,7 @@
{
j1 = k + this.hellRNG.nextInt(16) + 8;
k1 = this.hellRNG.nextInt(128);
@@ -494,7 +532,7 @@
@@ -495,7 +533,7 @@
(new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(this.worldObj, this.hellRNG, j1, k1, l1);
}
@ -134,8 +134,8 @@
{
j1 = k + this.hellRNG.nextInt(16) + 8;
k1 = this.hellRNG.nextInt(128);
@@ -502,6 +540,9 @@
(new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.hellRNG, j1, k1, l1);
@@ -522,6 +560,9 @@
(new WorldGenHellLava(Block.lavaMoving.blockID, true)).generate(this.worldObj, this.hellRNG, l1, i2, j2);
}
+ MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, hellRNG, k, l));

View file

@ -37,7 +37,7 @@
private ItemStack pickCheckLootItem(Random par1Random)
{
- int i = par1Random.nextInt(12);
- return i == 0 ? new ItemStack(Item.saddle) : (i == 1 ? new ItemStack(Item.ingotIron, par1Random.nextInt(4) + 1) : (i == 2 ? new ItemStack(Item.bread) : (i == 3 ? new ItemStack(Item.wheat, par1Random.nextInt(4) + 1) : (i == 4 ? new ItemStack(Item.gunpowder, par1Random.nextInt(4) + 1) : (i == 5 ? new ItemStack(Item.silk, par1Random.nextInt(4) + 1) : (i == 6 ? new ItemStack(Item.bucketEmpty) : (i == 7 && par1Random.nextInt(100) == 0 ? new ItemStack(Item.appleGold) : (i == 8 && par1Random.nextInt(2) == 0 ? new ItemStack(Item.redstone, par1Random.nextInt(4) + 1) : (i == 9 && par1Random.nextInt(10) == 0 ? new ItemStack(Item.itemsList[Item.record13.itemID + par1Random.nextInt(2)]) : (i == 10 ? new ItemStack(Item.dyePowder, 1, 3) : (i == 11 ? Item.field_92053_bW.func_92055_a(par1Random) : null)))))))))));
- return i == 0 ? new ItemStack(Item.saddle) : (i == 1 ? new ItemStack(Item.ingotIron, par1Random.nextInt(4) + 1) : (i == 2 ? new ItemStack(Item.bread) : (i == 3 ? new ItemStack(Item.wheat, par1Random.nextInt(4) + 1) : (i == 4 ? new ItemStack(Item.gunpowder, par1Random.nextInt(4) + 1) : (i == 5 ? new ItemStack(Item.silk, par1Random.nextInt(4) + 1) : (i == 6 ? new ItemStack(Item.bucketEmpty) : (i == 7 && par1Random.nextInt(100) == 0 ? new ItemStack(Item.appleGold) : (i == 8 && par1Random.nextInt(2) == 0 ? new ItemStack(Item.redstone, par1Random.nextInt(4) + 1) : (i == 9 && par1Random.nextInt(10) == 0 ? new ItemStack(Item.itemsList[Item.record13.itemID + par1Random.nextInt(2)]) : (i == 10 ? new ItemStack(Item.dyePowder, 1, 3) : (i == 11 ? Item.enchantedBook.func_92109_a(par1Random) : null)))))))))));
+ return ChestGenHooks.getOneItem(ChestGenHooks.DUNGEON_CHEST, par1Random);
}

View file

@ -8,29 +8,29 @@
/** The number of blocks to generate. */
private int numberOfBlocks;
@@ -17,6 +18,12 @@
{
@@ -24,6 +25,12 @@
this.minableBlockId = par1;
this.numberOfBlocks = par2;
this.field_94523_c = par3;
+ }
+
+ public WorldGenMinable(int id, int meta, int number)
+ public WorldGenMinable(int id, int meta, int number, int target)
+ {
+ this(id, number);
+ this(id, number, target);
+ minableBlockMeta = meta;
}
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
@@ -60,9 +67,10 @@
@@ -67,9 +74,10 @@
{
double d14 = ((double)i3 + 0.5D - d8) / (d10 / 2.0D);
- if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(k2, l2, i3) == Block.stone.blockID)
- if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && par1World.getBlockId(k2, l2, i3) == this.field_94523_c)
+ Block block = Block.blocksList[par1World.getBlockId(k2, l2, i3)];
+ if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, k2, l2, i3)))
+ if (d12 * d12 + d13 * d13 + d14 * d14 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, k2, l2, i3, field_94523_c)))
{
- par1World.setBlock(k2, l2, i3, this.minableBlockId);
+ par1World.setBlockAndMetadata(k2, l2, i3, this.minableBlockId, minableBlockMeta);
- par1World.setBlockAndMetadataWithNotify(k2, l2, i3, this.minableBlockId, 0, 4);
+ par1World.setBlockAndMetadataWithNotify(k2, l2, i3, this.minableBlockId, minableBlockMeta, 4);
}
}
}

View file

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java
+++ ../src_work/minecraft/net/minecraft/world/gen/structure/ComponentMineshaftCorridor.java
@@ -7,6 +7,9 @@
@@ -8,6 +8,9 @@
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
@ -10,7 +10,7 @@
public class ComponentMineshaftCorridor extends StructureComponent
{
@@ -236,14 +239,16 @@
@@ -260,14 +263,16 @@
this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k - 1, Block.torchWood.blockID, 0);
this.randomlyPlaceBlock(par1World, par3StructureBoundingBox, par2Random, 0.05F, 1, 2, k + 1, Block.torchWood.blockID, 0);
@ -18,13 +18,13 @@
+
if (par2Random.nextInt(100) == 0)
{
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, WeightedRandomChestContent.func_92029_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.field_92053_bW.func_92059_b(par2Random)}), 3 + par2Random.nextInt(4));
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4));
+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 2, 0, k - 1, info.getItems(par2Random), info.getCount(par2Random));
}
if (par2Random.nextInt(100) == 0)
{
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, WeightedRandomChestContent.func_92029_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.field_92053_bW.func_92059_b(par2Random)}), 3 + par2Random.nextInt(4));
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, WeightedRandomChestContent.func_92080_a(StructureMineshaftPieces.func_78816_a(), new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 3 + par2Random.nextInt(4));
+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 0, 0, k + 1, info.getItems(par2Random), info.getCount(par2Random));
}

View file

@ -21,7 +21,7 @@
{
int j1 = Direction.offsetX[i1] * 2;
int k1 = Direction.offsetZ[i1] * 2;
- this.field_74940_h[i1] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + j1, -11, 10 + k1, WeightedRandomChestContent.func_92029_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Item.field_92053_bW.func_92059_b(par2Random)}), 2 + par2Random.nextInt(5));
- this.field_74940_h[i1] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + j1, -11, 10 + k1, WeightedRandomChestContent.func_92080_a(itemsToGenerateInTemple, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5));
+ this.field_74940_h[i1] = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 10 + j1, -11, 10 + k1, info.getItems(par2Random), info.getCount(par2Random));
}
}

View file

@ -37,7 +37,7 @@
if (!this.field_74947_h)
{
- this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, WeightedRandomChestContent.func_92029_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.field_92053_bW.func_92059_b(par2Random)}), 2 + par2Random.nextInt(5));
- this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5));
+ this.field_74947_h = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 8, -3, 3, chest.getItems(par2Random), chest.getCount(par2Random));
}
@ -46,7 +46,7 @@
if (!this.field_74948_i)
{
- this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, WeightedRandomChestContent.func_92029_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.field_92053_bW.func_92059_b(par2Random)}), 2 + par2Random.nextInt(5));
- this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, WeightedRandomChestContent.func_92080_a(junglePyramidsChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(5));
+ this.field_74948_i = this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 9, -3, 10, chest.getItems(par2Random), chest.getCount(par2Random));
}

View file

@ -14,7 +14,7 @@
if (par3StructureBoundingBox.isVecInside(j, i, k))
{
this.hasMadeChest = true;
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, WeightedRandomChestContent.func_92029_a(strongholdChestContents, new WeightedRandomChestContent[] {Item.field_92053_bW.func_92059_b(par2Random)}), 2 + par2Random.nextInt(2));
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, WeightedRandomChestContent.func_92080_a(strongholdChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 2 + par2Random.nextInt(2));
+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 2, 3, ChestGenHooks.getItems(STRONGHOLD_CORRIDOR, par2Random), ChestGenHooks.getCount(STRONGHOLD_CORRIDOR, par2Random));
}
}

View file

@ -14,7 +14,7 @@
this.placeBlockAtCurrentPosition(par1World, Block.torchWood.blockID, 0, b1, 8, b2 + 1, par3StructureBoundingBox);
}
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, WeightedRandomChestContent.func_92029_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.field_92053_bW.func_92058_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4));
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4));
+ ChestGenHooks info = ChestGenHooks.getInfo(STRONGHOLD_LIBRARY);
+
+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 3, 5, info.getItems(par2Random), info.getCount(par2Random));
@ -22,7 +22,7 @@
if (this.isLargeRoom)
{
this.placeBlockAtCurrentPosition(par1World, 0, 0, 12, 9, 1, par3StructureBoundingBox);
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, WeightedRandomChestContent.func_92029_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.field_92053_bW.func_92058_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4));
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, WeightedRandomChestContent.func_92080_a(strongholdLibraryChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92112_a(par2Random, 1, 5, 2)}), 1 + par2Random.nextInt(4));
+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 12, 8, 1, info.getItems(par2Random), info.getCount(par2Random));
}

View file

@ -14,7 +14,7 @@
this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 1, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 2, 3, par3StructureBoundingBox);
this.placeBlockAtCurrentPosition(par1World, Block.ladder.blockID, this.getMetadataWithOffset(Block.ladder.blockID, 4), 9, 3, 3, par3StructureBoundingBox);
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, WeightedRandomChestContent.func_92029_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Item.field_92053_bW.func_92059_b(par2Random)}), 1 + par2Random.nextInt(4));
- this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, WeightedRandomChestContent.func_92080_a(strongholdRoomCrossingChestContents, new WeightedRandomChestContent[] {Item.enchantedBook.func_92114_b(par2Random)}), 1 + par2Random.nextInt(4));
+ this.generateStructureChestContents(par1World, par3StructureBoundingBox, par2Random, 3, 4, 8, ChestGenHooks.getItems(STRONGHOLD_CROSSING, par2Random), ChestGenHooks.getCount(STRONGHOLD_CROSSING, par2Random));
}