Updated Client side patches for the new Merged MCP workspace.

This commit is contained in:
LexManos 2012-08-09 03:06:41 -07:00
parent 1bd8cdcd3e
commit dae4a07c60
62 changed files with 486 additions and 1517 deletions

View File

@ -1,53 +0,0 @@
package net.minecraftforge.packets;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet250CustomPayload;
public abstract class ForgePacket
{
//Forge Packet ID Constants.
public static final int FORGE_ID = 0x040E9B47; //"Forge".hashCode();
public static final int SPAWN = 1;
public static final int OPEN_GUI = 2;
public static final int TRACK = 3;
public Packet getPacket()
{
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
DataOutputStream data = new DataOutputStream(bytes);
try
{
data.writeByte(getID());
writeData(data);
}
catch (IOException e)
{
e.printStackTrace();
}
Packet250CustomPayload pkt = new Packet250CustomPayload();
pkt.channel = "Forge";
pkt.data = bytes.toByteArray();
pkt.length = pkt.data.length;
return pkt;
}
public abstract void writeData(DataOutputStream data) throws IOException;
public abstract void readData(DataInputStream data) throws IOException;
public abstract int getID();
public String toString(boolean full)
{
return toString();
}
@Override
public String toString()
{
return getID() + " " + getClass().getSimpleName();
}
}

View File

@ -1,123 +0,0 @@
package net.minecraftforge.packets;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.DataWatcher;
import net.minecraft.src.MathHelper;
import net.minecraftforge.common.ISpawnHandler;
import net.minecraftforge.common.IThrowableEntity;
import net.minecraftforge.common.MinecraftForge;
public class PacketEntitySpawn extends ForgePacket
{
public int modID;
public int entityID;
public int typeID;
public int posX;
public int posY;
public int posZ;
public byte yaw;
public byte pitch;
public byte yawHead;
public int throwerID;
public int speedX;
public int speedY;
public int speedZ;
public Object metadata;
private ISpawnHandler handler;
public PacketEntitySpawn(){}
public PacketEntitySpawn(Entity ent, NetworkMod mod, int type)
{
entityID = ent.entityId;
posX = MathHelper.floor_double(ent.posX * 32D);
posY = MathHelper.floor_double(ent.posY * 32D);
posZ = MathHelper.floor_double(ent.posZ * 32D);
typeID = type;
modID = MinecraftForge.getModID(mod);
yaw = (byte)(ent.rotationYaw * 256.0F / 360.0F);
pitch = (byte)(ent.rotationPitch * 256.0F / 360.0F);
yawHead = (byte)(ent instanceof EntityLiving ? ((EntityLiving)ent).rotationYawHead * 256.0F / 360.0F : 0);
metadata = ent.getDataWatcher();
if (ent instanceof IThrowableEntity)
{
Entity owner = ((IThrowableEntity)ent).getThrower();
throwerID = (owner == null ? ent.entityId : owner.entityId);
double maxVel = 3.9D;
double mX = ent.motionX;
double mY = ent.motionY;
double mZ = ent.motionZ;
if (mX < -maxVel) mX = -maxVel;
if (mY < -maxVel) mY = -maxVel;
if (mZ < -maxVel) mZ = -maxVel;
if (mX > maxVel) mX = maxVel;
if (mY > maxVel) mY = maxVel;
if (mZ > maxVel) mZ = maxVel;
speedX = (int)(mX * 8000D);
speedY = (int)(mY * 8000D);
speedZ = (int)(mZ * 8000D);
}
if (ent instanceof ISpawnHandler)
{
handler = (ISpawnHandler)ent;
}
}
public void writeData(DataOutputStream data) throws IOException
{
data.writeInt(modID);
data.writeInt(entityID);
data.writeByte(typeID & 0xFF);
data.writeInt(posX);
data.writeInt(posY);
data.writeInt(posZ);
data.writeByte(yaw);
data.writeByte(pitch);
data.writeByte(yawHead);
((DataWatcher)metadata).writeWatchableObjects(data);
data.writeInt(throwerID);
if (throwerID != 0)
{
data.writeShort(speedX);
data.writeShort(speedY);
data.writeShort(speedZ);
}
if (handler != null)
{
handler.writeSpawnData(data);
}
}
public void readData(DataInputStream data) throws IOException
{
modID = data.readInt();
entityID = data.readInt();
typeID = data.readByte() & 0xFF;
posX = data.readInt();
posY = data.readInt();
posZ = data.readInt();
yaw = data.readByte();
pitch = data.readByte();
yawHead = data.readByte();
metadata = DataWatcher.readWatchableObjects(data);
throwerID = data.readInt();
if (throwerID != 0)
{
speedX = data.readShort();
speedY = data.readShort();
speedZ = data.readShort();
}
}
@Override
public int getID()
{
return ForgePacket.SPAWN;
}
}

View File

@ -1,44 +0,0 @@
package net.minecraftforge.packets;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class PacketEntityTrack extends ForgePacket
{
public int entityId;
public int serverPosX;
public int serverPosY;
public int serverPosZ;
public PacketEntityTrack(){}
public PacketEntityTrack(int entityId, int serverPosX, int serverPosY, int serverPosZ)
{
this.entityId = entityId;
this.serverPosX = serverPosX;
this.serverPosY = serverPosY;
this.serverPosZ = serverPosZ;
}
public void writeData(DataOutputStream data) throws IOException
{
data.writeInt(entityId);
data.writeInt(serverPosX);
data.writeInt(serverPosY);
data.writeInt(serverPosZ);
}
public void readData(DataInputStream data) throws IOException
{
entityId = data.readInt();
serverPosX = data.readInt();
serverPosY = data.readInt();
serverPosZ = data.readInt();
}
@Override
public int getID()
{
return ForgePacket.TRACK;
}
}

View File

@ -1,23 +0,0 @@
package net.minecraftforge.packets;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet;
/**
* A helper class used to make a shared interface for sending packets,
* Should not be used outside the API itself.
*/
public abstract class PacketHandlerBase implements IPacketHandler
{
public static boolean DEBUG = false;
/**
* Sends out a packet to the specified network manager.
* This is necessary because NetClientHandler, and
* NetServerHandler are not on both sides.
*
* @param network The manager to send the packet to
* @param packet The packet to send
*/
public abstract void sendPacket(NetworkManager network, Packet packet);
}

View File

@ -1,76 +0,0 @@
package net.minecraftforge.packets;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Map.Entry;
public class PacketOpenGUI extends ForgePacket
{
public int WindowID;
public int ModID;
public int GuiID;
public int X;
public int Y;
public int Z;
public PacketOpenGUI(){}
public PacketOpenGUI(int window, int mod, int id, int x, int y, int z)
{
WindowID = window;
ModID = mod;
GuiID = id;
X = x;
Y = y;
Z = z;
}
@Override
public void writeData(DataOutputStream data) throws IOException
{
data.writeInt(WindowID);
data.writeInt(ModID);
data.writeInt(GuiID);
data.writeInt(X);
data.writeInt(Y);
data.writeInt(Z);
}
@Override
public void readData(DataInputStream data) throws IOException
{
WindowID = data.readInt();
ModID = data.readInt();
GuiID = data.readInt();
X = data.readInt();
Y = data.readInt();
Z = data.readInt();
}
@Override
public int getID()
{
return ForgePacket.OPEN_GUI;
}
@Override
public String toString(boolean full)
{
if (full)
{
StringBuilder ret = new StringBuilder();
ret.append(toString() + '\n');
ret.append(" Window: " + WindowID + '\n');
ret.append(" Mod: " + ModID + '\n');
ret.append(" Gui: " + GuiID + '\n');
ret.append(" X: " + X + '\n');
ret.append(" Y: " + Y + '\n');
ret.append(" Z: " + Z + '\n');
return ret.toString();
}
else
{
return toString();
}
}
}

View File

@ -10,3 +10,4 @@
/org.eclipse.debug.ui.prefs /org.eclipse.debug.ui.prefs
/org.eclipse.jdt.ui.prefs /org.eclipse.jdt.ui.prefs
/org.eclipse.ui.ide.prefs /org.eclipse.ui.ide.prefs
/*.prefs

Binary file not shown.

BIN
fml-src-2.9.114.210.zip Normal file

Binary file not shown.

View File

@ -1,8 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/Block.java --- ../src_base/common/net/minecraft/src/Block.java
+++ ../src_work/minecraft/net/minecraft/src/Block.java +++ ../src_work/common/net/minecraft/src/Block.java
@@ -1,7 +1,13 @@ @@ -2,8 +2,15 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -14,7 +16,7 @@
public class Block public class Block
{ {
@@ -277,6 +283,7 @@ @@ -279,6 +286,7 @@
lightOpacity[par1] = this.isOpaqueCube() ? 255 : 0; lightOpacity[par1] = this.isOpaqueCube() ? 255 : 0;
canBlockGrass[par1] = !par2Material.getCanBlockGrass(); canBlockGrass[par1] = !par2Material.getCanBlockGrass();
} }
@ -22,7 +24,7 @@
} }
/** /**
@@ -415,9 +422,10 @@ @@ -417,9 +425,10 @@
return this.needsRandomTick; return this.needsRandomTick;
} }
@ -34,7 +36,7 @@
} }
/** /**
@@ -438,7 +446,7 @@ @@ -442,7 +451,7 @@
*/ */
public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{ {
@ -42,8 +44,8 @@
+ return par1IBlockAccess.getBrightness(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); + return par1IBlockAccess.getBrightness(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4));
} }
/** @SideOnly(Side.CLIENT)
@@ -446,7 +454,7 @@ @@ -452,7 +461,7 @@
*/ */
public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{ {
@ -51,8 +53,8 @@
+ return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4)); + return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4));
} }
/** @SideOnly(Side.CLIENT)
@@ -607,8 +615,7 @@ @@ -621,8 +630,7 @@
*/ */
public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5) public float getPlayerRelativeBlockHardness(EntityPlayer par1EntityPlayer, World par2World, int par3, int par4, int par5)
{ {
@ -62,7 +64,7 @@
} }
/** /**
@@ -626,18 +633,13 @@ @@ -640,18 +648,13 @@
{ {
if (!par1World.isRemote) if (!par1World.isRemote)
{ {
@ -70,7 +72,7 @@
- -
- for (int var9 = 0; var9 < var8; ++var9) - for (int var9 = 0; var9 < var8; ++var9)
+ ArrayList<ItemStack> items = getBlockDropped(par1World, par2, par3, par4, par5, par7); + ArrayList<ItemStack> items = getBlockDropped(par1World, par2, par3, par4, par5, par7);
+ +
+ for (ItemStack item : items) + for (ItemStack item : items)
{ {
if (par1World.rand.nextFloat() <= par6) if (par1World.rand.nextFloat() <= par6)
@ -85,7 +87,7 @@
} }
} }
} }
@@ -964,7 +966,7 @@ @@ -985,7 +988,7 @@
par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
par2EntityPlayer.addExhaustion(0.025F); par2EntityPlayer.addExhaustion(0.025F);
@ -94,11 +96,11 @@
{ {
ItemStack var8 = this.createStackedBlock(par6); ItemStack var8 = this.createStackedBlock(par6);
@@ -1218,4 +1220,650 @@ @@ -1249,4 +1252,650 @@
canBlockGrass[0] = true; canBlockGrass[0] = true;
StatList.initBreakableStats(); StatList.initBreakableStats();
} }
+ +
+ /* =================================================== FORGE START =====================================*/ + /* =================================================== FORGE START =====================================*/
+ protected static int blockFireSpreadSpeed[] = new int[blocksList.length]; + protected static int blockFireSpreadSpeed[] = new int[blocksList.length];
+ protected static int blockFlammability[] = new int[blocksList.length]; + protected static int blockFlammability[] = new int[blocksList.length];

View File

@ -1,15 +1,14 @@
--- ../src_base/minecraft/net/minecraft/src/BlockChest.java --- ../src_base/common/net/minecraft/src/BlockChest.java
+++ ../src_work/minecraft/net/minecraft/src/BlockChest.java +++ ../src_work/common/net/minecraft/src/BlockChest.java
@@ -2,6 +2,8 @@ @@ -4,6 +4,7 @@
import cpw.mods.fml.common.asm.SideOnly;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random; import java.util.Random;
+
+import static net.minecraftforge.common.Orientation.*; +import static net.minecraftforge.common.Orientation.*;
public class BlockChest extends BlockContainer public class BlockChest extends BlockContainer
{ {
@@ -379,7 +381,7 @@ @@ -383,7 +384,7 @@
{ {
return true; return true;
} }
@ -18,7 +17,7 @@
{ {
return true; return true;
} }
@@ -387,19 +389,19 @@ @@ -391,19 +392,19 @@
{ {
return true; return true;
} }

View File

@ -1,18 +1,20 @@
--- ../src_base/minecraft/net/minecraft/src/BlockCrops.java --- ../src_base/common/net/minecraft/src/BlockCrops.java
+++ ../src_work/minecraft/net/minecraft/src/BlockCrops.java +++ ../src_work/common/net/minecraft/src/BlockCrops.java
@@ -1,5 +1,6 @@ @@ -2,6 +2,8 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.Random; import java.util.Random;
public class BlockCrops extends BlockFlower public class BlockCrops extends BlockFlower
@@ -136,25 +137,26 @@ @@ -138,25 +140,27 @@
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) 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); super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
+ } + }
+ +
+ @Override + @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune) + public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ { + {
@ -26,7 +28,7 @@
+ for (int n = 0; n < 3 + fortune; n++) + for (int n = 0; n < 3 + fortune; n++)
{ {
- int var8 = 3 + par7; - int var8 = 3 + par7;
-
- for (int var9 = 0; var9 < var8; ++var9) - for (int var9 = 0; var9 < var8; ++var9)
+ if (world.rand.nextInt(15) <= metadata) + if (world.rand.nextInt(15) <= metadata)
{ {

View File

@ -0,0 +1,19 @@
--- ../src_base/common/net/minecraft/src/BlockDoor.java
+++ ../src_work/common/net/minecraft/src/BlockDoor.java
@@ -3,6 +3,7 @@
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.util.Random;
+import static net.minecraftforge.common.Orientation.*;
public class BlockDoor extends Block
{
@@ -263,7 +264,7 @@
{
if (this.blockMaterial == Material.iron)
{
- return true;
+ return false; //Allow items to interact with the door
}
else
{

View File

@ -1,16 +1,15 @@
--- ../src_base/minecraft/net/minecraft/src/BlockFire.java --- ../src_base/common/net/minecraft/src/BlockFire.java
+++ ../src_work/minecraft/net/minecraft/src/BlockFire.java +++ ../src_work/common/net/minecraft/src/BlockFire.java
@@ -1,6 +1,9 @@ @@ -3,6 +3,8 @@
package net.minecraft.src; import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.util.Random; import java.util.Random;
+
+import net.minecraftforge.common.Orientation; +import net.minecraftforge.common.Orientation;
+import static net.minecraftforge.common.Orientation.*; +import static net.minecraftforge.common.Orientation.*;
public class BlockFire extends Block public class BlockFire extends Block
{ {
@@ -25,6 +28,8 @@ @@ -27,6 +29,8 @@
*/ */
public void initializeBlock() public void initializeBlock()
{ {
@ -19,7 +18,7 @@
this.setBurnRate(Block.planks.blockID, 5, 20); this.setBurnRate(Block.planks.blockID, 5, 20);
this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20); this.setBurnRate(Block.woodDoubleSlab.blockID, 5, 20);
this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20); this.setBurnRate(Block.woodSingleSlab.blockID, 5, 20);
@@ -49,8 +54,7 @@ @@ -51,8 +55,7 @@
*/ */
private void setBurnRate(int par1, int par2, int par3) private void setBurnRate(int par1, int par2, int par3)
{ {
@ -29,7 +28,7 @@
} }
/** /**
@@ -108,12 +112,8 @@ @@ -110,12 +113,8 @@
*/ */
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{ {
@ -44,13 +43,7 @@
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{ {
@@ -137,12 +137,12 @@ @@ -144,7 +143,7 @@
if (!var6 && !this.canNeighborBurn(par1World, par2, par3, par4))
{
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) || var7 > 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) || var7 > 3)
{
par1World.setBlockWithNotify(par2, par3, par4, 0); par1World.setBlockWithNotify(par2, par3, par4, 0);
} }
} }
@ -59,7 +52,7 @@
{ {
par1World.setBlockWithNotify(par2, par3, par4, 0); par1World.setBlockWithNotify(par2, par3, par4, 0);
} }
@@ -156,12 +156,12 @@ @@ -158,12 +157,12 @@
var9 = -50; var9 = -50;
} }
@ -72,13 +65,13 @@
+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7, WEST ); + this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7, WEST );
+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7, EAST ); + this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7, EAST );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7, UP ); + this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7, UP );
+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7, DOWN); + this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7, DOWN );
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7, SOUTH); + this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7, SOUTH);
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7, NORTH); + this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7, NORTH);
for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10) for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10)
{ {
@@ -211,7 +211,16 @@ @@ -213,7 +212,16 @@
private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7) private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7)
{ {
@ -96,7 +89,7 @@
if (par6Random.nextInt(par5) < var8) if (par6Random.nextInt(par5) < var8)
{ {
@@ -245,7 +254,12 @@ @@ -247,7 +255,12 @@
*/ */
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4) private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
{ {
@ -110,7 +103,7 @@
} }
/** /**
@@ -261,12 +275,12 @@ @@ -263,12 +276,12 @@
} }
else else
{ {
@ -121,15 +114,15 @@
- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6); - var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6);
- var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6); - var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6);
+ int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5, WEST); + int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5, WEST);
+ var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6, EAST ); + var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6, EAST);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6, UP ); + var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6, UP);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6, DOWN ); + var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6, DOWN);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6, SOUTH); + var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6, SOUTH);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6, NORTH); + var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6, NORTH);
return var6; return var6;
} }
} }
@@ -281,21 +295,24 @@ @@ -283,21 +296,24 @@
/** /**
* Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z * Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
@ -159,7 +152,7 @@
} }
/** /**
@@ -351,9 +368,9 @@ @@ -355,9 +371,9 @@
float var8; float var8;
float var9; float var9;
@ -172,7 +165,7 @@
{ {
for (var6 = 0; var6 < 2; ++var6) for (var6 = 0; var6 < 2; ++var6)
{ {
@@ -364,7 +381,7 @@ @@ -368,7 +384,7 @@
} }
} }
@ -181,7 +174,7 @@
{ {
for (var6 = 0; var6 < 2; ++var6) for (var6 = 0; var6 < 2; ++var6)
{ {
@@ -375,7 +392,7 @@ @@ -379,7 +395,7 @@
} }
} }
@ -190,7 +183,7 @@
{ {
for (var6 = 0; var6 < 2; ++var6) for (var6 = 0; var6 < 2; ++var6)
{ {
@@ -386,7 +403,7 @@ @@ -390,7 +406,7 @@
} }
} }
@ -199,7 +192,7 @@
{ {
for (var6 = 0; var6 < 2; ++var6) for (var6 = 0; var6 < 2; ++var6)
{ {
@@ -397,7 +414,7 @@ @@ -401,7 +417,7 @@
} }
} }
@ -208,11 +201,11 @@
{ {
for (var6 = 0; var6 < 2; ++var6) for (var6 = 0; var6 < 2; ++var6)
{ {
@@ -419,4 +436,46 @@ @@ -423,4 +439,46 @@
} }
} }
} }
+ +
+ /** + /**
+ * Side sensitive version that calls the block function. + * Side sensitive version that calls the block function.
+ * + *

View File

@ -1,16 +1,15 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLadder.java --- ../src_base/common/net/minecraft/src/BlockLadder.java
+++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java +++ ../src_work/common/net/minecraft/src/BlockLadder.java
@@ -1,6 +1,9 @@ @@ -3,6 +3,8 @@
package net.minecraft.src; import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.util.Random; import java.util.Random;
+
+import net.minecraftforge.common.Orientation; +import net.minecraftforge.common.Orientation;
+import static net.minecraftforge.common.Orientation.*; +import static net.minecraftforge.common.Orientation.*;
public class BlockLadder extends Block public class BlockLadder extends Block
{ {
@@ -103,7 +106,10 @@ @@ -107,7 +109,10 @@
*/ */
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{ {
@ -22,7 +21,7 @@
} }
/** /**
@@ -113,22 +119,22 @@ @@ -117,22 +122,22 @@
{ {
int var9 = par1World.getBlockMetadata(par2, par3, par4); int var9 = par1World.getBlockMetadata(par2, par3, par4);
@ -49,7 +48,7 @@
{ {
var9 = 5; var9 = 5;
} }
@@ -145,22 +151,22 @@ @@ -149,22 +154,22 @@
int var6 = par1World.getBlockMetadata(par2, par3, par4); int var6 = par1World.getBlockMetadata(par2, par3, par4);
boolean var7 = false; boolean var7 = false;
@ -76,11 +75,11 @@
{ {
var7 = true; var7 = true;
} }
@@ -181,4 +187,10 @@ @@ -185,4 +190,10 @@
{ {
return 1; return 1;
} }
+ +
+ @Override + @Override
+ public boolean isLadder(World world, int x, int y, int z) + public boolean isLadder(World world, int x, int y, int z)
+ { + {

View File

@ -1,8 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLeaves.java --- ../src_base/common/net/minecraft/src/BlockLeaves.java
+++ ../src_work/minecraft/net/minecraft/src/BlockLeaves.java +++ ../src_work/common/net/minecraft/src/BlockLeaves.java
@@ -1,9 +1,12 @@ @@ -2,10 +2,14 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -14,7 +16,7 @@
{ {
/** /**
* The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can * The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can
@@ -91,10 +94,9 @@ @@ -98,10 +102,9 @@
{ {
int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11);
@ -27,7 +29,7 @@
} }
} }
} }
@@ -140,11 +142,13 @@ @@ -147,11 +150,13 @@
{ {
var15 = par1World.getBlockId(par2 + var12, par3 + var13, par4 + var14); var15 = par1World.getBlockId(par2 + var12, par3 + var13, par4 + var14);
@ -43,7 +45,7 @@
{ {
this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2; this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2;
} }
@@ -285,15 +289,7 @@ @@ -294,15 +299,7 @@
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{ {
@ -60,7 +62,7 @@
} }
/** /**
@@ -340,4 +336,30 @@ @@ -353,4 +350,30 @@
par3List.add(new ItemStack(par1, 1, 2)); par3List.add(new ItemStack(par1, 1, 2));
par3List.add(new ItemStack(par1, 1, 3)); par3List.add(new ItemStack(par1, 1, 3));
} }
@ -78,13 +80,13 @@
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
+ return ret; + return ret;
+ } + }
+ +
+ @Override + @Override
+ public void beginLeavesDecay(World world, int x, int y, int z) + public void beginLeavesDecay(World world, int x, int y, int z)
+ { + {
+ world.setBlockMetadata(x, y, z, world.getBlockMetadata(x, y, z) | 8); + world.setBlockMetadata(x, y, z, world.getBlockMetadata(x, y, z) | 8);
+ } + }
+ +
+ @Override + @Override
+ public boolean isLeaves(World world, int x, int y, int z) + public boolean isLeaves(World world, int x, int y, int z)
+ { + {

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLog.java --- ../src_base/common/net/minecraft/src/BlockLog.java
+++ ../src_work/minecraft/net/minecraft/src/BlockLog.java +++ ../src_work/common/net/minecraft/src/BlockLog.java
@@ -57,14 +57,9 @@ @@ -59,14 +59,9 @@
{ {
int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11); int var12 = par1World.getBlockId(par2 + var9, par3 + var10, par4 + var11);
@ -17,7 +17,7 @@
} }
} }
} }
@@ -144,4 +139,16 @@ @@ -148,4 +143,16 @@
{ {
return new ItemStack(this.blockID, 1, limitToValidMetadata(par1)); return new ItemStack(this.blockID, 1, limitToValidMetadata(par1));
} }

View File

@ -1,13 +1,15 @@
--- ../src_base/minecraft/net/minecraft/src/BlockNetherStalk.java --- ../src_base/common/net/minecraft/src/BlockNetherStalk.java
+++ ../src_work/minecraft/net/minecraft/src/BlockNetherStalk.java +++ ../src_work/common/net/minecraft/src/BlockNetherStalk.java
@@ -1,5 +1,6 @@ @@ -2,6 +2,8 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.Random; import java.util.Random;
public class BlockNetherStalk extends BlockFlower public class BlockNetherStalk extends BlockFlower
@@ -67,25 +68,7 @@ @@ -69,25 +71,7 @@
*/ */
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7) public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{ {
@ -34,7 +36,7 @@
} }
/** /**
@@ -111,4 +94,23 @@ @@ -115,4 +99,23 @@
{ {
return Item.netherStalkSeeds.shiftedIndex; return Item.netherStalkSeeds.shiftedIndex;
} }

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/BlockPistonBase.java --- ../src_base/common/net/minecraft/src/BlockPistonBase.java
+++ ../src_work/minecraft/net/minecraft/src/BlockPistonBase.java +++ ../src_work/common/net/minecraft/src/BlockPistonBase.java
@@ -364,7 +364,7 @@ @@ -368,7 +368,7 @@
return false; return false;
} }

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java --- ../src_base/common/net/minecraft/src/BlockRedstoneWire.java
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java +++ ../src_work/common/net/minecraft/src/BlockRedstoneWire.java
@@ -550,7 +550,7 @@ @@ -556,7 +556,7 @@
} }
else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID) else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID)
{ {

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/BlockSnow.java --- ../src_base/common/net/minecraft/src/BlockSnow.java
+++ ../src_work/minecraft/net/minecraft/src/BlockSnow.java +++ ../src_work/common/net/minecraft/src/BlockSnow.java
@@ -55,7 +55,8 @@ @@ -57,7 +57,8 @@
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{ {
int var5 = par1World.getBlockId(par2, par3 - 1, par4); int var5 = par1World.getBlockId(par2, par3 - 1, par4);
@ -10,7 +10,7 @@
} }
/** /**
@@ -74,7 +75,6 @@ @@ -76,7 +77,6 @@
{ {
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{ {
@ -18,7 +18,7 @@
par1World.setBlockWithNotify(par2, par3, par4, 0); par1World.setBlockWithNotify(par2, par3, par4, 0);
return false; return false;
} }
@@ -90,15 +90,7 @@ @@ -92,15 +92,7 @@
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{ {
@ -35,7 +35,7 @@
par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1); par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
} }
@@ -115,7 +107,7 @@ @@ -117,7 +109,7 @@
*/ */
public int quantityDropped(Random par1Random) public int quantityDropped(Random par1Random)
{ {
@ -44,7 +44,7 @@
} }
/** /**
@@ -125,7 +117,6 @@ @@ -127,7 +119,6 @@
{ {
if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11) if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11)
{ {

View File

@ -1,8 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTallGrass.java --- ../src_base/common/net/minecraft/src/BlockTallGrass.java
+++ ../src_work/minecraft/net/minecraft/src/BlockTallGrass.java +++ ../src_work/common/net/minecraft/src/BlockTallGrass.java
@@ -1,9 +1,13 @@ @@ -2,10 +2,15 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@ -15,7 +17,7 @@
{ {
protected BlockTallGrass(int par1, int par2) protected BlockTallGrass(int par1, int par2)
{ {
@@ -50,7 +54,7 @@ @@ -57,7 +62,7 @@
*/ */
public int idDropped(int par1, Random par2Random, int par3) public int idDropped(int par1, Random par2Random, int par3)
{ {
@ -24,7 +26,7 @@
} }
/** /**
@@ -67,15 +71,7 @@ @@ -74,15 +79,7 @@
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{ {
@ -40,12 +42,12 @@
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
} }
/** @SideOnly(Side.CLIENT)
@@ -96,4 +92,35 @@ @@ -107,4 +104,35 @@
par3List.add(new ItemStack(par1, 1, var4)); par3List.add(new ItemStack(par1, 1, var4));
} }
} }
+ +
+ @Override + @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int meta, int fortune) + public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int meta, int fortune)
+ { + {
@ -54,7 +56,7 @@
+ { + {
+ return ret; + return ret;
+ } + }
+ +
+ ItemStack item = ForgeHooks.getGrassSeed(world); + ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null) + if (item != null)
+ { + {

View File

@ -1,34 +1,24 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTorch.java --- ../src_base/common/net/minecraft/src/BlockTorch.java
+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java +++ ../src_work/common/net/minecraft/src/BlockTorch.java
@@ -1,6 +1,9 @@ @@ -3,6 +3,8 @@
package net.minecraft.src; import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.util.Random; import java.util.Random;
+
+import net.minecraftforge.common.Orientation; +import net.minecraftforge.common.Orientation;
+import static net.minecraftforge.common.Orientation.*; +import static net.minecraftforge.common.Orientation.*;
public class BlockTorch extends Block public class BlockTorch extends Block
{ {
@@ -50,15 +53,8 @@ @@ -59,7 +61,7 @@
*/ else
private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4) {
{ int var5 = par1World.getBlockId(par2, par3, par4);
- if (par1World.doesBlockHaveSolidTopSurface(par2, par3, par4))
- {
- return true;
- }
- else
- {
- int var5 = par1World.getBlockId(par2, par3, par4);
- return var5 == Block.fence.blockID || var5 == Block.netherFence.blockID || var5 == Block.glass.blockID; - return var5 == Block.fence.blockID || var5 == Block.netherFence.blockID || var5 == Block.glass.blockID;
- } + return (Block.blocksList[var5] != null && Block.blocksList[var5].canPlaceTorchOnTop(par1World, par2, par3, par4));
+ int id = par1World.getBlockId(par2, par3, par4); }
+ return (Block.blocksList[id] != null && Block.blocksList[id].canPlaceTorchOnTop(par1World, par2, par3, par4));
} }
/** @@ -68,7 +70,11 @@
@@ -66,7 +62,11 @@
*/ */
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{ {
@ -41,7 +31,7 @@
} }
/** /**
@@ -81,22 +81,22 @@ @@ -83,22 +89,22 @@
var9 = 5; var9 = 5;
} }
@ -58,17 +48,17 @@
} }
- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true)) - if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, NORTH, true)) + if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, WEST, true))
{ {
var9 = 2; var9 = 2;
} }
- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true)) - if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, SOUTH, true)) + if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, EAST, true))
{ {
var9 = 1; var9 = 1;
} }
@@ -122,19 +122,19 @@ @@ -124,19 +130,19 @@
*/ */
public void onBlockAdded(World par1World, int par2, int par3, int par4) public void onBlockAdded(World par1World, int par2, int par3, int par4)
{ {
@ -92,7 +82,7 @@
{ {
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4); par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
} }
@@ -157,22 +157,22 @@ @@ -159,22 +165,22 @@
int var6 = par1World.getBlockMetadata(par2, par3, par4); int var6 = par1World.getBlockMetadata(par2, par3, par4);
boolean var7 = false; boolean var7 = false;

View File

@ -1,20 +1,21 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java --- ../src_base/common/net/minecraft/src/BlockTrapDoor.java
+++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java +++ ../src_work/common/net/minecraft/src/BlockTrapDoor.java
@@ -1,7 +1,13 @@ @@ -1,10 +1,14 @@
package net.minecraft.src; package net.minecraft.src;
+
+import net.minecraftforge.common.Orientation; +import net.minecraftforge.common.Orientation;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
public class BlockTrapDoor extends Block public class BlockTrapDoor extends Block
{ {
+
+ /** Set this to allow trapdoors to remain free-floating */ + /** Set this to allow trapdoors to remain free-floating */
+ public static boolean disableValidation = false; + public static boolean disableValidation = false;
+ +
protected BlockTrapDoor(int par1, Material par2Material) protected BlockTrapDoor(int par1, Material par2Material)
{ {
super(par1, par2Material); super(par1, par2Material);
@@ -183,7 +189,7 @@ @@ -188,7 +192,7 @@
--var7; --var7;
} }
@ -23,7 +24,7 @@
{ {
par1World.setBlockWithNotify(par2, par3, par4, 0); par1World.setBlockWithNotify(par2, par3, par4, 0);
this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0); this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0);
@@ -243,6 +249,10 @@ @@ -248,6 +252,10 @@
*/ */
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5) public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{ {
@ -34,7 +35,7 @@
if (par5 == 0) if (par5 == 0)
{ {
return false; return false;
@@ -273,7 +283,7 @@ @@ -278,7 +286,7 @@
--par2; --par2;
} }
@ -43,7 +44,7 @@
} }
} }
@@ -288,6 +298,10 @@ @@ -293,6 +301,10 @@
*/ */
private static boolean isValidSupportBlock(int par0) private static boolean isValidSupportBlock(int par0)
{ {

View File

@ -1,18 +1,21 @@
--- ../src_base/minecraft/net/minecraft/src/BlockVine.java --- ../src_base/common/net/minecraft/src/BlockVine.java
+++ ../src_work/minecraft/net/minecraft/src/BlockVine.java +++ ../src_work/common/net/minecraft/src/BlockVine.java
@@ -2,7 +2,10 @@ @@ -2,9 +2,13 @@
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList;
import java.util.Random; import java.util.Random;
-public class BlockVine extends Block -public class BlockVine extends Block
+import java.util.ArrayList;
+import net.minecraftforge.common.IShearable; +import net.minecraftforge.common.IShearable;
+ +
+public class BlockVine extends Block implements IShearable +public class BlockVine extends Block implements IShearable
{ {
public BlockVine(int par1) public BlockVine(int par1)
{ {
@@ -424,14 +427,26 @@ @@ -431,14 +435,26 @@
*/ */
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{ {
@ -27,13 +30,13 @@
- } - }
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6); + super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
+ } + }
+ +
+ @Override + @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z) + public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ { + {
+ return true; + return true;
+ } + }
+ +
+ @Override + @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune) + public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ { + {
@ -41,7 +44,7 @@
+ ret.add(new ItemStack(this, 1, 0)); + ret.add(new ItemStack(this, 1, 0));
+ return ret; + return ret;
+ } + }
+ +
+ @Override + @Override
+ public boolean isLadder(World world, int x, int y, int z) + public boolean isLadder(World world, int x, int y, int z)
+ { + {

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/Chunk.java --- ../src_base/common/net/minecraft/src/Chunk.java
+++ ../src_work/minecraft/net/minecraft/src/Chunk.java +++ ../src_work/common/net/minecraft/src/Chunk.java
@@ -7,6 +7,9 @@ @@ -9,6 +9,9 @@
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
@ -10,7 +10,7 @@
public class Chunk public class Chunk
{ {
@@ -120,7 +123,9 @@ @@ -122,7 +125,9 @@
{ {
for (int var8 = 0; var8 < var5; ++var8) for (int var8 = 0; var8 < var5; ++var8)
{ {
@ -21,7 +21,7 @@
if (var9 != 0) if (var9 != 0)
{ {
@@ -132,6 +137,48 @@ @@ -134,6 +139,48 @@
} }
this.storageArrays[var10].setExtBlockID(var6, var8 & 15, var7, var9); this.storageArrays[var10].setExtBlockID(var6, var8 & 15, var7, var9);
@ -53,7 +53,7 @@
+ for (int y = 0; y < var5; ++y) + for (int y = 0; y < var5; ++y)
+ { + {
+ int idx = x << 11 | z << 7 | y; + int idx = x << 11 | z << 7 | y;
+ int id = ids[idx] & 0xFF; + int id = ids[idx] & 0xFF;
+ int meta = metadata[idx]; + int meta = metadata[idx];
+ +
+ if (id != 0) + if (id != 0)
@ -70,7 +70,7 @@
} }
} }
} }
@@ -503,7 +550,7 @@ @@ -507,7 +554,7 @@
*/ */
public int getBlockID(int par1, int par2, int par3) public int getBlockID(int par1, int par2, int par3)
{ {
@ -79,7 +79,7 @@
{ {
return 0; return 0;
} }
@@ -519,7 +566,7 @@ @@ -523,7 +570,7 @@
*/ */
public int getBlockMetadata(int par1, int par2, int par3) public int getBlockMetadata(int par1, int par2, int par3)
{ {
@ -88,7 +88,7 @@
{ {
return 0; return 0;
} }
@@ -560,6 +607,11 @@ @@ -564,6 +611,11 @@
} }
else else
{ {
@ -100,7 +100,7 @@
ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4]; ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4];
boolean var11 = false; boolean var11 = false;
@@ -590,7 +642,7 @@ @@ -594,7 +646,7 @@
{ {
Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9); Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9);
} }
@ -109,7 +109,7 @@
{ {
this.worldObj.removeBlockTileEntity(var12, par2, var13); this.worldObj.removeBlockTileEntity(var12, par2, var13);
} }
@@ -634,29 +686,21 @@ @@ -638,29 +690,21 @@
Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13); Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13);
} }
@ -142,7 +142,7 @@
} }
} }
@@ -671,7 +715,7 @@ @@ -675,7 +719,7 @@
*/ */
public boolean setBlockMetadata(int par1, int par2, int par3, int par4) public boolean setBlockMetadata(int par1, int par2, int par3, int par4)
{ {
@ -151,7 +151,7 @@
if (var5 == null) if (var5 == null)
{ {
@@ -691,7 +735,7 @@ @@ -695,7 +739,7 @@
var5.setExtBlockMetadata(par1, par2 & 15, par3, par4); var5.setExtBlockMetadata(par1, par2 & 15, par3, par4);
int var7 = var5.getExtBlockID(par1, par2 & 15, par3); int var7 = var5.getExtBlockID(par1, par2 & 15, par3);
@ -160,7 +160,7 @@
{ {
TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3); TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3);
@@ -712,7 +756,7 @@ @@ -716,7 +760,7 @@
*/ */
public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4) public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
{ {
@ -169,7 +169,7 @@
return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue)); return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
} }
@@ -722,6 +766,11 @@ @@ -726,6 +770,11 @@
*/ */
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5) public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
{ {
@ -181,7 +181,7 @@
ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4]; ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4];
if (var6 == null) if (var6 == null)
@@ -750,7 +799,7 @@ @@ -754,7 +803,7 @@
*/ */
public int getBlockLightValue(int par1, int par2, int par3, int par4) public int getBlockLightValue(int par1, int par2, int par3, int par4)
{ {
@ -190,7 +190,7 @@
if (var5 == null) if (var5 == null)
{ {
@@ -853,33 +902,32 @@ @@ -857,33 +906,33 @@
ChunkPosition var4 = new ChunkPosition(par1, par2, par3); ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4); TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
@ -203,7 +203,7 @@
if (var5 == null) if (var5 == null)
{ {
int var6 = this.getBlockID(par1, par2, par3); int var6 = this.getBlockID(par1, par2, par3);
-
- if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity()) - if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity())
+ int meta = this.getBlockMetadata(par1, par2, par3); + int meta = this.getBlockMetadata(par1, par2, par3);
+ +
@ -235,7 +235,7 @@
} }
/** /**
@@ -894,7 +942,7 @@ @@ -898,7 +947,7 @@
if (this.isChunkLoaded) if (this.isChunkLoaded)
{ {
@ -244,7 +244,7 @@
} }
} }
@@ -909,8 +957,14 @@ @@ -913,8 +962,14 @@
par4TileEntity.yCoord = par2; par4TileEntity.yCoord = par2;
par4TileEntity.zCoord = this.zPosition * 16 + par3; par4TileEntity.zCoord = this.zPosition * 16 + par3;
@ -261,7 +261,7 @@
par4TileEntity.validate(); par4TileEntity.validate();
this.chunkTileEntityMap.put(var5, par4TileEntity); this.chunkTileEntityMap.put(var5, par4TileEntity);
} }
@@ -949,6 +1003,7 @@ @@ -953,6 +1008,7 @@
List var4 = var1[var3]; List var4 = var1[var3];
this.worldObj.addLoadedEntities(var4); this.worldObj.addLoadedEntities(var4);
} }
@ -269,7 +269,7 @@
} }
/** /**
@@ -973,6 +1028,7 @@ @@ -977,6 +1033,7 @@
List var4 = var5[var3]; List var4 = var5[var3];
this.worldObj.unloadEntities(var4); this.worldObj.unloadEntities(var4);
} }
@ -277,7 +277,7 @@
} }
/** /**
@@ -989,8 +1045,8 @@ @@ -993,8 +1050,8 @@
*/ */
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List) public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List)
{ {
@ -288,7 +288,7 @@
if (var4 < 0) if (var4 < 0)
{ {
@@ -1038,8 +1094,8 @@ @@ -1042,8 +1099,8 @@
*/ */
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List) public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List)
{ {
@ -299,7 +299,7 @@
if (var4 < 0) if (var4 < 0)
{ {
@@ -1221,6 +1277,15 @@ @@ -1225,6 +1282,15 @@
*/ */
public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4) public void fillChunk(byte[] par1ArrayOfByte, int par2, int par3, boolean par4)
{ {
@ -315,7 +315,7 @@
int var5 = 0; int var5 = 0;
int var6; int var6;
@@ -1317,12 +1382,26 @@ @@ -1321,12 +1387,26 @@
} }
this.generateHeightMap(); this.generateHeightMap();
@ -348,7 +348,7 @@
} }
} }
@@ -1431,4 +1510,18 @@ @@ -1437,4 +1517,18 @@
} }
} }
} }
@ -359,11 +359,11 @@
+ ChunkPosition position = new ChunkPosition(x, y, z); + ChunkPosition position = new ChunkPosition(x, y, z);
+ if (isChunkLoaded) + if (isChunkLoaded)
+ { + {
+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(position); + TileEntity entity = (TileEntity)chunkTileEntityMap.get(position);
+ if (entity != null && entity.isInvalid()) + if (entity != null && entity.isInvalid())
+ { + {
+ chunkTileEntityMap.remove(position); + chunkTileEntityMap.remove(position);
+ } + }
+ } + }
+ } + }
} }

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/ContainerFurnace.java --- ../src_base/common/net/minecraft/src/ContainerFurnace.java
+++ ../src_work/minecraft/net/minecraft/src/ContainerFurnace.java +++ ../src_work/common/net/minecraft/src/ContainerFurnace.java
@@ -119,7 +119,7 @@ @@ -122,7 +122,7 @@
} }
else if (par1 != 1 && par1 != 0) else if (par1 != 1 && par1 != 0)
{ {

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/Enchantment.java --- ../src_base/common/net/minecraft/src/Enchantment.java
+++ ../src_work/minecraft/net/minecraft/src/Enchantment.java +++ ../src_work/common/net/minecraft/src/Enchantment.java
@@ -191,4 +191,14 @@ @@ -198,4 +198,14 @@
String var2 = StatCollector.translateToLocal(this.getName()); String var2 = StatCollector.translateToLocal(this.getName());
return var2 + " " + StatCollector.translateToLocal("enchantment.level." + par1); return var2 + " " + StatCollector.translateToLocal("enchantment.level." + par1);
} }

View File

@ -1,25 +1,26 @@
--- ../src_base/minecraft/net/minecraft/src/Entity.java --- ../src_base/common/net/minecraft/src/Entity.java
+++ ../src_work/minecraft/net/minecraft/src/Entity.java +++ ../src_work/common/net/minecraft/src/Entity.java
@@ -1,5 +1,6 @@ @@ -2,6 +2,8 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -180,6 +181,11 @@ @@ -186,6 +188,10 @@
public boolean ignoreFrustumCheck;
public boolean isAirBorne; public boolean isAirBorne;
public EnumEntitySize myEntitySize; public EnumEntitySize myEntitySize;
+ /** Forge: Used to store custom data for each entity. */ + /** Forge: Used to store custom data for each entity. */
+ private NBTTagCompound customEntityData; + private NBTTagCompound customEntityData;
+ protected boolean captureDrops = false; + protected boolean captureDrops = false;
+ protected ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>(); + protected ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
+
public Entity(World par1World) public Entity(World par1World)
{ {
this.entityId = nextEntityID++; @@ -1382,6 +1388,10 @@
@@ -1364,6 +1370,10 @@
par1NBTTagCompound.setShort("Fire", (short)this.fire); par1NBTTagCompound.setShort("Fire", (short)this.fire);
par1NBTTagCompound.setShort("Air", (short)this.getAir()); par1NBTTagCompound.setShort("Air", (short)this.getAir());
par1NBTTagCompound.setBoolean("OnGround", this.onGround); par1NBTTagCompound.setBoolean("OnGround", this.onGround);
@ -30,7 +31,7 @@
this.writeEntityToNBT(par1NBTTagCompound); this.writeEntityToNBT(par1NBTTagCompound);
} }
@@ -1405,6 +1415,10 @@ @@ -1423,6 +1433,10 @@
this.onGround = par1NBTTagCompound.getBoolean("OnGround"); this.onGround = par1NBTTagCompound.getBoolean("OnGround");
this.setPosition(this.posX, this.posY, this.posZ); this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch); this.setRotation(this.rotationYaw, this.rotationPitch);
@ -41,7 +42,7 @@
this.readEntityFromNBT(par1NBTTagCompound); this.readEntityFromNBT(par1NBTTagCompound);
} }
@@ -1490,7 +1504,14 @@ @@ -1509,7 +1523,14 @@
{ {
EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack); EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
var3.delayBeforeCanPickup = 10; var3.delayBeforeCanPickup = 10;
@ -57,7 +58,7 @@
return var3; return var3;
} }
@@ -1813,7 +1834,7 @@ @@ -1843,7 +1864,7 @@
*/ */
public boolean isRiding() public boolean isRiding()
{ {
@ -66,7 +67,7 @@
} }
/** /**
@@ -2074,4 +2095,27 @@ @@ -2107,4 +2128,27 @@
{ {
return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] {this.getClass().getSimpleName(), this.getEntityName(), Integer.valueOf(this.entityId), this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(), Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)}); return String.format("%s[\'%s\'/%d, l=\'%s\', x=%.2f, y=%.2f, z=%.2f]", new Object[] {this.getClass().getSimpleName(), this.getEntityName(), Integer.valueOf(this.entityId), this.worldObj == null ? "~NULL~" : this.worldObj.getWorldInfo().getWorldName(), Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ)});
} }
@ -84,7 +85,7 @@
+ } + }
+ return customEntityData; + return customEntityData;
+ } + }
+ +
+ /** + /**
+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. + * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. + * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.

View File

@ -1,10 +1,9 @@
--- ../src_base/minecraft/net/minecraft/src/EntityLiving.java --- ../src_base/common/net/minecraft/src/EntityLiving.java
+++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java +++ ../src_work/common/net/minecraft/src/EntityLiving.java
@@ -5,6 +5,11 @@ @@ -7,6 +7,10 @@
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
+
+import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.living.*; +import net.minecraftforge.event.entity.living.*;
@ -12,7 +11,7 @@
public abstract class EntityLiving extends Entity public abstract class EntityLiving extends Entity
{ {
@@ -310,6 +315,7 @@ @@ -314,6 +318,7 @@
public void setAttackTarget(EntityLiving par1EntityLiving) public void setAttackTarget(EntityLiving par1EntityLiving)
{ {
this.attackTarget = par1EntityLiving; this.attackTarget = par1EntityLiving;
@ -20,7 +19,7 @@
} }
public boolean isExplosiveMob(Class par1Class) public boolean isExplosiveMob(Class par1Class)
@@ -366,6 +372,7 @@ @@ -370,6 +375,7 @@
{ {
this.entityLivingToAttack = par1EntityLiving; this.entityLivingToAttack = par1EntityLiving;
this.revengeTimer = this.entityLivingToAttack != null ? 60 : 0; this.revengeTimer = this.entityLivingToAttack != null ? 60 : 0;
@ -28,7 +27,7 @@
} }
protected void entityInit() protected void entityInit()
@@ -648,6 +655,11 @@ @@ -656,6 +662,11 @@
*/ */
public void onUpdate() public void onUpdate()
{ {
@ -40,7 +39,7 @@
super.onUpdate(); super.onUpdate();
if (this.arrowHitTempCounter > 0) if (this.arrowHitTempCounter > 0)
@@ -815,6 +827,11 @@ @@ -823,6 +834,11 @@
*/ */
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2) public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{ {
@ -52,7 +51,7 @@
if (this.worldObj.isRemote) if (this.worldObj.isRemote)
{ {
return false; return false;
@@ -997,6 +1014,13 @@ @@ -1007,6 +1023,13 @@
*/ */
protected void damageEntity(DamageSource par1DamageSource, int par2) protected void damageEntity(DamageSource par1DamageSource, int par2)
{ {
@ -66,7 +65,7 @@
par2 = this.applyArmorCalculations(par1DamageSource, par2); par2 = this.applyArmorCalculations(par1DamageSource, par2);
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.health -= par2; this.health -= par2;
@@ -1060,6 +1084,11 @@ @@ -1070,6 +1093,11 @@
*/ */
public void onDeath(DamageSource par1DamageSource) public void onDeath(DamageSource par1DamageSource)
{ {
@ -78,7 +77,7 @@
Entity var2 = par1DamageSource.getEntity(); Entity var2 = par1DamageSource.getEntity();
if (this.scoreValue >= 0 && var2 != null) if (this.scoreValue >= 0 && var2 != null)
@@ -1083,13 +1112,17 @@ @@ -1093,13 +1121,17 @@
var3 = EnchantmentHelper.getLootingModifier(((EntityPlayer)var2).inventory); var3 = EnchantmentHelper.getLootingModifier(((EntityPlayer)var2).inventory);
} }
@ -97,7 +96,7 @@
if (var4 < 5) if (var4 < 5)
{ {
@@ -1097,6 +1130,16 @@ @@ -1107,6 +1139,16 @@
} }
} }
} }
@ -114,7 +113,7 @@
} }
this.worldObj.setEntityState(this, (byte)3); this.worldObj.setEntityState(this, (byte)3);
@@ -1140,6 +1183,13 @@ @@ -1150,6 +1192,13 @@
*/ */
protected void fall(float par1) protected void fall(float par1)
{ {
@ -128,7 +127,7 @@
super.fall(par1); super.fall(par1);
int var2 = MathHelper.ceiling_float_int(par1 - 3.0F); int var2 = MathHelper.ceiling_float_int(par1 - 3.0F);
@@ -1327,7 +1377,7 @@ @@ -1337,7 +1386,7 @@
int var2 = MathHelper.floor_double(this.boundingBox.minY); int var2 = MathHelper.floor_double(this.boundingBox.minY);
int var3 = MathHelper.floor_double(this.posZ); int var3 = MathHelper.floor_double(this.posZ);
int var4 = this.worldObj.getBlockId(var1, var2, var3); int var4 = this.worldObj.getBlockId(var1, var2, var3);
@ -137,7 +136,7 @@
} }
/** /**
@@ -1590,6 +1640,7 @@ @@ -1600,6 +1649,7 @@
} }
this.isAirBorne = true; this.isAirBorne = true;

View File

@ -1,11 +1,12 @@
--- ../src_base/minecraft/net/minecraft/src/EntityMinecart.java --- ../src_base/common/net/minecraft/src/EntityMinecart.java
+++ ../src_work/minecraft/net/minecraft/src/EntityMinecart.java +++ ../src_work/common/net/minecraft/src/EntityMinecart.java
@@ -1,6 +1,14 @@ @@ -2,7 +2,15 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.List; import java.util.List;
+
+import net.minecraftforge.common.IMinecartCollisionHandler; +import net.minecraftforge.common.IMinecartCollisionHandler;
+import net.minecraftforge.common.MinecartRegistry; +import net.minecraftforge.common.MinecartRegistry;
+import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.MinecraftForge;
@ -15,9 +16,9 @@
public class EntityMinecart extends Entity implements IInventory public class EntityMinecart extends Entity implements IInventory
{ {
@@ -26,6 +34,23 @@ @@ -31,6 +39,23 @@
private double velocityY; @SideOnly(Side.CLIENT)
private double velocityZ; protected double velocityZ;
+ /* Forge: Minecart Compatibility Layer Integration. */ + /* Forge: Minecart Compatibility Layer Integration. */
+ public static float defaultMaxSpeedRail = 0.4f; + public static float defaultMaxSpeedRail = 0.4f;
@ -39,7 +40,7 @@
public EntityMinecart(World par1World) public EntityMinecart(World par1World)
{ {
super(par1World); super(par1World);
@@ -35,6 +60,18 @@ @@ -40,6 +65,18 @@
this.preventEntitySpawning = true; this.preventEntitySpawning = true;
this.setSize(0.98F, 0.7F); this.setSize(0.98F, 0.7F);
this.yOffset = this.height / 2.0F; this.yOffset = this.height / 2.0F;
@ -58,7 +59,7 @@
} }
/** /**
@@ -60,6 +97,10 @@ @@ -65,6 +102,10 @@
*/ */
public AxisAlignedBB getCollisionBox(Entity par1Entity) public AxisAlignedBB getCollisionBox(Entity par1Entity)
{ {
@ -69,7 +70,7 @@
return par1Entity.boundingBox; return par1Entity.boundingBox;
} }
@@ -68,6 +109,10 @@ @@ -73,6 +114,10 @@
*/ */
public AxisAlignedBB getBoundingBox() public AxisAlignedBB getBoundingBox()
{ {
@ -80,7 +81,7 @@
return null; return null;
} }
@@ -76,7 +121,7 @@ @@ -81,7 +126,7 @@
*/ */
public boolean canBePushed() public boolean canBePushed()
{ {
@ -89,7 +90,7 @@
} }
public EntityMinecart(World par1World, double par2, double par4, double par6, int par8) public EntityMinecart(World par1World, double par2, double par4, double par6, int par8)
@@ -125,48 +170,7 @@ @@ -130,48 +175,7 @@
} }
this.setDead(); this.setDead();
@ -139,7 +140,7 @@
} }
return true; return true;
@@ -259,7 +263,7 @@ @@ -266,7 +270,7 @@
this.kill(); this.kill();
} }
@ -148,7 +149,7 @@
{ {
this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D); this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D);
} }
@@ -303,49 +307,26 @@ @@ -310,17 +314,17 @@
double var6 = 0.0078125D; double var6 = 0.0078125D;
int var8 = this.worldObj.getBlockId(var1, var2, var3); int var8 = this.worldObj.getBlockId(var1, var2, var3);
@ -169,16 +170,15 @@
var12 = !var11; var12 = !var11;
} }
- if (((BlockRail)Block.blocksList[var8]).isPowered()) @@ -329,30 +333,7 @@
- { var10 &= 7;
- var10 &= 7;
- }
-
if (var10 >= 2 && var10 <= 5)
{
this.posY = (double)(var2 + 1);
} }
- if (var10 >= 2 && var10 <= 5)
- {
- this.posY = (double)(var2 + 1);
- }
-
- if (var10 == 2) - if (var10 == 2)
- { - {
- this.motionX -= var6; - this.motionX -= var6;
@ -202,7 +202,7 @@
int[][] var13 = field_70500_g[var10]; int[][] var13 = field_70500_g[var10];
double var14 = (double)(var13[1][0] - var13[0][0]); double var14 = (double)(var13[1][0] - var13[0][0]);
@@ -378,7 +359,7 @@ @@ -385,7 +366,7 @@
} }
} }
@ -211,7 +211,7 @@
{ {
var24 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); var24 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
@@ -426,36 +407,8 @@ @@ -433,36 +414,8 @@
this.posX = var26 + var14 * var24; this.posX = var26 + var14 * var24;
this.posZ = var28 + var16 * var24; this.posZ = var28 + var16 * var24;
this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ); this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ);
@ -250,7 +250,7 @@
if (var13[0][1] != 0 && MathHelper.floor_double(this.posX) - var1 == var13[0][0] && MathHelper.floor_double(this.posZ) - var3 == var13[0][2]) if (var13[0][1] != 0 && MathHelper.floor_double(this.posX) - var1 == var13[0][0] && MathHelper.floor_double(this.posZ) - var3 == var13[0][2])
{ {
@@ -466,42 +419,7 @@ @@ -473,42 +426,7 @@
this.setPosition(this.posX, this.posY + (double)var13[1][1], this.posZ); this.setPosition(this.posX, this.posY + (double)var13[1][1], this.posZ);
} }
@ -294,7 +294,7 @@
Vec3 var52 = this.func_70489_a(this.posX, this.posY, this.posZ); Vec3 var52 = this.func_70489_a(this.posX, this.posY, this.posZ);
@@ -531,30 +449,14 @@ @@ -538,30 +456,14 @@
double var41; double var41;
@ -333,7 +333,7 @@
{ {
var41 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ); var41 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
@@ -592,41 +494,7 @@ @@ -599,41 +501,7 @@
} }
else else
{ {
@ -376,7 +376,7 @@
} }
this.rotationPitch = 0.0F; this.rotationPitch = 0.0F;
@@ -652,7 +520,18 @@ @@ -659,7 +527,18 @@
} }
this.setRotation(this.rotationYaw, this.rotationPitch); this.setRotation(this.rotationYaw, this.rotationPitch);
@ -396,7 +396,7 @@
if (var15 != null && !var15.isEmpty()) if (var15 != null && !var15.isEmpty())
{ {
@@ -677,17 +556,8 @@ @@ -684,17 +563,8 @@
this.riddenByEntity = null; this.riddenByEntity = null;
} }
@ -416,7 +416,7 @@
} }
} }
@@ -710,12 +580,7 @@ @@ -717,12 +587,7 @@
} }
else else
{ {
@ -430,7 +430,7 @@
par3 = (double)var10; par3 = (double)var10;
@@ -761,13 +626,8 @@ @@ -769,13 +634,8 @@
if (BlockRail.isRailBlock(var10)) if (BlockRail.isRailBlock(var10))
{ {
@ -445,7 +445,7 @@
if (var11 >= 2 && var11 <= 5) if (var11 >= 2 && var11 <= 5)
{ {
@@ -832,13 +692,14 @@ @@ -840,13 +700,14 @@
{ {
par1NBTTagCompound.setInteger("Type", this.minecartType); par1NBTTagCompound.setInteger("Type", this.minecartType);
@ -464,7 +464,7 @@
{ {
NBTTagList var2 = new NBTTagList(); NBTTagList var2 = new NBTTagList();
@@ -864,13 +725,21 @@ @@ -872,13 +733,21 @@
{ {
this.minecartType = par1NBTTagCompound.getInteger("Type"); this.minecartType = par1NBTTagCompound.getInteger("Type");
@ -490,7 +490,7 @@
{ {
NBTTagList var2 = par1NBTTagCompound.getTagList("Items"); NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.cargoItems = new ItemStack[this.getSizeInventory()]; this.cargoItems = new ItemStack[this.getSizeInventory()];
@@ -898,11 +767,17 @@ @@ -907,11 +776,17 @@
*/ */
public void applyEntityCollision(Entity par1Entity) public void applyEntityCollision(Entity par1Entity)
{ {
@ -509,7 +509,7 @@
{ {
par1Entity.mountEntity(this); par1Entity.mountEntity(this);
} }
@@ -948,7 +823,7 @@ @@ -957,7 +832,7 @@
double var18 = par1Entity.motionX + this.motionX; double var18 = par1Entity.motionX + this.motionX;
double var20 = par1Entity.motionZ + this.motionZ; double var20 = par1Entity.motionZ + this.motionZ;
@ -518,7 +518,7 @@
{ {
this.motionX *= 0.20000000298023224D; this.motionX *= 0.20000000298023224D;
this.motionZ *= 0.20000000298023224D; this.motionZ *= 0.20000000298023224D;
@@ -956,7 +831,7 @@ @@ -965,7 +840,7 @@
par1Entity.motionX *= 0.949999988079071D; par1Entity.motionX *= 0.949999988079071D;
par1Entity.motionZ *= 0.949999988079071D; par1Entity.motionZ *= 0.949999988079071D;
} }
@ -527,7 +527,7 @@
{ {
par1Entity.motionX *= 0.20000000298023224D; par1Entity.motionX *= 0.20000000298023224D;
par1Entity.motionZ *= 0.20000000298023224D; par1Entity.motionZ *= 0.20000000298023224D;
@@ -991,7 +866,7 @@ @@ -1000,7 +875,7 @@
*/ */
public int getSizeInventory() public int getSizeInventory()
{ {
@ -536,7 +536,7 @@
} }
/** /**
@@ -1094,7 +969,12 @@ @@ -1103,7 +978,12 @@
*/ */
public boolean interact(EntityPlayer par1EntityPlayer) public boolean interact(EntityPlayer par1EntityPlayer)
{ {
@ -550,7 +550,7 @@
{ {
if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer) if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer)
{ {
@@ -1106,14 +986,14 @@ @@ -1115,14 +995,14 @@
par1EntityPlayer.mountEntity(this); par1EntityPlayer.mountEntity(this);
} }
} }
@ -567,7 +567,7 @@
{ {
ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem(); ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
@@ -1233,4 +1113,375 @@ @@ -1246,4 +1126,375 @@
{ {
return this.dataWatcher.getWatchableObjectInt(18); return this.dataWatcher.getWatchableObjectInt(18);
} }
@ -789,7 +789,7 @@
+ return; + return;
+ } + }
+ float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k); + float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k);
+ +
+ double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail()); + double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail());
+ double mX = motionX; + double mX = motionX;
+ double mZ = motionZ; + double mZ = motionZ;
@ -803,7 +803,7 @@
+ if(mZ < -maxSpeed) mZ = -maxSpeed; + if(mZ < -maxSpeed) mZ = -maxSpeed;
+ if(mZ > maxSpeed) mZ = maxSpeed; + if(mZ > maxSpeed) mZ = maxSpeed;
+ moveEntity(mX, 0.0D, mZ); + moveEntity(mX, 0.0D, mZ);
+ } + }
+ +
+ /** + /**
+ * Moved to allow overrides. + * Moved to allow overrides.

View File

@ -1,9 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/EntityOcelot.java --- ../src_base/common/net/minecraft/src/EntityOcelot.java
+++ ../src_work/minecraft/net/minecraft/src/EntityOcelot.java +++ ../src_work/common/net/minecraft/src/EntityOcelot.java
@@ -321,7 +321,9 @@ @@ -325,8 +325,9 @@
}
int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3); int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3);
-
- if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID) - if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID)
+ Block block = Block.blocksList[var4]; + Block block = Block.blocksList[var4];
+ +

View File

@ -1,22 +1,20 @@
--- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java --- ../src_base/common/net/minecraft/src/EntityPlayer.java
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java +++ ../src_work/common/net/minecraft/src/EntityPlayer.java
@@ -2,6 +2,15 @@ @@ -6,6 +6,13 @@
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
+ +
+import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.IGuiHandler;
+import net.minecraftforge.common.ISpecialArmor.ArmorProperties; +import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
+import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.living.LivingHurtEvent; +import net.minecraftforge.event.entity.living.LivingHurtEvent;
+import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
+import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent; +import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
+import net.minecraftforge.packets.PacketOpenGUI;
public abstract class EntityPlayer extends EntityLiving implements ICommandSender public abstract class EntityPlayer extends EntityLiving implements ICommandSender
{ {
@@ -207,6 +216,7 @@ @@ -220,6 +227,7 @@
if (var1 == this.itemInUse) if (var1 == this.itemInUse)
{ {
@ -24,7 +22,7 @@
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0) if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
{ {
this.updateItemUse(var1, 5); this.updateItemUse(var1, 5);
@@ -607,7 +617,16 @@ @@ -624,7 +632,16 @@
*/ */
public EntityItem dropOneItem() public EntityItem dropOneItem()
{ {
@ -42,7 +40,7 @@
} }
/** /**
@@ -673,13 +692,21 @@ @@ -690,13 +707,21 @@
/** /**
* Returns how strong the player is against the specified block at this moment * Returns how strong the player is against the specified block at this moment
@ -67,7 +65,7 @@
{ {
var2 += (float)(var3 * var3 + 1); var2 += (float)(var3 * var3 + 1);
} }
@@ -972,12 +999,23 @@ @@ -989,12 +1014,23 @@
*/ */
protected void damageEntity(DamageSource par1DamageSource, int par2) protected void damageEntity(DamageSource par1DamageSource, int par2)
{ {
@ -92,7 +90,7 @@
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2); par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.addExhaustion(par1DamageSource.getHungerDamage()); this.addExhaustion(par1DamageSource.getHungerDamage());
this.health -= par2; this.health -= par2;
@@ -1012,6 +1050,10 @@ @@ -1029,6 +1065,10 @@
public boolean interactWith(Entity par1Entity) public boolean interactWith(Entity par1Entity)
{ {
@ -103,7 +101,7 @@
if (par1Entity.interact(this)) if (par1Entity.interact(this))
{ {
return true; return true;
@@ -1055,7 +1097,9 @@ @@ -1072,7 +1112,9 @@
*/ */
public void destroyCurrentEquippedItem() public void destroyCurrentEquippedItem()
{ {
@ -113,7 +111,7 @@
} }
/** /**
@@ -1084,6 +1128,15 @@ @@ -1101,6 +1143,15 @@
*/ */
public void attackTargetEntityWithCurrentItem(Entity par1Entity) public void attackTargetEntityWithCurrentItem(Entity par1Entity)
{ {
@ -129,7 +127,7 @@
if (par1Entity.canAttackWithItem()) if (par1Entity.canAttackWithItem())
{ {
int var2 = this.inventory.getDamageVsEntity(par1Entity); int var2 = this.inventory.getDamageVsEntity(par1Entity);
@@ -1226,6 +1279,12 @@ @@ -1244,6 +1295,12 @@
*/ */
public EnumStatus sleepInBedAt(int par1, int par2, int par3) public EnumStatus sleepInBedAt(int par1, int par2, int par3)
{ {
@ -142,7 +140,7 @@
if (!this.worldObj.isRemote) if (!this.worldObj.isRemote)
{ {
if (this.isPlayerSleeping() || !this.isEntityAlive()) if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1265,6 +1324,11 @@ @@ -1283,6 +1340,11 @@
{ {
int var9 = this.worldObj.getBlockMetadata(par1, par2, par3); int var9 = this.worldObj.getBlockMetadata(par1, par2, par3);
int var5 = BlockBed.getDirection(var9); int var5 = BlockBed.getDirection(var9);
@ -154,11 +152,10 @@
float var10 = 0.5F; float var10 = 0.5F;
float var7 = 0.5F; float var7 = 0.5F;
@@ -1334,11 +1398,12 @@ @@ -1353,10 +1415,12 @@
this.resetHeight();
ChunkCoordinates var4 = this.playerLocation; ChunkCoordinates var4 = this.playerLocation;
ChunkCoordinates var5 = this.playerLocation; ChunkCoordinates var5 = this.playerLocation;
-
- if (var4 != null && this.worldObj.getBlockId(var4.posX, var4.posY, var4.posZ) == Block.bed.blockID) - if (var4 != null && this.worldObj.getBlockId(var4.posX, var4.posY, var4.posZ) == Block.bed.blockID)
- { - {
- BlockBed.setBedOccupied(this.worldObj, var4.posX, var4.posY, var4.posZ, false); - BlockBed.setBedOccupied(this.worldObj, var4.posX, var4.posY, var4.posZ, false);
@ -172,7 +169,7 @@
if (var5 == null) if (var5 == null)
{ {
@@ -1375,7 +1440,9 @@ @@ -1393,7 +1457,9 @@
*/ */
private boolean isInBed() private boolean isInBed()
{ {
@ -183,11 +180,10 @@
} }
/** /**
@@ -1389,14 +1456,15 @@ @@ -1408,13 +1474,15 @@
var2.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ - 3 >> 4);
var2.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); var2.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
var2.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4); var2.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
-
- if (par0World.getBlockId(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ) != Block.bed.blockID) - if (par0World.getBlockId(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ) != Block.bed.blockID)
+ ChunkCoordinates c = par1ChunkCoordinates; + ChunkCoordinates c = par1ChunkCoordinates;
+ Block block = Block.blocksList[par0World.getBlockId(c.posX, c.posY, c.posZ)]; + Block block = Block.blocksList[par0World.getBlockId(c.posX, c.posY, c.posZ)];
@ -202,7 +198,7 @@
return var3; return var3;
} }
} }
@@ -1408,8 +1476,11 @@ @@ -1428,8 +1496,11 @@
{ {
if (this.playerLocation != null) if (this.playerLocation != null)
{ {
@ -216,7 +212,7 @@
switch (var2) switch (var2)
{ {
@@ -1699,6 +1770,7 @@ @@ -1722,6 +1793,7 @@
return 101; return 101;
} }
} }
@ -224,54 +220,3 @@
} }
return var3; return var3;
@@ -1919,4 +1991,50 @@
{
return this.theInventoryEnderChest;
}
+
+ /**
+ * Opens a Gui for the player.
+ *
+ * @param mod The mod associated with the gui
+ * @param ID The ID number for the Gui
+ * @param world The World
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ */
+ public void openGui(BaseMod mod, int ID, World world, int x, int y, int z)
+ {
+ if (this instanceof EntityPlayerSP)
+ {
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod, true);
+ if (handler != null)
+ {
+ GuiScreen screen = (GuiScreen)handler.getGuiElement(ID, this, world, x, y, z);
+ if (screen != null)
+ {
+ ModLoader.getMinecraftInstance().displayGuiScreen(screen);
+ }
+ }
+ }
+ else if (this instanceof EntityPlayerMP)
+ {
+ EntityPlayerMP player = (EntityPlayerMP)this;
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod, false);
+
+ if (handler != null)
+ {
+ Container container = (Container)handler.getGuiElement(ID, player, world, x, y, z);
+ if (container != null)
+ {
+ player.incrementWindowID();
+ player.closeInventory();
+ PacketOpenGUI pkt = new PacketOpenGUI(player.currentWindowId, MinecraftForge.getModID((NetworkMod)mod), ID, x, y, z);
+ player.serverForThisPlayer.sendPacket(pkt.getPacket());
+ craftingInventory = container;
+ craftingInventory.windowId = player.currentWindowId;
+ craftingInventory.addCraftingToCrafters(player);
+ }
+ }
+ }
+ }
}

View File

@ -1,8 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/EntitySheep.java --- ../src_base/common/net/minecraft/src/EntitySheep.java
+++ ../src_work/minecraft/net/minecraft/src/EntitySheep.java +++ ../src_work/common/net/minecraft/src/EntitySheep.java
@@ -1,8 +1,11 @@ @@ -2,9 +2,13 @@
package net.minecraft.src;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
+
+import java.util.ArrayList; +import java.util.ArrayList;
import java.util.Random; import java.util.Random;
@ -13,7 +15,7 @@
{ {
/** /**
* Holds the RGB table of the sheep colors - in OpenGL glColor3f values - used to render the sheep colored fleece. * Holds the RGB table of the sheep colors - in OpenGL glColor3f values - used to render the sheep colored fleece.
@@ -129,27 +132,6 @@ @@ -134,27 +138,6 @@
*/ */
public boolean interact(EntityPlayer par1EntityPlayer) public boolean interact(EntityPlayer par1EntityPlayer)
{ {
@ -41,7 +43,7 @@
return super.interact(par1EntityPlayer); return super.interact(par1EntityPlayer);
} }
@@ -282,4 +264,23 @@ @@ -287,4 +270,23 @@
this.setGrowingAge(var1); this.setGrowingAge(var1);
} }
} }

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/Item.java --- ../src_base/common/net/minecraft/src/Item.java
+++ ../src_work/minecraft/net/minecraft/src/Item.java +++ ../src_work/common/net/minecraft/src/Item.java
@@ -194,13 +194,16 @@ @@ -196,13 +196,16 @@
/** full name of item from language file */ /** full name of item from language file */
private String itemName; private String itemName;
@ -18,22 +18,12 @@
} }
itemsList[256 + par1] = this; itemsList[256 + par1] = this;
@@ -570,7 +573,7 @@ @@ -651,4 +654,185 @@
float var17 = MathHelper.sin(-var5 * 0.017453292F);
float var18 = var15 * var16;
float var20 = var14 * var16;
- double var21 = 5.0D;
+ double var21 = ModLoader.getMinecraftInstance().playerController.getBlockReachDistance();
Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
}
@@ -625,4 +628,187 @@
{ {
StatList.initStats(); StatList.initStats();
} }
+ -}
+ +
+
+ /* =========================================================== FORGE START ===============================================================*/ + /* =========================================================== FORGE START ===============================================================*/
+ public boolean isDefaultTexture = true; + public boolean isDefaultTexture = true;
+ private String currentTexture = "/gui/items.png"; + private String currentTexture = "/gui/items.png";
@ -214,4 +204,4 @@
+ { + {
+ return new ItemStack(getContainerItem()); + return new ItemStack(getContainerItem());
+ } + }
} +}

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/ItemBlock.java --- ../src_base/common/net/minecraft/src/ItemBlock.java
+++ ../src_work/minecraft/net/minecraft/src/ItemBlock.java +++ ../src_work/common/net/minecraft/src/ItemBlock.java
@@ -30,7 +30,8 @@ @@ -32,7 +32,8 @@
{ {
par7 = 1; par7 = 1;
} }

View File

@ -1,8 +1,8 @@
--- ../src_base/minecraft/net/minecraft/src/ItemDye.java --- ../src_base/common/net/minecraft/src/ItemDye.java
+++ ../src_work/minecraft/net/minecraft/src/ItemDye.java +++ ../src_work/common/net/minecraft/src/ItemDye.java
@@ -1,6 +1,10 @@ @@ -3,6 +3,10 @@
package net.minecraft.src; import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import java.util.List; import java.util.List;
+ +
+import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.ForgeHooks;
@ -11,21 +11,20 @@
public class ItemDye extends Item public class ItemDye extends Item
{ {
@@ -45,6 +49,22 @@ @@ -49,6 +53,21 @@
if (par1ItemStack.getItemDamage() == 15) if (par1ItemStack.getItemDamage() == 15)
{ {
var11 = par3World.getBlockId(par4, par5, par6); var11 = par3World.getBlockId(par4, par5, par6);
+ +
+ BonemealEvent event = new BonemealEvent(par2EntityPlayer, par3World, var11, par4, par5, par6); + BonemealEvent event = new BonemealEvent(par2EntityPlayer, par3World, var11, par4, par5, par6);
+ MinecraftForge.EVENT_BUS.post(event); + if (!MinecraftForge.EVENT_BUS.post(event))
+ if (event.isCanceled())
+ { + {
+ return false; + return false;
+ } + }
+ +
+ if (event.isHandeled()) + if (event.isHandeled())
+ { + {
+ if (!par3World.isRemote) + if (!par3World.isRemote)
+ { + {
+ par1ItemStack.stackSize--; + par1ItemStack.stackSize--;
+ } + }
@ -34,7 +33,7 @@
if (var11 == Block.sapling.blockID) if (var11 == Block.sapling.blockID)
{ {
@@ -144,16 +164,9 @@ @@ -148,16 +167,9 @@
par3World.setBlockAndMetadataWithNotify(var13, var14, var15, Block.tallGrass.blockID, 1); par3World.setBlockAndMetadataWithNotify(var13, var14, var15, Block.tallGrass.blockID, 1);
} }
} }

View File

@ -1,20 +1,19 @@
--- ../src_base/minecraft/net/minecraft/src/ItemHoe.java --- ../src_base/common/net/minecraft/src/ItemHoe.java
+++ ../src_work/minecraft/net/minecraft/src/ItemHoe.java +++ ../src_work/common/net/minecraft/src/ItemHoe.java
@@ -1,4 +1,7 @@ @@ -1,5 +1,7 @@
package net.minecraft.src; package net.minecraft.src;
+
+import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.UseHoeEvent; +import net.minecraftforge.event.entity.UseHoeEvent;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
public class ItemHoe extends Item @@ -24,6 +26,17 @@
{
@@ -21,6 +24,18 @@
} }
else else
{ {
+ UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6); + UseHoeEvent event = new UseHoeEvent(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6);
+ MinecraftForge.EVENT_BUS.post(event); + if (MinecraftForge.EVENT_BUS.post(event))
+ if (event.isCanceled())
+ { + {
+ return false; + return false;
+ } + }

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/ItemMap.java --- ../src_base/common/net/minecraft/src/ItemMap.java
+++ ../src_work/minecraft/net/minecraft/src/ItemMap.java +++ ../src_work/common/net/minecraft/src/ItemMap.java
@@ -84,7 +84,7 @@ @@ -87,7 +87,7 @@
byte var23 = 0; byte var23 = 0;
byte var24 = 0; byte var24 = 0;
byte var25 = 0; byte var25 = 0;
@ -9,7 +9,7 @@
Chunk var27 = par1World.getChunkFromBlockCoords(var21, var22); Chunk var27 = par1World.getChunkFromBlockCoords(var21, var22);
if (!var27.isEmpty()) if (!var27.isEmpty())
@@ -183,7 +183,7 @@ @@ -186,7 +186,7 @@
var33 = 0; var33 = 0;
var34 = 0; var34 = 0;

View File

@ -1,17 +1,17 @@
--- ../src_base/minecraft/net/minecraft/src/ItemTool.java --- ../src_base/common/net/minecraft/src/ItemTool.java
+++ ../src_work/minecraft/net/minecraft/src/ItemTool.java +++ ../src_work/common/net/minecraft/src/ItemTool.java
@@ -1,4 +1,6 @@ @@ -1,5 +1,6 @@
package net.minecraft.src; package net.minecraft.src;
+
+import net.minecraftforge.common.ForgeHooks;
public class ItemTool extends Item +import net.minecraftforge.common.ForgeHooks;
{ import cpw.mods.fml.common.Side;
@@ -94,4 +96,15 @@ import cpw.mods.fml.common.asm.SideOnly;
@@ -99,4 +100,15 @@
{ {
return this.toolMaterial.toString(); return this.toolMaterial.toString();
} }
+ +
+ /** FORGE: Overridden to allow custom tool effectiveness */ + /** FORGE: Overridden to allow custom tool effectiveness */
+ @Override + @Override
+ public float getStrVsBlock(ItemStack stack, Block block, int meta) + public float getStrVsBlock(ItemStack stack, Block block, int meta)

View File

@ -5,17 +5,9 @@
+ +
+import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.ForgeHooks;
public class SlotCrafting extends Slot import cpw.mods.fml.common.registry.GameRegistry;
{
@@ -107,6 +109,7 @@
*/
public void onPickupFromSlot(ItemStack par1ItemStack)
{
+ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix);
this.onCrafting(par1ItemStack);
for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2) @@ -122,7 +124,7 @@
@@ -119,7 +122,7 @@
if (var3.getItem().hasContainerItem()) if (var3.getItem().hasContainerItem())
{ {

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/StatList.java --- ../src_base/common/net/minecraft/src/StatList.java
+++ ../src_work/minecraft/net/minecraft/src/StatList.java +++ ../src_work/common/net/minecraft/src/StatList.java
@@ -166,9 +166,9 @@ @@ -168,9 +168,9 @@
*/ */
private static StatBase[] initMinableStats(String par0Str, int par1) private static StatBase[] initMinableStats(String par0Str, int par1)
{ {

View File

@ -1,10 +1,10 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntity.java --- ../src_base/common/net/minecraft/src/TileEntity.java
+++ ../src_work/minecraft/net/minecraft/src/TileEntity.java +++ ../src_work/common/net/minecraft/src/TileEntity.java
@@ -243,4 +243,33 @@ @@ -250,4 +250,33 @@
addMapping(TileEntityEnchantmentTable.class, "EnchantTable"); addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
addMapping(TileEntityEndPortal.class, "Airportal"); addMapping(TileEntityEndPortal.class, "Airportal");
} }
+ +
+ /** + /**
+ * Determines if this TileEntity requires update calls. + * Determines if this TileEntity requires update calls.
+ * @return True if you want updateEntity() to be called, false if not + * @return True if you want updateEntity() to be called, false if not
@ -13,7 +13,7 @@
+ { + {
+ return true; + return true;
+ } + }
+ +
+ /** + /**
+ * Called when you receive a TileEntityData packet for the location this + * Called when you receive a TileEntityData packet for the location this
+ * TileEntity is currently in. On the client, the NetworkManager will always + * TileEntity is currently in. On the client, the NetworkManager will always
@ -26,7 +26,7 @@
+ public void onDataPacket(NetworkManager net, Packet132TileEntityData pkt) + public void onDataPacket(NetworkManager net, Packet132TileEntityData pkt)
+ { + {
+ } + }
+ +
+ /** + /**
+ * Called when the chunk this TileEntity is on is Unloaded. + * Called when the chunk this TileEntity is on is Unloaded.
+ */ + */

View File

@ -1,7 +1,7 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityBrewingStand.java --- ../src_base/common/net/minecraft/src/TileEntityBrewingStand.java
+++ ../src_work/minecraft/net/minecraft/src/TileEntityBrewingStand.java +++ ../src_work/common/net/minecraft/src/TileEntityBrewingStand.java
@@ -2,7 +2,10 @@ @@ -4,7 +4,10 @@
import cpw.mods.fml.common.asm.SideOnly;
import java.util.List; import java.util.List;
-public class TileEntityBrewingStand extends TileEntity implements IInventory -public class TileEntityBrewingStand extends TileEntity implements IInventory
@ -12,7 +12,7 @@
{ {
/** The itemstacks currently placed in the slots of the brewing stand */ /** The itemstacks currently placed in the slots of the brewing stand */
private ItemStack[] brewingItemStacks = new ItemStack[4]; private ItemStack[] brewingItemStacks = new ItemStack[4];
@@ -156,7 +159,7 @@ @@ -158,7 +161,7 @@
if (Item.itemsList[var1.itemID].hasContainerItem()) if (Item.itemsList[var1.itemID].hasContainerItem())
{ {
@ -21,7 +21,7 @@
} }
else else
{ {
@@ -322,4 +325,16 @@ @@ -325,4 +328,16 @@
return var1; return var1;
} }

View File

@ -1,18 +1,21 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java --- ../src_base/common/net/minecraft/src/TileEntityFurnace.java
+++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java +++ ../src_work/common/net/minecraft/src/TileEntityFurnace.java
@@ -1,6 +1,10 @@ @@ -1,11 +1,13 @@
package net.minecraft.src; package net.minecraft.src;
-public class TileEntityFurnace extends TileEntity implements IInventory
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.ISidedInventory; +import net.minecraftforge.common.ISidedInventory;
+import net.minecraftforge.common.Orientation; +import net.minecraftforge.common.Orientation;
+ import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
-public class TileEntityFurnace extends TileEntity implements IInventory
+public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory +public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory
{ {
/** /**
* The ItemStacks that hold the items currently being used in the furnace * The ItemStacks that hold the items currently being used in the furnace
@@ -226,8 +230,7 @@ @@ -235,8 +237,7 @@
if (this.furnaceItemStacks[1].stackSize == 0) if (this.furnaceItemStacks[1].stackSize == 0)
{ {
@ -22,7 +25,7 @@
} }
} }
} }
@@ -273,8 +276,12 @@ @@ -282,8 +283,12 @@
} }
else else
{ {
@ -37,7 +40,7 @@
} }
} }
@@ -285,15 +292,15 @@ @@ -294,15 +299,15 @@
{ {
if (this.canSmelt()) if (this.canSmelt())
{ {
@ -57,7 +60,7 @@
} }
--this.furnaceItemStacks[0].stackSize; --this.furnaceItemStacks[0].stackSize;
@@ -320,7 +327,7 @@ @@ -329,7 +334,7 @@
int var1 = par0ItemStack.getItem().shiftedIndex; int var1 = par0ItemStack.getItem().shiftedIndex;
Item var2 = par0ItemStack.getItem(); Item var2 = par0ItemStack.getItem();
@ -66,29 +69,7 @@
{ {
Block var3 = Block.blocksList[var1]; Block var3 = Block.blocksList[var1];
@@ -335,7 +342,20 @@ @@ -374,4 +379,18 @@
}
}
- return var2 instanceof ItemTool && ((ItemTool)var2).func_77861_e().equals("WOOD") ? 200 : (var2 instanceof ItemSword && ((ItemSword)var2).func_77825_f().equals("WOOD") ? 200 : (var2 instanceof ItemHoe && ((ItemHoe)var2).func_77842_f().equals("WOOD") ? 200 : (var1 == Item.stick.shiftedIndex ? 100 : (var1 == Item.coal.shiftedIndex ? 1600 : (var1 == Item.bucketLava.shiftedIndex ? 20000 : (var1 == Block.sapling.blockID ? 100 : (var1 == Item.blazeRod.shiftedIndex ? 2400 : 0)))))));
+ if (var2 instanceof ItemTool && ((ItemTool) var2).func_77861_e().equals("WOOD")) return 200;
+ if (var2 instanceof ItemSword && ((ItemSword)var2).func_77825_f().equals("WOOD")) return 200;
+ if (var2 instanceof ItemHoe && ((ItemHoe) var2).func_77842_f().equals("WOOD")) return 200;
+ if (var1 == Item.stick.shiftedIndex) return 100;
+ if (var1 == Item.coal.shiftedIndex) return 1600;
+ if (var1 == Item.bucketLava.shiftedIndex) return 20000;
+ if (var1 == Block.sapling.blockID) return 100;
+ if (var1 == Item.blazeRod.shiftedIndex) return 2400;
+ int ret = ForgeHooks.getItemBurnTime(par0ItemStack);
+ if (ret > 0)
+ {
+ return ret;
+ }
+ return 0;
}
}
@@ -358,4 +378,18 @@
public void openChest() {} public void openChest() {}
public void closeChest() {} public void closeChest() {}

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/World.java --- ../src_base/common/net/minecraft/src/World.java
+++ ../src_work/minecraft/net/minecraft/src/World.java +++ ../src_work/common/net/minecraft/src/World.java
@@ -8,8 +8,21 @@ @@ -10,8 +10,21 @@
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@ -18,11 +18,11 @@
+ * of one of there entities. + * of one of there entities.
+ */ + */
+ public static double MAX_ENTITY_RADIUS = 2.0D; + public static double MAX_ENTITY_RADIUS = 2.0D;
+ +
/** /**
* boolean; if true updates scheduled by scheduleBlockUpdate happen immediately * boolean; if true updates scheduled by scheduleBlockUpdate happen immediately
*/ */
@@ -164,6 +177,7 @@ @@ -167,6 +180,7 @@
this.chunkProvider = this.createChunkProvider(); this.chunkProvider = this.createChunkProvider();
this.calculateInitialSkylight(); this.calculateInitialSkylight();
this.calculateInitialWeather(); this.calculateInitialWeather();
@ -30,7 +30,7 @@
} }
public World(ISaveHandler par1ISaveHandler, String par2Str, WorldSettings par3WorldSettings, WorldProvider par4WorldProvider, Profiler par5Profiler) public World(ISaveHandler par1ISaveHandler, String par2Str, WorldSettings par3WorldSettings, WorldProvider par4WorldProvider, Profiler par5Profiler)
@@ -210,6 +224,7 @@ @@ -213,6 +227,7 @@
this.calculateInitialSkylight(); this.calculateInitialSkylight();
this.calculateInitialWeather(); this.calculateInitialWeather();
@ -38,7 +38,7 @@
} }
/** /**
@@ -264,7 +279,8 @@ @@ -269,7 +284,8 @@
*/ */
public boolean isAirBlock(int par1, int par2, int par3) public boolean isAirBlock(int par1, int par2, int par3)
{ {
@ -48,7 +48,7 @@
} }
/** /**
@@ -273,7 +289,8 @@ @@ -278,7 +294,8 @@
public boolean blockHasTileEntity(int par1, int par2, int par3) public boolean blockHasTileEntity(int par1, int par2, int par3)
{ {
int var4 = this.getBlockId(par1, par2, par3); int var4 = this.getBlockId(par1, par2, par3);
@ -58,7 +58,7 @@
} }
/** /**
@@ -999,7 +1016,7 @@ @@ -1009,7 +1026,7 @@
int var12 = this.getBlockMetadata(var8, var9, var10); int var12 = this.getBlockMetadata(var8, var9, var10);
Block var13 = Block.blocksList[var11]; Block var13 = Block.blocksList[var11];
@ -67,7 +67,7 @@
{ {
MovingObjectPosition var14 = var13.collisionRayTrace(this, var8, var9, var10, par1Vec3, par2Vec3); MovingObjectPosition var14 = var13.collisionRayTrace(this, var8, var9, var10, par1Vec3, par2Vec3);
@@ -1199,6 +1216,12 @@ @@ -1209,6 +1226,12 @@
*/ */
public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4) public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4)
{ {
@ -80,7 +80,7 @@
if (par1Entity != null && par2Str != null) if (par1Entity != null && par2Str != null)
{ {
Iterator var5 = this.worldAccesses.iterator(); Iterator var5 = this.worldAccesses.iterator();
@@ -1862,7 +1885,7 @@ @@ -1887,7 +1910,7 @@
if (var8 != null) if (var8 != null)
{ {
@ -89,7 +89,7 @@
} }
} }
} }
@@ -1872,6 +1895,10 @@ @@ -1897,6 +1920,10 @@
if (!this.entityRemoval.isEmpty()) if (!this.entityRemoval.isEmpty())
{ {
@ -100,7 +100,7 @@
this.loadedTileEntityList.removeAll(this.entityRemoval); this.loadedTileEntityList.removeAll(this.entityRemoval);
this.entityRemoval.clear(); this.entityRemoval.clear();
} }
@@ -1892,7 +1919,9 @@ @@ -1917,7 +1944,9 @@
{ {
this.loadedTileEntityList.add(var9); this.loadedTileEntityList.add(var9);
} }
@ -111,7 +111,7 @@
if (this.chunkExists(var9.xCoord >> 4, var9.zCoord >> 4)) if (this.chunkExists(var9.xCoord >> 4, var9.zCoord >> 4))
{ {
Chunk var10 = this.getChunkFromChunkCoords(var9.xCoord >> 4, var9.zCoord >> 4); Chunk var10 = this.getChunkFromChunkCoords(var9.xCoord >> 4, var9.zCoord >> 4);
@@ -1902,8 +1931,6 @@ @@ -1927,8 +1956,6 @@
var10.setChunkBlockTileEntity(var9.xCoord & 15, var9.yCoord, var9.zCoord & 15, var9); var10.setChunkBlockTileEntity(var9.xCoord & 15, var9.yCoord, var9.zCoord & 15, var9);
} }
} }
@ -120,7 +120,7 @@
} }
} }
@@ -1916,13 +1943,13 @@ @@ -1941,13 +1968,13 @@
public void addTileEntity(Collection par1Collection) public void addTileEntity(Collection par1Collection)
{ {
@ -141,12 +141,11 @@
} }
} }
@@ -1943,8 +1970,14 @@ @@ -1968,7 +1995,14 @@
int var3 = MathHelper.floor_double(par1Entity.posX); int var3 = MathHelper.floor_double(par1Entity.posX);
int var4 = MathHelper.floor_double(par1Entity.posZ); int var4 = MathHelper.floor_double(par1Entity.posZ);
byte var5 = 32; byte var5 = 32;
- -
- if (!par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5))
+ boolean canUpdate = !par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5); + boolean canUpdate = !par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5);
+ if (!canUpdate) + if (!canUpdate)
+ { + {
@ -155,10 +154,10 @@
+ canUpdate = event.canUpdate; + canUpdate = event.canUpdate;
+ } + }
+ if (canUpdate) + if (canUpdate)
if (!par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5))
{ {
par1Entity.lastTickPosX = par1Entity.posX; par1Entity.lastTickPosX = par1Entity.posX;
par1Entity.lastTickPosY = par1Entity.posY; @@ -2204,6 +2238,14 @@
@@ -2179,6 +2212,14 @@
{ {
return true; return true;
} }
@ -173,7 +172,7 @@
} }
} }
} }
@@ -2481,25 +2522,21 @@ @@ -2510,25 +2552,21 @@
*/ */
public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity) public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity)
{ {
@ -214,7 +213,7 @@
} }
} }
@@ -2508,27 +2545,10 @@ @@ -2537,27 +2575,10 @@
*/ */
public void removeBlockTileEntity(int par1, int par2, int par3) public void removeBlockTileEntity(int par1, int par2, int par3)
{ {
@ -246,7 +245,7 @@
} }
} }
@@ -2554,7 +2574,8 @@ @@ -2583,7 +2604,8 @@
*/ */
public boolean isBlockNormalCube(int par1, int par2, int par3) public boolean isBlockNormalCube(int par1, int par2, int par3)
{ {
@ -256,7 +255,7 @@
} }
/** /**
@@ -2562,8 +2583,7 @@ @@ -2591,8 +2613,7 @@
*/ */
public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3) public boolean doesBlockHaveSolidTopSurface(int par1, int par2, int par3)
{ {
@ -266,7 +265,7 @@
} }
/** /**
@@ -2579,7 +2599,7 @@ @@ -2608,7 +2629,7 @@
if (var5 != null && !var5.isEmpty()) if (var5 != null && !var5.isEmpty())
{ {
Block var6 = Block.blocksList[this.getBlockId(par1, par2, par3)]; Block var6 = Block.blocksList[this.getBlockId(par1, par2, par3)];
@ -275,16 +274,16 @@
} }
else else
{ {
@@ -3006,7 +3026,7 @@ @@ -3035,7 +3056,7 @@
private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6) private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6)
{ {
- int var7 = Block.lightValue[par5]; - int var7 = Block.lightValue[par5];
+ int var7 = (par5 == 0 || Block.blocksList[par5] == null ? 0 : Block.blocksList[par5].getLightValue(this, par2, par3, par4));; + int var7 = (par5 == 0 || Block.blocksList[par5] == null ? 0 : Block.blocksList[par5].getLightValue(this, par2, par3, par4));
int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6; int var8 = this.getSavedLightValue(EnumSkyBlock.Block, par2 - 1, par3, par4) - par6;
int var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6; int var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6;
int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6; int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6;
@@ -3274,10 +3294,10 @@ @@ -3303,10 +3324,10 @@
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB) public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB)
{ {
this.entitiesWithinAABBExcludingEntity.clear(); this.entitiesWithinAABBExcludingEntity.clear();
@ -299,7 +298,7 @@
for (int var7 = var3; var7 <= var4; ++var7) for (int var7 = var3; var7 <= var4; ++var7)
{ {
@@ -3298,10 +3318,10 @@ @@ -3327,10 +3348,10 @@
*/ */
public List getEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB) public List getEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB)
{ {
@ -314,10 +313,11 @@
ArrayList var7 = new ArrayList(); ArrayList var7 = new ArrayList();
for (int var8 = var3; var8 <= var4; ++var8) for (int var8 = var3; var8 <= var4; ++var8)
@@ -3430,6 +3450,10 @@ @@ -3460,7 +3481,10 @@
{
var9 = null; var9 = null;
} }
-
+ if (var9 != null && var9.isBlockReplaceable(this, par2, par3, par4)) + if (var9 != null && var9.isBlockReplaceable(this, par2, par3, par4))
+ { + {
+ var9 = null; + var9 = null;
@ -325,11 +325,11 @@
return par1 > 0 && var9 == null && var10.canPlaceBlockOnSide(this, par2, par3, par4, par6); return par1 > 0 && var9 == null && var10.canPlaceBlockOnSide(this, par2, par3, par4, par6);
} }
} }
@@ -3917,4 +3941,65 @@ @@ -3958,4 +3982,65 @@
var7.destroyBlockPartially(par1, par2, par3, par4, par5); var7.destroyBlockPartially(par1, par2, par3, par4, par5);
} }
} }
+ +
+ /** + /**
+ * Adds a single TileEntity to the world. + * Adds a single TileEntity to the world.
+ * @param entity The TileEntity to be added. + * @param entity The TileEntity to be added.
@ -342,7 +342,7 @@
+ dest.add(entity); + dest.add(entity);
+ } + }
+ } + }
+ +
+ /** + /**
+ * Determine if the given block is considered solid on the + * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic. + * specified side. Used by placement logic.
@ -357,7 +357,7 @@
+ { + {
+ return isBlockSolidOnSide(X, Y, Z, side, false); + return isBlockSolidOnSide(X, Y, Z, side, false);
+ } + }
+ +
+ /** + /**
+ * Determine if the given block is considered solid on the + * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic. + * specified side. Used by placement logic.
@ -375,19 +375,19 @@
+ { + {
+ return _default; + return _default;
+ } + }
+ +
+ Chunk var5 = this.chunkProvider.provideChunk(X >> 4, Z >> 4); + Chunk var5 = this.chunkProvider.provideChunk(X >> 4, Z >> 4);
+ if (var5 == null || var5.isEmpty()) + if (var5 == null || var5.isEmpty())
+ { + {
+ return _default; + return _default;
+ } + }
+ +
+ Block block = Block.blocksList[getBlockId(X, Y, Z)]; + Block block = Block.blocksList[getBlockId(X, Y, Z)];
+ if(block == null) + if(block == null)
+ { + {
+ return false; + return false;
+ } + }
+ +
+ return block.isBlockSolidOnSide(this, X, Y, Z, side); + return block.isBlockSolidOnSide(this, X, Y, Z, side);
+ } + }
} }

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/WorldProvider.java --- ../src_base/common/net/minecraft/src/WorldProvider.java
+++ ../src_work/minecraft/net/minecraft/src/WorldProvider.java +++ ../src_work/common/net/minecraft/src/WorldProvider.java
@@ -177,7 +177,7 @@ @@ -185,7 +185,7 @@
public static WorldProvider getProviderForDimension(int par0) public static WorldProvider getProviderForDimension(int par0)
{ {
@ -8,8 +8,8 @@
+ return DimensionManager.createProviderFor(par0); + return DimensionManager.createProviderFor(par0);
} }
/** @SideOnly(Side.CLIENT)
@@ -232,4 +232,73 @@ @@ -249,4 +249,73 @@
{ {
return false; return false;
} }

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft/net/minecraft/src/WorldServer.java --- ../src_base/common/net/minecraft/src/WorldServer.java
+++ ../src_work/minecraft/net/minecraft/src/WorldServer.java +++ ../src_work/common/net/minecraft/src/WorldServer.java
@@ -8,6 +8,8 @@ @@ -10,6 +10,8 @@
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
@ -9,7 +9,7 @@
public class WorldServer extends World public class WorldServer extends World
{ {
@@ -685,6 +687,7 @@ @@ -689,6 +691,7 @@
} }
this.chunkProvider.saveChunks(par1, par2IProgressUpdate); this.chunkProvider.saveChunks(par1, par2IProgressUpdate);

View File

@ -1,38 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockDoor.java
+++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java
@@ -1,6 +1,8 @@
package net.minecraft.src;
import java.util.Random;
+
+import static net.minecraftforge.common.Orientation.*;
public class BlockDoor extends Block
{
@@ -257,7 +259,7 @@
{
if (this.blockMaterial == Material.iron)
{
- return true;
+ return false; //Allow items to interact with the door
}
else
{
@@ -327,7 +329,7 @@
var7 = true;
}
- if (!par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
var7 = true;
@@ -392,7 +394,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par3 >= 255 ? false : par1World.doesBlockHaveSolidTopSurface(par2, par3 - 1, par4) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4);
+ return par3 >= 255 ? false : par1World.isBlockSolidOnSide(par2, par3 - 1, par4, UP) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4);
}
/**

View File

@ -1,30 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/MemoryConnection.java
+++ ../src_work/minecraft/net/minecraft/src/MemoryConnection.java
@@ -6,6 +6,8 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+
+import net.minecraftforge.common.ForgeHooks;
public class MemoryConnection implements NetworkManager
{
@@ -106,6 +108,7 @@
this.shuttingDown = true;
this.shutdownReason = par1Str;
this.field_74439_g = par2ArrayOfObj;
+ ForgeHooks.onDisconnect(this, par1Str, par2ArrayOfObj);
}
/**
@@ -151,4 +154,10 @@
this.readPacketCache.add(par1Packet);
}
}
+
+ @Override
+ public NetHandler getNetHandler()
+ {
+ return myNetHandler;
+ }
}

View File

@ -12,24 +12,7 @@
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.LoaderException; import cpw.mods.fml.common.LoaderException;
@@ -59,6 +64,8 @@ @@ -589,7 +594,7 @@
this.mc = par1Minecraft;
Socket var4 = new Socket(InetAddress.getByName(par2Str), par3);
this.netManager = new TcpConnection(var4, "Client", this);
+
+ ForgeHooks.onConnect(netManager);
}
public NetClientHandler(Minecraft par1Minecraft, IntegratedServer par2IntegratedServer) throws IOException
@@ -159,6 +166,7 @@
this.currentServerMaxPlayers = par1Packet1Login.maxPlayers;
this.mc.playerController.setGameType(par1Packet1Login.gameType);
this.addToSendQueue(new Packet204ClientInfo(this.mc.gameSettings.language, this.mc.gameSettings.renderDistance, this.mc.gameSettings.chatVisibility, this.mc.gameSettings.chatColours, this.mc.gameSettings.difficulty));
+ ForgeHooksClient.onLogin(par1Packet1Login, this, netManager);
}
public void handlePickupSpawn(Packet21PickupSpawn par1Packet21PickupSpawn)
@@ -586,7 +594,7 @@
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect) public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
{ {
@ -38,7 +21,7 @@
this.field_72554_f = true; this.field_72554_f = true;
this.mc.loadWorld((WorldClient)null); this.mc.loadWorld((WorldClient)null);
this.mc.displayGuiScreen(new GuiDisconnected("disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason})); this.mc.displayGuiScreen(new GuiDisconnected("disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
@@ -650,7 +658,11 @@ @@ -653,7 +658,11 @@
public void handleChat(Packet3Chat par1Packet3Chat) public void handleChat(Packet3Chat par1Packet3Chat)
{ {
@ -51,7 +34,7 @@
} }
public void handleAnimation(Packet18Animation par1Packet18Animation) public void handleAnimation(Packet18Animation par1Packet18Animation)
@@ -1005,6 +1017,19 @@ @@ -1008,6 +1017,19 @@
{ {
((TileEntityMobSpawner)var2).readFromNBT(par1Packet132TileEntityData.customParam1); ((TileEntityMobSpawner)var2).readFromNBT(par1Packet132TileEntityData.customParam1);
} }
@ -71,7 +54,7 @@
} }
} }
@@ -1141,6 +1166,10 @@ @@ -1144,6 +1166,10 @@
if (par1Packet131MapData.itemID == Item.map.shiftedIndex) if (par1Packet131MapData.itemID == Item.map.shiftedIndex)
{ {
ItemMap.getMPMapData(par1Packet131MapData.uniqueID, this.mc.theWorld).updateMPMapData(par1Packet131MapData.itemData); ItemMap.getMPMapData(par1Packet131MapData.uniqueID, this.mc.theWorld).updateMPMapData(par1Packet131MapData.itemData);

View File

@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/NetworkManager.java
+++ ../src_work/minecraft/net/minecraft/src/NetworkManager.java
@@ -5,6 +5,8 @@
public interface NetworkManager
{
void setNetHandler(NetHandler var1);
+
+ NetHandler getNetHandler();
/**
* Adds the packet to the correct send queue (chunk data packets go to a separate queue).

View File

@ -61,3 +61,15 @@
} }
} }
@@ -354,9 +376,10 @@
{
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = var5;
- if (var5.stackSize == 0)
+ if (var5.stackSize <= 0)
{
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null;
+ MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(par1EntityPlayer, var5));
}
return true;

View File

@ -11,27 +11,23 @@
public class RenderBiped extends RenderLiving public class RenderBiped extends RenderLiving
{ {
@@ -31,8 +35,11 @@ @@ -32,7 +36,10 @@
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F); GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
float var4; float var4;
-
- if (var3.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())) - if (var3.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
+
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED); + IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D)); + boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
+ +
+ if (var3.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))) + if (var3.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())))
{ {
var4 = 0.5F; var4 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -71,8 +78,11 @@ @@ -72,7 +79,10 @@
this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 0);
if (var3.getItem().requiresMultipleRenderPasses()) if (var3.getItem().requiresMultipleRenderPasses())
- { {
- this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 1); - this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 1);
+ {
+ for (int x = 1; x < var3.getItem().getRenderPasses(var3.getItemDamage()); x++) + for (int x = 1; x < var3.getItem().getRenderPasses(var3.getItemDamage()); x++)
+ { + {
+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, x); + this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, x);

View File

@ -1,16 +1,16 @@
--- ../src_base/minecraft/net/minecraft/src/RenderEngine.java --- ../src_base/minecraft/net/minecraft/src/RenderEngine.java
+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java +++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java
@@ -14,6 +14,9 @@ @@ -18,6 +18,9 @@
import java.util.List; import java.util.logging.Logger;
import java.util.Map;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
+ +
+import net.minecraftforge.client.ForgeHooksClient; +import net.minecraftforge.client.ForgeHooksClient;
+ +
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
public class RenderEngine import cpw.mods.fml.client.TextureFXManager;
@@ -155,6 +158,7 @@ @@ -164,6 +167,7 @@
try try
{ {
@ -18,7 +18,7 @@
this.singleIntBuffer.clear(); this.singleIntBuffer.clear();
GLAllocation.generateTextureNames(this.singleIntBuffer); GLAllocation.generateTextureNames(this.singleIntBuffer);
int var3 = this.singleIntBuffer.get(0); int var3 = this.singleIntBuffer.get(0);
@@ -198,6 +202,7 @@ @@ -207,6 +211,7 @@
} }
this.textureMap.put(par1Str, Integer.valueOf(var3)); this.textureMap.put(par1Str, Integer.valueOf(var3));

View File

@ -22,7 +22,7 @@
- if (var14 != null && RenderBlocks.renderItemIn3d(var14.getRenderType())) - if (var14 != null && RenderBlocks.renderItemIn3d(var14.getRenderType()))
+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, var10, var11, var12, random, renderManager.renderEngine, renderBlocks)) + if (ForgeHooksClient.renderEntityItem(par1EntityItem, var10, var11, var12, random, renderManager.renderEngine, renderBlocks))
+ { + {
+ ; + ;
+ } + }
+ else if (var10.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType())) + else if (var10.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType()))
{ {

View File

@ -1,30 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/TcpConnection.java
+++ ../src_work/minecraft/net/minecraft/src/TcpConnection.java
@@ -14,6 +14,8 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import javax.crypto.SecretKey;
+
+import net.minecraftforge.common.ForgeHooks;
public class TcpConnection implements NetworkManager
{
@@ -399,6 +401,7 @@
{
;
}
+ ForgeHooks.onDisconnect(this, par1Str, par2ArrayOfObj);
}
}
@@ -559,4 +562,10 @@
{
return par0TcpConnection.writeThread;
}
+
+ @Override
+ public NetHandler getNetHandler()
+ {
+ return theNetHandler;
+ }
}

View File

@ -1,68 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockTallGrass.java
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTallGrass.java
@@ -1,8 +1,12 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
-public class BlockTallGrass extends BlockFlower
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.IShearable;
+
+public class BlockTallGrass extends BlockFlower implements IShearable
{
protected BlockTallGrass(int par1, int par2)
{
@@ -24,7 +28,7 @@
*/
public int idDropped(int par1, Random par2Random, int par3)
{
- return par2Random.nextInt(8) == 0 ? Item.seeds.shiftedIndex : -1;
+ return -1;
}
/**
@@ -41,14 +45,37 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int meta, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (world.rand.nextInt(8) != 0)
{
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6));
+ return ret;
}
- else
+
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
{
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
+ ret.add(item);
}
+ return ret;
+ }
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));
+ return ret;
}
}

View File

@ -1,320 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/Chunk.java
+++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java
@@ -7,6 +7,9 @@
import java.util.List;
import java.util.Map;
import java.util.Random;
+
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.world.ChunkEvent;
public class Chunk
{
@@ -120,7 +123,9 @@
{
for (int var8 = 0; var8 < var5; ++var8)
{
- byte var9 = par2ArrayOfByte[var6 << 11 | var7 << 7 | var8];
+ /* FORGE: The following change, a cast from unsigned byte to int,
+ * fixes a vanilla bug when generating new chunks that contain a block ID > 127 */
+ int var9 = par2ArrayOfByte[var6 << 11 | var7 << 7 | var8] & 0xFF;
if (var9 != 0)
{
@@ -132,6 +137,48 @@
}
this.storageArrays[var10].setExtBlockID(var6, var8 & 15, var7, var9);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Metadata sensitive Chunk constructor for use in new ChunkProviders that
+ * use metadata sensitive blocks during generation.
+ *
+ * @param world The world this chunk belongs to
+ * @param ids A ByteArray containing all the BlockID's to set this chunk to
+ * @param metadata A ByteArray containing all the metadata to set this chunk to
+ * @param chunkX The chunk's X position
+ * @param chunkZ The Chunk's Z position
+ */
+ public Chunk(World world, byte[] ids, byte[] metadata, int chunkX, int chunkY)
+ {
+ this(world, chunkX, chunkY);
+ int var5 = ids.length / 256;
+
+ for (int x = 0; x < 16; ++x)
+ {
+ for (int z = 0; z < 16; ++z)
+ {
+ for (int y = 0; y < var5; ++y)
+ {
+ int idx = x << 11 | z << 7 | y;
+ int id = ids[idx] & 0xFF;
+ int meta = metadata[idx];
+
+ if (id != 0)
+ {
+ int var10 = y >> 4;
+
+ if (this.storageArrays[var10] == null)
+ {
+ this.storageArrays[var10] = new ExtendedBlockStorage(var10 << 4);
+ }
+
+ this.storageArrays[var10].setExtBlockID(x, y & 15, z, id);
+ this.storageArrays[var10].setExtBlockMetadata(x, y & 15, z, meta);
}
}
}
@@ -463,7 +510,7 @@
*/
public int getBlockID(int par1, int par2, int par3)
{
- if (par2 >> 4 >= this.storageArrays.length)
+ if (par2 >> 4 >= this.storageArrays.length || par2 >> 4 < 0)
{
return 0;
}
@@ -479,7 +526,7 @@
*/
public int getBlockMetadata(int par1, int par2, int par3)
{
- if (par2 >> 4 >= this.storageArrays.length)
+ if (par2 >> 4 >= this.storageArrays.length || par2 >> 4 < 0)
{
return 0;
}
@@ -520,6 +567,11 @@
}
else
{
+ if (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0)
+ {
+ return false;
+ }
+
ExtendedBlockStorage var10 = this.storageArrays[par2 >> 4];
boolean var11 = false;
@@ -550,7 +602,7 @@
{
Block.blocksList[var8].breakBlock(this.worldObj, var12, par2, var13, var8, var9);
}
- else if (Block.blocksList[var8] instanceof BlockContainer && var8 != par4)
+ else if (Block.blocksList[var8] != null && Block.blocksList[var8].hasTileEntity(var9))
{
this.worldObj.removeBlockTileEntity(var12, par2, var13);
}
@@ -594,29 +646,21 @@
Block.blocksList[par4].onBlockAdded(this.worldObj, var12, par2, var13);
}
- if (Block.blocksList[par4] instanceof BlockContainer)
+ if (Block.blocksList[par4] != null && Block.blocksList[par4].hasTileEntity(par5))
{
var14 = this.getChunkBlockTileEntity(par1, par2, par3);
if (var14 == null)
{
- var14 = ((BlockContainer)Block.blocksList[par4]).createNewTileEntity(this.worldObj);
+ var14 = Block.blocksList[par4].getTileEntity(this.worldObj, par5);
this.worldObj.setBlockTileEntity(var12, par2, var13, var14);
}
if (var14 != null)
{
var14.updateContainingBlockInfo();
+ var14.blockMetadata = par5;
}
- }
- }
- else if (var8 > 0 && Block.blocksList[var8] instanceof BlockContainer)
- {
- var14 = this.getChunkBlockTileEntity(par1, par2, par3);
-
- if (var14 != null)
- {
- var14.updateContainingBlockInfo();
}
}
@@ -631,7 +675,7 @@
*/
public boolean setBlockMetadata(int par1, int par2, int par3, int par4)
{
- ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4];
+ ExtendedBlockStorage var5 = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]);
if (var5 == null)
{
@@ -651,7 +695,7 @@
var5.setExtBlockMetadata(par1, par2 & 15, par3, par4);
int var7 = var5.getExtBlockID(par1, par2 & 15, par3);
- if (var7 > 0 && Block.blocksList[var7] instanceof BlockContainer)
+ if (var7 > 0 && Block.blocksList[var7] != null && Block.blocksList[var7].hasTileEntity(par4))
{
TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3);
@@ -672,7 +716,7 @@
*/
public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
{
- ExtendedBlockStorage var5 = this.storageArrays[par3 >> 4];
+ ExtendedBlockStorage var5 = (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0 ? null : storageArrays[par3 >> 4]);
return var5 == null ? (this.canBlockSeeTheSky(par2, par3, par4) ? par1EnumSkyBlock.defaultLightValue : 0) : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
}
@@ -682,6 +726,11 @@
*/
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
{
+ if (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0)
+ {
+ return;
+ }
+
ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4];
if (var6 == null)
@@ -710,7 +759,7 @@
*/
public int getBlockLightValue(int par1, int par2, int par3, int par4)
{
- ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4];
+ ExtendedBlockStorage var5 = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]);
if (var5 == null)
{
@@ -813,33 +862,32 @@
ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
+ if (var5 != null && var5.isInvalid())
+ {
+ chunkTileEntityMap.remove(var4);
+ var5 = null;
+ }
+
if (var5 == null)
{
int var6 = this.getBlockID(par1, par2, par3);
-
- if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity())
+ int meta = this.getBlockMetadata(par1, par2, par3);
+
+ if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity(meta))
{
return null;
}
if (var5 == null)
{
- var5 = ((BlockContainer)Block.blocksList[var6]).createNewTileEntity(this.worldObj);
+ var5 = Block.blocksList[var6].createNewTileEntity(this.worldObj, meta);
this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, var5);
}
var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
}
- if (var5 != null && var5.isInvalid())
- {
- this.chunkTileEntityMap.remove(var4);
- return null;
- }
- else
- {
- return var5;
- }
+ return var5;
}
/**
@@ -854,7 +902,7 @@
if (this.isChunkLoaded)
{
- this.worldObj.loadedTileEntityList.add(par1TileEntity);
+ this.worldObj.addTileEntity(par1TileEntity);
}
}
@@ -869,8 +917,14 @@
par4TileEntity.yCoord = par2;
par4TileEntity.zCoord = this.zPosition * 16 + par3;
- if (this.getBlockID(par1, par2, par3) != 0 && Block.blocksList[this.getBlockID(par1, par2, par3)] instanceof BlockContainer)
- {
+ Block block = Block.blocksList[getBlockID(par1, par2, par3)];
+ if (block != null && block.hasTileEntity(getBlockMetadata(par1, par2, par3)))
+ {
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(var5);
+ if (old != null)
+ {
+ old.invalidate();
+ }
par4TileEntity.validate();
this.chunkTileEntityMap.put(var5, par4TileEntity);
}
@@ -909,6 +963,7 @@
List var4 = var1[var3];
this.worldObj.addLoadedEntities(var4);
}
+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(this));
}
/**
@@ -933,6 +988,7 @@
List var4 = var5[var3];
this.worldObj.unloadEntities(var4);
}
+ MinecraftForge.EVENT_BUS.post(new ChunkEvent.Unload(this));
}
/**
@@ -949,8 +1005,8 @@
*/
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List)
{
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
if (var4 < 0)
{
@@ -998,8 +1054,8 @@
*/
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List)
{
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
if (var4 < 0)
{
@@ -1281,4 +1337,18 @@
}
}
}
+
+ /** FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int x, int y, int z)
+ {
+ ChunkPosition position = new ChunkPosition(x, y, z);
+ if (isChunkLoaded)
+ {
+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(position);
+ if (entity != null && entity.isInvalid())
+ {
+ chunkTileEntityMap.remove(position);
+ }
+ }
+ }
}

View File

@ -1,53 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemDye.java
+++ ../src_work/minecraft_server/net/minecraft/src/ItemDye.java
@@ -1,4 +1,8 @@
package net.minecraft.src;
+
+import net.minecraftforge.common.ForgeHooks;
+import net.minecraftforge.common.MinecraftForge;
+import net.minecraftforge.event.entity.BonemealEvent;
public class ItemDye extends Item
{
@@ -34,6 +38,22 @@
if (par1ItemStack.getItemDamage() == 15)
{
var11 = par3World.getBlockId(par4, par5, par6);
+
+ BonemealEvent event = new BonemealEvent(par2EntityPlayer, par3World, var11, par4, par5, par6);
+ MinecraftForge.EVENT_BUS.post(event);
+ if (event.isCanceled())
+ {
+ return false;
+ }
+
+ if (event.isHandeled())
+ {
+ if (!par3World.isRemote)
+ {
+ par1ItemStack.stackSize--;
+ }
+ return true;
+ }
if (var11 == Block.sapling.blockID)
{
@@ -133,16 +153,9 @@
par3World.setBlockAndMetadataWithNotify(var13, var14, var15, Block.tallGrass.blockID, 1);
}
}
- else if (itemRand.nextInt(3) != 0)
+ else
{
- if (Block.plantYellow.canBlockStay(par3World, var13, var14, var15))
- {
- par3World.setBlockWithNotify(var13, var14, var15, Block.plantYellow.blockID);
- }
- }
- else if (Block.plantRed.canBlockStay(par3World, var13, var14, var15))
- {
- par3World.setBlockWithNotify(var13, var14, var15, Block.plantRed.blockID);
+ ForgeHooks.plantGrass(par3World, var13, var14, var15);
}
}
}

View File

@ -0,0 +1,20 @@
--- ../src_base/minecraft_server/net/minecraft/src/ModLoader.java
+++ ../src_work/minecraft_server/net/minecraft/src/ModLoader.java
@@ -538,7 +538,7 @@
*/
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id)
{
- EntityRegistry.registerGlobalEntityID(entityClass, entityName, id);
+ EntityRegistry.registerEntityID(entityClass, entityName, id);
}
/**
@@ -552,7 +552,7 @@
*/
public static void registerEntityID(Class<? extends Entity> entityClass, String entityName, int id, int background, int foreground)
{
- EntityRegistry.registerGlobalEntityID(entityClass, entityName, id, background, foreground);
+ EntityRegistry.registerEntityID(entityClass, entityName, id, background, foreground);
}
public static void registerKey(BaseMod mod, Object keyHandler, boolean allowRepeat)

View File

@ -1,96 +0,0 @@
--- ../src_base/minecraft_server/net/minecraft/src/World.java
+++ ../src_work/minecraft_server/net/minecraft/src/World.java
@@ -8,8 +8,17 @@
import java.util.Random;
import java.util.Set;
+import net.minecraftforge.common.Orientation;
+
public abstract class World implements IBlockAccess
{
+ /**
+ * Used in the getEntitiesWithinAABB functions to expand the search area for entities.
+ * Modders should change this variable to a higher value if it is less then the radius
+ * of one of there entities.
+ */
+ public static double MAX_ENTITY_RADIUS = 2.0D;
+
/**
* boolean; if true updates scheduled by scheduleBlockUpdate happen immediately
*/
@@ -248,7 +257,8 @@
public boolean blockHasTileEntity(int par1, int par2, int par3)
{
int var4 = this.getBlockId(par1, par2, par3);
- return Block.blocksList[var4] != null && Block.blocksList[var4].hasTileEntity();
+ int meta = this.getBlockMetadata(par1, par2, par3);
+ return Block.blocksList[var4] != null && Block.blocksList[var4].hasTileEntity(meta);
}
/**
@@ -3515,4 +3525,65 @@
var7.destroyBlockPartially(par1, par2, par3, par4, par5);
}
}
+
+ /**
+ * Adds a single TileEntity to the world.
+ * @param entity The TileEntity to be added.
+ */
+ public void addTileEntity(TileEntity entity)
+ {
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if(entity.canUpdate())
+ {
+ dest.add(entity);
+ }
+ }
+
+ /**
+ * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ *
+ * @param X Block X Position
+ * @param Y Block Y Position
+ * @param Z Block Z Position
+ * @param side The Side in question
+ * @return True if the side is solid
+ */
+ public boolean isBlockSolidOnSide(int X, int Y, int Z, Orientation side)
+ {
+ return isBlockSolidOnSide(X, Y, Z, side, false);
+ }
+
+ /**
+ * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ *
+ * @param X Block X Position
+ * @param Y Block Y Position
+ * @param Z Block Z Position
+ * @param side The Side in question
+ * @param _default The defult to return if the block doesn't exist.
+ * @return True if the side is solid
+ */
+ public boolean isBlockSolidOnSide(int X, int Y, int Z, Orientation side, boolean _default)
+ {
+ if (X < -30000000 || Z < -30000000 || X >= 30000000 || Z >= 30000000)
+ {
+ return _default;
+ }
+
+ Chunk var5 = this.chunkProvider.provideChunk(X >> 4, Z >> 4);
+ if (var5 == null || var5.isEmpty())
+ {
+ return _default;
+ }
+
+ Block block = Block.blocksList[getBlockId(X, Y, Z)];
+ if(block == null)
+ {
+ return false;
+ }
+
+ return block.isBlockSolidOnSide(this, X, Y, Z, side);
+ }
}

View File

@ -12,8 +12,7 @@ from forge import setup_forge_mcp, apply_forge_patches
def main(): def main():
print '=================================== Setup Start =================================' print '=================================== Setup Start ================================='
dont_gen_conf = '-no_gen_conf' in sys.argv dont_gen_conf = '-no_gen_conf' in sys.argv
setup_forge_mcp(mcp_dir, forge_dir, dont_gen_conf) setup_fml(dont_gen_conf)
setup_fml()
base_dir = os.path.join(mcp_dir, 'src_base') base_dir = os.path.join(mcp_dir, 'src_base')
work_dir = os.path.join(mcp_dir, 'src_work') work_dir = os.path.join(mcp_dir, 'src_work')
@ -44,7 +43,7 @@ def main():
print '=================================== Setup Finished =================================' print '=================================== Setup Finished ================================='
def setup_fml(): def setup_fml(dont_gen_conf):
print 'Setting up Forge ModLoader' print 'Setting up Forge ModLoader'
fml = glob.glob(os.path.join(forge_dir, 'fml-src-*.zip')) fml = glob.glob(os.path.join(forge_dir, 'fml-src-*.zip'))
if not len(fml) == 1: if not len(fml) == 1:
@ -67,7 +66,7 @@ def setup_fml():
sys.path.append(fml_dir) sys.path.append(fml_dir)
from install import fml_main from install import fml_main
fml_main(fml_dir, mcp_dir) fml_main(fml_dir, mcp_dir, dont_gen_conf)
if __name__ == '__main__': if __name__ == '__main__':
main() main()