First push of server side patch updates for 1.2.3. MLMP is still not updated so it does not include those changes, and will not compile.

This commit is contained in:
LexManos 2012-03-04 20:46:15 -08:00
parent 70388dd607
commit 5a0e798102
66 changed files with 2979 additions and 3135 deletions

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/server/MinecraftServer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/server/MinecraftServer.java 0000-00-00 00:00:00.000000000 -0000
@@ -7,6 +7,7 @@
@@ -8,6 +8,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@ -8,243 +8,214 @@
import java.util.Iterator;
import java.util.List;
import java.util.Random;
@@ -42,12 +43,14 @@
@@ -42,11 +43,13 @@
import net.minecraft.src.ThreadServerApplication;
import net.minecraft.src.ThreadSleepForever;
import net.minecraft.src.ThreadServerSleep;
import net.minecraft.src.Vec3D;
+import net.minecraft.src.World;
import net.minecraft.src.WorldInfo;
import net.minecraft.src.WorldManager;
import net.minecraft.src.WorldProvider;
import net.minecraft.src.WorldServer;
import net.minecraft.src.WorldServerMulti;
import net.minecraft.src.WorldSettings;
import net.minecraft.src.WorldType;
+import net.minecraft.src.forge.DimensionManager;
public class MinecraftServer
implements Runnable, ICommandListener, IServer
@@ -58,9 +61,10 @@
private int serverPort;
public NetworkListenThread networkServer;
public class MinecraftServer implements Runnable, ICommandListener, IServer
{
@@ -67,9 +70,10 @@
public PropertyManager propertyManagerObj;
- public WorldServer worldMngr[];
+ //public WorldServer worldMngr[];
public long field_40027_f[];
- public long field_40028_g[][];
+ //public long field_40028_g[][];
/** The server world manager. */
- public WorldServer[] worldMngr;
+ //public WorldServer[] worldMngr;
public long[] field_40027_f = new long[100];
- public long[][] field_40028_g;
+ //public long[][] field_40028_g;
+ public Hashtable<Integer, long[]> worldTickTimes = new Hashtable<Integer, long[]>();
/** the server config manager for this server */
public ServerConfigurationManager configManager;
private ConsoleCommandHandler commandHandler;
private boolean serverRunning;
@@ -70,7 +74,7 @@
public int percentDone;
private List playersOnline;
private List commands;
- public EntityTracker entityTracker[];
+ //public EntityTracker entityTracker[];
@@ -97,7 +101,7 @@
/** A list containing all the commands entered. */
private List commands = Collections.synchronizedList(new ArrayList());
- public EntityTracker[] entityTracker = new EntityTracker[3];
+ //public EntityTracker[] entityTracker = new EntityTracker[3];
/** True if the server is in online mode. */
public boolean onlineMode;
public boolean spawnPeacefulMobs;
public boolean field_44002_p;
@@ -88,7 +92,7 @@
deathTime = 0;
playersOnline = new ArrayList();
commands = Collections.synchronizedList(new ArrayList());
- entityTracker = new EntityTracker[3];
+ //entityTracker = new EntityTracker[3];
new ThreadSleepForever(this);
@@ -189,9 +193,11 @@
}
@@ -143,9 +147,11 @@
logger.warning("To change this, set \"online-mode\" to \"true\" in the server.settings file.");
}
configManager = new ServerConfigurationManager(this);
this.configManager = new ServerConfigurationManager(this);
+ /*
entityTracker[0] = new EntityTracker(this, 0);
entityTracker[1] = new EntityTracker(this, -1);
entityTracker[2] = new EntityTracker(this, 1);
this.entityTracker[0] = new EntityTracker(this, 0);
this.entityTracker[1] = new EntityTracker(this, -1);
this.entityTracker[2] = new EntityTracker(this, 1);
+ */
long l = System.nanoTime();
String s = propertyManagerObj.getStringProperty("level-name", "world");
String s1 = propertyManagerObj.getStringProperty("level-seed", "");
@@ -196,46 +202,43 @@
long var3 = System.nanoTime();
String var5 = this.propertyManagerObj.getStringProperty("level-name", "world");
String var6 = this.propertyManagerObj.getStringProperty("level-seed", "");
@@ -257,53 +263,36 @@
logger.info("Converting map!");
isaveformat.convertMapFormat(s, new ConvertProgressUpdater(this));
par1ISaveFormat.convertMapFormat(par2Str, new ConvertProgressUpdater(this));
}
- worldMngr = new WorldServer[3];
- field_40028_g = new long[worldMngr.length][100];
+ //worldMngr = new WorldServer[3];
+ //field_40028_g = new long[3][100];
int i = propertyManagerObj.getIntProperty("gamemode", 0);
i = WorldSettings.validGameType(i);
logger.info((new StringBuilder()).append("Default game type: ").append(i).toString());
boolean flag = propertyManagerObj.getBooleanProperty("generate-structures", true);
WorldSettings worldsettings = new WorldSettings(l, i, flag, false, enumworldtype);
SaveOldDir saveolddir = new SaveOldDir(new File("."), s, true);
- for (int j = 0; j < worldMngr.length; j++)
-
+ /*
this.worldMngr = new WorldServer[3];
this.field_40028_g = new long[this.worldMngr.length][100];
+ */
int var6 = this.propertyManagerObj.getIntProperty("gamemode", 0);
var6 = WorldSettings.validGameType(var6);
logger.info("Default game type: " + var6);
boolean var7 = this.propertyManagerObj.getBooleanProperty("generate-structures", true);
WorldSettings var8 = new WorldSettings(par3, var6, var7, false, par5WorldType);
AnvilSaveHandler var9 = new AnvilSaveHandler(new File("."), par2Str, true);
-
- for (int var10 = 0; var10 < this.worldMngr.length; ++var10)
- {
- byte byte0 = 0;
- if (j == 1)
- byte var11 = 0;
-
- if (var10 == 1)
- {
- byte0 = -1;
- var11 = -1;
- }
- if (j == 2)
-
- if (var10 == 2)
- {
- byte0 = 1;
- var11 = 1;
- }
- if (j == 0)
-
- if (var10 == 0)
- {
- worldMngr[j] = new WorldServer(this, saveolddir, s, byte0, worldsettings);
- this.worldMngr[var10] = new WorldServer(this, var9, par2Str, var11, var8);
- }
- else
- {
- worldMngr[j] = new WorldServerMulti(this, saveolddir, s, byte0, worldsettings, worldMngr[0]);
- this.worldMngr[var10] = new WorldServerMulti(this, var9, par2Str, var11, var8, this.worldMngr[0]);
- }
- worldMngr[j].addWorldAccess(new WorldManager(this, worldMngr[j]));
- worldMngr[j].difficultySetting = propertyManagerObj.getIntProperty("difficulty", 1);
- worldMngr[j].setAllowedSpawnTypes(propertyManagerObj.getBooleanProperty("spawn-monsters", true), spawnPeacefulMobs);
- worldMngr[j].getWorldInfo().setGameType(i);
- configManager.setPlayerManager(worldMngr);
+
+ WorldServer overWorld = new WorldServer(this, saveolddir, s, 0, worldsettings);
+ overWorld.addWorldAccess(new WorldManager(this, overWorld));
+ overWorld.difficultySetting = propertyManagerObj.getIntProperty("difficulty", 1);
+ overWorld.setAllowedSpawnTypes(propertyManagerObj.getBooleanProperty("spawn-monsters", true), spawnPeacefulMobs);
+ overWorld.getWorldInfo().setGameType(i);
+ worldTickTimes.put(0, new long[100]);
+ configManager.setPlayerManager(new WorldServer[]{ overWorld });
-
- this.worldMngr[var10].addWorldAccess(new WorldManager(this, this.worldMngr[var10]));
- this.worldMngr[var10].difficultySetting = this.propertyManagerObj.getIntProperty("difficulty", 1);
- this.worldMngr[var10].setAllowedSpawnTypes(this.propertyManagerObj.getBooleanProperty("spawn-monsters", true), this.spawnPeacefulMobs);
- this.worldMngr[var10].getWorldInfo().setGameType(var6);
- this.configManager.setPlayerManager(this.worldMngr);
+
+ WorldServer overWorld = new WorldServer(this, var9, par2Str, 0, var8);
+ for (Integer id : DimensionManager.getIDs())
+ {
+ if (id == 0)
+ {
+ continue;
+ }
+ WorldServer world = new WorldServerMulti(this, saveolddir, s, id, worldsettings, overWorld);
+ WorldServer world = (id == 0 ? overWorld : new WorldServerMulti(this, var9, par2Str, id, var8, overWorld));
+ world.addWorldAccess(new WorldManager(this, overWorld));
+ world.difficultySetting = propertyManagerObj.getIntProperty("difficulty", 1);
+ world.setAllowedSpawnTypes(propertyManagerObj.getBooleanProperty("spawn-monsters", true), spawnPeacefulMobs);
+ world.getWorldInfo().setGameType(i);
+ world.getWorldInfo().setGameType(var6);
+ worldTickTimes.put(id, new long[100]);
}
+ configManager.setPlayerManager(new WorldServer[]{ overWorld });
char c = '\304';
long l1 = System.currentTimeMillis();
- for (int k = 0; k < 1; k++)
short var22 = 196;
long var23 = System.currentTimeMillis();
- for (int var13 = 0; var13 < 1; ++var13)
+ for (Integer id : DimensionManager.getIDs())
{
- logger.info((new StringBuilder()).append("Preparing start region for level ").append(k).toString());
- WorldServer worldserver = worldMngr[k];
- logger.info("Preparing start region for level " + var13);
- WorldServer var14 = this.worldMngr[var13];
+ logger.info("Preparing start region for level " + id);
+ WorldServer worldserver = (WorldServer)DimensionManager.getWorld(id);
ChunkCoordinates chunkcoordinates = worldserver.getSpawnPoint();
for (int i1 = -c; i1 <= c && serverRunning; i1 += 16)
{
@@ -278,9 +281,9 @@
private void saveServerWorld()
+ WorldServer var14 = (WorldServer)DimensionManager.getWorld(id);
ChunkCoordinates var15 = var14.getSpawnPoint();
for (int var16 = -var22; var16 <= var22 && this.serverRunning; var16 += 16)
@@ -364,9 +353,9 @@
{
logger.info("Saving chunks");
- for (int i = 0; i < worldMngr.length; i++)
- for (int var1 = 0; var1 < this.worldMngr.length; ++var1)
+ for (World world : DimensionManager.getWorlds())
{
- WorldServer worldserver = worldMngr[i];
+ WorldServer worldserver = (WorldServer)world;
worldserver.saveWorld(true, null);
worldserver.func_30006_w();
- WorldServer var2 = this.worldMngr[var1];
+ WorldServer var2 = (WorldServer)world;
var2.saveWorld(true, (IProgressUpdate)null);
var2.func_30006_w();
}
@@ -293,12 +296,12 @@
{
configManager.savePlayerStates();
}
- for (int i = 0; i < worldMngr.length; i++)
+ for (World worldserver : DimensionManager.getWorlds())
{
- WorldServer worldserver = worldMngr[i];
if (worldserver != null)
{
saveServerWorld();
+ break;
}
}
}
@@ -333,7 +336,7 @@
}
l1 += l3;
l = l2;
- if (worldMngr[0].isAllPlayersFullyAsleep())
+ if (((WorldServer)DimensionManager.getWorld(0)).isAllPlayersFullyAsleep())
{
doTick();
l1 = 0L;
@@ -426,12 +429,12 @@
AxisAlignedBB.clearBoundingBoxPool();
Vec3D.initialize();
deathTime++;
- for (int j = 0; j < worldMngr.length; j++)
+ for (Integer j : DimensionManager.getIDs())
{
long l1 = System.nanoTime();
if (j == 0 || propertyManagerObj.getBooleanProperty("allow-nether", true))
{
- WorldServer worldserver = worldMngr[j];
+ WorldServer worldserver = (WorldServer)DimensionManager.getWorld(j);
if (deathTime % 20 == 0)
{
configManager.sendPacketToAllPlayersInDimension(new Packet4UpdateTime(worldserver.getWorldTime()), worldserver.worldProvider.worldType);
@@ -440,14 +443,14 @@
while (worldserver.updatingLighting()) ;
worldserver.updateEntities();
}
- field_40028_g[j][deathTime % 100] = System.nanoTime() - l1;
+ worldTickTimes.get(j)[deathTime % 100] = System.nanoTime() - l1;
@@ -384,13 +373,14 @@
this.configManager.savePlayerStates();
}
networkServer.handleNetworkListenThread();
configManager.onTick();
- for (int k = 0; k < entityTracker.length; k++)
- for (int var1 = 0; var1 < this.worldMngr.length; ++var1)
+ for (World world : DimensionManager.getWorlds())
{
- entityTracker[k].updateTrackedEntities();
- WorldServer var2 = this.worldMngr[var1];
+ WorldServer var2 = (WorldServer)world;
if (var2 != null)
{
this.saveServerWorld();
+ break; //Added because saveServerWorld() loops through all worlds anyways.
}
}
}
@@ -431,7 +421,7 @@
var3 += var7;
var1 = var5;
- if (this.worldMngr[0].isAllPlayersFullyAsleep())
+ if (((WorldServer)DimensionManager.getWorld(0)).isAllPlayersFullyAsleep())
{
this.doTick();
var3 = 0L;
@@ -532,13 +522,13 @@
Vec3D.initialize();
++this.deathTime;
- for (var9 = 0; var9 < this.worldMngr.length; ++var9)
+ for (Integer id : DimensionManager.getIDs())
{
long var10 = System.nanoTime();
- if (var9 == 0 || this.propertyManagerObj.getBooleanProperty("allow-nether", true))
+ if (id == 0 || this.propertyManagerObj.getBooleanProperty("allow-nether", true))
{
- WorldServer var7 = this.worldMngr[var9];
+ WorldServer var7 = (WorldServer)DimensionManager.getWorld(id);
if (this.deathTime % 20 == 0)
{
@@ -557,15 +547,15 @@
}
}
- this.field_40028_g[var9][this.deathTime % 100] = System.nanoTime() - var10;
+ worldTickTimes.get(id)[this.deathTime % 100] = System.nanoTime() - var10;
}
this.networkServer.handleNetworkListenThread();
this.configManager.onTick();
- for (var9 = 0; var9 < this.entityTracker.length; ++var9)
+ for (World world : DimensionManager.getWorlds())
{
- this.entityTracker[var9].updateTrackedEntities();
+ ((WorldServer)world).entityTracker.updateTrackedEntities();
}
for (int i1 = 0; i1 < playersOnline.size(); i1++)
@@ -525,34 +528,17 @@
public WorldServer getWorldManager(int i)
for (var9 = 0; var9 < this.playersOnline.size(); ++var9)
@@ -679,7 +669,8 @@
*/
public WorldServer getWorldManager(int par1)
{
- if (i == -1)
- {
- return worldMngr[1];
- }
- if (i == 1)
- {
- return worldMngr[2];
- }
- else
+ WorldServer ret = (WorldServer)DimensionManager.getWorld(i);
+ if (ret == null)
{
- return worldMngr[0];
+ ret = (WorldServer)DimensionManager.getWorld(0);
}
+ return ret;
- return par1 == -1 ? this.worldMngr[1] : (par1 == 1 ? this.worldMngr[2] : this.worldMngr[0]);
+ WorldServer ret = (WorldServer)DimensionManager.getWorld(par1);
+ return (ret != null ? ret : (WorldServer)DimensionManager.getWorld(0));
}
public EntityTracker getEntityTracker(int i)
/**
@@ -687,7 +678,7 @@
*/
public EntityTracker getEntityTracker(int par1)
{
- if (i == -1)
- {
- return entityTracker[1];
- }
- if (i == 1)
- {
- return entityTracker[2];
- }
- else
- {
- return entityTracker[0];
- }
+ return getWorldManager(i).entityTracker;
- return par1 == -1 ? this.entityTracker[1] : (par1 == 1 ? this.entityTracker[2] : this.entityTracker[0]);
+ return getWorldManager(par1).entityTracker;
}
public int getIntProperty(String s, int i)
/**

View File

@ -8,176 +8,256 @@
+
public class Block
{
public static final StepSound soundPowderFootstep;
@@ -344,6 +346,12 @@
public static final StepSound soundPowderFootstep = new StepSound("stone", 1.0F, 1.0F);
@@ -396,7 +398,7 @@
public boolean func_48124_n()
{
- return this.field_48128_bU;
+ return hasTileEntity(0);
}
+ /**
/**
@@ -535,12 +537,16 @@
return this.blockID;
}
+
/**
- * Defines whether or not a play can break the block with current tool.
+ * Deprecated in favor of a metadata sensitive version
+ * @param entityplayer Entity attacking the block
+ * @return
+ */
*/
+ @Deprecated
public int quantityDropped(Random random)
public float blockStrength(EntityPlayer par1EntityPlayer)
{
return 1;
@@ -356,18 +364,7 @@
public float blockStrength(EntityPlayer entityplayer)
{
- if (blockHardness < 0.0F)
- {
- return 0.0F;
- }
- if (!entityplayer.canHarvestBlock(this))
- {
- return 1.0F / blockHardness / 100F;
- }
- else
- {
- return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F;
- }
+ return blockStrength(entityplayer, 0);
- return this.blockHardness < 0.0F ? 0.0F : (!par1EntityPlayer.canHarvestBlock(this) ? 1.0F / this.blockHardness / 100.0F : par1EntityPlayer.getCurrentPlayerStrVsBlock(this) / this.blockHardness / 30.0F);
+ return blockStrength(par1EntityPlayer, 0);
}
public final void dropBlockAsItem(World world, int i, int j, int k, int l, int i1)
@@ -381,18 +378,14 @@
/**
@@ -559,17 +565,13 @@
if (!par1World.isRemote)
{
return;
}
- int j1 = quantityDroppedWithBonus(i1, world.rand);
- for (int k1 = 0; k1 < j1; k1++)
+ ArrayList<ItemStack> items = getBlockDropped(world, i, j, k, l, i1);
+ for(ItemStack item : items)
int var8 = this.quantityDroppedWithBonus(par7, par1World.rand);
-
- for (int var9 = 0; var9 < var8; ++var9)
+
+ ArrayList<ItemStack> items = getBlockDropped(par1World, par2, par3, par4, par5, par7);
+ for (ItemStack item : items)
{
if (world.rand.nextFloat() > f)
if (par1World.rand.nextFloat() <= par6)
{
continue;
}
- int l1 = idDropped(l, world.rand, i1);
- if (l1 > 0)
- int var10 = this.idDropped(par5, par1World.rand, par7);
-
- if (var10 > 0)
- {
- dropBlockAsItem_do(world, i, j, k, new ItemStack(l1, 1, damageDropped(l)));
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5)));
- }
+ dropBlockAsItem_do(world, i, j, k, item);
+ this.dropBlockAsItem_do(par1World, par2, par3, par4, item);
}
}
}
@@ -849,7 +851,7 @@
par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
par2EntityPlayer.addExhaustion(0.025F);
@@ -620,7 +613,7 @@
- if (this.renderAsNormalBlock() && !this.field_48128_bU && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory))
+ if (this.renderAsNormalBlock() && !hasTileEntity(par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory))
{
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
entityplayer.addExhaustion(0.025F);
- if (renderAsNormalBlock() && !isBlockContainer[blockID] && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
+ if (renderAsNormalBlock() && !hasTileEntity(l) && EnchantmentHelper.getSilkTouchModifier(entityplayer.inventory))
{
ItemStack itemstack = createStackedBlock(l);
if (itemstack != null)
@@ -699,6 +692,278 @@
{
}
ItemStack var8 = this.createStackedBlock(par6);
+ /* FORGE: Allow a block to set illumination on a coordinate basis.
@@ -951,6 +953,362 @@
*/
public void onFallenUpon(World par1World, int par2, int par3, int par4, Entity par5Entity, float par6) {}
+ /* =================================================== FORGE START =====================================*/
+ /**
+ * Get a light value for this block, normal ranges are between 0 and 15
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return The light value
+ */
+ public int getLightValue(IBlockAccess iba, int i, int j, int k)
+ public int getLightValue(IBlockAccess world, int x, int y, int z)
+ {
+ return lightValue[blockID];
+ }
+
+ /* FORGE: Implement and return true if you wish this block to behave
+ * like a ladder when the player is inside.
+ /**
+ * Checks if a player or entity can use this block to 'climb' like a ladder.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return True if the block should act like a ladder
+ */
+ public boolean isLadder(World world, int i, int j, int k)
+ public boolean isLadder(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /* FORGE: Return true if the block is a normal, solid cube. This
+ /**
+ * Return true if the block is a normal, solid cube. This
+ * determines indirect power state, entity ejection from blocks, and a few
+ * others.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return True if the block is a full cube
+ */
+ public boolean isBlockNormalCube(World world, int i, int j, int k)
+ public boolean isBlockNormalCube(World world, int x, int y, int z)
+ {
+ return blockMaterial.isOpaque() && renderAsNormalBlock();
+ }
+
+ /* FORGE: Return true if the block is solid on the given side. This
+ * is used by placement logic. */
+ public boolean isBlockSolidOnSide(World world, int i, int j, int k, int side)
+ /**
+ * Checks if the block is a solid face on the given side, used by placement logic.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @param size The side to check
+ * @return True if the block is solid on the specified side.
+ */
+ public boolean isBlockSolidOnSide(World world, int x, int y, int z, int side)
+ {
+ return isBlockNormalCube(world, i, j, k);
+ return isBlockNormalCube(world, x, y, z);
+ }
+
+ /* FORGE: Return true if the player can place a new block in the block
+ * occupied by this one, like water, lava, fire, etc.
+ /**
+ * Determines if a new block can be replace the space occupied by this one,
+ * Used in the player's placement code to make the block act like water, and lava.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return True if the block is replaceable by another block
+ */
+ public boolean isBlockReplaceable(World world, int i, int j, int k)
+ public boolean isBlockReplaceable(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should set fire and deal fire damage
+ * to entities coming into contact with it, false otherwise.
+ /**
+ * Determines if this block should set fire and deal fire damage
+ * to entities coming into contact with it.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return True if the block should deal damage
+ */
+ public boolean isBlockBurning(World world, int i, int j, int k)
+ public boolean isBlockBurning(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /* FORGE: Return true if this block should be treated as an air block
+ * by the rest of the code, false otherwise. This method is primarily
+ /**
+ * Determines this block should be treated as an air block
+ * by the rest of the code. This method is primarily
+ * useful for creating pure logic-blocks that will be invisible
+ * to the player and otherwise interact as air would.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return True if the block considered air
+ */
+ public boolean isAirBlock(World world, int i, int j, int k)
+ public boolean isAirBlock(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /* FORGE: Return the block hardness with metadata md.
+ /**
+ * Metadata sensitive version of the default getHardness function.
+ *
+ * @param meta The block's current metatdata
+ * @return Block hardness
+ */
+ public float getHardness(int md)
+ public float getHardness(int meta)
+ {
+ return blockHardness;
+ }
+
+ /* FORGE: Return the block strength of the block at i,j,k against the
+ * player.
+ /**
+ * Determines this block's strength against being destroyed by a player.
+ *
+ * @param world The current world
+ * @param player The player damaging the block, may be null
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return A value
+ */
+ public float blockStrength(World world, EntityPlayer player, int i, int j, int k)
+ public float blockStrength(World world, EntityPlayer player, int x, int y, int z)
+ {
+ return blockStrength(player, world.getBlockMetadata(i, j, k));
+ return blockStrength(player, world.getBlockMetadata(x, y, z));
+ }
+
+ /* FORGE: Return the block strength of a prototypical block with metadata
+ * md against the player.
+ /**
+ * Determines this block's strength against being destroyed by a player.
+ *
+ * @param player The player damaging the block, may be null
+ * @param meta The block's current metadata
+ * @return The larger the value, the faster it breaks.
+ */
+ public float blockStrength(EntityPlayer player, int md)
+ public float blockStrength(EntityPlayer player, int meta)
+ {
+ return ForgeHooks.blockStrength(this, player, md);
+ return ForgeHooks.blockStrength(this, player, meta);
+ }
+
+ /* FORGE: Return true if the player can harvest a prototypical block with
+ * metadata md.
+ /**
+ * Determines if the player can harvest this block, obtaining it's drops when the block is destroyed.
+ *
+ * @param player The player damaging the block, may be null
+ * @param meta The block's current metadata
+ * @return True tospawn the drops
+ */
+ public boolean canHarvestBlock(EntityPlayer player, int md) {
+ return ForgeHooks.canHarvestBlock(this,player,md);
+ public boolean canHarvestBlock(EntityPlayer player, int meta)
+ {
+ return ForgeHooks.canHarvestBlock(this, player, meta);
+ }
+
+ /* FORGE: Called when a player removes a block. This is responsible for
+ /**
+ * Called when a player removes a block. This is responsible for
+ * actually destroying the block, and the block is intact at time of call.
+ * This is called regardless of whether the player can harvest the block or
+ * not. Return true if the block is actually destroyed.
+ * not.
+ *
+ * Return true if the block is actually destroyed.
+ *
+ * Note: When used in multiplayer, this is called on both client and
+ * server sides!
+ *
+ * @param world The current world
+ * @param player The player damaging the block, may be null
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return True if the block is actually destroyed.
+ */
+ public boolean removeBlockByPlayer(World world, EntityPlayer player, int i, int j, int k)
+ public boolean removeBlockByPlayer(World world, EntityPlayer player, int x, int y, int z)
+ {
+ return world.setBlockWithNotify(i, j, k, 0);
+ return world.setBlockWithNotify(x, y, z, 0);
+ }
+
+ /* FORGE: This is not called by the server, but declared here for compatibility
+ /**
+ * Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this block you want a player in creative mode
+ * to have access to.
+ *
+ * @param itemList The list of items to display on the creative inventory.
+ */
+ public void addCreativeItems(ArrayList itemList)
+ {
@ -239,8 +319,8 @@
+
+ /**
+ * Currently only called by fire when it is on top of this block.
+ * Returning true will prevent the fire from naturally dieing during updating.
+ * Also prevents firing from dieing from rain.
+ * Returning true will prevent the fire from naturally dying during updating.
+ * Also prevents firing from dying from rain.
+ *
+ * @param world The current world
+ * @param x The blocks X position
@ -287,8 +367,7 @@
+ */
+ public boolean hasTileEntity(int metadata)
+ {
+ return (isBlockContainer[blockID]);
+
+ return field_48128_bU;
+ }
+
+ /**
@ -326,14 +405,14 @@
+ * This returns a complete list of items dropped from this block.
+ *
+ * @param world The current world
+ * @param X X Position
+ * @param x X Position
+ * @param Y Y Position
+ * @param Z Z Position
+ * @param metadata Current metadata
+ * @param fortune Breakers fortune level
+ * @return A ArrayList containing all items this block drops
+ */
+ 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)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
@ -349,6 +428,6 @@
+ return ret;
+ }
+
static Class _mthclass$(String s)
static
{
try
Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setItemName("cloth");

View File

@ -1,119 +1,90 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
@@ -32,36 +32,36 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
@@ -49,7 +49,10 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5);
- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)));
+ return (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) ||
+ (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) ||
+ (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) ||
+ (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5));
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
/**
@@ -57,7 +60,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1, 2);
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -69,19 +69,19 @@
int i1 = world.getBlockMetadata(i, j, k);
int j1 = i1 & 8;
i1 &= 7;
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- else if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ else if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- else if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ else if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- else if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ else if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -94,19 +94,19 @@
/**
@@ -70,19 +76,19 @@
int var7 = var6 & 8;
var6 &= 7;
private int getOrientation(World world, int i, int j, int k)
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return 1;
var6 = 4;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
- else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ else if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
return 2;
var6 = 3;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
- else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ else if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
return 3;
var6 = 2;
}
- return !world.isBlockNormalCube(i, j, k + 1) ? 1 : 4;
+ return !world.isBlockSolidOnSide(i, j, k + 1, 2) ? 1 : 4;
- else if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ else if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
var6 = 1;
}
@@ -99,7 +105,11 @@
*/
private int getOrientation(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? 1 : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? 2 : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? 3 : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? 4 : 1)));
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5)) return 1;
+ if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) return 2;
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) return 3;
+ if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) return 4;
+ return 1;
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
@@ -115,19 +115,19 @@
/**
@@ -113,22 +123,22 @@
int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7;
boolean var7 = false;
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) && var6 == 1)
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) && var6 == 2)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) && var6 == 4)
{
flag = true;
var7 = true;
}

View File

@ -1,31 +1,31 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
@@ -334,23 +334,23 @@
@@ -370,23 +370,23 @@
{
return true;
}
- if (world.isBlockNormalCube(i, j + 1, k))
+ if (world.isBlockSolidOnSide(i, j + 1, k, 0))
- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, 0))
{
return true;
}
- if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockNormalCube(i - 1, j + 1, k))
+ if (world.getBlockId(i - 1, j, k) == blockID && world.isBlockSolidOnSide(i - 1, j + 1, k, 0))
- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4))
+ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, 0))
{
return true;
}
- if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockNormalCube(i + 1, j + 1, k))
+ if (world.getBlockId(i + 1, j, k) == blockID && world.isBlockSolidOnSide(i + 1, j + 1, k, 0))
- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4))
+ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, 0))
{
return true;
}
- if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockNormalCube(i, j + 1, k - 1))
+ if (world.getBlockId(i, j, k - 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k - 1, 0))
- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1))
+ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, 0))
{
return true;
}
- if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockNormalCube(i, j + 1, k + 1))
+ if (world.getBlockId(i, j, k + 1) == blockID && world.isBlockSolidOnSide(i, j + 1, k + 1, 0))
- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1))
+ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, 0))
{
return true;
}

View File

@ -1,25 +1,16 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
@@ -17,7 +17,7 @@
public void onBlockAdded(World world, int i, int j, int k)
@@ -20,7 +20,7 @@
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
super.onBlockAdded(world, i, j, k);
- world.setBlockTileEntity(i, j, k, getBlockEntity());
+ world.setBlockTileEntity(i, j, k, getBlockEntity(world.getBlockMetadata(i,j,k)));
super.onBlockAdded(par1World, par2, par3, par4);
- par1World.setBlockTileEntity(par2, par3, par4, this.getBlockEntity());
+ par1World.setBlockTileEntity(par2, par3, par4, this.getBlockEntity(par1World.getBlockMetadata(par2, par3, par4)));
}
public void onBlockRemoval(World world, int i, int j, int k)
@@ -27,7 +27,7 @@
}
public abstract TileEntity getBlockEntity();
-
+
public void powerBlock(World world, int i, int j, int k, int l, int i1)
{
super.powerBlock(world, i, j, k, l, i1);
@@ -37,4 +37,14 @@
tileentity.onTileEntityPowered(l, i1);
/**
@@ -47,4 +47,14 @@
var7.onTileEntityPowered(par5, par6);
}
}
+

View File

@ -8,41 +8,47 @@
public class BlockCrops extends BlockFlower
{
@@ -98,27 +99,23 @@
@@ -129,31 +130,23 @@
return 6;
}
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
- /**
- * Drops the block items with a specified chance of dropping the specified items
- */
- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int meta, int fortune)
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
{
- super.dropBlockAsItemWithChance(world, i, j, k, l, f, 0);
- if (world.isRemote)
- super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
-
- if (!par1World.isRemote)
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (meta == 7)
+ if (metadata == 7)
{
- return;
- int var8 = 3 + par7;
-
- for (int var9 = 0; var9 < var8; ++var9)
+ ret.add(new ItemStack(Item.wheat));
}
- int j1 = 3 + i1;
- for (int k1 = 0; k1 < j1; k1++)
+ }
+
+ for (int n = 0; n < 3 + fortune; n++)
+ {
+ if (world.rand.nextInt(15) < metadata)
{
- if (world.rand.nextInt(15) <= l)
+ if (world.rand.nextInt(15) <= meta)
{
- float f1 = 0.7F;
- float f2 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- float f3 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- float f4 = world.rand.nextFloat() * f1 + (1.0F - f1) * 0.5F;
- EntityItem entityitem = new EntityItem(world, (float)i + f2, (float)j + f3, (float)k + f4, new ItemStack(Item.seeds));
- entityitem.delayBeforeCanPickup = 10;
- world.spawnEntityInWorld(entityitem);
- if (par1World.rand.nextInt(15) <= par5)
- {
- float var10 = 0.7F;
- float var11 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F;
- float var12 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F;
- float var13 = par1World.rand.nextFloat() * var10 + (1.0F - var10) * 0.5F;
- EntityItem var14 = new EntityItem(par1World, (double)((float)par2 + var11), (double)((float)par3 + var12), (double)((float)par4 + var13), new ItemStack(Item.seeds));
- var14.delayBeforeCanPickup = 10;
- par1World.spawnEntityInWorld(var14);
- }
+ ret.add(new ItemStack(Item.seeds));
}
}
+ return ret;
}
public int idDropped(int i, Random random, int j)
/**

View File

@ -1,29 +1,29 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
@@ -95,7 +95,7 @@
@@ -164,7 +164,7 @@
{
if (blockMaterial == Material.iron)
if (this.blockMaterial == Material.iron)
{
- return true;
+ return false;
}
int l = world.getBlockMetadata(i, j, k);
if ((l & 8) != 0)
@@ -163,7 +163,7 @@
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
@@ -232,7 +232,7 @@
}
else
{
- return world.isBlockNormalCube(i, j - 1, k) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
}
@@ -243,7 +243,7 @@
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
var7 = true;
@@ -296,7 +296,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par3 >= 255 ? false : par1World.isBlockNormalCube(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, 1) && super.canPlaceBlockAt(par1World, par2, par3, par4) && super.canPlaceBlockAt(par1World, par2, par3 + 1, par4);
}
/**

View File

@ -1,244 +1,234 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
@@ -10,8 +10,8 @@
protected BlockFire(int i, int j)
@@ -5,13 +5,13 @@
public class BlockFire extends Block
{
super(i, j, Material.fire);
- chanceToEncourageFire = new int[256];
- abilityToCatchFire = new int[256];
+ chanceToEncourageFire = Block.blockFireSpreadSpeed;
+ abilityToCatchFire = Block.blockFlammability;
setTickOnLoad(true);
/** The chance this block will encourage nearby blocks to catch on fire */
- private int[] chanceToEncourageFire = new int[256];
+ private int[] chanceToEncourageFire = Block.blockFireSpreadSpeed;
/**
* This is an array indexed by block ID the larger the number in the array the more likely a block type will catch
* fires
*/
- private int[] abilityToCatchFire = new int[256];
+ private int[] abilityToCatchFire = Block.blockFlammability;
protected BlockFire(int par1, int par2)
{
@@ -42,8 +42,7 @@
*/
private void setBurnRate(int par1, int par2, int par3)
{
- this.chanceToEncourageFire[par1] = par2;
- this.abilityToCatchFire[par1] = par3;
+ Block.setBurnProperties(par1, par2, par3);
}
@@ -28,11 +28,10 @@
setBurnRate(Block.cloth.blockID, 30, 60);
setBurnRate(Block.vine.blockID, 15, 100);
}
-
+
private void setBurnRate(int i, int j, int k)
/**
@@ -101,7 +100,8 @@
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
- chanceToEncourageFire[i] = j;
- abilityToCatchFire[i] = k;
+ Block.setBurnProperties(i, j, k);
- boolean var6 = par1World.getBlockId(par2, par3 - 1, par4) == Block.netherrack.blockID;
+ Block base = Block.blocksList[par1World.getBlockId(par2, par3 - 1, par4)];
+ boolean var6 = (base != null && base.isFireSource(par1World, par2, par3 - 1, par4, par1World.getBlockMetadata(par2, par3 - 1, par4), 0));
if (par1World.worldProvider instanceof WorldProviderEnd && par1World.getBlockId(par2, par3 - 1, par4) == Block.bedrock.blockID)
{
@@ -130,12 +130,12 @@
if (!var6 && !this.canNeighborBurn(par1World, par2, par3, par4))
{
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) || var7 > 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || var7 > 3)
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
}
- else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4) && var7 == 15 && par5Random.nextInt(4) == 0)
+ else if (!var6 && !this.canBlockCatchFire(par1World, par2, par3 - 1, par4, 1) && var7 == 15 && par5Random.nextInt(4) == 0)
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
@@ -149,12 +149,12 @@
var9 = -50;
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
@@ -67,7 +66,9 @@
- this.func_48133_a(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7);
- this.func_48133_a(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7);
- this.func_48133_a(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7);
- this.func_48133_a(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7);
- this.func_48133_a(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7);
- this.func_48133_a(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7);
+ this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7, 4);
+ this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7, 5);
+ this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7, 1);
+ this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7, 0);
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7, 3);
+ this.tryToCatchBlockOnFire(par1World, par2, par3, par4 + 1, 300 + var9, par5Random, var7, 2);
public void updateTick(World world, int i, int j, int k, Random random)
for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10)
{
- boolean flag = world.getBlockId(i, j - 1, k) == Block.netherrack.blockID;
+ Block base = Block.blocksList[world.getBlockId(i, j - 1, k)];
+ boolean flag = (base != null && base.isFireSource(world, i, j - 1, k, world.getBlockMetadata(i, j - 1, k), 0));
+
if ((world.worldProvider instanceof WorldProviderEnd) && world.getBlockId(i, j - 1, k) == Block.bedrock.blockID)
{
flag = true;
@@ -89,23 +90,23 @@
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
if (!flag && !canNeighborBurn(world, i, j, k))
{
- if (!world.isBlockNormalCube(i, j - 1, k) || l > 3)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 0) || l > 3)
{
world.setBlockWithNotify(i, j, k, 0);
}
return;
}
- if (!flag && !canBlockCatchFire(world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0)
+ if (!flag && !canBlockCatchFire(world, i, j - 1, k, 1) && l == 15 && random.nextInt(4) == 0)
{
world.setBlockWithNotify(i, j, k, 0);
return;
}
- tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l);
- tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l);
- tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l);
- tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l);
- tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l);
- tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l);
+ tryToCatchBlockOnFire(world, i + 1, j, k, 300, random, l, 4);
+ tryToCatchBlockOnFire(world, i - 1, j, k, 300, random, l, 5);
+ tryToCatchBlockOnFire(world, i, j - 1, k, 250, random, l, 1);
+ tryToCatchBlockOnFire(world, i, j + 1, k, 250, random, l, 0);
+ tryToCatchBlockOnFire(world, i, j, k - 1, 300, random, l, 3);
+ tryToCatchBlockOnFire(world, i, j, k + 1, 300, random, l, 2);
for (int i1 = i - 1; i1 <= i + 1; i1++)
{
for (int j1 = k - 1; j1 <= k + 1; j1++)
@@ -142,9 +143,24 @@
@@ -202,9 +202,21 @@
}
}
+ /**
+ * Deprecated for a side-sensitive version
+ */
+ /** Deprecated for a side-sensitive version */
+ @Deprecated
private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1)
private void func_48133_a(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7)
{
- int j1 = abilityToCatchFire[world.getBlockId(i, j, k)];
+ tryToCatchBlockOnFire(world, i, j, k, l, random, i1, 0);
- int var8 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)];
+ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, 0);
+ }
+
+ private void tryToCatchBlockOnFire(World world, int i, int j, int k, int l, Random random, int i1, int face)
+ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, int face)
+ {
+ int j1 = 0;
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ int var8 = 0;
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)];
+ if (block != null)
+ {
+ j1 = block.getFlammability(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ var8 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face);
+ }
+
if (random.nextInt(l) < j1)
{
boolean flag = world.getBlockId(i, j, k) == Block.tnt.blockID;
@@ -170,27 +186,27 @@
private boolean canNeighborBurn(World world, int i, int j, int k)
if (par6Random.nextInt(par5) < var8)
{
- if (canBlockCatchFire(world, i + 1, j, k))
+ if (canBlockCatchFire(world, i + 1, j, k, 4))
@@ -238,7 +250,12 @@
*/
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
{
return true;
}
- if (canBlockCatchFire(world, i - 1, j, k))
+ if (canBlockCatchFire(world, i - 1, j, k, 5))
{
return true;
}
- if (canBlockCatchFire(world, i, j - 1, k))
+ if (canBlockCatchFire(world, i, j - 1, k, 1))
{
return true;
}
- if (canBlockCatchFire(world, i, j + 1, k))
+ if (canBlockCatchFire(world, i, j + 1, k, 0))
{
return true;
}
- if (canBlockCatchFire(world, i, j, k - 1))
+ if (canBlockCatchFire(world, i, j, k - 1, 3))
{
return true;
}
- return canBlockCatchFire(world, i, j, k + 1);
+ return canBlockCatchFire(world, i, j, k + 1, 2);
- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1)))));
+ return this.canBlockCatchFire(par1World, par2 + 1, par3, par4, 4) ||
+ this.canBlockCatchFire(par1World, par2 - 1, par3, par4, 5) ||
+ this.canBlockCatchFire(par1World, par2, par3 - 1, par4, 1) ||
+ this.canBlockCatchFire(par1World, par2, par3 + 1, par4, 0) ||
+ this.canBlockCatchFire(par1World, par2, par3, par4 - 1, 3) ||
+ this.canBlockCatchFire(par1World, par2, par3, par4 + 1, 2);
}
private int getChanceOfNeighborsEncouragingFire(World world, int i, int j, int k)
@@ -202,12 +218,12 @@
/**
@@ -254,15 +271,15 @@
}
else
{
- l = getChanceToEncourageFire(world, i + 1, j, k, l);
- l = getChanceToEncourageFire(world, i - 1, j, k, l);
- l = getChanceToEncourageFire(world, i, j - 1, k, l);
- l = getChanceToEncourageFire(world, i, j + 1, k, l);
- l = getChanceToEncourageFire(world, i, j, k - 1, l);
- l = getChanceToEncourageFire(world, i, j, k + 1, l);
+ l = getChanceToEncourageFire(world, i + 1, j, k, l, 5);
+ l = getChanceToEncourageFire(world, i - 1, j, k, l, 4);
+ l = getChanceToEncourageFire(world, i, j - 1, k, l, 1);
+ l = getChanceToEncourageFire(world, i, j + 1, k, l, 0);
+ l = getChanceToEncourageFire(world, i, j, k - 1, l, 3);
+ l = getChanceToEncourageFire(world, i, j, k + 1, l, 2);
return l;
- int var6 = this.getChanceToEncourageFire(par1World, par2 + 1, par3, par4, var5);
- var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6);
- var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6);
- var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, 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, 4);
+ var6 = this.getChanceToEncourageFire(par1World, par2 - 1, par3, par4, var6, 5);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3 - 1, par4, var6, 1);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3 + 1, par4, var6, 0);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 - 1, var6, 3);
+ var6 = this.getChanceToEncourageFire(par1World, par2, par3, par4 + 1, var6, 2);
return var6;
}
}
@@ -217,32 +233,32 @@
return false;
}
+ /**
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public boolean canBlockCatchFire(IBlockAccess iblockaccess, int i, int j, int k)
{
- return chanceToEncourageFire[iblockaccess.getBlockId(i, j, k)] > 0;
+ return canBlockCatchFire(iblockaccess, i, j, k, 0);
}
+ /**
+ * Deprecated for a side-sensitive version
+ */
+ @Deprecated
public int getChanceToEncourageFire(World world, int i, int j, int k, int l)
{
- int i1 = chanceToEncourageFire[world.getBlockId(i, j, k)];
- if (i1 > l)
- {
- return i1;
- }
- else
- {
- return l;
- }
+ return getChanceToEncourageFire(world, i, j, k, l, 0);
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
- return world.isBlockNormalCube(i, j - 1, k) || canNeighborBurn(world, i, j, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || canNeighborBurn(world, i, j, k);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
- if (!world.isBlockNormalCube(i, j - 1, k) && !canNeighborBurn(world, i, j, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !canNeighborBurn(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -259,7 +275,7 @@
{
return;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && !canNeighborBurn(world, i, j, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && !canNeighborBurn(world, i, j, k))
{
world.setBlockWithNotify(i, j, k, 0);
return;
@@ -269,5 +285,40 @@
world.scheduleBlockUpdate(i, j, k, blockID, tickRate());
return;
}
+ }
/**
* Returns if this block is collidable (only used by Fire). Args: x, y, z
@@ -274,21 +291,24 @@
/**
* Checks the specified block coordinate to see if it can catch fire. Args: blockAccess, x, y, z
+ * Deprecated for a side-sensitive version
*/
+ @Deprecated
public boolean canBlockCatchFire(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
- return this.chanceToEncourageFire[par1IBlockAccess.getBlockId(par2, par3, par4)] > 0;
+ return canBlockCatchFire(par1IBlockAccess, par2, par3, par4, 0);
}
/**
* Retrieves a specified block's chance to encourage their neighbors to burn and if the number is greater than the
* current number passed in it will return its number instead of the passed in one. Args: world, x, y, z,
* curChanceToEncourageFire
+ * Deprecated for a side-sensitive version
*/
+ @Deprecated
public int getChanceToEncourageFire(World par1World, int par2, int par3, int par4, int par5)
{
- int var6 = this.chanceToEncourageFire[par1World.getBlockId(par2, par3, par4)];
- return var6 > par5 ? var6 : par5;
+ return getChanceToEncourageFire(par1World, par2, par3, par4, par5, 0);
}
/**
@@ -296,7 +316,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCube(par2, par3 - 1, par4) || this.canNeighborBurn(par1World, par2, par3, par4);
+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || this.canNeighborBurn(par1World, par2, par3, par4);
}
/**
@@ -305,7 +325,7 @@
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
{
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && !this.canNeighborBurn(par1World, par2, par3, par4))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
@@ -318,7 +338,7 @@
{
if (par1World.worldProvider.worldType > 0 || par1World.getBlockId(par2, par3 - 1, par4) != Block.obsidian.blockID || !Block.portal.tryToCreatePortal(par1World, par2, par3, par4))
{
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && !this.canNeighborBurn(par1World, par2, par3, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && !this.canNeighborBurn(par1World, par2, par3, par4))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
@@ -328,4 +348,46 @@
}
}
}
+
+ /**
+ * Forge: Side sensitive version
+ * Side sensitive version that calls the block function.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param face The side the fire is coming from
+ * @return True if the face can catch fire.
+ */
+ public boolean canBlockCatchFire(IBlockAccess world, int i, int j, int k, int face)
+ public boolean canBlockCatchFire(IBlockAccess world, int x, int y, int z, int face)
+ {
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ return block.isFlammable(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ return false;
+ }
+
+ /**
+ * Forge: Side sensitive version
+ * Side sensitive version that calls the block function.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param oldChance The previous maximum chance.
+ * @param face The side the fire is coming from
+ * @return The chance of the block catching fire, or oldChance if it is higher
+ */
+ public int getChanceToEncourageFire(World world, int i, int j, int k, int l, int face)
+ public int getChanceToEncourageFire(World world, int x, int y, int z, int oldChance, int face)
+ {
+ int i1 = 0;
+ Block block = Block.blocksList[world.getBlockId(i, j, k)];
+ int newChance = 0;
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ i1 = block.getFireSpreadSpeed(world, i, j, k, world.getBlockMetadata(i, j, k), face);
+ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+
+ if (i1 > l)
+ {
+ return i1;
+ }
+ else
+ {
+ return l;
+ return (newChance > oldChance ? newChance : oldChance);
+ }
}
}

View File

@ -1,82 +1,78 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
@@ -31,37 +31,37 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
@@ -71,7 +71,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- return world.isBlockNormalCube(i, j, k + 1);
+ return world.isBlockSolidOnSide(i, j, k + 1, 2);
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
/**
@@ -82,22 +85,22 @@
{
int i1 = world.getBlockMetadata(i, j, k);
- if ((i1 == 0 || l == 2) && world.isBlockNormalCube(i, j, k + 1))
+ if ((i1 == 0 || l == 2) && world.isBlockSolidOnSide(i, j, k + 1, 2))
int var6 = par1World.getBlockMetadata(par2, par3, par4);
- if ((var6 == 0 || par5 == 2) && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if ((var6 == 0 || par5 == 2) && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
i1 = 2;
var6 = 2;
}
- if ((i1 == 0 || l == 3) && world.isBlockNormalCube(i, j, k - 1))
+ if ((i1 == 0 || l == 3) && world.isBlockSolidOnSide(i, j, k - 1, 3))
- if ((var6 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if ((var6 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
i1 = 3;
var6 = 3;
}
- if ((i1 == 0 || l == 4) && world.isBlockNormalCube(i + 1, j, k))
+ if ((i1 == 0 || l == 4) && world.isBlockSolidOnSide(i + 1, j, k, 4))
- if ((var6 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if ((var6 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
i1 = 4;
var6 = 4;
}
- if ((i1 == 0 || l == 5) && world.isBlockNormalCube(i - 1, j, k))
+ if ((i1 == 0 || l == 5) && world.isBlockSolidOnSide(i - 1, j, k, 5))
- if ((var6 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if ((var6 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
i1 = 5;
var6 = 5;
}
@@ -72,19 +72,19 @@
@@ -114,22 +117,22 @@
int var6 = par1World.getBlockMetadata(par2, par3, par4);
boolean var7 = false;
- if (var6 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (var6 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if (i1 == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if(i1 == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
flag = true;
var7 = true;
}
- if (i1 == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if(i1 == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
- if (var6 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (var6 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
flag = true;
var7 = true;
}
- if (i1 == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if(i1 == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
- if (var6 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (var6 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
flag = true;
var7 = true;
}
- if (i1 == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if(i1 == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
- if (var6 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (var6 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
flag = true;
var7 = true;
}
@@ -100,4 +100,10 @@
@@ -150,4 +153,10 @@
{
return 1;
}
+
+ /* FORGE: Implemented base method, see Block.isLadder */
+ public boolean isLadder(World world, int i, int j, int k)
+ @Override
+ public boolean isLadder(World world, int x, int y, int z)
+ {
+ return true;
+ }

View File

@ -11,41 +11,41 @@
+
+public class BlockLeaves extends BlockLeavesBase implements IShearable
{
private int baseIndexInPNG;
int adjacentTreeBlocks[];
@@ -162,15 +165,7 @@
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
/**
* The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can
@@ -216,15 +219,7 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- {
- entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.leaves.blockID, 1, l & 3));
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.leaves.blockID, 1, par6 & 3));
- }
- else
- {
- super.harvestBlock(world, entityplayer, i, j, k, l);
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(world, entityplayer, i, j, k, l);
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
protected int damageDropped(int i)
@@ -199,4 +194,18 @@
/**
@@ -259,4 +254,18 @@
{
super.onEntityWalking(world, i, j, k, entity);
super.onEntityWalking(par1World, par2, par3, par4, par5Entity);
}
+
+ @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;
+ }
+
+ @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)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ 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;
+ }
}

View File

@ -1,120 +1,100 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
@@ -31,44 +31,44 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
@@ -46,7 +46,11 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
- if (l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return true;
}
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- return l == 5 && world.isBlockNormalCube(i - 1, j, k);
+ return l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5);
- return par5 == 1 && par1World.isBlockNormalCube(par2, par3 - 1, par4) ? true : (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))));
+ return (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1)) ||
+ (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2)) ||
+ (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3)) ||
+ (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4)) ||
+ (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5));
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
/**
@@ -54,7 +58,11 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- if (world.isBlockNormalCube(i - 1, j, k))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
}
- if (world.isBlockNormalCube(i + 1, j, k))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k - 1))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (world.isBlockNormalCube(i, j, k + 1))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : par1World.isBlockNormalCube(par2, par3 - 1, par4))));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) ||
+ par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1);
}
public void onBlockPlaced(World world, int i, int j, int k, int l)
@@ -77,23 +77,23 @@
int j1 = i1 & 8;
i1 &= 7;
i1 = -1;
- if (l == 1 && world.isBlockNormalCube(i, j - 1, k))
+ if (l == 1 && world.isBlockSolidOnSide(i, j - 1, k, 1))
/**
@@ -68,27 +76,27 @@
var6 &= 7;
var6 = -1;
- if (par5 == 1 && par1World.isBlockNormalCube(par2, par3 - 1, par4))
+ if (par5 == 1 && par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1))
{
i1 = 5 + world.rand.nextInt(2);
var6 = 5 + par1World.rand.nextInt(2);
}
- if (l == 2 && world.isBlockNormalCube(i, j, k + 1))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
i1 = 4;
var6 = 4;
}
- if (l == 3 && world.isBlockNormalCube(i, j, k - 1))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
i1 = 3;
var6 = 3;
}
- if (l == 4 && world.isBlockNormalCube(i + 1, j, k))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
i1 = 2;
var6 = 2;
}
- if (l == 5 && world.isBlockNormalCube(i - 1, j, k))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
i1 = 1;
var6 = 1;
}
@@ -116,27 +116,27 @@
@@ -115,32 +123,32 @@
int var6 = par1World.getBlockMetadata(par2, par3, par4) & 7;
boolean var7 = false;
- if (!par1World.isBlockNormalCube(par2 - 1, par3, par4) && var6 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) && var6 == 1)
{
int i1 = world.getBlockMetadata(i, j, k) & 7;
boolean flag = false;
- if (!world.isBlockNormalCube(i - 1, j, k) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i + 1, j, k) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) && var6 == 2)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i, j, k - 1) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i, j, k + 1) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) && var6 == 4)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 5)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 5)
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && var6 == 5)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && var6 == 5)
{
flag = true;
var7 = true;
}
- if (!world.isBlockNormalCube(i, j - 1, k) && i1 == 6)
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1) && i1 == 6)
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && var6 == 6)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && var6 == 6)
{
flag = true;
var7 = true;
}

View File

@ -7,37 +7,45 @@
import java.util.Random;
public class BlockNetherStalk extends BlockFlower
@@ -57,25 +58,24 @@
@@ -66,30 +67,20 @@
return 6;
}
- public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f, int i1)
- /**
- * Drops the block items with a specified chance of dropping the specified items
- */
- public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int i, int j, int k, int meta, int fortune)
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
{
- if (world.isRemote)
- {
- return;
- }
- if (!par1World.isRemote)
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
int j1 = 1;
- if (l >= 3)
+ if (meta >= 3)
+ int n = 1;
+ if (metadata >= 3)
{
j1 = 2 + world.rand.nextInt(3);
- if (i1 > 0)
+ if (fortune > 0)
{
- j1 += world.rand.nextInt(i1 + 1);
+ j1 += world.rand.nextInt(fortune + 1);
}
}
for (int k1 = 0; k1 < j1; k1++)
{
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Item.netherStalkSeeds));
- int var8 = 1;
-
- if (par5 >= 3)
- {
- var8 = 2 + par1World.rand.nextInt(3);
-
- if (par7 > 0)
- {
- var8 += par1World.rand.nextInt(par7 + 1);
- }
- }
-
- for (int var9 = 0; var9 < var8; ++var9)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds));
- }
+ n = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0);
+ }
+ for (int m = 0; m < n; m++)
+ {
+ ret.add(new ItemStack(Item.netherStalkSeeds));
}
+ return ret;
}
public int idDropped(int i, Random random, int j)
/**

View File

@ -1,11 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
@@ -350,7 +350,7 @@
@@ -355,7 +355,7 @@
return false;
}
- return !(Block.blocksList[par0] instanceof BlockContainer);
+ return !(Block.blocksList[par0] != null && Block.blocksList[par0].hasTileEntity(par1World.getBlockMetadata(par2, par3, par4)));
}
- return !(Block.blocksList[i] instanceof BlockContainer);
+ return !(Block.blocksList[i] != null && Block.blocksList[i].hasTileEntity(world.getBlockMetadata(j, k, l)));
}
private static boolean canExtend(World world, int i, int j, int k, int l)

View File

@ -1,11 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
@@ -38,7 +38,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
@@ -61,7 +61,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return world.isBlockNormalCube(i, j - 1, k) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
+ return world.isBlockSolidOnSide(i, j - 1, k, 1) || world.getBlockId(i, j - 1, k) == Block.fence.blockID;
- return par1World.isBlockNormalCube(par2, par3 - 1, par4) || par1World.getBlockId(par2, par3 - 1, par4) == Block.fence.blockID;
+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || par1World.getBlockId(par2, par3 - 1, par4) == Block.fence.blockID;
}
public void onBlockAdded(World world, int i, int j, int k)
/**

View File

@ -18,68 +18,72 @@
+ renderType = value;
+ }
public static final boolean isRailBlockAt(World world, int i, int j, int k)
public static final boolean isRailBlockAt(World par0World, int par1, int par2, int par3)
{
int l = world.getBlockId(i, j, k);
- return l == Block.rail.blockID || l == Block.railPowered.blockID || l == Block.railDetector.blockID;
+ return Block.blocksList[l] instanceof BlockRail;
int var4 = par0World.getBlockId(par1, par2, par3);
- return var4 == Block.rail.blockID || var4 == Block.railPowered.blockID || var4 == Block.railDetector.blockID;
+ return Block.blocksList[var4] instanceof BlockRail;
}
public static final boolean isRailBlock(int i)
public static final boolean isRailBlock(int par0)
{
- return i == Block.rail.blockID || i == Block.railPowered.blockID || i == Block.railDetector.blockID;
+ return Block.blocksList[i] instanceof BlockRail;
- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID;
+ return Block.blocksList[par0] instanceof BlockRail;
}
protected BlockRail(int i, int j, boolean flag)
@@ -81,7 +94,7 @@
protected BlockRail(int par1, int par2, boolean par3)
@@ -107,7 +120,7 @@
*/
public int getRenderType()
{
- return 9;
+ return renderType;
}
public int quantityDropped(Random random)
@@ -91,7 +104,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
/**
@@ -123,7 +136,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
- return par1World.isBlockNormalCube(par2, par3 - 1, par4);
+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1);
}
public void onBlockAdded(World world, int i, int j, int k)
@@ -119,23 +132,23 @@
j1 &= 7;
}
boolean flag = false;
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
/**
@@ -160,27 +173,27 @@
boolean var8 = false;
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1))
{
flag = true;
var8 = true;
}
- if (j1 == 2 && !world.isBlockNormalCube(i + 1, j, k))
+ if (j1 == 2 && !world.isBlockSolidOnSide(i + 1, j, k, 1))
- if (var7 == 2 && !par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (var7 == 2 && !par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 1))
{
flag = true;
var8 = true;
}
- if (j1 == 3 && !world.isBlockNormalCube(i - 1, j, k))
+ if (j1 == 3 && !world.isBlockSolidOnSide(i - 1, j, k, 1))
- if (var7 == 3 && !par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (var7 == 3 && !par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 1))
{
flag = true;
var8 = true;
}
- if (j1 == 4 && !world.isBlockNormalCube(i, j, k - 1))
+ if (j1 == 4 && !world.isBlockSolidOnSide(i, j, k - 1, 1))
- if (var7 == 4 && !par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (var7 == 4 && !par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 1))
{
flag = true;
var8 = true;
}
- if (j1 == 5 && !world.isBlockNormalCube(i, j, k + 1))
+ if (j1 == 5 && !world.isBlockSolidOnSide(i, j, k + 1, 1))
- if (var7 == 5 && !par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (var7 == 5 && !par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 1))
{
flag = true;
var8 = true;
}
@@ -317,8 +330,119 @@
@@ -383,8 +396,121 @@
return 0;
}
@ -87,21 +91,21 @@
+ * This function is no longer called by Minecraft
+ */
+ @Deprecated
static boolean isPoweredBlockRail(BlockRail blockrail)
static boolean isPoweredBlockRail(BlockRail par0BlockRail)
{
return blockrail.isPowered;
return par0BlockRail.isPowered;
}
+
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(World world, int i, int j, int k)
+ public boolean isFlexibleRail(World world, int y, int x, int z)
+ {
+ return !isPowered;
+ }
@ -110,12 +114,12 @@
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(World world, int i, int j, int k)
+ public boolean canMakeSlopes(World world, int x, int y, int z)
+ {
+ return true;
+ }
@ -141,32 +145,34 @@
+ * All directions are Notch defined.
+ * In MC Beta 1.8.3 the Sun rises in the North.
+ * In MC 1.0.0 the Sun rises in the East.
+ *
+ * @param world The world.
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @param y The rail X coordinate.
+ * @param x The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return The metadata.
+ */
+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int i, int j, int k)
+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if(isPowered)
+ {
+ int meta = world.getBlockMetadata(i, j, k);
+ if(isPowered) {
+ meta = meta & 7;
+ }
+ return meta;
+ }
+
+ /**
+ * Returns the max speed of the rail at [i, j, k].
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, EntityMinecart cart, int i, int j, int k)
+ public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)
+ {
+ return 0.4f;
+ }
@ -176,11 +182,11 @@
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @param y The rail X coordinate.
+ * @param x The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ */
+ public void onMinecartPass(World world, EntityMinecart cart, int i, int j, int k)
+ public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z)
+ {
+ }
+
@ -189,12 +195,12 @@
+ * Avoid using this function when getBasicRailMetadata() can be used instead.
+ * The only reason to use this function is if you wish to change the rails metadata.
+ * @param world The world.
+ * @param i The rail X coordinate.
+ * @param j The rail Y coordinate.
+ * @param k The rail Z coordinate.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return True if the 4th bit is a power bit.
+ */
+ public boolean hasPowerBit(World world, int i, int j, int k)
+ public boolean hasPowerBit(World world, int x, int y, int z)
+ {
+ return isPowered;
+ }

View File

@ -1,20 +1,20 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
@@ -28,7 +28,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return false;
- return !par1World.isBlockNormalCube(par2, par3 - 1, par4) ? false : super.canPlaceBlockAt(par1World, par2, par3, par4);
+ return !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) ? false : super.canPlaceBlockAt(par1World, par2, par3, par4);
}
@@ -40,7 +40,7 @@
public boolean canBlockStay(World world, int i, int j, int k)
/**
@@ -36,7 +36,7 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
- if (!world.isBlockNormalCube(i, j - 1, k))
+ if (!world.isBlockSolidOnSide(i, j - 1, k, 1))
{
return false;
- return !par1World.isBlockNormalCube(par2, par3 - 1, par4) ? false : super.canBlockStay(par1World, par2, par3, par4);
+ return !par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) ? false : super.canBlockStay(par1World, par2, par3, par4);
}
/**

View File

@ -1,31 +1,31 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.*;
@@ -5,6 +5,8 @@
import java.util.Random;
import java.util.Set;
+import net.minecraft.src.forge.IConnectRedstone;
+
public class BlockRedstoneWire extends Block
{
private boolean wiresProvidePower;
@@ -42,7 +44,7 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
/**
@@ -67,7 +69,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return world.isBlockNormalCube(i, j - 1, k);
+ return world.isBlockSolidOnSide(i, j - 1, k, 1);
- return par1World.isBlockNormalCube(par2, par3 - 1, par4) || par1World.getBlockId(par2, par3 - 1, par4) == Block.glowStone.blockID;
+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) || par1World.getBlockId(par2, par3 - 1, par4) == Block.glowStone.blockID;
}
private void updateAndPropagateCurrentStrength(World world, int i, int j, int k)
@@ -429,6 +431,10 @@
{
return false;
/**
@@ -502,6 +504,10 @@
}
+ if(Block.blocksList[i1] instanceof IConnectRedstone)
else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID)
{
+ if (Block.blocksList[var5] instanceof IConnectRedstone)
+ {
+ return ((IConnectRedstone)Block.blocksList[i1]).canConnectRedstone(iblockaccess,i,j,k,l);
+ return ((IConnectRedstone)Block.blocksList[var5]).canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4);
+ }
if (i1 == Block.redstoneRepeaterIdle.blockID || i1 == Block.redstoneRepeaterActive.blockID)
{
int j1 = iblockaccess.getBlockMetadata(i, j, k);
return Block.blocksList[var5].canProvidePower() && par4 != -1;
}
else

View File

@ -1,43 +1,44 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
@@ -63,7 +63,6 @@
@@ -73,7 +73,6 @@
{
if (!canPlaceBlockAt(world, i, j, k))
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
- dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
world.setBlockWithNotify(i, j, k, 0);
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
return false;
}
@@ -75,15 +74,7 @@
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
@@ -89,15 +88,7 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- int i1 = Item.snowball.shiftedIndex;
- float f = 0.7F;
- double d = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
- double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
- double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
- EntityItem entityitem = new EntityItem(world, (double)i + d, (double)j + d1, (double)k + d2, new ItemStack(i1, 1, 0));
- entityitem.delayBeforeCanPickup = 10;
- world.spawnEntityInWorld(entityitem);
- world.setBlockWithNotify(i, j, k, 0);
+ dropBlockAsItem(world,i,j,k,l,0);
entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
- int var7 = Item.snowball.shiftedIndex;
- float var8 = 0.7F;
- double var9 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
- double var11 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
- double var13 = (double)(par1World.rand.nextFloat() * var8) + (double)(1.0F - var8) * 0.5D;
- EntityItem var15 = new EntityItem(par1World, (double)par3 + var9, (double)par4 + var11, (double)par5 + var13, new ItemStack(var7, 1, 0));
- var15.delayBeforeCanPickup = 10;
- par1World.spawnEntityInWorld(var15);
- par1World.setBlockWithNotify(par3, par4, par5, 0);
+ dropBlockAsItem(par1World, par3, par4, par5, par6, 0);
par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
}
@@ -94,14 +85,13 @@
public int quantityDropped(Random random)
@@ -114,7 +105,7 @@
*/
public int quantityDropped(Random par1Random)
{
- return 0;
+ return 1;
}
public void updateTick(World world, int i, int j, int k, Random random)
/**
@@ -124,7 +115,6 @@
{
if (world.getSavedLightValue(EnumSkyBlock.Block, i, j, k) > 11)
if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11)
{
- dropBlockAsItem(world, i, j, k, world.getBlockMetadata(i, j, k), 0);
world.setBlockWithNotify(i, j, k, 0);
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
}

View File

@ -12,23 +12,33 @@
+
+public class BlockTallGrass extends BlockFlower implements IShearable
{
protected BlockTallGrass(int i, int j)
protected BlockTallGrass(int par1, int par2)
{
@@ -33,15 +37,25 @@
public int idDropped(int i, Random random, int j)
@@ -24,7 +28,7 @@
*/
public int idDropped(int par1, Random par2Random, int par3)
{
- if (random.nextInt(8) == 0)
- 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 i, int j, int k, int md, int fortune)
+ 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)
{
- return Item.seeds.shiftedIndex;
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.tallGrass, 1, par6));
+ return ret;
}
- else
@ -36,42 +46,23 @@
+ ItemStack item = ForgeHooks.getGrassSeed(world);
+ if (item != null)
{
- return -1;
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
+ ret.add(item);
}
- }
+ return ret;
+ }
public int quantityDroppedWithBonus(int i, Random random)
{
@@ -50,14 +64,20 @@
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
{
- if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- {
- entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.tallGrass, 1, l));
- }
- else
- {
- super.harvestBlock(world, entityplayer, i, j, k, l);
- }
+ super.harvestBlock(world, entityplayer, i, j, k, l);
+ }
+
+ @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;
+ }
+
+ @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)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(X, Y, Z)));
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));
+ return ret;
}
}

View File

@ -1,107 +1,102 @@
--- ../src_base/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
@@ -32,7 +32,7 @@
@@ -49,7 +49,7 @@
*/
private boolean canPlaceTorchOn(World par1World, int par2, int par3, int par4)
{
- if (par1World.isBlockNormalCubeDefault(par2, par3, par4, true))
+ if (par1World.isBlockSolidOnSide(par2, par3, par4, 1))
{
return true;
}
@@ -83,7 +83,11 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) ? true : (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) ? true : this.canPlaceTorchOn(par1World, par2, par3 - 1, par4))));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) ||
+ this.canPlaceTorchOn(par1World, par2, par3 - 1, par4);
}
private boolean canPlaceTorchOn(World world, int i, int j, int k)
{
- if (world.isBlockNormalCubeDefault(i, j, k, true))
+ if (world.isBlockSolidOnSide(i, j, k, 1))
{
return true;
/**
@@ -99,22 +103,22 @@
var6 = 5;
}
@@ -45,19 +45,19 @@
public boolean canPlaceBlockAt(World world, int i, int j, int k)
- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
- if (world.isBlockNormalCubeDefault(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
return true;
var6 = 4;
}
- if (world.isBlockNormalCubeDefault(i + 1, j, k, true))
+ if (world.isBlockSolidOnSide(i + 1, j, k, 4))
{
return true;
}
- if (world.isBlockNormalCubeDefault(i, j, k - 1, true))
+ if (world.isBlockSolidOnSide(i, j, k - 1, 3))
{
return true;
}
- if (world.isBlockNormalCubeDefault(i, j, k + 1, true))
+ if (world.isBlockSolidOnSide(i, j, k + 1, 2))
{
return true;
}
@@ -71,19 +71,19 @@
{
i1 = 5;
}
- if (l == 2 && world.isBlockNormalCubeDefault(i, j, k + 1, true))
+ if (l == 2 && world.isBlockSolidOnSide(i, j, k + 1, 2))
{
i1 = 4;
}
- if (l == 3 && world.isBlockNormalCubeDefault(i, j, k - 1, true))
+ if (l == 3 && world.isBlockSolidOnSide(i, j, k - 1, 3))
{
i1 = 3;
}
- if (l == 4 && world.isBlockNormalCubeDefault(i + 1, j, k, true))
+ if (l == 4 && world.isBlockSolidOnSide(i + 1, j, k, 4))
{
i1 = 2;
}
- if (l == 5 && world.isBlockNormalCubeDefault(i - 1, j, k, true))
+ if (l == 5 && world.isBlockSolidOnSide(i - 1, j, k, 5))
{
i1 = 1;
}
@@ -101,19 +101,19 @@
public void onBlockAdded(World world, int i, int j, int k)
- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
- if (world.isBlockNormalCubeDefault(i - 1, j, k, true))
+ if (world.isBlockSolidOnSide(i - 1, j, k, 5))
{
world.setBlockMetadataWithNotify(i, j, k, 1);
var6 = 3;
}
- else if (world.isBlockNormalCubeDefault(i + 1, j, k, true))
+ else if (world.isBlockSolidOnSide(i + 1, j, k, 4))
- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
world.setBlockMetadataWithNotify(i, j, k, 2);
var6 = 2;
}
- else if (world.isBlockNormalCubeDefault(i, j, k - 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k - 1, 3))
- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
world.setBlockMetadataWithNotify(i, j, k, 3);
var6 = 1;
}
- else if (world.isBlockNormalCubeDefault(i, j, k + 1, true))
+ else if (world.isBlockSolidOnSide(i, j, k + 1, 2))
@@ -140,19 +144,19 @@
*/
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
world.setBlockMetadataWithNotify(i, j, k, 4);
- if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1);
}
@@ -130,19 +130,19 @@
- else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
int i1 = world.getBlockMetadata(i, j, k);
boolean flag = false;
- if (!world.isBlockNormalCubeDefault(i - 1, j, k, true) && i1 == 1)
+ if (!world.isBlockSolidOnSide(i - 1, j, k, 5) && i1 == 1)
{
flag = true;
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
- if (!world.isBlockNormalCubeDefault(i + 1, j, k, true) && i1 == 2)
+ if (!world.isBlockSolidOnSide(i + 1, j, k, 4) && i1 == 2)
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
flag = true;
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
- if (!world.isBlockNormalCubeDefault(i, j, k - 1, true) && i1 == 3)
+ if (!world.isBlockSolidOnSide(i, j, k - 1, 3) && i1 == 3)
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
flag = true;
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4);
}
- if (!world.isBlockNormalCubeDefault(i, j, k + 1, true) && i1 == 4)
+ if (!world.isBlockSolidOnSide(i, j, k + 1, 2) && i1 == 4)
@@ -175,22 +179,22 @@
int var6 = par1World.getBlockMetadata(par2, par3, par4);
boolean var7 = false;
- if (!par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true) && var6 == 1)
+ if (!par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) && var6 == 1)
{
flag = true;
var7 = true;
}
- if (!par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true) && var6 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) && var6 == 2)
{
var7 = true;
}
- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true) && var6 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3)
{
var7 = true;
}
- if (!par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true) && var6 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) && var6 == 4)
{
var7 = true;
}

View File

@ -4,38 +4,39 @@
public class BlockTrapDoor extends Block
{
+ /* FORGE: Set this to allow trapdoors to remain free-floating */
+ /** Set this to allow trapdoors to remain free-floating */
+ public static boolean disableValidation = false;
+
protected BlockTrapDoor(int i, Material material)
protected BlockTrapDoor(int par1, Material par2Material)
{
super(i, material);
@@ -133,7 +136,7 @@
{
j1--;
super(par1, par2Material);
@@ -174,7 +177,7 @@
--var7;
}
- if (!isValidSupportBlock(world.getBlockId(j1, j, k1)))
+ if (!(isValidSupportBlock(world.getBlockId(j1, j, k1)) || world.isBlockSolidOnSide(j1, j, k1, (i1 & 3) + 2)))
{
world.setBlockWithNotify(i, j, k, 0);
dropBlockAsItem(world, i, j, k, i1, 0);
@@ -175,6 +178,10 @@
public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
- if (!isValidSupportBlock(par1World.getBlockId(var7, par3, var8)))
+ if (!(isValidSupportBlock(par1World.getBlockId(var7, par3, var8)) || par1World.isBlockSolidOnSide(var7, par3, var8, (var6 & 3) + 2)))
{
par1World.setBlockWithNotify(par2, par3, par4, 0);
this.dropBlockAsItem(par1World, par2, par3, par4, var6, 0);
@@ -235,6 +238,11 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
+ if (disableValidation)
+ {
+ return true;
+ }
if (l == 0)
+
if (par5 == 0)
{
return false;
@@ -199,7 +206,7 @@
{
i--;
}
- return isValidSupportBlock(world.getBlockId(i, j, k));
+ return isValidSupportBlock(world.getBlockId(i, j, k)) || world.isBlockSolidOnSide(i, j, k, l);
@@ -265,7 +273,7 @@
--par2;
}
- return isValidSupportBlock(par1World.getBlockId(par2, par3, par4));
+ return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)) || par1World.isBlockSolidOnSide(par2, par3, par4, par5);
}
}
public static boolean isTrapdoorOpen(int i)

View File

@ -11,35 +11,41 @@
+
+public class BlockVine extends Block implements IShearable
{
public BlockVine(int i)
public BlockVine(int par1)
{
@@ -330,14 +333,20 @@
public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
@@ -404,14 +407,26 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- if (!world.isRemote && entityplayer.getCurrentEquippedItem() != null && entityplayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- {
- entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
- dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.vine, 1, 0));
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.vine, 1, 0));
- }
- else
- {
- super.harvestBlock(world, entityplayer, i, j, k, l);
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(world, entityplayer, i, j, k, l);
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
+ }
+
+ @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 false;
+ }
+
+ @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)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, 0));
+ return ret;
+ }
+
+ @Override
+ public boolean isLadder(World world, int x, int y, int z)
+ {
+ return true;
}
}

View File

@ -1,182 +1,136 @@
--- ../src_base/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
@@ -316,7 +316,7 @@
@@ -475,7 +475,7 @@
{
Block.blocksList[l1].onBlockRemoval(worldObj, i2, j, j2);
Block.blocksList[var8].onBlockRemoval(this.worldObj, var11, par2, var12);
}
- else if ((Block.blocksList[l1] instanceof BlockContainer) && l1 != l)
+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(getBlockMetadata(i, j, k)))
- else if (Block.blocksList[var8] instanceof BlockContainer && var8 != par4)
+ else if (Block.blocksList[var8] != null && Block.blocksList[var8].hasTileEntity(getBlockMetadata(par1, par2, par3)))
{
worldObj.removeBlockTileEntity(i2, j, j2);
this.worldObj.removeBlockTileEntity(var11, par2, var12);
}
@@ -346,12 +346,12 @@
@@ -513,7 +513,7 @@
Block.blocksList[par4].onBlockAdded(this.worldObj, var11, par2, var12);
}
- if (Block.blocksList[par4] instanceof BlockContainer)
+ if (Block.blocksList[par4] != null && Block.blocksList[par4].hasTileEntity(par5))
{
Block.blocksList[l].onBlockAdded(worldObj, i2, j, j2);
}
- if (Block.blocksList[l] instanceof BlockContainer)
+ if (Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(i1))
var13 = this.getChunkBlockTileEntity(par1, par2, par3);
@@ -526,18 +526,10 @@
if (var13 != null)
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(i1);
worldObj.setBlockTileEntity(i2, j, j2, tileentity);
}
if (tileentity != null)
@@ -360,14 +360,6 @@
var13.updateContainingBlockInfo();
+ var13.blockMetadata = par5;
}
}
}
- else if (l1 > 0 && (Block.blocksList[l1] instanceof BlockContainer))
- else if (var8 > 0 && Block.blocksList[var8] instanceof BlockContainer)
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if (tileentity1 != null)
- var13 = this.getChunkBlockTileEntity(par1, par2, par3);
-
- if (var13 != null)
- {
- tileentity1.updateContainingBlockInfo();
- var13.updateContainingBlockInfo();
- }
- }
isModified = true;
this.isModified = true;
return true;
}
@@ -391,7 +383,11 @@
blocks[i << worldObj.xShift | k << worldObj.heightShift | j] = (byte)(byte0 & 0xff);
if (k1 != 0)
@@ -569,7 +561,7 @@
var5.func_48585_b(par1, par2 & 15, par3, par4);
int var7 = var5.func_48591_a(par1, par2 & 15, par3);
- if (var7 > 0 && Block.blocksList[var7] instanceof BlockContainer)
+ if (var7 > 0 && Block.blocksList[var7] != null && Block.blocksList[var7].hasTileEntity(var5.func_48598_b(par1, par3 & 15, par3)))
{
- Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ if (!worldObj.isRemote)
TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3);
@@ -736,33 +728,30 @@
ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
+ if (var5 != null && var5.isInvalid())
+ {
+ Block.blocksList[k1].onBlockRemoval(worldObj, l1, j, i2);
+ chunkTileEntityMap.remove(var4);
+ var5 = null;
+ }
+ worldObj.removeBlockTileEntity(l1, j, i2);
}
data.set(i, j, k, 0);
if (Block.lightOpacity[byte0 & 0xff] != 0)
@@ -414,28 +410,22 @@
+
if (var5 == null)
{
Block.blocksList[l].onBlockAdded(worldObj, l1, j, i2);
}
- if (l > 0 && (Block.blocksList[l] instanceof BlockContainer))
+ int meta = getBlockMetadata(i, j, k);
+ if (l > 0 && Block.blocksList[l] != null && Block.blocksList[l].hasTileEntity(meta))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(l1, j, i2, tileentity);
}
if (tileentity != null)
{
tileentity.updateContainingBlockInfo();
+ tileentity.blockMetadata = meta;
}
}
}
- else if (k1 > 0 && (Block.blocksList[k1] instanceof BlockContainer))
- {
- TileEntity tileentity1 = getChunkBlockTileEntity(i, j, k);
- if (tileentity1 != null)
- {
- tileentity1.updateContainingBlockInfo();
- }
- }
isModified = true;
return true;
}
@@ -455,7 +445,7 @@
}
data.set(i, j, k, l);
int j1 = getBlockID(i, j, k);
- if (j1 > 0 && (Block.blocksList[j1] instanceof BlockContainer))
+ if (j1 > 0 && Block.blocksList[j1] != null && Block.blocksList[j1].hasTileEntity(l))
{
TileEntity tileentity = getChunkBlockTileEntity(i, j, k);
if (tileentity != null)
@@ -572,29 +562,27 @@
{
ChunkPosition chunkposition = new ChunkPosition(i, j, k);
TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if(tileentity != null && tileentity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ tileentity = null;
+ }
if (tileentity == null)
{
int l = getBlockID(i, j, k);
- if (!Block.isBlockContainer[l])
+ int meta = getBlockMetadata(i, j, k);
+ if(Block.blocksList[l] == null || !Block.blocksList[l].hasTileEntity(meta))
int var6 = this.getBlockID(par1, par2, par3);
-
- if (var6 <= 0 || !Block.blocksList[var6].func_48124_n())
+ int meta = getBlockMetadata(par1, par2, par3);
+ if (var6 <= 0 || Block.blocksList[var6] == null || !Block.blocksList[var6].hasTileEntity(meta))
{
return null;
}
if (tileentity == null)
if (var5 == null)
{
- tileentity = ((BlockContainer)Block.blocksList[l]).getBlockEntity();
+ tileentity = Block.blocksList[l].getTileEntity(meta);
worldObj.setBlockTileEntity(xPosition * 16 + i, j, zPosition * 16 + k, tileentity);
- var5 = ((BlockContainer)Block.blocksList[var6]).getBlockEntity();
+ var5 = Block.blocksList[var6].getTileEntity(meta);
this.worldObj.setBlockTileEntity(this.xPosition * 16 + par1, par2, this.zPosition * 16 + par3, var5);
}
tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
}
- if (tileentity != null && tileentity.isInvalid())
-
- if (var5 != null && var5.isInvalid())
- {
- chunkTileEntityMap.remove(chunkposition);
- this.chunkTileEntityMap.remove(var4);
- return null;
- }
- else
- {
- return tileentity;
- return var5;
- }
+ return tileentity;
+ return var5;
}
public void addTileEntity(TileEntity tileentity)
@@ -605,7 +593,7 @@
setChunkBlockTileEntity(i, j, k, tileentity);
if (isChunkLoaded)
/**
@@ -777,7 +766,7 @@
if (this.isChunkLoaded)
{
- worldObj.loadedTileEntityList.add(tileentity);
+ worldObj.addTileEntity(tileentity);
- this.worldObj.loadedTileEntityList.add(par1TileEntity);
+ this.worldObj.addTileEntity(par1TileEntity);
}
}
@@ -616,12 +604,18 @@
tileentity.xCoord = xPosition * 16 + i;
tileentity.yCoord = j;
tileentity.zCoord = zPosition * 16 + k;
- if (getBlockID(i, j, k) == 0 || !(Block.blocksList[getBlockID(i, j, k)] instanceof BlockContainer))
+ int id = getBlockID(i, j, k);
+ if(id == 0 || Block.blocksList[id] == null || !Block.blocksList[id].hasTileEntity(getBlockMetadata(i, j, k)))
@@ -792,8 +781,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)
+ int id = getBlockID(par1, par2, par3);
+ if (id > 0 && Block.blocksList[id] != null && Block.blocksList[id].hasTileEntity(getBlockMetadata(par1, par2, par3)))
{
return;
}
else
{
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(var5);
+ if (old != null)
+ {
+ old.invalidate();
+ }
tileentity.validate();
chunkTileEntityMap.put(chunkposition, tileentity);
return;
@@ -903,4 +897,18 @@
{
return new ChunkCoordIntPair(xPosition, zPosition);
par4TileEntity.validate();
this.chunkTileEntityMap.put(var5, par4TileEntity);
}
@@ -1179,4 +1174,18 @@
}
}
}
+
+ /* FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int i, int j, int k)
+ /** FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int x, int y, int z)
+ {
+ ChunkPosition chunkposition = new ChunkPosition(i, j, k);
+ ChunkPosition position = new ChunkPosition(x, y, z);
+ if (isChunkLoaded)
+ {
+ TileEntity tileentity = (TileEntity)chunkTileEntityMap.get(chunkposition);
+ if (tileentity != null && tileentity.isInvalid())
+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(position);
+ if (entity != null && entity.isInvalid())
+ {
+ chunkTileEntityMap.remove(chunkposition);
+ chunkTileEntityMap.remove(position);
+ }
+ }
+ }

View File

@ -1,81 +1,82 @@
--- ../src_base/minecraft_server/net/minecraft/src/ConsoleCommandHandler.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ConsoleCommandHandler.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,7 @@
import java.util.*;
@@ -4,6 +4,7 @@
import java.util.Set;
import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.src.forge.DimensionManager;
public class ConsoleCommandHandler
{
@@ -40,10 +41,9 @@
{
serverconfigurationmanager.savePlayerStates();
@@ -52,10 +53,9 @@
var5.savePlayerStates();
}
- for (int i = 0; i < minecraftServer.worldMngr.length; i++)
- for (var6 = 0; var6 < this.minecraftServer.worldMngr.length; ++var6)
+ for (World world : DimensionManager.getWorlds())
{
- WorldServer worldserver = minecraftServer.worldMngr[i];
- worldserver.saveWorld(true, null);
- var7 = this.minecraftServer.worldMngr[var6];
- var7.saveWorld(true, (IProgressUpdate)null);
+ world.saveWorld(true, null);
}
sendNoticeToOps(s1, "Save complete.");
@@ -51,19 +51,17 @@
else if (s.toLowerCase().startsWith("save-off"))
this.sendNoticeToOps(var4, "Save complete.");
@@ -64,20 +64,18 @@
{
sendNoticeToOps(s1, "Disabling level saving..");
- for (int j = 0; j < minecraftServer.worldMngr.length; j++)
this.sendNoticeToOps(var4, "Disabling level saving..");
- for (var6 = 0; var6 < this.minecraftServer.worldMngr.length; ++var6)
+ for (World world : DimensionManager.getWorlds())
{
- WorldServer worldserver1 = minecraftServer.worldMngr[j];
- worldserver1.levelSaving = true;
- var7 = this.minecraftServer.worldMngr[var6];
- var7.levelSaving = true;
+ ((WorldServer)world).levelSaving = true;
}
}
else if (s.toLowerCase().startsWith("save-on"))
else if (var2.toLowerCase().startsWith("save-on"))
{
sendNoticeToOps(s1, "Enabling level saving..");
- for (int k = 0; k < minecraftServer.worldMngr.length; k++)
this.sendNoticeToOps(var4, "Enabling level saving..");
- for (var6 = 0; var6 < this.minecraftServer.worldMngr.length; ++var6)
+ for (World world : DimensionManager.getWorlds())
{
- WorldServer worldserver2 = minecraftServer.worldMngr[k];
- worldserver2.levelSaving = false;
- var7 = this.minecraftServer.worldMngr[var6];
- var7.levelSaving = false;
+ ((WorldServer)world).levelSaving = false;
}
}
else if (s.toLowerCase().startsWith("op "))
@@ -291,20 +289,18 @@
int i1 = Integer.parseInt(as4[2]);
if ("add".equalsIgnoreCase(s12))
else
@@ -353,20 +351,18 @@
if ("add".equalsIgnoreCase(var20))
{
- for (int i2 = 0; i2 < minecraftServer.worldMngr.length; i2++)
- for (var19 = 0; var19 < this.minecraftServer.worldMngr.length; ++var19)
+ for (World world : DimensionManager.getWorlds())
{
- WorldServer worldserver3 = minecraftServer.worldMngr[i2];
- worldserver3.advanceTime(worldserver3.getWorldTime() + (long)i1);
+ world.advanceTime(world.getWorldTime() + (long)i1);
- var22 = this.minecraftServer.worldMngr[var19];
- var22.advanceTime(var22.getWorldTime() + (long)var8);
+ world.advanceTime(world.getWorldTime() + (long)var8);
}
sendNoticeToOps(s1, (new StringBuilder()).append("Added ").append(i1).append(" to time").toString());
this.sendNoticeToOps(var4, "Added " + var8 + " to time");
}
else if ("set".equalsIgnoreCase(s12))
else if ("set".equalsIgnoreCase(var20))
{
- for (int j2 = 0; j2 < minecraftServer.worldMngr.length; j2++)
- for (var19 = 0; var19 < this.minecraftServer.worldMngr.length; ++var19)
+ for (World world : DimensionManager.getWorlds())
{
- WorldServer worldserver4 = minecraftServer.worldMngr[j2];
- worldserver4.advanceTime(i1);
+ world.advanceTime(i1);
- var22 = this.minecraftServer.worldMngr[var19];
- var22.advanceTime((long)var8);
+ world.advanceTime((long)var8);
}
sendNoticeToOps(s1, (new StringBuilder()).append("Set time to ").append(i1).toString());
@@ -347,7 +343,7 @@
this.sendNoticeToOps(var4, "Set time to " + var8);
@@ -411,7 +407,7 @@
}
else if (s.toLowerCase().startsWith("toggledownfall"))
else if (var2.toLowerCase().startsWith("toggledownfall"))
{
- minecraftServer.worldMngr[0].commandToggleDownfall();
- this.minecraftServer.worldMngr[0].commandToggleDownfall();
+ ((WorldServer)DimensionManager.getWorld(0)).commandToggleDownfall();
icommandlistener.log("Toggling rain and snow, hold on...");
var3.log("Toggling rain and snow, hold on...");
}
else if (s.toLowerCase().startsWith("banlist"))
else if (var2.toLowerCase().startsWith("banlist"))

View File

@ -1,11 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -423,7 +423,7 @@
i++;
@@ -239,7 +239,7 @@
}
}
- if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isDamageable())
+ if (i == 2 && itemstack.itemID == itemstack1.itemID && itemstack.stackSize == 1 && itemstack1.stackSize == 1 && Item.itemsList[itemstack.itemID].isRepairable())
- if (var2 == 2 && var3.itemID == var4.itemID && var3.stackSize == 1 && var4.stackSize == 1 && Item.itemsList[var3.itemID].isDamageable())
+ if (var2 == 2 && var3.itemID == var4.itemID && var3.stackSize == 1 && var4.stackSize == 1 && Item.itemsList[var3.itemID].isRepairable())
{
Item item = Item.itemsList[itemstack.itemID];
int l = item.getMaxDamage() - itemstack.getItemDamageForDisplay();
Item var11 = Item.itemsList[var3.itemID];
int var10 = var11.getMaxDamage() - var3.getItemDamageForDisplay();

View File

@ -1,9 +1,10 @@
--- ../src_base/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
@@ -91,6 +91,16 @@
@@ -154,4 +154,14 @@
this.name = par1Str;
return this;
}
+
+ /**
+ * Called to determine if this enchantment can be applied to a ItemStack
+ * @param item The ItemStack that the enchantment might be put on
@ -13,7 +14,4 @@
+ {
+ return type.canEnchantItem(item.getItem());
+ }
+
static
{
looting = new EnchantmentLootBonus(21, 2, EnumEnchantmentType.weapon);
}

View File

@ -1,11 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
@@ -261,7 +261,7 @@
for (int k = 0; k < j; k++)
@@ -348,7 +348,7 @@
{
Enchantment enchantment = aenchantment[k];
- if (enchantment == null || !enchantment.type.canEnchantItem(item))
+ if (enchantment == null || !enchantment.canEnchantItem(itemstack))
Enchantment var7 = var4[var6];
- if (var7 != null && var7.type.canEnchantItem(var2))
+ if (var7 != null && var7.canEnchantItem(par1ItemStack))
{
for (int var8 = var7.getMinLevel(); var8 <= var7.getMaxLevel(); ++var8)
{
continue;
}

View File

@ -1,11 +1,19 @@
--- ../src_base/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
@@ -106,6 +106,22 @@
@@ -140,6 +140,9 @@
public boolean ignoreFrustrumCheck;
public boolean isAirBorne;
+ /** Forge: Used to store custom data for each entity. */
+ private NBTTagCompound customEntityData;
+
public Entity(World par1World)
{
this.entityId = nextEntityID++;
@@ -181,6 +184,20 @@
protected abstract void entityInit();
+ //Forge: Used to store custom data for each entity.
+ private NBTTagCompound customEntityData;
+ /**
+ * Returns a NBTTagCompound that can be used to store custom data for this entity.
+ * It will be written, and read from disc, so it persists over world saves.
@ -22,26 +30,26 @@
+
public DataWatcher getDataWatcher()
{
return dataWatcher;
@@ -883,6 +899,10 @@
nbttagcompound.setShort("Fire", (short)fire);
nbttagcompound.setShort("Air", (short)getAir());
nbttagcompound.setBoolean("OnGround", onGround);
return this.dataWatcher;
@@ -1128,6 +1145,10 @@
par1NBTTagCompound.setShort("Fire", (short)this.fire);
par1NBTTagCompound.setShort("Air", (short)this.getAir());
par1NBTTagCompound.setBoolean("OnGround", this.onGround);
+ if (customEntityData != null)
+ {
+ nbttagcompound.setCompoundTag("ForgeData", customEntityData);
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
+ }
writeEntityToNBT(nbttagcompound);
this.writeEntityToNBT(par1NBTTagCompound);
}
@@ -917,6 +937,10 @@
onGround = nbttagcompound.getBoolean("OnGround");
setPosition(posX, posY, posZ);
setRotation(rotationYaw, rotationPitch);
+ if (nbttagcompound.hasKey("ForgeData"))
@@ -1169,6 +1190,10 @@
this.onGround = par1NBTTagCompound.getBoolean("OnGround");
this.setPosition(this.posX, this.posY, this.posZ);
this.setRotation(this.rotationYaw, this.rotationPitch);
+ if (par1NBTTagCompound.hasKey("ForgeData"))
+ {
+ customEntityData = nbttagcompound.getCompoundTag("ForgeData");
+ customEntityData = par1NBTTagCompound.getCompoundTag("ForgeData");
+ }
readEntityFromNBT(nbttagcompound);
this.readEntityFromNBT(par1NBTTagCompound);
}

View File

@ -1,30 +1,31 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.Random;
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class EntityItem extends Entity
{
public ItemStack item;
@@ -139,6 +141,18 @@
return;
}
int i = item.stackSize;
+ if (delayBeforeCanPickup == 0 && !ForgeHooks.onItemPickup(entityplayer, this))
/** The item stack of this EntityItem. */
@@ -171,6 +173,20 @@
if (!this.worldObj.isRemote)
{
int var2 = this.item.stackSize;
+
+ if (delayBeforeCanPickup == 0 && !ForgeHooks.onItemPickup(par1EntityPlayer, this))
+ {
+ ModLoader.OnItemPickup(entityplayer, item);
+ worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ entityplayer.onItemPickup(this, i);
+ ModLoader.onItemPickup(par1EntityPlayer, item);
+ this.worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
+ par1EntityPlayer.onItemPickup(this, var2);
+ if (item.stackSize <= 0)
+ {
+ setEntityDead();
+ }
+ return;
+ }
+ i = item.stackSize;
if (delayBeforeCanPickup == 0 && entityplayer.inventory.addItemStackToInventory(item))
+
+ var2 = item.stackSize;
if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(this.item))
{
if (item.itemID == Block.wood.blockID)

View File

@ -1,22 +1,11 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
@@ -29,7 +29,7 @@
public float swingProgress;
protected int health;
public int prevHealth;
- protected int carryoverDamage;
+ public int carryoverDamage;
private int livingSoundTime;
public int hurtTime;
public int maxHurtTime;
@@ -812,7 +812,9 @@
int i = MathHelper.floor_double(posX);
int j = MathHelper.floor_double(boundingBox.minY);
int k = MathHelper.floor_double(posZ);
- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID;
+ Block block=Block.blocksList[worldObj.getBlockId(i,j,k)];
+ if(block==null) return false;
+ return block.isLadder(worldObj,i,j,k);
@@ -1233,7 +1233,7 @@
int var2 = MathHelper.floor_double(this.boundingBox.minY);
int var3 = MathHelper.floor_double(this.posZ);
int var4 = this.worldObj.getBlockId(var1, var2, var3);
- return var4 == Block.ladder.blockID || var4 == Block.vine.blockID;
+ return (Block.blocksList[var4] != null && Block.blocksList[var4].isLadder(worldObj, var1, var2, var3));
}
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
/**

View File

@ -10,44 +10,50 @@
+
+public class EntityMooshroom extends EntityCow implements IShearable
{
public EntityMooshroom(World world)
public EntityMooshroom(World par1World)
{
@@ -17,30 +21,36 @@
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, new ItemStack(Item.bowlSoup));
@@ -21,31 +25,7 @@
par1EntityPlayer.inventory.setInventorySlotContents(par1EntityPlayer.inventory.currentItem, new ItemStack(Item.bowlSoup));
return true;
}
- if (itemstack != null && itemstack.itemID == Item.shears.shiftedIndex && getDelay() >= 0)
- else if (var2 != null && var2.itemID == Item.shears.shiftedIndex && this.func_48351_J() >= 0)
- {
- setEntityDead();
- EntityCow entitycow = new EntityCow(worldObj);
- entitycow.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
- entitycow.setEntityHealth(getEntityHealth());
- entitycow.renderYawOffset = renderYawOffset;
- worldObj.spawnEntityInWorld(entitycow);
- worldObj.spawnParticle("largeexplode", posX, posY + (double)(height / 2.0F), posZ, 0.0D, 0.0D, 0.0D);
- for (int i = 0; i < 5; i++)
- this.setEntityDead();
- this.worldObj.spawnParticle("largeexplode", this.posX, this.posY + (double)(this.height / 2.0F), this.posZ, 0.0D, 0.0D, 0.0D);
-
- if (!this.worldObj.isRemote)
- {
- worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY + (double)height, posZ, new ItemStack(Block.mushroomRed)));
- EntityCow var3 = new EntityCow(this.worldObj);
- var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
- var3.setEntityHealth(this.getEntityHealth());
- var3.renderYawOffset = this.renderYawOffset;
- this.worldObj.spawnEntityInWorld(var3);
-
- for (int var4 = 0; var4 < 5; ++var4)
- {
- this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.posX, this.posY + (double)this.height, this.posZ, new ItemStack(Block.mushroomRed)));
- }
- }
-
- return true;
- }
- else
- {
- return super.interact(entityplayer);
- return super.interact(par1EntityPlayer);
- }
+ return super.interact(entityplayer);
+ return super.interact(par1EntityPlayer);
}
protected EntityAnimal spawnBabyAnimal(EntityAnimal entityanimal)
/**
@@ -55,4 +35,29 @@
{
return new EntityMooshroom(worldObj);
return new EntityMooshroom(this.worldObj);
}
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
+ {
+ return getDelay() >= 0;
+ return func_48351_J() >= 0;
+ }
+
+ @Override

View File

@ -1,8 +1,8 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,10 @@
import java.util.*;
@@ -3,6 +3,10 @@
import java.util.Iterator;
import java.util.List;
+import net.minecraft.src.forge.ArmorProperties;
+import net.minecraft.src.forge.ForgeHooks;
@ -10,149 +10,116 @@
+
public abstract class EntityPlayer extends EntityLiving
{
public InventoryPlayer inventory;
@@ -124,6 +128,7 @@
/** Inventory of the player */
@@ -158,6 +162,7 @@
}
else
{
+ itemInUse.getItem().onUsingItemTick(itemInUse,this,itemInUseCount);
if (itemInUseCount <= 25 && itemInUseCount % 4 == 0)
+ itemInUse.getItem().onUsingItemTick(itemInUse, this, itemInUseCount);
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
{
func_35208_b(itemstack, 5);
@@ -274,6 +279,10 @@
this.func_35208_b(var1, 5);
@@ -341,6 +346,10 @@
*/
protected void closeScreen()
{
+ if (craftingInventory != null)
+ if (craftingInventory != null) //TODO: This is a bugfix for chests staying open in SMP
+ {
+ craftingInventory.onCraftGuiClosed(this);
+ }
craftingInventory = inventorySlots;
this.craftingInventory = this.inventorySlots;
}
@@ -433,7 +442,16 @@
@@ -514,7 +523,16 @@
public void dropCurrentItem()
public EntityItem func_48347_R()
{
- dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false);
- return this.func_48349_a(this.inventory.decrStackSize(this.inventory.currentItem, 1), false);
+ ItemStack stack = inventory.getCurrentItem();
+ if (stack == null)
+ {
+ return;
+ return null;
+ }
+
+ if (stack.getItem().onDroppedByPlayer(stack, this))
+ {
+ dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false);
+ return func_48349_a(inventory.decrStackSize(inventory.currentItem, 1), false);
+ }
+ return null;
}
public void dropPlayerItem(ItemStack itemstack)
@@ -480,6 +498,8 @@
worldObj.spawnEntityInWorld(entityitem);
}
public EntityItem func_48348_b(ItemStack par1ItemStack)
@@ -573,10 +591,18 @@
+ /* FORGE: This isnt called anymore, There is a new metadata sensitive version */
/**
* Returns how strong the player is against the specified block at this moment
+ * Deprecated in favor of the metadata-sensitive version
*/
+ @Deprecated
public float getCurrentPlayerStrVsBlock(Block block)
public float getCurrentPlayerStrVsBlock(Block par1Block)
{
float f = inventory.getStrVsBlock(block);
@@ -508,6 +528,45 @@
return f1;
- float var2 = this.inventory.getStrVsBlock(par1Block);
+ return getCurrentPlayerStrVsBlock(par1Block, 0);
+ }
+
+ public float getCurrentPlayerStrVsBlock(Block par1Block, int meta)
+ {
+ ItemStack stack = inventory.getCurrentItem();
+ float var2 = (stack == null ? 1.0F : stack.getItem().getStrVsBlock(stack, par1Block, meta));
float var3 = var2;
int var4 = EnchantmentHelper.getEfficiencyModifier(this.inventory);
@@ -868,7 +894,11 @@
par2 = 1 + par2 >> 1;
}
+ /* FORGE: Extended to allow metadata.
+ */
+ public float getCurrentPlayerStrVsBlock(Block block, int md)
+ {
+ float f = 1.0F;
+ ItemStack ist = inventory.getCurrentItem();
+ if(ist != null)
+ {
+ f = ist.getItem().getStrVsBlock(ist, block, md);
+ }
+
+ int i = EnchantmentHelper.getEfficiencyModifier(inventory);
+ if (i > 0 && ForgeHooks.canHarvestBlock(block, this, md))
+ {
+ f += i * i + 1;
+ }
+
+ if(isPotionActive(Potion.digSpeed))
+ {
+ f *= 1.0F + (float)(getActivePotionEffect(Potion.digSpeed).getAmplifier() + 1) * 0.2F;
+ }
+
+ if(isPotionActive(Potion.digSlowdown))
+ {
+ f *= 1.0F - (float)(getActivePotionEffect(Potion.digSlowdown).getAmplifier() + 1) * 0.2F;
+ }
+
+ if(isInsideOfMaterial(Material.water) && !EnchantmentHelper.getAquaAffinityModifier(inventory))
+ {
+ f /= 5F;
+ }
+
+ if(!onGround)
+ {
+ f /= 5F;
+ }
+ return f;
+ }
+
public boolean canHarvestBlock(Block block)
{
return inventory.canHarvestBlock(block);
@@ -711,7 +770,11 @@
{
i = 1 + i >> 1;
}
- i = applyArmorCalculations(damagesource, i);
+ i = ArmorProperties.ApplyArmor(this, inventory.armorInventory, damagesource, i);
+ if (i <= 0)
- par2 = this.applyArmorCalculations(par1DamageSource, par2);
+ par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2);
+ if (par2 <= 0)
+ {
+ return;
+ }
i = applyPotionDamageCalculations(damagesource, i);
addExhaustion(damagesource.getHungerDamage());
health -= i;
@@ -758,7 +821,9 @@
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.addExhaustion(par1DamageSource.getHungerDamage());
this.health -= par2;
@@ -926,7 +956,9 @@
*/
public void destroyCurrentEquippedItem()
{
+ ItemStack orig=inventory.getCurrentItem();
inventory.setInventorySlotContents(inventory.currentItem, null);
+ ItemStack orig = inventory.getCurrentItem();
this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null);
+ ForgeHooks.onDestroyCurrentItem(this, orig);
}
public double getYOffset()
@@ -777,6 +842,11 @@
public void attackTargetEntityWithCurrentItem(Entity entity)
/**
@@ -955,6 +987,12 @@
*/
public void attackTargetEntityWithCurrentItem(Entity par1Entity)
{
+ ItemStack stack = getCurrentEquippedItem();
+ if (stack != null && stack.getItem().onLeftClickEntity(stack, this, entity))
+ if (stack != null && stack.getItem().onLeftClickEntity(stack, this, par1Entity))
+ {
+ return;
+ }
int i = inventory.getDamageVsEntity(entity);
if (isPotionActive(Potion.damageBoost))
+
if (par1Entity.func_48313_k_())
{
@@ -884,6 +954,11 @@
public EnumStatus sleepInBedAt(int i, int j, int k)
int var2 = this.inventory.getDamageVsEntity(par1Entity);
@@ -1093,6 +1131,12 @@
*/
public EnumStatus sleepInBedAt(int par1, int par2, int par3)
{
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, i, j, k);
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, par1, par2, par3);
+ if (customSleep != null)
+ {
+ return customSleep;
+ }
if (!worldObj.isRemote)
+
if (!this.worldObj.isRemote)
{
if (isPlayerSleeping() || !isEntityAlive())
@@ -1353,4 +1428,16 @@
experience = entityplayer.experience;
score = entityplayer.score;
if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1643,4 +1687,16 @@
{
return !this.capabilities.isFlying;
}
+
+ /**
@ -165,5 +132,5 @@
+ * @param Y Y Position
+ * @param Z Z Position
+ */
+ public void openGui(BaseMod mod, int ID, World world, int X, int Y, int Z){}
+ public void openGui(BaseMod mod, int ID, World world, int x, int y, int z){}
}

View File

@ -1,67 +1,67 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityPlayerMP.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityPlayerMP.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,10 @@
import java.util.*;
@@ -5,6 +5,10 @@
import java.util.List;
import java.util.Set;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.src.forge.IGuiHandler;
+import net.minecraft.src.forge.MinecraftForge;
+import net.minecraft.src.forge.NetworkMod;
+import net.minecraft.src.forge.packets.PacketOpenGUI;
public class EntityPlayerMP extends EntityPlayer
implements ICrafting
@@ -405,6 +409,7 @@
public void displayWorkbenchGUI(int i, int j, int k)
public class EntityPlayerMP extends EntityPlayer implements ICrafting
{
getNextWidowId();
+ closeCraftingGui();
playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 1, "Crafting", 9));
craftingInventory = new ContainerWorkbench(inventory, worldObj, i, j, k);
craftingInventory.windowId = currentWindowId;
@@ -414,6 +419,7 @@
public void displayGUIEnchantment(int i, int j, int k)
@@ -548,6 +552,7 @@
public void displayWorkbenchGUI(int par1, int par2, int par3)
{
getNextWidowId();
+ closeCraftingGui();
playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 4, "Enchanting", 9));
craftingInventory = new ContainerEnchantment(inventory, worldObj, i, j, k);
craftingInventory.windowId = currentWindowId;
@@ -423,6 +429,7 @@
public void displayGUIChest(IInventory iinventory)
this.getNextWidowId();
+ closeCraftingGui(); //TODO: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 1, "Crafting", 9));
this.craftingInventory = new ContainerWorkbench(this.inventory, this.worldObj, par1, par2, par3);
this.craftingInventory.windowId = this.currentWindowId;
@@ -557,6 +562,7 @@
public void displayGUIEnchantment(int par1, int par2, int par3)
{
getNextWidowId();
+ closeCraftingGui();
playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 0, iinventory.getInvName(), iinventory.getSizeInventory()));
craftingInventory = new ContainerChest(inventory, iinventory);
craftingInventory.windowId = currentWindowId;
@@ -432,6 +439,7 @@
public void displayGUIFurnace(TileEntityFurnace tileentityfurnace)
this.getNextWidowId();
+ closeCraftingGui(); //TODO: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 4, "Enchanting", 9));
this.craftingInventory = new ContainerEnchantment(this.inventory, this.worldObj, par1, par2, par3);
this.craftingInventory.windowId = this.currentWindowId;
@@ -569,6 +575,7 @@
public void displayGUIChest(IInventory par1IInventory)
{
getNextWidowId();
+ closeCraftingGui();
playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 2, tileentityfurnace.getInvName(), tileentityfurnace.getSizeInventory()));
craftingInventory = new ContainerFurnace(inventory, tileentityfurnace);
craftingInventory.windowId = currentWindowId;
@@ -441,6 +449,7 @@
public void displayGUIDispenser(TileEntityDispenser tileentitydispenser)
this.getNextWidowId();
+ closeCraftingGui(); //TODO: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 0, par1IInventory.getInvName(), par1IInventory.getSizeInventory()));
this.craftingInventory = new ContainerChest(this.inventory, par1IInventory);
this.craftingInventory.windowId = this.currentWindowId;
@@ -581,6 +588,7 @@
public void displayGUIFurnace(TileEntityFurnace par1TileEntityFurnace)
{
getNextWidowId();
+ closeCraftingGui();
playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 3, tileentitydispenser.getInvName(), tileentitydispenser.getSizeInventory()));
craftingInventory = new ContainerDispenser(inventory, tileentitydispenser);
craftingInventory.windowId = currentWindowId;
@@ -450,6 +459,7 @@
public void displayGUIBrewingStand(TileEntityBrewingStand tileentitybrewingstand)
this.getNextWidowId();
+ closeCraftingGui(); //TODO: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 2, par1TileEntityFurnace.getInvName(), par1TileEntityFurnace.getSizeInventory()));
this.craftingInventory = new ContainerFurnace(this.inventory, par1TileEntityFurnace);
this.craftingInventory.windowId = this.currentWindowId;
@@ -593,6 +601,7 @@
public void displayGUIDispenser(TileEntityDispenser par1TileEntityDispenser)
{
getNextWidowId();
+ closeCraftingGui();
playerNetServerHandler.sendPacket(new Packet100OpenWindow(currentWindowId, 5, tileentitybrewingstand.getInvName(), tileentitybrewingstand.getSizeInventory()));
craftingInventory = new ContainerBrewingStand(inventory, tileentitybrewingstand);
craftingInventory.windowId = currentWindowId;
@@ -613,4 +623,38 @@
EntityTracker entitytracker = mcServer.getEntityTracker(dimension);
entitytracker.sendPacketToTrackedPlayersAndTrackedEntity(this, new Packet18Animation(entity, 7));
this.getNextWidowId();
+ closeCraftingGui(); //TODO: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 3, par1TileEntityDispenser.getInvName(), par1TileEntityDispenser.getSizeInventory()));
this.craftingInventory = new ContainerDispenser(this.inventory, par1TileEntityDispenser);
this.craftingInventory.windowId = this.currentWindowId;
@@ -602,6 +611,7 @@
public void displayGUIBrewingStand(TileEntityBrewingStand par1TileEntityBrewingStand)
{
this.getNextWidowId();
+ closeCraftingGui(); //TODO: This is a bug fix for chests staying open in SMP
this.playerNetServerHandler.sendPacket(new Packet100OpenWindow(this.currentWindowId, 5, par1TileEntityBrewingStand.getInvName(), par1TileEntityBrewingStand.getSizeInventory()));
this.craftingInventory = new ContainerBrewingStand(this.inventory, par1TileEntityBrewingStand);
this.craftingInventory.windowId = this.currentWindowId;
@@ -785,4 +795,38 @@
EntityTracker var2 = this.mcServer.getEntityTracker(this.dimension);
var2.sendPacketToTrackedPlayersAndTrackedEntity(this, new Packet18Animation(par1Entity, 7));
}
+
+ /**
@ -70,12 +70,12 @@
+ * @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
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ */
+ @Override
+ public void openGui(BaseMod mod, int ID, World world, int X, int Y, int Z)
+ public void openGui(BaseMod mod, int ID, World world, int x, int y, int z)
+ {
+ if (!(mod instanceof NetworkMod))
+ {
@ -84,12 +84,12 @@
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
+ if (handler != null)
+ {
+ Container container = handler.getGuiContainer(ID, this, world, X, Y, Z);
+ Container container = handler.getGuiContainer(ID, this, world, x, y, z);
+ if (container != null)
+ {
+ getNextWidowId();
+ closeCraftingGui();
+ PacketOpenGUI pkt = new PacketOpenGUI(currentWindowId, MinecraftForge.getModID((NetworkMod)mod), ID, X, Y, Z);
+ PacketOpenGUI pkt = new PacketOpenGUI(currentWindowId, MinecraftForge.getModID((NetworkMod)mod), ID, x, y, z);
+ playerNetServerHandler.sendPacket(pkt.getPacket());
+ craftingInventory = container;
+ craftingInventory.windowId = currentWindowId;

View File

@ -11,35 +11,39 @@
+
+public class EntitySheep extends EntityAnimal implements IShearable
{
public static final float fleeceColorTable[][] =
{
@@ -145,23 +148,6 @@
public static final float[][] fleeceColorTable = new float[][] {{1.0F, 1.0F, 1.0F}, {0.95F, 0.7F, 0.2F}, {0.9F, 0.5F, 0.85F}, {0.6F, 0.7F, 0.95F}, {0.9F, 0.9F, 0.2F}, {0.5F, 0.8F, 0.1F}, {0.95F, 0.7F, 0.8F}, {0.3F, 0.3F, 0.3F}, {0.6F, 0.6F, 0.6F}, {0.3F, 0.6F, 0.7F}, {0.7F, 0.4F, 0.9F}, {0.2F, 0.4F, 0.8F}, {0.5F, 0.4F, 0.3F}, {0.4F, 0.5F, 0.2F}, {0.8F, 0.3F, 0.3F}, {0.1F, 0.1F, 0.1F}};
public boolean interact(EntityPlayer entityplayer)
@@ -94,27 +97,6 @@
*/
public boolean interact(EntityPlayer par1EntityPlayer)
{
- ItemStack itemstack = entityplayer.inventory.getCurrentItem();
- if (itemstack != null && itemstack.itemID == Item.shears.shiftedIndex && !getSheared() && !isChild())
- ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
-
- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared() && !this.isChild())
- {
- if (!worldObj.isRemote)
- if (!this.worldObj.isRemote)
- {
- setSheared(true);
- int i = 1 + rand.nextInt(3);
- for (int j = 0; j < i; j++)
- this.setSheared(true);
- int var3 = 1 + this.rand.nextInt(3);
-
- for (int var4 = 0; var4 < var3; ++var4)
- {
- EntityItem entityitem = entityDropItem(new ItemStack(Block.cloth.blockID, 1, getFleeceColor()), 1.0F);
- entityitem.motionY += rand.nextFloat() * 0.05F;
- entityitem.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
- entityitem.motionZ += (rand.nextFloat() - rand.nextFloat()) * 0.1F;
- EntityItem var5 = this.entityDropItem(new ItemStack(Block.cloth.blockID, 1, this.getFleeceColor()), 1.0F);
- var5.motionY += (double)(this.rand.nextFloat() * 0.05F);
- var5.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
- var5.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
- }
- }
- itemstack.damageItem(1, entityplayer);
-
- var2.damageItem(1, par1EntityPlayer);
- }
return super.interact(entityplayer);
-
return super.interact(par1EntityPlayer);
}
@@ -259,4 +245,23 @@
@@ -237,4 +219,23 @@
this.func_48350_c(var1);
}
return entitysheep1;
}
+
+ @Override

View File

@ -1,21 +1,21 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityTracker.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityTracker.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,7 @@
import java.util.*;
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.Set;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.src.forge.ForgeHooksServer;
public class EntityTracker
{
@@ -22,6 +23,10 @@
@@ -30,6 +31,10 @@
public void trackEntity(Entity entity)
public void trackEntity(Entity par1Entity)
{
+ if (ForgeHooksServer.OnTrackEntity(this, entity))
+ if (ForgeHooksServer.OnTrackEntity(this, par1Entity))
+ {
+ return;
+ }
if (entity instanceof EntityPlayerMP)
if (par1Entity instanceof EntityPlayerMP)
{
trackEntity(entity, 512, 2);
this.trackEntity(par1Entity, 512, 2);

View File

@ -1,25 +1,23 @@
--- ../src_base/minecraft_server/net/minecraft/src/EntityTrackerEntry.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/EntityTrackerEntry.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,8 @@
import java.util.*;
import java.util.logging.Logger;
import java.util.List;
import java.util.Set;
+import net.minecraft.src.forge.ForgeHooks;
+
public class EntityTrackerEntry
{
public Entity trackedEntity;
@@ -250,6 +252,13 @@
/** The entity that this EntityTrackerEntry tracks. */
@@ -286,6 +288,11 @@
{
System.out.println("Fetching addPacket for removed entity");
}
+
+ Packet pkt = ForgeHooks.getEntitySpawnPacket(trackedEntity);
+ if (pkt != null)
+ {
+ return pkt;
+ }
+
EntityTrackerEntry2 entitytrackerentry2 = ModLoaderMp.HandleEntityTrackerEntries(trackedEntity);
if (entitytrackerentry2 != null)
if (this.trackedEntity instanceof EntityItem)
{

View File

@ -1,27 +1,28 @@
--- ../src_base/minecraft_server/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.*;
@@ -6,6 +6,8 @@
import java.util.Random;
import java.util.Set;
+import net.minecraft.src.forge.ISpecialResistance;
+
public class Explosion
{
public boolean isFlaming;
@@ -66,7 +68,14 @@
int k3 = worldObj.getBlockId(l2, i3, j3);
if (k3 > 0)
/** whether or not the explosion sets fire to blocks around it */
@@ -72,7 +74,15 @@
if (var25 > 0)
{
- f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2;
+ if (Block.blocksList[k3] instanceof ISpecialResistance)
- var14 -= (Block.blocksList[var25].getExplosionResistance(this.exploder) + 0.3F) * var21;
+ if (Block.blocksList[var25] instanceof ISpecialResistance)
+ {
+ ISpecialResistance isr = (ISpecialResistance)Block.blocksList[k3];
+ f1 -= (isr.getSpecialExplosionResistance(worldObj, l2, i3, j3, explosionX, explosionY, explosionZ, exploder) + 0.3F) * f2;
+ } else {
+ f1 -= (Block.blocksList[k3].getExplosionResistance(exploder) + 0.3F) * f2;
+ ISpecialResistance isr = (ISpecialResistance)Block.blocksList[var25];
+ var14 -= (isr.getSpecialExplosionResistance(worldObj, var22, var23, var24, explosionX, explosionY, explosionZ, exploder) + 0.3F) * var21;
+ }
+ else
+ {
+ var14 -= (Block.blocksList[var25].getExplosionResistance(this.exploder) + 0.3F) * var21;
+ }
+
}
if (f1 > 0.0F)
{
if (var14 > 0.0F)

View File

@ -1,31 +1,35 @@
--- ../src_base/minecraft_server/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,11 +2,13 @@
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import java.util.Arrays;
public class FurnaceRecipes
{
private static final FurnaceRecipes smeltingBase = new FurnaceRecipes();
private Map smeltingList;
+ private Map metaSmeltingList;
@@ -9,6 +10,7 @@
public static final FurnaceRecipes smelting()
/** The list of smelting results. */
private Map smeltingList = new HashMap();
+ private Map metaSmeltingList = new HashMap();
/**
* Used to call methods addSmelting and getSmeltingResult.
@@ -47,7 +49,9 @@
/**
* Returns the smelting result of an item.
+ * Deprecated in favor of a metadata sensitive version
*/
+ @Deprecated
public ItemStack getSmeltingResult(int par1)
{
@@ -16,6 +18,7 @@
private FurnaceRecipes()
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
@@ -57,4 +61,34 @@
{
smeltingList = new HashMap();
+ metaSmeltingList = new HashMap();
addSmelting(Block.oreIron.blockID, new ItemStack(Item.ingotIron));
addSmelting(Block.oreGold.blockID, new ItemStack(Item.ingotGold));
addSmelting(Block.oreDiamond.blockID, new ItemStack(Item.diamond));
@@ -38,11 +41,43 @@
smeltingList.put(Integer.valueOf(i), itemstack);
return this.smeltingList;
}
+
+ /**
+ * Add a metadata-sensitive furnace recipe
+ * @param itemID The Item ID
@ -37,13 +41,6 @@
+ metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
+ }
+
+ /* FORGE: Not used anymore, now uses a metadata sensitive version */
+ @Deprecated
public ItemStack getSmeltingResult(int i)
{
return (ItemStack)smeltingList.get(Integer.valueOf(i));
}
+ /**
+ * Used to get the resulting ItemStack form a source ItemStack
+ * @param item The Source ItemStack
@ -62,7 +59,4 @@
+ }
+ return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
+ }
+
public Map getSmeltingList()
{
return smeltingList;
}

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/GuiStatsComponent.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/GuiStatsComponent.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,7 @@
@@ -7,6 +7,7 @@
import javax.swing.JComponent;
import javax.swing.Timer;
import net.minecraft.server.MinecraftServer;
@ -8,10 +8,11 @@
public class GuiStatsComponent extends JComponent
{
@@ -31,15 +32,25 @@
@@ -41,22 +42,30 @@
{
long l = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
long var1 = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
System.gc();
+
+ if (displayStrings.length < DimensionManager.getIDs().length + 3)
+ {
+ displayStrings = new String[DimensionManager.getIDs().length + 3];
@ -20,32 +21,38 @@
+ {
+ displayStrings[x] = "";
+ }
displayStrings[0] = (new StringBuilder()).append("Memory use: ").append(l / 1024L / 1024L).append(" mb (").append((Runtime.getRuntime().freeMemory() * 100L) / Runtime.getRuntime().maxMemory()).append("% free)").toString();
displayStrings[1] = (new StringBuilder()).append("Threads: ").append(NetworkManager.numReadThreads).append(" + ").append(NetworkManager.numWriteThreads).toString();
displayStrings[2] = (new StringBuilder()).append("Avg tick: ").append(field_40573_a.format(func_40571_a(field_40572_e.field_40027_f) * 9.9999999999999995E-007D)).append(" ms").toString();
- for (int i = 0; i < field_40572_e.worldMngr.length; i++)
+
this.displayStrings[0] = "Memory use: " + var1 / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
this.displayStrings[1] = "Threads: " + NetworkManager.numReadThreads + " + " + NetworkManager.numWriteThreads;
this.displayStrings[2] = "Avg tick: " + field_40573_a.format(this.func_48551_a(this.field_40572_e.field_40027_f) * 1.0E-6D) + " ms";
this.displayStrings[3] = "Avg sent: " + (int)this.func_48551_a(this.field_40572_e.field_48080_u) + ", Avg size: " + (int)this.func_48551_a(this.field_40572_e.field_48079_v);
this.displayStrings[4] = "Avg rec: " + (int)this.func_48551_a(this.field_40572_e.field_48078_w) + ", Avg size: " + (int)this.func_48551_a(this.field_40572_e.field_48082_x);
- if (this.field_40572_e.worldMngr != null)
+ int x = 0;
+ for (Integer id : DimensionManager.getIDs())
{
- displayStrings[3 + i] = (new StringBuilder()).append("Lvl ").append(i).append(" tick: ").append(field_40573_a.format(func_40571_a(field_40572_e.field_40028_g[i]) * 9.9999999999999995E-007D)).append(" ms").toString();
- if (field_40572_e.worldMngr[i] != null && field_40572_e.worldMngr[i].chunkProviderServer != null)
+ displayStrings[2 + ++x] = "Lvl " + id + " tick: " + field_40573_a.format(func_40571_a(field_40572_e.worldTickTimes.get(id)) * 10E-007D) + " ms";
- for (int var3 = 0; var3 < this.field_40572_e.worldMngr.length; ++var3)
+ displayStrings[2 + ++x] = "Lvl " + id + " tick: " + field_40573_a.format(func_48551_a(field_40572_e.worldTickTimes.get(id)) * 10E-6D) + " ms";
+ WorldServer world = (WorldServer)DimensionManager.getWorld(id);
+ if (world != null && world.chunkProviderServer != null)
{
- displayStrings[3 + i] += ", " + field_40572_e.worldMngr[i].chunkProviderServer.func_46040_d();
- this.displayStrings[5 + var3] = "Lvl " + var3 + " tick: " + field_40573_a.format(this.func_48551_a(this.field_40572_e.field_40028_g[var3]) * 1.0E-6D) + " ms";
-
- if (this.field_40572_e.worldMngr[var3] != null && this.field_40572_e.worldMngr[var3].chunkProviderServer != null)
- {
- this.displayStrings[5 + var3] = this.displayStrings[5 + var3] + ", " + this.field_40572_e.worldMngr[var3].chunkProviderServer.func_46040_d();
- }
+ displayStrings[2 + x] += ", " + world.chunkProviderServer.func_46040_d();
}
}
memoryUse[updateCounter++ & 0xff] = (int)((l * 100L) / Runtime.getRuntime().maxMemory());
@@ -48,6 +59,10 @@
private double func_40571_a(long al[])
@@ -67,7 +76,7 @@
private double func_48551_a(long[] par1ArrayOfLong)
{
+ if (al == null)
+ {
+ return 0;
+ }
long l = 0L;
for (int i = 0; i < al.length; i++)
long var2 = 0L;
-
+ if (par1ArrayOfLong == null) return 0;
for (int var4 = 0; var4 < par1ArrayOfLong.length; ++var4)
{
var2 += par1ArrayOfLong[var4];

View File

@ -1,36 +1,40 @@
--- ../src_base/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
@@ -1,5 +1,6 @@
package net.minecraft.src;
import java.io.PrintStream;
+import java.util.ArrayList;
import java.util.Random;
public class Item
@@ -156,6 +157,9 @@
private String potionEffect;
private String itemName;
@@ -184,6 +185,9 @@
+ // FORGE: To disable repair recipes.
+ protected boolean canRepair = true;
/** full name of item from language file */
private String itemName;
+
protected Item(int i)
+ /** FORGE: To disable repair recipes. */
+ protected boolean canRepair = true;
protected Item(int par1)
{
maxStackSize = 64;
@@ -389,10 +393,148 @@
float f8 = f6;
float f9 = f3 * f5;
double d3 = 5D;
+ if (entityplayer instanceof EntityPlayerMP)
@@ -468,6 +472,10 @@
float var18 = var15 * var16;
float var20 = var14 * var16;
double var21 = 5.0D;
+ if (par2EntityPlayer instanceof EntityPlayerMP)
+ {
+ d3 = ((EntityPlayerMP)entityplayer).itemInWorldManager.getBlockReachDistance();
+ var21 = ((EntityPlayerMP)par2EntityPlayer).itemInWorldManager.getBlockReachDistance();
+ }
Vec3D vec3d1 = vec3d.addVector((double)f7 * d3, (double)f8 * d3, (double)f9 * d3);
MovingObjectPosition movingobjectposition = world.rayTraceBlocks_do_do(vec3d, vec3d1, flag, !flag);
return movingobjectposition;
Vec3D var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21);
MovingObjectPosition var24 = par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3);
return var24;
@@ -482,4 +490,149 @@
{
StatList.initStats();
}
+
+ /* =========================================================== FORGE START ===============================================================*/
+
+ /**
+ * Called when a new CreativeContainer is opened, populate the list
+ * with all of the items for this item you want a player in creative mode
@ -161,9 +165,16 @@
+ */
+ public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
+ {
+ //This is here server side for compilation compatibility
+ /*
+ * Here is an example usage for Vanilla bows.
+ if (usingItem != null && usingItem.getItem().shiftedIndex == Item.bow.shiftedIndex)
+ {
+ int k = usingItem.getMaxItemUseDuration() - useRemaining;
+ if (k >= 18) return 133;
+ if (k > 13) return 117;
+ if (k > 0) return 101;
+ }
+ */
+ return 0;
+ }
public int getItemEnchantability()
{
}

View File

@ -1,35 +1,34 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemBow.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBow.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.Random;
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemBow extends Item
{
public ItemBow(int i)
@@ -13,6 +15,11 @@
public ItemBow(int par1)
@@ -11,6 +13,10 @@
public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer entityplayer, int i)
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
+ boolean handled = ForgeHooks.onArrowLoose(itemstack, world, entityplayer, getMaxItemUseDuration(itemstack) - i);
+ if (handled)
+ if (ForgeHooks.onArrowLoose(par1ItemStack, par2World, par3EntityPlayer, getMaxItemUseDuration(par1ItemStack) - par4))
+ {
+ return;
+ }
boolean flag = entityplayer.capabilities.depleteBuckets || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemstack) > 0;
if (flag || entityplayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
@@ -80,6 +87,11 @@
boolean var5 = par3EntityPlayer.capabilities.depleteBuckets || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
@@ -100,6 +106,12 @@
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
+ ItemStack stack = ForgeHooks.onArrowNock(itemstack, world, entityplayer);
+ ItemStack stack = ForgeHooks.onArrowNock(par1ItemStack, par2World, par3EntityPlayer);
+ if (stack != null)
+ {
+ return stack;
+ }
if (entityplayer.capabilities.depleteBuckets || entityplayer.inventory.hasItem(Item.arrow.shiftedIndex))
+
if (par3EntityPlayer.capabilities.depleteBuckets || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
entityplayer.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));

View File

@ -1,23 +1,28 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.Random;
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.MinecraftForge;
+
public class ItemBucket extends Item
{
private int isFull;
@@ -36,6 +38,11 @@
/** field for checking if the bucket has been filled. */
@@ -43,10 +45,16 @@
if (this.isFull == 0)
{
- if (!par3EntityPlayer.canPlayerEdit(var13, var14, var15))
+ if (par3EntityPlayer != null && !par3EntityPlayer.canPlayerEdit(var13, var14, var15))
{
return par1ItemStack;
}
if (isFull == 0)
{
+ ItemStack customBucket = MinecraftForge.fillCustomBucket(world, i, j, k);
+ if (customBucket != null)
+
+ ItemStack stack = MinecraftForge.fillCustomBucket(par2World, var13, var14, var15);
+ if (stack != null)
+ {
+ return customBucket;
+ return stack;
+ }
if (!entityplayer.canPlayerEdit(i, j, k))
if (par2World.getBlockMaterial(var13, var14, var15) == Material.water && par2World.getBlockMetadata(var13, var14, var15) == 0)
{
return itemstack;

View File

@ -1,51 +1,50 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.Random;
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemDye extends Item
{
public static final String dyeColorNames[] =
@@ -30,13 +32,21 @@
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int i, int j, int k, int l)
/** List of dye color names */
@@ -25,7 +27,7 @@
*/
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7)
{
- if (!entityplayer.canPlayerEdit(i, j, k))
+ if (entityplayer != null && !entityplayer.canPlayerEdit(i, j, k))
- if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6))
+ if (par2EntityPlayer != null && !par2EntityPlayer.canPlayerEdit(par4, par5, par6))
{
return false;
}
if (itemstack.getItemDamage() == 15)
- {
@@ -34,7 +36,14 @@
if (par1ItemStack.getItemDamage() == 15)
{
int var8 = par3World.getBlockId(par4, par5, par6);
-
+ if (ForgeHooks.onUseBonemeal(par3World, var8, par4, par5, par6))
+ {
int i1 = world.getBlockId(i, j, k);
+ if (ForgeHooks.onUseBonemeal(world, i1, i, j, k))
+ if (!par3World.isRemote)
+ {
+ if (!world.isRemote)
+ {
+ itemstack.stackSize--;
+ par1ItemStack.stackSize--;
+ }
+ return true;
+ }
if (i1 == Block.sapling.blockID)
if (var8 == Block.sapling.blockID)
{
if (!world.isRemote)
@@ -103,14 +113,7 @@
world.setBlockAndMetadataWithNotify(k1, l1, i2, Block.tallGrass.blockID, 1);
continue;
if (!par3World.isRemote)
@@ -109,13 +118,9 @@
{
par3World.setBlockAndMetadataWithNotify(var10, var11, var12, Block.tallGrass.blockID, 1);
}
- if (itemRand.nextInt(3) != 0)
- else if (itemRand.nextInt(3) != 0)
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantYellow.blockID);
- par3World.setBlockWithNotify(var10, var11, var12, Block.plantYellow.blockID);
- }
- else
- {
- world.setBlockWithNotify(k1, l1, i2, Block.plantRed.blockID);
- }
+ ForgeHooks.plantGrassPlant(world, k1, l1, i2);
else
{
- par3World.setBlockWithNotify(var10, var11, var12, Block.plantRed.blockID);
+ ForgeHooks.plantGrassPlant(par3World, var10, var11, var12);
}
}
}
return true;

View File

@ -7,16 +7,16 @@
+
public class ItemHoe extends Item
{
public ItemHoe(int i, EnumToolMaterial enumtoolmaterial)
@@ -15,6 +17,11 @@
{
return false;
public ItemHoe(int par1, EnumToolMaterial par2EnumToolMaterial)
@@ -21,6 +23,11 @@
}
+ if(ForgeHooks.onUseHoe(itemstack, entityplayer, world, i, j, k))
else
{
+ if(ForgeHooks.onUseHoe(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6))
+ {
+ itemstack.damageItem(1, entityplayer);
+ par1ItemStack.damageItem(1, par2EntityPlayer);
+ return true;
+ }
int i1 = world.getBlockId(i, j, k);
int j1 = world.getBlockId(i, j + 1, k);
if (l != 0 && j1 == 0 && i1 == Block.grass.blockID || i1 == Block.dirt.blockID)
int var8 = par3World.getBlockId(par4, par5, par6);
int var9 = par3World.getBlockId(par4, par5 + 1, par6);

View File

@ -1,124 +1,114 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemInWorldManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,7 +1,10 @@
@@ -1,7 +1,11 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemInWorldManager
{
+ /** Forge reach distance hook */
+ private double blockReachDistance = 5.0d;
/** The world object that this object is connected to. */
public World thisWorld;
public EntityPlayer thisPlayer;
private int gameType;
@@ -71,7 +74,7 @@
if (j != 0)
@@ -81,7 +85,7 @@
if (var2 != 0)
{
Block block = Block.blocksList[j];
- float f = block.blockStrength(thisPlayer) * (float)(i + 1);
+ float f = block.blockStrength(thisWorld, thisPlayer, field_22049_l, field_22048_m, field_22047_n) * (float)(i + 1);
if (f >= 1.0F)
Block var3 = Block.blocksList[var2];
- float var4 = var3.blockStrength(this.thisPlayer) * (float)(var1 + 1);
+ float var4 = var3.blockStrength(thisWorld, this.thisPlayer, field_22049_l, field_22048_m, field_22047_n) * (float)(var1 + 1);
if (var4 >= 1.0F)
{
field_22050_k = false;
@@ -99,7 +102,7 @@
{
Block.blocksList[i1].onBlockClicked(thisWorld, i, j, k, thisPlayer);
@@ -116,7 +120,7 @@
Block.blocksList[var5].onBlockClicked(this.thisWorld, par1, par2, par3, this.thisPlayer);
}
- if (i1 > 0 && Block.blocksList[i1].blockStrength(thisPlayer) >= 1.0F)
+ if (i1 > 0 && Block.blocksList[i1].blockStrength(thisWorld, thisPlayer, i, j, k) >= 1.0F)
- if (var5 > 0 && Block.blocksList[var5].blockStrength(this.thisPlayer) >= 1.0F)
+ if (var5 > 0 && Block.blocksList[var5].blockStrength(thisWorld, this.thisPlayer, par1, par2, par3) >= 1.0F)
{
blockHarvessted(i, j, k);
this.blockHarvessted(par1, par2, par3);
}
@@ -120,7 +123,7 @@
if (i1 != 0)
@@ -139,7 +143,7 @@
if (var5 != 0)
{
Block block = Block.blocksList[i1];
- float f = block.blockStrength(thisPlayer) * (float)(l + 1);
+ float f = block.blockStrength(thisWorld, thisPlayer, i, j, k) * (float)(l + 1);
if (f >= 0.7F)
Block var6 = Block.blocksList[var5];
- float var7 = var6.blockStrength(this.thisPlayer) * (float)(var4 + 1);
+ float var7 = var6.blockStrength(thisWorld, this.thisPlayer, par1, par2, par3) * (float)(var4 + 1);
if (var7 >= 0.7F)
{
blockHarvessted(i, j, k);
@@ -142,8 +145,13 @@
@@ -166,7 +170,7 @@
{
Block block = Block.blocksList[thisWorld.getBlockId(i, j, k)];
int l = thisWorld.getBlockMetadata(i, j, k);
- boolean flag = thisWorld.setBlockWithNotify(i, j, k, 0);
- if (block != null && flag)
Block var4 = Block.blocksList[this.thisWorld.getBlockId(par1, par2, par3)];
int var5 = this.thisWorld.getBlockMetadata(par1, par2, par3);
- boolean var6 = this.thisWorld.setBlockWithNotify(par1, par2, par3, 0);
+ boolean var6 = (var4 != null && var4.removeBlockByPlayer(thisWorld, thisPlayer, par1, par2, par3));
if (var4 != null && var6)
{
@@ -178,6 +182,11 @@
public boolean blockHarvessted(int par1, int par2, int par3)
{
+ ItemStack stack = thisPlayer.getCurrentEquippedItem();
+ if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, thisPlayer))
+ {
+ return false;
+ }
int var4 = this.thisWorld.getBlockId(par1, par2, par3);
int var5 = this.thisWorld.getBlockMetadata(par1, par2, par3);
this.thisWorld.playAuxSFXAtEntity(this.thisPlayer, 2001, par1, par2, par3, var4 + (this.thisWorld.getBlockMetadata(par1, par2, par3) << 12));
@@ -190,7 +199,7 @@
else
{
ItemStack var7 = this.thisPlayer.getCurrentEquippedItem();
- boolean var8 = this.thisPlayer.canHarvestBlock(Block.blocksList[var4]);
+ boolean var8 = Block.blocksList[var4].canHarvestBlock(thisPlayer, var5);
if (var7 != null)
{
@@ -200,6 +209,7 @@
{
var7.onItemDestroyedByUse(this.thisPlayer);
this.thisPlayer.destroyCurrentEquippedItem();
+ ForgeHooks.onDestroyCurrentItem(thisPlayer, var7);
}
}
@@ -246,6 +256,11 @@
*/
public boolean activeBlockOrUseItem(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7)
{
+ if (par3ItemStack != null && par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return true;
+ }
+
+ if (block == null)
+ {
+ return false;
+ }
+ boolean flag = block.removeBlockByPlayer(thisWorld, thisPlayer, i, j, k);
+ if (flag)
{
block.onBlockDestroyedByPlayer(thisWorld, i, j, k, l);
}
@@ -152,6 +160,11 @@
int var8 = par2World.getBlockId(par4, par5, par6);
public boolean blockHarvessted(int i, int j, int k)
{
+ ItemStack itemstack = thisPlayer.getCurrentEquippedItem();
+ if (itemstack != null && itemstack.getItem().onBlockStartBreak(itemstack, i, j, k, thisPlayer))
+ {
+ return false;
+ }
int l = thisWorld.getBlockId(i, j, k);
int i1 = thisWorld.getBlockMetadata(i, j, k);
thisWorld.playAuxSFXAtEntity(thisPlayer, 2001, i, j, k, l + thisWorld.getBlockMetadata(i, j, k) * 256);
@@ -162,8 +175,7 @@
if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer))
@@ -267,7 +282,15 @@
}
else
{
- ItemStack itemstack = thisPlayer.getCurrentEquippedItem();
- boolean flag1 = thisPlayer.canHarvestBlock(Block.blocksList[l]);
+ boolean flag1 = Block.blocksList[l].canHarvestBlock(thisPlayer, i1);
if (itemstack != null)
{
itemstack.onDestroyBlock(l, i, j, k, thisPlayer);
@@ -197,6 +209,7 @@
if (itemstack1.stackSize == 0)
{
entityplayer.inventory.mainInventory[entityplayer.inventory.currentItem] = null;
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack1);
}
return true;
}
@@ -208,6 +221,14 @@
public boolean activeBlockOrUseItem(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
{
+ if (itemstack != null)
+ {
+ Item item = itemstack.getItem();
+ if (item.onItemUseFirst(itemstack, entityplayer, world, i, j, k, l))
+ {
+ return true;
+ }
+ }
int i1 = world.getBlockId(i, j, k);
if (i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
{
@@ -228,7 +249,15 @@
}
else
{
- return itemstack.useItem(entityplayer, world, i, j, k, l);
+ if (!itemstack.useItem(entityplayer, world, i, j, k, l))
- return par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7);
+ if (!par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return false;
+ }
+ if (itemstack.stackSize == 0)
+ if (par3ItemStack.stackSize == 0)
+ {
+ ForgeHooks.onDestroyCurrentItem(entityplayer,itemstack);
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack);
+ }
+ return true;
}
}
@@ -236,4 +265,13 @@
@@ -278,4 +301,13 @@
{
thisWorld = worldserver;
this.thisWorld = par1WorldServer;
}
+
+ public double getBlockReachDistance()

View File

@ -9,22 +9,26 @@
+
public class ItemShears extends Item
{
public ItemShears(int i)
@@ -11,9 +15,8 @@
public ItemShears(int par1)
@@ -11,13 +15,12 @@
public boolean onBlockDestroyed(ItemStack itemstack, int i, int j, int k, int l, EntityLiving entityliving)
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
- if (i == Block.leaves.blockID || i == Block.web.blockID || i == Block.tallGrass.blockID || i == Block.vine.blockID)
+ if (i == Block.leaves.blockID || i == Block.web.blockID || i == Block.tallGrass.blockID || i == Block.vine.blockID || Block.blocksList[i] instanceof IShearable)
- if (par2 != Block.leaves.blockID && par2 != Block.web.blockID && par2 != Block.tallGrass.blockID && par2 != Block.vine.blockID)
+ if (par2 != Block.leaves.blockID && par2 != Block.web.blockID && par2 != Block.tallGrass.blockID && par2 != Block.vine.blockID && !(Block.blocksList[par2] instanceof IShearable))
{
- itemstack.damageItem(1, entityliving);
return true;
return super.onBlockDestroyed(par1ItemStack, par2, par3, par4, par5, par6EntityLiving);
}
else
@@ -42,4 +45,62 @@
return super.getStrVsBlock(itemstack, block);
{
- par1ItemStack.damageItem(1, par6EntityLiving);
return true;
}
}
@@ -38,4 +41,62 @@
{
return par2Block.blockID != Block.web.blockID && par2Block.blockID != Block.leaves.blockID ? (par2Block.blockID == Block.cloth.blockID ? 5.0F : super.getStrVsBlock(par1ItemStack, par2Block)) : 15.0F;
}
+
+ @Override
+ public void useItemOnEntity(ItemStack itemstack, EntityLiving entity)

View File

@ -1,34 +1,36 @@
--- ../src_base/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,10 +1,12 @@
@@ -1,13 +1,15 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemTool extends Item
{
private Block blocksEffectiveAgainst[];
- protected float efficiencyOnProperMaterial;
/** Array of blocks the tool has extra effect against. */
private Block[] blocksEffectiveAgainst;
- protected float efficiencyOnProperMaterial = 4.0F;
+ public float efficiencyOnProperMaterial = 4.0F;
/** Damage versus entities. */
- private int damageVsEntity;
+ public float efficiencyOnProperMaterial;
+ public int damageVsEntity;
/** The material this tool is made from. */
protected EnumToolMaterial toolMaterial;
protected ItemTool(int i, int j, EnumToolMaterial enumtoolmaterial, Block ablock[])
@@ -32,6 +34,16 @@
return 1.0F;
@@ -61,4 +63,15 @@
{
return this.toolMaterial.getEnchantability();
}
+ /* FORGE: Overridden to allow custom tool effectiveness */
+
+ /** FORGE: Overridden to allow custom tool effectiveness */
+ @Override
+ public float getStrVsBlock(ItemStack itemstack, Block block, int md)
+ public float getStrVsBlock(ItemStack stack, Block block, int meta)
+ {
+ if (ForgeHooks.isToolEffective(itemstack, block, md))
+ if (ForgeHooks.isToolEffective(stack, block, meta))
+ {
+ return efficiencyOnProperMaterial;
+ }
+ return getStrVsBlock(itemstack,block);
+ return getStrVsBlock(stack, block);
+ }
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
{
itemstack.damageItem(2, entityliving1);
}

View File

@ -1,12 +1,12 @@
--- ../src_base/minecraft_server/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
@@ -9,6 +9,9 @@
public int sideHit;
public Vec3D hitVec;
@@ -25,6 +25,9 @@
/** The hit entity */
public Entity entityHit;
+
+ //Added for RedPower SubBlocks.
+ public int subHit = -1;
public MovingObjectPosition(int i, int j, int k, int l, Vec3D vec3d)
+ /** Used to determine what sub-segment is hit */
+ public int subHit = -1;
+
public MovingObjectPosition(int par1, int par2, int par3, int par4, Vec3D par5Vec3D)
{
this.typeOfHit = EnumMovingObjectType.TILE;

View File

@ -1,34 +1,27 @@
--- ../src_base/minecraft_server/net/minecraft/src/NetLoginHandler.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/NetLoginHandler.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,10 +1,15 @@
package net.minecraft.src;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.net.Socket;
import java.util.*;
@@ -6,6 +6,9 @@
import java.util.Random;
import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.ForgeHooksServer;
+import net.minecraft.src.forge.MessageManager;
+import net.minecraft.src.forge.packets.ForgePacket;
+import net.minecraft.src.forge.*;
+import net.minecraft.src.forge.packets.*;
+import java.io.UnsupportedEncodingException;
public class NetLoginHandler extends NetHandler
{
@@ -29,6 +34,7 @@
mcServer = minecraftserver;
netManager = new NetworkManager(socket, s, this);
netManager.chunkDataSendCounter = 0;
@@ -46,6 +49,7 @@
this.mcServer = par1MinecraftServer;
this.netManager = new NetworkManager(par2Socket, par3Str, this);
this.netManager.chunkDataSendCounter = 0;
+ ForgeHooks.onConnect(netManager);
}
public void tryLogin()
@@ -129,7 +135,39 @@
/**
@@ -163,6 +167,38 @@
}
entityplayermp.func_20057_k();
- ModLoaderMp.HandleAllLogins(entityplayermp);
var2.func_20057_k();
+
+ if (packet1login.serverMode == ForgePacket.FORGE_ID)
+ {
@ -53,15 +46,14 @@
+ e.printStackTrace();
+ }
+ pkt.length = pkt.data.length;
+ netserverhandler.sendPacket(pkt);
+ var5.sendPacket(pkt);
+ ForgeHooksServer.sendModListRequest(netManager);
+ ModLoaderMp.HandleAllLogins(entityplayermp);
+ ModLoaderMp.HandleAllLogins(var2);
+ }
+ else
+ {
+ netserverhandler.kickPlayer("This server requires you to have Minecraft Forge installed.");
+ var5.kickPlayer("This server requires you to have Minecraft Forge installed.");
+ }
+
}
finishedProcessing = true;
}
this.finishedProcessing = true;

View File

@ -1,40 +1,40 @@
--- ../src_base/minecraft_server/net/minecraft/src/NetServerHandler.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/NetServerHandler.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,9 +1,11 @@
package net.minecraft.src;
import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
import java.util.*;
@@ -4,6 +4,8 @@
import java.util.Random;
import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.src.forge.MessageManager;
+import java.io.UnsupportedEncodingException;
public class NetServerHandler extends NetHandler
implements ICommandListener
@@ -295,7 +297,9 @@
double d1 = (playerEntity.posY - ((double)j + 0.5D)) + 1.5D;
double d3 = playerEntity.posZ - ((double)k + 0.5D);
double d5 = d * d + d1 * d1 + d3 * d3;
- if (d5 > 36D)
public class NetServerHandler extends NetHandler implements ICommandListener
{
@@ -372,8 +374,11 @@
double var10 = this.playerEntity.posY - ((double)var6 + 0.5D) + 1.5D;
double var12 = this.playerEntity.posZ - ((double)var7 + 0.5D);
double var14 = var8 * var8 + var10 * var10 + var12 * var12;
+
+ double dist = playerEntity.itemInWorldManager.getBlockReachDistance() + 1;
+ dist *= dist;
+ if (d5 > dist)
- if (var14 > 36.0D)
+ if (var14 > dist)
{
return;
}
@@ -366,7 +370,9 @@
@@ -465,8 +470,9 @@
{
j1 = i1;
var12 = var11;
}
- if (hasMoved && playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < 64D && (j1 > 16 || flag))
+ double dist = playerEntity.itemInWorldManager.getBlockReachDistance() + 3;
-
- if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < 64.0D && (var12 > 16 || var9))
+ double dist = playerEntity.itemInWorldManager.getBlockReachDistance() + 1;
+ dist *= dist;
+ if (hasMoved && playerEntity.getDistanceSq((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D) < dist && (j1 > 16 || flag))
+ if (this.hasMoved && this.playerEntity.getDistanceSq((double)var5 + 0.5D, (double)var6 + 0.5D, (double)var7 + 0.5D) < dist && (var12 > 16 || var9))
{
playerEntity.itemInWorldManager.activeBlockOrUseItem(playerEntity, worldserver, itemstack, i, j, k, l);
this.playerEntity.itemInWorldManager.activeBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8);
}
@@ -764,4 +770,49 @@
@@ -950,4 +956,49 @@
{
return true;
}

View File

@ -1,27 +1,27 @@
--- ../src_base/minecraft_server/net/minecraft/src/NetworkManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/NetworkManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,9 @@
import java.net.*;
import java.util.*;
@@ -11,6 +11,9 @@
import java.util.Collections;
import java.util.List;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.MessageManager;
+
public class NetworkManager
{
public static final Object threadSyncObject = new Object();
@@ -206,6 +209,8 @@
networkSocket = null;
/** Synchronization object used for read and write threads. */
@@ -312,6 +315,8 @@
{
;
}
catch (Throwable throwable2) { }
+ ForgeHooks.onDisconnect(this, s, aobj);
+ ForgeHooks.onDisconnect(this, par1Str, par2ArrayOfObj);
+ MessageManager.getInstance().removeConnection(this);
}
}
public void processReadPackets()
@@ -313,4 +318,14 @@
@@ -456,4 +461,14 @@
{
return networkmanager.writeThread;
return par0NetworkManager.writeThread;
}
+
+ /**

View File

@ -7,81 +7,80 @@
-class RailLogic
+public class RailLogic
{
/** Reference to the World object. */
private World worldObj;
private int trackX;
@@ -12,6 +12,7 @@
private final boolean isPoweredRail;
@@ -14,6 +14,7 @@
private List connectedTracks;
final BlockRail rail;
+ private final boolean canMakeSlopes;
public RailLogic(BlockRail blockrail, World world, int i, int j, int k)
public RailLogic(BlockRail par1BlockRail, World par2World, int par3, int par4, int par5)
{
@@ -23,16 +24,12 @@
trackY = j;
trackZ = k;
int l = world.getBlockId(i, j, k);
- int i1 = world.getBlockMetadata(i, j, k);
- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[l]))
@@ -24,17 +25,11 @@
this.trackY = par4;
this.trackZ = par5;
int var6 = par2World.getBlockId(par3, par4, par5);
- int var7 = par2World.getBlockMetadata(par3, par4, par5);
- if (BlockRail.isPoweredBlockRail((BlockRail)Block.blocksList[var6]))
- {
- isPoweredRail = true;
- i1 &= -9;
- this.isPoweredRail = true;
- var7 &= -9;
- }
- else
- {
- isPoweredRail = false;
- this.isPoweredRail = false;
- }
+
+ BlockRail target = (BlockRail)Block.blocksList[l];
+ int i1 = target.getBasicRailMetadata(world, null, i, j, k);
+ isPoweredRail = !target.isFlexibleRail(world, i, j, k);
+ canMakeSlopes = target.canMakeSlopes(world, i, j, k);
+
setConnections(i1);
}
+ BlockRail target = (BlockRail)Block.blocksList[var6];
+ int var7 = target.getBasicRailMetadata(par2World, null, par3, par4, par5);
+ isPoweredRail = !target.isFlexibleRail(par2World, par3, par4, par5);
+ canMakeSlopes = target.canMakeSlopes(par2World, par3, par4, par5);
@@ -243,7 +240,7 @@
byte0 = 9;
this.setConnections(var7);
}
}
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -254,7 +251,7 @@
byte0 = 5;
}
}
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -377,7 +374,7 @@
}
}
}
- if (byte0 == 0)
+ if (byte0 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX, trackY + 1, trackZ - 1))
{
@@ -388,7 +385,7 @@
byte0 = 5;
}
}
- if (byte0 == 1)
+ if (byte0 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(worldObj, trackX + 1, trackY + 1, trackZ))
{
@@ -428,7 +425,7 @@
@@ -251,7 +246,7 @@
}
}
- static int getNAdjacentTracks(RailLogic raillogic)
+ public static int getNAdjacentTracks(RailLogic raillogic)
- if (var6 == 0)
+ if (var6 == 0 && canMakeSlopes)
{
return raillogic.getAdjacentTracks();
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -264,7 +259,7 @@
}
}
- if (var6 == 1)
+ if (var6 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{
@@ -415,7 +410,7 @@
}
}
- if (var7 == 0)
+ if (var7 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -428,7 +423,7 @@
}
}
- if (var7 == 1)
+ if (var7 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{
@@ -478,7 +473,7 @@
/**
* get number of adjacent tracks
*/
- static int getNAdjacentTracks(RailLogic par0RailLogic)
+ public static int getNAdjacentTracks(RailLogic par0RailLogic)
{
return par0RailLogic.getAdjacentTracks();
}

View File

@ -1,146 +1,135 @@
--- ../src_base/minecraft_server/net/minecraft/src/ServerConfigurationManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/ServerConfigurationManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,13 +4,14 @@
import java.util.*;
@@ -12,6 +12,7 @@
import java.util.Set;
import java.util.logging.Logger;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.src.forge.DimensionManager;
public class ServerConfigurationManager
{
public static Logger logger = Logger.getLogger("Minecraft");
public List playerEntities;
@@ -25,7 +26,7 @@
private MinecraftServer mcServer;
- private PlayerManager playerManagerObj[];
+ //private PlayerManager playerManagerObj[];
private int maxPlayers;
private Set bannedPlayers;
private Set bannedIPs;
@@ -32,16 +33,18 @@
ops = new HashSet();
whiteListedIPs = new HashSet();
field_35482_p = 0;
- playerManagerObj = new PlayerManager[3];
+ //playerManagerObj = new PlayerManager[3];
mcServer = minecraftserver;
bannedPlayersFile = minecraftserver.getFile("banned-players.txt");
ipBanFile = minecraftserver.getFile("banned-ips.txt");
opFile = minecraftserver.getFile("ops.txt");
whitelistPlayersFile = minecraftserver.getFile("white-list.txt");
int i = minecraftserver.propertyManagerObj.getIntProperty("view-distance", 10);
+ /*
playerManagerObj[0] = new PlayerManager(minecraftserver, 0, i);
playerManagerObj[1] = new PlayerManager(minecraftserver, -1, i);
playerManagerObj[2] = new PlayerManager(minecraftserver, 1, i);
+ */
maxPlayers = minecraftserver.propertyManagerObj.getIntProperty("max-players", 20);
whiteListEnforced = minecraftserver.propertyManagerObj.getBooleanProperty("white-list", false);
readBannedPlayers();
@@ -61,9 +64,10 @@
public void joinNewPlayerManager(EntityPlayerMP entityplayermp)
/** Reference to the PlayerManager object. */
- private PlayerManager[] playerManagerObj = new PlayerManager[3];
+ //private PlayerManager[] playerManagerObj = new PlayerManager[3];
/** the maximum amount of players that can be connected */
private int maxPlayers;
@@ -71,9 +72,11 @@
this.opFile = par1MinecraftServer.getFile("ops.txt");
this.whitelistPlayersFile = par1MinecraftServer.getFile("white-list.txt");
int var2 = par1MinecraftServer.propertyManagerObj.getIntProperty("view-distance", 10);
+ /*
this.playerManagerObj[0] = new PlayerManager(par1MinecraftServer, 0, var2);
this.playerManagerObj[1] = new PlayerManager(par1MinecraftServer, -1, var2);
this.playerManagerObj[2] = new PlayerManager(par1MinecraftServer, 1, var2);
+ */
this.maxPlayers = par1MinecraftServer.propertyManagerObj.getIntProperty("max-players", 20);
this.whiteListEnforced = par1MinecraftServer.propertyManagerObj.getBooleanProperty("white-list", false);
this.readBannedPlayers();
@@ -100,9 +103,10 @@
*/
public void joinNewPlayerManager(EntityPlayerMP par1EntityPlayerMP)
{
- playerManagerObj[0].removePlayer(entityplayermp);
- playerManagerObj[1].removePlayer(entityplayermp);
- playerManagerObj[2].removePlayer(entityplayermp);
- this.playerManagerObj[0].removePlayer(par1EntityPlayerMP);
- this.playerManagerObj[1].removePlayer(par1EntityPlayerMP);
- this.playerManagerObj[2].removePlayer(par1EntityPlayerMP);
+ for (World world : DimensionManager.getWorlds())
+ {
+ ((WorldServer)world).playerManager.removePlayer(entityplayermp);
+ ((WorldServer)world).playerManager.removePlayer(par1EntityPlayerMP);
+ }
getPlayerManager(entityplayermp.dimension).addPlayer(entityplayermp);
WorldServer worldserver = mcServer.getWorldManager(entityplayermp.dimension);
worldserver.chunkProviderServer.loadChunk((int)entityplayermp.posX >> 4, (int)entityplayermp.posZ >> 4);
@@ -71,27 +75,18 @@
this.getPlayerManager(par1EntityPlayerMP.dimension).addPlayer(par1EntityPlayerMP);
WorldServer var2 = this.mcServer.getWorldManager(par1EntityPlayerMP.dimension);
var2.chunkProviderServer.loadChunk((int)par1EntityPlayerMP.posX >> 4, (int)par1EntityPlayerMP.posZ >> 4);
@@ -110,7 +114,7 @@
public int getMaxTrackingDistance()
{
- return playerManagerObj[0].getMaxTrackingDistance();
+ WorldServer world = (WorldServer)DimensionManager.getWorld(0);
+ return world.playerManager.getMaxTrackingDistance();
- return this.playerManagerObj[0].getMaxTrackingDistance();
+ return getPlayerManager(0).getMaxTrackingDistance();
}
private PlayerManager getPlayerManager(int i)
/**
@@ -118,7 +122,8 @@
*/
private PlayerManager getPlayerManager(int par1)
{
- if (i == -1)
- {
- return playerManagerObj[1];
- }
- if (i == 0)
- {
- return playerManagerObj[0];
- }
- if (i == 1)
- {
- return playerManagerObj[2];
- }
- else
+ WorldServer world = (WorldServer)DimensionManager.getWorld(i);
+ if (world == null)
{
return null;
}
+ return world.playerManager;
- return par1 == -1 ? this.playerManagerObj[1] : (par1 == 0 ? this.playerManagerObj[0] : (par1 == 1 ? this.playerManagerObj[2] : null));
+ WorldServer world = (WorldServer)DimensionManager.getWorld(par1);
+ return (world == null ? null : world.playerManager);
}
public void readPlayerDataFromFile(EntityPlayerMP entityplayermp)
@@ -213,6 +208,10 @@
public void sendPlayerToOtherDimension(EntityPlayerMP entityplayermp, int i)
/**
@@ -285,6 +290,10 @@
*/
public void sendPlayerToOtherDimension(EntityPlayerMP par1EntityPlayerMP, int par2)
{
+ sendPlayerToOtherDimension(entityplayermp, i, new Teleporter());
+ sendPlayerToOtherDimension(par1EntityPlayerMP, par2, new Teleporter());
+ }
+ public void sendPlayerToOtherDimension(EntityPlayerMP entityplayermp, int i, Teleporter teleporter)
+ public void sendPlayerToOtherDimension(EntityPlayerMP par1EntityPlayerMP, int par2, Teleporter teleporter)
+ {
int j = entityplayermp.dimension;
WorldServer worldserver = mcServer.getWorldManager(entityplayermp.dimension);
entityplayermp.dimension = i;
@@ -220,30 +219,14 @@
entityplayermp.playerNetServerHandler.sendPacket(new Packet9Respawn((byte)entityplayermp.dimension, (byte)entityplayermp.worldObj.difficultySetting, worldserver1.getSeed(), worldserver1.getWorldInfo().getTerrainType(), worldserver1.worldHeight, entityplayermp.itemInWorldManager.getGameType()));
worldserver.removePlayer(entityplayermp);
entityplayermp.isDead = false;
- double d = entityplayermp.posX;
- double d1 = entityplayermp.posZ;
- double d2 = 8D;
- if (entityplayermp.dimension == -1)
int var3 = par1EntityPlayerMP.dimension;
WorldServer var4 = this.mcServer.getWorldManager(par1EntityPlayerMP.dimension);
par1EntityPlayerMP.dimension = par2;
@@ -292,33 +301,14 @@
par1EntityPlayerMP.playerNetServerHandler.sendPacket(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, var5.getWorldInfo().getTerrainType(), var5.func_48095_y(), par1EntityPlayerMP.itemInWorldManager.getGameType()));
var4.removePlayer(par1EntityPlayerMP);
par1EntityPlayerMP.isDead = false;
- double var6 = par1EntityPlayerMP.posX;
- double var8 = par1EntityPlayerMP.posZ;
- double var10 = 8.0D;
-
- if (par1EntityPlayerMP.dimension == -1)
- {
- d /= d2;
- d1 /= d2;
- entityplayermp.setLocationAndAngles(d, entityplayermp.posY, d1, entityplayermp.rotationYaw, entityplayermp.rotationPitch);
- if (entityplayermp.isEntityAlive())
- var6 /= var10;
- var8 /= var10;
- par1EntityPlayerMP.setLocationAndAngles(var6, par1EntityPlayerMP.posY, var8, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
- if (par1EntityPlayerMP.isEntityAlive())
- {
- worldserver.updateEntityWithOptionalForce(entityplayermp, false);
- var4.updateEntityWithOptionalForce(par1EntityPlayerMP, false);
- }
- }
- else if (entityplayermp.dimension == 0)
- else if (par1EntityPlayerMP.dimension == 0)
- {
- d *= d2;
- d1 *= d2;
- entityplayermp.setLocationAndAngles(d, entityplayermp.posY, d1, entityplayermp.rotationYaw, entityplayermp.rotationPitch);
- if (entityplayermp.isEntityAlive())
- var6 *= var10;
- var8 *= var10;
- par1EntityPlayerMP.setLocationAndAngles(var6, par1EntityPlayerMP.posY, var8, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
+ WorldProvider pOld = DimensionManager.getProvider(var3);
+ WorldProvider pNew = DimensionManager.getProvider(par2);
+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor();
+ double var6 = par1EntityPlayerMP.posX * moveFactor;
+ double var8 = par1EntityPlayerMP.posZ * moveFactor;
- if (par1EntityPlayerMP.isEntityAlive())
- {
- worldserver.updateEntityWithOptionalForce(entityplayermp, false);
- var4.updateEntityWithOptionalForce(par1EntityPlayerMP, false);
- }
- }
- else
+
+ WorldProvider pOld = DimensionManager.getProvider(j);
+ WorldProvider pNew = DimensionManager.getProvider(i);
+ double moveFactor = pOld.getMovementFactor() / pNew.getMovementFactor();
+ double d = entityplayermp.posX * moveFactor;
+ double d1 = entityplayermp.posZ * moveFactor;
+
+ if (entityplayermp.dimension == 1)
+ if (par1EntityPlayerMP.dimension == 1)
{
ChunkCoordinates chunkcoordinates = worldserver1.getEntrancePortalLocation();
d = chunkcoordinates.posX;
@@ -283,9 +266,9 @@
EntityPlayerMP entityplayermp = (EntityPlayerMP)playerEntities.get(field_35482_p);
sendPacketToAllPlayers(new Packet201PlayerInfo(entityplayermp.username, true, entityplayermp.ping));
ChunkCoordinates var12 = var5.getEntrancePortalLocation();
var6 = (double)var12.posX;
@@ -338,7 +328,7 @@
par1EntityPlayerMP.setLocationAndAngles(var6, par1EntityPlayerMP.posY, var8, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
var5.updateEntityWithOptionalForce(par1EntityPlayerMP, false);
var5.chunkProviderServer.chunkLoadOverride = true;
- (new Teleporter()).placeInPortal(var5, par1EntityPlayerMP);
+ teleporter.placeInPortal(var5, par1EntityPlayerMP);
var5.chunkProviderServer.chunkLoadOverride = false;
}
- for (int i = 0; i < playerManagerObj.length; i++)
@@ -366,9 +356,9 @@
this.sendPacketToAllPlayers(new Packet201PlayerInfo(var1.username, true, var1.ping));
}
- for (int var2 = 0; var2 < this.playerManagerObj.length; ++var2)
+ for (World world : DimensionManager.getWorlds())
{
- playerManagerObj[i].updatePlayerInstances();
- this.playerManagerObj[var2].updatePlayerInstances();
+ ((WorldServer)world).playerManager.updatePlayerInstances();
}
}

View File

@ -7,12 +7,12 @@
+
public class SlotCrafting extends Slot
{
private final IInventory craftMatrix;
@@ -61,6 +63,7 @@
thePlayer.addStat(AchievementList.bookcase, 1);
}
ModLoader.TakenFromCrafting(thePlayer, itemstack);
+ ForgeHooks.onTakenFromCrafting(thePlayer, itemstack, craftMatrix);
for (int i = 0; i < craftMatrix.getSizeInventory(); i++)
/** The craft matrix inventory linked to this result slot. */
@@ -87,6 +89,7 @@
{
ItemStack itemstack1 = craftMatrix.getStackInSlot(i);
this.thePlayer.addStat(AchievementList.bookcase, 1);
}
+ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix);
}
/**

View File

@ -0,0 +1,12 @@
--- ../src_base/minecraft_server/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
@@ -190,7 +190,8 @@
else
{
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
- return Block.func_48126_g(var5) && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4);
+ //Fix for 1.2.3 change.. Why guys.. why?
+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4);
}
}

View File

@ -1,9 +1,10 @@
--- ../src_base/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
@@ -63,6 +63,15 @@
{
@@ -197,4 +197,13 @@
addMapping(TileEntityEnchantmentTable.class, "EnchantTable");
addMapping(TileEntityEndPortal.class, "Airportal");
}
+
+ /**
+ * Determines if this TileEntity requires update calls.
+ * @return True if you want updateEntity() to be called, false if not
@ -12,7 +13,4 @@
+ {
+ return true;
+ }
+
public static TileEntity createAndLoadEntity(NBTTagCompound nbttagcompound)
{
TileEntity tileentity = null;
}

View File

@ -1,22 +1,20 @@
--- ../src_base/minecraft_server/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,7 +1,9 @@
package net.minecraft.src;
@@ -2,7 +2,9 @@
import java.util.List;
-public class TileEntityBrewingStand extends TileEntity implements IInventory
+import net.minecraft.src.forge.ISidedInventory;
+
public class TileEntityBrewingStand extends TileEntity
- implements IInventory
+ implements IInventory, ISidedInventory
+public class TileEntityBrewingStand extends TileEntity implements IInventory, ISidedInventory
{
private ItemStack brewingItemStacks[];
private int brewTime;
@@ -267,5 +269,17 @@
}
/** The itemstacks currently placed in the slots of the brewing stand */
private ItemStack[] brewingItemStacks = new ItemStack[4];
@@ -310,4 +312,16 @@
return i;
- }
+ }
return var1;
}
+
+ @Override
+ public int getStartInventorySide(int side)

View File

@ -1,20 +1,61 @@
--- ../src_base/minecraft_server/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,7 +1,9 @@
@@ -1,6 +1,8 @@
package net.minecraft.src;
-public class TileEntityFurnace extends TileEntity implements IInventory
+import net.minecraft.src.forge.ISidedInventory;
+
public class TileEntityFurnace extends TileEntity
- implements IInventory
+ implements IInventory, ISidedInventory
+public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory
{
private ItemStack furnaceItemStacks[];
public int furnaceBurnTime;
@@ -21,6 +23,18 @@
return furnaceItemStacks.length;
/**
* The ItemStacks that hold the items currently being used in the furnace
@@ -242,8 +244,12 @@
}
else
{
- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex);
- return var1 == null ? false : (this.furnaceItemStacks[2] == null ? true : (!this.furnaceItemStacks[2].isItemEqual(var1) ? false : (this.furnaceItemStacks[2].stackSize < this.getInventoryStackLimit() && this.furnaceItemStacks[2].stackSize < this.furnaceItemStacks[2].getMaxStackSize() ? true : this.furnaceItemStacks[2].stackSize < var1.getMaxStackSize())));
+ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
+ if (var1 == null) return false;
+ if (this.furnaceItemStacks[2] == null) return true;
+ if (!this.furnaceItemStacks[2].isItemEqual(var1)) return false;
+ int result = furnaceItemStacks[2].stackSize + var1.stackSize;
+ return (result < this.getInventoryStackLimit() && result < this.furnaceItemStacks[2].getMaxStackSize());
}
}
@@ -254,13 +260,13 @@
{
if (this.canSmelt())
{
- ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack var1 = FurnaceRecipes.smelting().getSmeltingResult(this.furnaceItemStacks[0]);
if (this.furnaceItemStacks[2] == null)
{
this.furnaceItemStacks[2] = var1.copy();
}
- else if (this.furnaceItemStacks[2].itemID == var1.itemID)
+ else if (this.furnaceItemStacks[2].isItemEqual(var1))
{
++this.furnaceItemStacks[2].stackSize;
}
@@ -278,7 +284,7 @@
* Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't
* fuel
*/
- private int getItemBurnTime(ItemStack par1ItemStack)
+ public int getItemBurnTime(ItemStack par1ItemStack)
{
if (par1ItemStack == null)
{
@@ -302,4 +308,18 @@
public void openChest() {}
public void closeChest() {}
+
+ @Override
+ public int getStartInventorySide(int side)
+ {
+ if (side == 0) return 1;
@ -22,73 +63,9 @@
+ return 2;
+ }
+
+ @Override
+ public int getSizeInventorySide(int side)
+ {
+ return 1;
+ }
+
public ItemStack getStackInSlot(int i)
{
return furnaceItemStacks[i];
@@ -171,7 +185,7 @@
{
return false;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if (itemstack == null)
{
return false;
@@ -184,14 +198,8 @@
{
return false;
}
- if (furnaceItemStacks[2].stackSize < getInventoryStackLimit() && furnaceItemStacks[2].stackSize < furnaceItemStacks[2].getMaxStackSize())
- {
- return true;
- }
- else
- {
- return furnaceItemStacks[2].stackSize < itemstack.getMaxStackSize();
- }
+ int result = furnaceItemStacks[2].stackSize + itemstack.stackSize;
+ return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize());
}
public void smeltItem()
@@ -200,23 +208,30 @@
{
return;
}
- ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0].getItem().shiftedIndex);
+ ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnaceItemStacks[0]);
if (furnaceItemStacks[2] == null)
{
furnaceItemStacks[2] = itemstack.copy();
}
- else if (furnaceItemStacks[2].itemID == itemstack.itemID)
+ else if (furnaceItemStacks[2].isItemEqual(itemstack))
+ {
+ furnaceItemStacks[2].stackSize += itemstack.stackSize;
+ }
+ if (furnaceItemStacks[0].getItem().hasContainerItem())
+ {
+ furnaceItemStacks[0] = new ItemStack(furnaceItemStacks[0].getItem().getContainerItem());
+ }
+ else
{
- furnaceItemStacks[2].stackSize++;
+ furnaceItemStacks[0].stackSize--;
}
- furnaceItemStacks[0].stackSize--;
if (furnaceItemStacks[0].stackSize <= 0)
{
furnaceItemStacks[0] = null;
}
}
- private int getItemBurnTime(ItemStack itemstack)
+ public static int getItemBurnTime(ItemStack itemstack)
{
if (itemstack == null)
{

View File

@ -1,68 +1,65 @@
--- ../src_base/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
@@ -33,7 +33,7 @@
public int lightningFlash;
public boolean editingBlocks;
private long lockTimestamp;
- protected int autosavePeriod;
+ public int autosavePeriod;
@@ -66,7 +66,7 @@
* Contains a timestamp from when the World object was created. Is used in the session.lock file
*/
private long lockTimestamp = System.currentTimeMillis();
- protected int autosavePeriod = 40;
+ public int autosavePeriod = 40;
/** Whether monsters are enabled or not. (1 = on, 0 = off) */
public int difficultySetting;
public Random rand;
public boolean isNewWorld;
@@ -236,7 +236,13 @@
public boolean isAirBlock(int i, int j, int k)
@@ -324,7 +324,8 @@
*/
public boolean isAirBlock(int par1, int par2, int par3)
{
- return getBlockId(i, j, k) == 0;
+ int iBlockID = getBlockId(i, j, k);
+
+ if (iBlockID == 0)
+ {
+ return true;
+ }
+ return Block.blocksList[iBlockID].isAirBlock(this, i, j, k);
- return this.getBlockId(par1, par2, par3) == 0;
+ int id = getBlockId(par1, par2, par3);
+ return (id == 0 || Block.blocksList[id] == null || Block.blocksList[id].isAirBlock(this, par1, par2, par3));
}
public boolean blockExists(int i, int j, int k)
@@ -1205,7 +1211,7 @@
Chunk chunk = getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4);
if (chunk != null)
public boolean func_48084_h(int par1, int par2, int par3)
@@ -1549,7 +1550,7 @@
if (var7 != null)
{
- chunk.removeChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
+ chunk.cleanChunkBlockTileEntity(tileentity.xCoord & 0xf, tileentity.yCoord, tileentity.zCoord & 0xf);
- var7.removeChunkBlockTileEntity(var5.xCoord & 15, var5.yCoord, var5.zCoord & 15);
+ var7.cleanChunkBlockTileEntity(var5.xCoord & 15, var5.yCoord, var5.zCoord & 15);
}
}
}
@@ -1234,12 +1240,15 @@
@@ -1579,14 +1580,16 @@
{
loadedTileEntityList.add(tileentity1);
this.loadedTileEntityList.add(var8);
}
-
+ }
+ else
+ {
if (chunkExists(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4))
if (this.chunkExists(var8.xCoord >> 4, var8.zCoord >> 4))
{
Chunk chunk1 = getChunkFromChunkCoords(tileentity1.xCoord >> 4, tileentity1.zCoord >> 4);
if (chunk1 != null)
{
- chunk1.setChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf, tileentity1);
+ chunk1.cleanChunkBlockTileEntity(tileentity1.xCoord & 0xf, tileentity1.yCoord, tileentity1.zCoord & 0xf);
}
}
markBlockNeedsUpdate(tileentity1.xCoord, tileentity1.yCoord, tileentity1.zCoord);
@@ -1254,13 +1263,13 @@
Chunk var9 = this.getChunkFromChunkCoords(var8.xCoord >> 4, var8.zCoord >> 4);
public void addTileEntity(Collection collection)
if (var9 != null)
{
- if (scanningTileEntities)
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ for(Object entity : collection)
- var9.setChunkBlockTileEntity(var8.xCoord & 15, var8.yCoord, var8.zCoord & 15, var8);
+ var9.cleanChunkBlockTileEntity(var8.xCoord & 15, var8.yCoord, var8.zCoord & 15);
}
}
@@ -1603,13 +1606,13 @@
public void addTileEntity(Collection par1Collection)
{
- addedTileEntityList.addAll(collection);
- if (this.scanningTileEntities)
- {
- this.addedTileEntityList.addAll(par1Collection);
- }
- else
- {
- loadedTileEntityList.addAll(collection);
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ for(Object entity : par1Collection)
{
- this.loadedTileEntityList.addAll(par1Collection);
+ if(((TileEntity)entity).canUpdate())
+ {
+ dest.add(entity);
@ -70,115 +67,124 @@
}
}
@@ -1460,6 +1469,13 @@
if (j2 == Block.fire.blockID || j2 == Block.lavaMoving.blockID || j2 == Block.lavaStill.blockID)
@@ -1841,6 +1844,13 @@
if (var11 == Block.fire.blockID || var11 == Block.lavaMoving.blockID || var11 == Block.lavaStill.blockID)
{
return true;
+ }
+ else
+ {
+ if (j2 > 0 && Block.blocksList[j2].isBlockBurning(this, k1, l1, i2))
+ if (var11 > 0 && Block.blocksList[var11] != null && Block.blocksList[var11].isBlockBurning(this, var8, var9, var10))
+ {
+ return true;
+ }
}
}
}
@@ -1690,47 +1706,28 @@
public void setBlockTileEntity(int i, int j, int k, TileEntity tileentity)
@@ -2121,25 +2131,21 @@
*/
public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity)
{
- if (tileentity != null && !tileentity.isInvalid())
+ if (tileentity == null || tileentity.isInvalid())
- if (par4TileEntity != null && !par4TileEntity.isInvalid())
+ if (par4TileEntity == null || !par4TileEntity.isInvalid())
{
- if (scanningTileEntities)
- if (this.scanningTileEntities)
- {
- tileentity.xCoord = i;
- tileentity.yCoord = j;
- tileentity.zCoord = k;
- addedTileEntityList.add(tileentity);
- par4TileEntity.xCoord = par1;
- par4TileEntity.yCoord = par2;
- par4TileEntity.zCoord = par3;
- this.addedTileEntityList.add(par4TileEntity);
- }
- else
- {
- loadedTileEntityList.add(tileentity);
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if (chunk != null)
- {
- chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
- }
- }
- this.loadedTileEntityList.add(par4TileEntity);
- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
+ return;
+ }
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if (tileentity.canUpdate())
+ if (par4TileEntity.canUpdate())
+ {
+ dest.add(tileentity);
+ dest.add(par4TileEntity);
+ }
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if (chunk != null)
+
+ Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
- if (var5 != null)
- {
- var5.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity);
- }
- }
+ if (var5 != null)
+ {
+ chunk.setChunkBlockTileEntity(i & 0xf, j, k & 0xf, tileentity);
+ var5.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity);
}
}
public void removeBlockTileEntity(int i, int j, int k)
@@ -2148,27 +2154,10 @@
*/
public void removeBlockTileEntity(int par1, int par2, int par3)
{
- TileEntity tileentity = getBlockTileEntity(i, j, k);
- if (tileentity != null && scanningTileEntities)
+ Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
+ if (chunk != null)
- TileEntity var4 = this.getBlockTileEntity(par1, par2, par3);
-
- if (var4 != null && this.scanningTileEntities)
+ Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
+ if (var5 != null)
{
- tileentity.invalidate();
- addedTileEntityList.remove(tileentity);
- var4.invalidate();
- this.addedTileEntityList.remove(var4);
- }
- else
- {
- if (tileentity != null)
- if (var4 != null)
- {
- addedTileEntityList.remove(tileentity);
- loadedTileEntityList.remove(tileentity);
- this.addedTileEntityList.remove(var4);
- this.loadedTileEntityList.remove(var4);
- }
- Chunk chunk = getChunkFromChunkCoords(i >> 4, k >> 4);
- if (chunk != null)
-
- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
-
- if (var5 != null)
- {
- chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
- var5.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
- }
+ chunk.removeChunkBlockTileEntity(i & 0xf, j, k & 0xf);
+ var5.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
}
}
@@ -1761,7 +1758,7 @@
}
else
@@ -2191,7 +2180,8 @@
*/
public boolean isBlockNormalCube(int par1, int par2, int par3)
{
- return block.blockMaterial.isOpaque() && block.renderAsNormalBlock();
+ return block.isBlockNormalCube(this, i, j, k);
}
- return Block.func_48126_g(this.getBlockId(par1, par2, par3));
+ Block block = Block.blocksList[getBlockId(par1, par2, par3)];
+ return block != null && block.isBlockNormalCube(this, par1, par2, par3);
}
@@ -2179,7 +2176,7 @@
/**
@@ -2785,7 +2775,7 @@
private int computeBlockLightValue(int i, int j, int k, int l, int i1, int j1)
private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6)
{
- int k1 = Block.lightValue[i1];
+ int k1 = (i1 == 0 || Block.blocksList[i1] == null ? 0 : Block.blocksList[i1].getLightValue(this, j, k, l));
int l1 = getSavedLightValue(EnumSkyBlock.Block, j - 1, k, l) - j1;
int i2 = getSavedLightValue(EnumSkyBlock.Block, j + 1, k, l) - j1;
int j2 = getSavedLightValue(EnumSkyBlock.Block, j, k - 1, l) - j1;
@@ -2557,6 +2554,10 @@
- int var7 = Block.lightValue[par5];
+ 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 var9 = this.getSavedLightValue(EnumSkyBlock.Block, par2 + 1, par3, par4) - par6;
int var10 = this.getSavedLightValue(EnumSkyBlock.Block, par2, par3 - 1, par4) - par6;
@@ -3267,6 +3257,11 @@
{
block = null;
var8 = null;
}
+ if (block != null && block.isBlockReplaceable(this, j, k, l))
+
+ if (var8 != null && var8.isBlockReplaceable(this, par2, par3, par4))
+ {
+ block = null;
+ var8 = null;
+ }
return i > 0 && block == null && block1.canPlaceBlockOnSide(this, j, k, l, i1);
}
@@ -3028,4 +3029,38 @@
return par1 > 0 && var8 == null && var9.canPlaceBlockOnSide(this, par2, par3, par4, par6);
}
@@ -3732,4 +3727,38 @@
{
return getChunkProvider().findClosestStructure(this, s, i, j, k);
return this.getChunkProvider().findClosestStructure(this, par1Str, par2, par3, par4);
}
+
+ /**
@ -199,19 +205,19 @@
+ * 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 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, int side)
+ public boolean isBlockSolidOnSide(int x, int y, int z, int side)
+ {
+ Block block = Block.blocksList[getBlockId(X, Y, Z)];
+ Block block = Block.blocksList[getBlockId(x, y, z)];
+ if(block == null)
+ {
+ return false;
+ }
+ return block.isBlockSolidOnSide(this, X, Y, Z, side);
+ return block.isBlockSolidOnSide(this, x, y, z, side);
+ }
}

View File

@ -1,34 +1,32 @@
--- ../src_base/minecraft_server/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,6 +3,8 @@
import java.io.PrintStream;
@@ -2,6 +2,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
public class WorldGenDungeons extends WorldGenerator
{
public WorldGenDungeons()
@@ -118,11 +120,11 @@
int k4 = 0;
do
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
@@ -117,9 +119,9 @@
if (var16 != null)
{
- if (k4 >= 8)
+ if (k4 >= MinecraftForge.getDungeonLootTries())
- for (int var17 = 0; var17 < 8; ++var17)
+ for (int var17 = 0; var17 < MinecraftForge.getDungeonLootTries(); ++var17)
{
break label0;
}
- ItemStack itemstack = pickCheckLootItem(random);
+ ItemStack itemstack = MinecraftForge.getRandomDungeonLoot(random);
if (itemstack != null)
- ItemStack var18 = this.pickCheckLootItem(par2Random);
+ ItemStack var18 = MinecraftForge.getRandomDungeonLoot(par2Random);
if (var18 != null)
{
tileentitychest.setInventorySlotContents(random.nextInt(tileentitychest.getSizeInventory()), itemstack);
@@ -137,7 +139,7 @@
TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner)world.getBlockTileEntity(i, j, k);
if (tileentitymobspawner != null)
@@ -147,7 +149,7 @@
if (var19 != null)
{
- tileentitymobspawner.setMobID(pickMobSpawner(random));
+ tileentitymobspawner.setMobID(MinecraftForge.getRandomDungeonMob(random));
- var19.setMobID(this.pickMobSpawner(par2Random));
+ var19.setMobID(MinecraftForge.getRandomDungeonMob(par2Random));
}
else
{

View File

@ -8,33 +8,18 @@
public abstract class WorldProvider
{
public World worldObj;
@@ -95,22 +97,7 @@
@@ -103,7 +105,7 @@
public static WorldProvider getProviderForDimension(int i)
public static WorldProvider getProviderForDimension(int par0)
{
- if (i == -1)
- {
- return new WorldProviderHell();
- }
- if (i == 0)
- {
- return new WorldProviderSurface();
- }
- if (i == 1)
- {
- return new WorldProviderEnd();
- }
- else
- {
- return null;
- }
+ return DimensionManager.getProvider(i);
- return (WorldProvider)(par0 == -1 ? new WorldProviderHell() : (par0 == 0 ? new WorldProviderSurface() : (par0 == 1 ? new WorldProviderEnd() : null)));
+ return DimensionManager.getProvider(par0);
}
public ChunkCoordinates getEntrancePortalLocation()
@@ -129,4 +116,36 @@
return worldObj.worldHeight / 2;
}
/**
@@ -118,4 +120,36 @@
{
return this.terrainType == WorldType.field_48458_c ? 4 : 64;
}
+
+ /**

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/WorldProviderEnd.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/WorldProviderEnd.java 0000-00-00 00:00:00.000000000 -0000
@@ -51,4 +51,22 @@
@@ -53,4 +53,22 @@
{
return 50;
}

View File

@ -1,6 +1,6 @@
--- ../src_base/minecraft_server/net/minecraft/src/WorldProviderHell.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/WorldProviderHell.java 0000-00-00 00:00:00.000000000 -0000
@@ -44,4 +44,28 @@
@@ -54,4 +54,28 @@
{
return false;
}

View File

@ -1,10 +1,9 @@
--- ../src_base/minecraft_server/net/minecraft/src/WorldProviderSurface.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft_server/net/minecraft/src/WorldProviderSurface.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,4 +5,22 @@
public WorldProviderSurface()
@@ -2,4 +2,21 @@
public class WorldProviderSurface extends WorldProvider
{
}
+
+ @Override
+ public String getSaveFolder()
+ {

View File

@ -8,58 +8,55 @@
public class WorldServer extends World
{
@@ -11,6 +12,8 @@
public boolean levelSaving;
private MinecraftServer mcServer;
@@ -17,6 +18,8 @@
/** Maps ids to entity instances */
private IntHashMap entityInstanceIdMap;
+ public EntityTracker entityTracker;
+ public PlayerManager playerManager;
public WorldServer(MinecraftServer minecraftserver, ISaveHandler isavehandler, String s, int i, WorldSettings worldsettings)
public WorldServer(MinecraftServer par1MinecraftServer, ISaveHandler par2ISaveHandler, String par3Str, int par4, WorldSettings par5WorldSettings)
{
@@ -21,6 +24,9 @@
@@ -27,6 +30,9 @@
{
entityInstanceIdMap = new IntHashMap();
this.entityInstanceIdMap = new IntHashMap();
}
+ DimensionManager.setWorld(i, this);
+ playerManager = new PlayerManager(mcServer, i, mcServer.propertyManagerObj.getIntProperty("view-distance", 10));
+ entityTracker = new EntityTracker(mcServer, i);
+ DimensionManager.setWorld(par4, this);
+ playerManager = new PlayerManager(mcServer, par4, mcServer.propertyManagerObj.getIntProperty("view-distance", 10));
+ entityTracker = new EntityTracker(mcServer, par4);
}
public void updateEntityWithOptionalForce(Entity entity, boolean flag)
@@ -54,15 +60,30 @@
public List getTileEntityList(int i, int j, int k, int l, int i1, int j1)
public void updateEntityWithOptionalForce(Entity par1Entity, boolean par2)
@@ -68,14 +74,26 @@
public List getTileEntityList(int par1, int par2, int par3, int par4, int par5, int par6)
{
ArrayList arraylist = new ArrayList();
- for (int k1 = 0; k1 < loadedTileEntityList.size(); k1++)
+ for(int x = (i>>4); x <= (l>>4); x++)
ArrayList var7 = new ArrayList();
-
- for (int var8 = 0; var8 < this.loadedTileEntityList.size(); ++var8)
+ for(int x = (par1 >> 4); x <= (par4 >> 4); x++)
{
- TileEntity tileentity = (TileEntity)loadedTileEntityList.get(k1);
- if (tileentity.xCoord >= i && tileentity.yCoord >= j && tileentity.zCoord >= k && tileentity.xCoord < l && tileentity.yCoord < i1 && tileentity.zCoord < j1)
+ for(int z = (k>>4); z <= (j1>>4); z++)
- TileEntity var9 = (TileEntity)this.loadedTileEntityList.get(var8);
-
- if (var9.xCoord >= par1 && var9.yCoord >= par2 && var9.zCoord >= par3 && var9.xCoord < par4 && var9.yCoord < par5 && var9.zCoord < par6)
+ for(int z = (par3 >> 4); z <= (par6 >> 4); z++)
{
- arraylist.add(tileentity);
+ Chunk chunk = getChunkFromChunkCoords(x,z);
+ if (chunk == null)
- var7.add(var9);
+ Chunk chunk = getChunkFromChunkCoords(x, z);
+ if (chunk != null)
+ {
+ continue;
+ }
+ for(Object obj : chunk.chunkTileEntityMap.values())
+ {
+ TileEntity entity = (TileEntity)obj;
+ if(entity.isInvalid())
+ if (!entity.isInvalid())
+ {
+ continue;
+ if (entity.xCoord >= par1 && entity.yCoord >= par2 && entity.zCoord >= par3 &&
+ entity.xCoord <= par4 && entity.yCoord <= par5 && entity.zCoord <= par6)
+ {
+ var7.add(entity);
+ }
+ }
+ if (entity.xCoord >= i && entity.yCoord >= j && entity.zCoord >= k &&
+ entity.xCoord <= l && entity.yCoord <= i1 && entity.zCoord <= j1)
+ {
+ arraylist.add(entity);
+ }
+ }
}
}
-
return arraylist;
}