Get rid of all old patches

This commit is contained in:
LexManos 2012-08-04 00:00:31 -07:00
parent 25e422d583
commit c2d851cf20
196 changed files with 1 additions and 15985 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
/logs/
/*.pyc
/forge-*/
/patches-old/

Binary file not shown.

View file

@ -1,133 +0,0 @@
--- ../src_base/minecraft/net/minecraft/client/Minecraft.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/client/Minecraft.java 0000-00-00 00:00:00.000000000 -0000
@@ -1960,86 +1960,54 @@
*/
public void usePortal(int par1)
{
+ usePortal(par1, new Teleporter());
+ }
+
+ public void usePortal(int par1, Teleporter teleporter)
+ {
int var2 = this.thePlayer.dimension;
this.thePlayer.dimension = par1;
this.theWorld.setEntityDead(this.thePlayer);
this.thePlayer.isDead = false;
+ WorldProvider pNew = WorldProvider.getProviderForDimension(par1);
+ WorldProvider pOld = WorldProvider.getProviderForDimension(var2);
double var3 = this.thePlayer.posX;
double var5 = this.thePlayer.posZ;
- double var7 = 1.0D;
-
- if (var2 > -1 && this.thePlayer.dimension == -1)
- {
- var7 = 0.125D;
- }
- else if (var2 == -1 && this.thePlayer.dimension > -1)
- {
- var7 = 8.0D;
- }
-
+ double var7 = pOld.getMovementFactor() / pNew.getMovementFactor();
var3 *= var7;
var5 *= var7;
- World var9;
-
- if (this.thePlayer.dimension == -1)
- {
- this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch);
-
- if (this.thePlayer.isEntityAlive())
- {
- this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false);
- }
+ World var9 = new World(theWorld, pNew);
- var9 = null;
- var9 = new World(this.theWorld, WorldProvider.getProviderForDimension(this.thePlayer.dimension));
- this.changeWorld(var9, "Entering the Nether", this.thePlayer);
- }
- else if (this.thePlayer.dimension == 0)
+ if (this.thePlayer.isEntityAlive())
{
- if (this.thePlayer.isEntityAlive())
- {
- this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch);
- this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false);
- }
-
- var9 = null;
- var9 = new World(this.theWorld, WorldProvider.getProviderForDimension(this.thePlayer.dimension));
-
- if (var2 == -1)
- {
- this.changeWorld(var9, "Leaving the Nether", this.thePlayer);
- }
- else
- {
- this.changeWorld(var9, "Leaving the End", this.thePlayer);
- }
+ this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false);
}
- else
+
+ if (thePlayer.dimension == 1)
{
- var9 = null;
- var9 = new World(this.theWorld, WorldProvider.getProviderForDimension(this.thePlayer.dimension));
ChunkCoordinates var10 = var9.getEntrancePortalLocation();
var3 = (double)var10.posX;
this.thePlayer.posY = (double)var10.posY;
var5 = (double)var10.posZ;
- this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, 90.0F, 0.0F);
-
- if (this.thePlayer.isEntityAlive())
- {
- var9.updateEntityWithOptionalForce(this.thePlayer, false);
- }
-
- this.changeWorld(var9, "Entering the End", this.thePlayer);
+ }
+
+ if (thePlayer.dimension == 0)
+ {
+ changeWorld(var9, pOld.getDepartMessage(), thePlayer);
+ }
+ else
+ {
+ changeWorld(var9, pNew.getWelcomeMessage(), thePlayer);
}
this.thePlayer.worldObj = this.theWorld;
System.out.println("Teleported to " + this.theWorld.worldProvider.worldType);
- if (this.thePlayer.isEntityAlive() && var2 < 1)
+ if (this.thePlayer.isEntityAlive())
{
this.thePlayer.setLocationAndAngles(var3, this.thePlayer.posY, var5, this.thePlayer.rotationYaw, this.thePlayer.rotationPitch);
this.theWorld.updateEntityWithOptionalForce(this.thePlayer, false);
- (new Teleporter()).placeInPortal(this.theWorld, this.thePlayer);
+ teleporter.placeInPortal(this.theWorld, this.thePlayer);
}
}
@@ -2324,6 +2292,11 @@
{
this.usePortal(0);
}
+
+ if (!this.theWorld.isRemote && this.theWorld.worldProvider.canRespawnHere())
+ {
+ par2 = this.theWorld.worldProvider.worldType; //Fix for vanilla always re-spawning to the over world.
+ }
ChunkCoordinates var4 = null;
ChunkCoordinates var5 = null;
@@ -2591,6 +2564,7 @@
var0.addData("java_version", System.getProperty("java.version"));
var0.addData("opengl_version", GL11.glGetString(GL11.GL_VERSION));
var0.addData("opengl_vendor", GL11.glGetString(GL11.GL_VENDOR));
+ var0.addData("client_brand", "forge");
var0.sendReport();
}
}

View file

@ -1,27 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/AnvilChunkLoader.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/AnvilChunkLoader.java 0000-00-00 00:00:00.000000000 -0000
@@ -10,6 +10,8 @@
import java.util.List;
import java.util.Set;
+import net.minecraft.src.forge.ForgeHooks;
+
public class AnvilChunkLoader implements IThreadedFileIO, IChunkLoader
{
private List field_48451_a = new ArrayList();
@@ -88,6 +90,7 @@
}
var5.removeUnknownBlocks();
+ ForgeHooks.onChunkLoadData(par1World, var5, par4NBTTagCompound);
return var5;
}
}
@@ -103,6 +106,7 @@
var3.setTag("Level", var4);
this.writeChunkToNBT(par2Chunk, par1World, var4);
this.func_48446_a(par2Chunk.getChunkCoordIntPair(), var3);
+ ForgeHooks.onChunkSaveData(par1World, par2Chunk, var3);
}
catch (Exception var5)
{

View file

@ -1,20 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/AnvilSaveHandler.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/AnvilSaveHandler.java 0000-00-00 00:00:00.000000000 -0000
@@ -18,15 +18,9 @@
File var2 = this.getSaveDirectory();
File var3;
- if (par1WorldProvider instanceof WorldProviderHell)
+ if (par1WorldProvider.getSaveFolder() != null)
{
- var3 = new File(var2, "DIM-1");
- var3.mkdirs();
- return new AnvilChunkLoader(var3);
- }
- else if (par1WorldProvider instanceof WorldProviderEnd)
- {
- var3 = new File(var2, "DIM1");
+ var3 = new File(var2, par1WorldProvider.getSaveFolder());
var3.mkdirs();
return new AnvilChunkLoader(var3);
}

View file

@ -1,712 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Block.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,9 +1,12 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.ITextureProvider;
+
import java.util.ArrayList;
import java.util.Random;
-public class Block
+public class Block implements ITextureProvider
{
public static final StepSound soundPowderFootstep = new StepSound("stone", 1.0F, 1.0F);
public static final StepSound soundWoodFootstep = new StepSound("wood", 1.0F, 1.0F);
@@ -257,6 +260,7 @@
lightOpacity[par1] = this.isOpaqueCube() ? 255 : 0;
canBlockGrass[par1] = !par2Material.getCanBlockGrass();
}
+ isDefaultTexture = (getTextureFile() != null && getTextureFile().equalsIgnoreCase("/terrain.png"));
}
/**
@@ -397,7 +401,7 @@
public boolean hasTileEntity()
{
- return this.isBlockContainer;
+ return hasTileEntity(0);
}
/**
@@ -418,7 +422,7 @@
*/
public float getBlockBrightness(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
- return par1IBlockAccess.getBrightness(par2, par3, par4, lightValue[this.blockID]);
+ return par1IBlockAccess.getBrightness(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4));
}
/**
@@ -426,7 +430,7 @@
*/
public int getMixedBrightnessForBlock(IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
- return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, lightValue[this.blockID]);
+ return par1IBlockAccess.getLightBrightnessForSkyBlocks(par2, par3, par4, getLightValue(par1IBlockAccess, par2, par3, par4));
}
/**
@@ -583,11 +587,14 @@
}
/**
- * 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 float blockStrength(EntityPlayer par1EntityPlayer)
{
- 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);
}
/**
@@ -607,16 +614,12 @@
{
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 (par1World.rand.nextFloat() <= par6)
{
- int var10 = this.idDropped(par5, par1World.rand, par7);
-
- if (var10 > 0)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(var10, 1, this.damageDropped(par5)));
- }
+ this.dropBlockAsItem_do(par1World, par2, par3, par4, item);
}
}
}
@@ -929,7 +932,7 @@
par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
par2EntityPlayer.addExhaustion(0.025F);
- if (this.canSilkHarvest() && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory))
+ if (this.canSilkHarvest(par1World, par2EntityPlayer, par3, par4, par5, par6) && EnchantmentHelper.getSilkTouchModifier(par2EntityPlayer.inventory))
{
ItemStack var8 = this.createStackedBlock(par6);
@@ -1058,6 +1061,614 @@
*/
public void onFallenUpon(World par1World, int par2, int par3, int par4, Entity par5Entity, float par6) {}
+ /* =================================================== FORGE START =====================================*/
+ protected static int blockFireSpreadSpeed[] = new int[blocksList.length];
+ protected static int blockFlammability[] = new int[blocksList.length];
+ protected String currentTexture = "/terrain.png";
+ public boolean isDefaultTexture = true;
+
+ /**
+ * 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 world, int x, int y, int z)
+ {
+ return lightValue[blockID];
+ }
+
+ /**
+ * 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 x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * 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 x, int y, int z)
+ {
+ return blockMaterial.isOpaque() && renderAsNormalBlock();
+ }
+
+ /**
+ * 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)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if (this instanceof BlockStep)
+ {
+ return (((meta & 8) == 8 && (side == 1)) || isOpaqueCube());
+ }
+ else if (this instanceof BlockFarmland)
+ {
+ return (side != 1 && side != 0);
+ }
+ else if (this instanceof BlockStairs)
+ {
+ boolean flipped = ((meta & 4) != 0);
+ return ((meta & 3) + side == 5) || (side == 1 && flipped);
+ }
+ return isBlockNormalCube(world, x, y, z);
+ }
+
+ /**
+ * 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 x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * 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 x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * 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 x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * Metadata sensitive version of the default getHardness function.
+ *
+ * @param meta The block's current metatdata
+ * @return Block hardness
+ */
+ public float getHardness(int meta)
+ {
+ return blockHardness;
+ }
+
+ /**
+ * 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 x, int y, int z)
+ {
+ return blockStrength(player, world.getBlockMetadata(x, y, z));
+ }
+
+ /**
+ * 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 meta)
+ {
+ return ForgeHooks.blockStrength(this, player, meta);
+ }
+
+ /**
+ * 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 meta)
+ {
+ return ForgeHooks.canHarvestBlock(this, player, meta);
+ }
+
+ /**
+ * 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.
+ *
+ * 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 x, int y, int z)
+ {
+ return world.setBlockWithNotify(x, y, z, 0);
+ }
+
+ /**
+ * 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)
+ {
+ }
+
+ /**
+ * Chance that fire will spread and consume this block.
+ * 300 being a 100% chance, 0, being a 0% chance.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return A number ranging from 0 to 300 relating used to determine if the block will be consumed by fire
+ */
+ public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, int face)
+ {
+ return blockFlammability[blockID];
+ }
+
+ /**
+ * Called when fire is updating, checks if a block face can catch fire.
+ *
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return True if the face can be on fire, false otherwise.
+ */
+ public boolean isFlammable(IBlockAccess world, int x, int y, int z, int metadata, int face)
+ {
+ return getFlammability(world, x, y, z, metadata, face) > 0;
+ }
+
+ /**
+ * Called when fire is updating on a neighbor block.
+ * The higher the number returned, the faster fire will spread around this block.
+ *
+ * @param world The current world
+ * @param x The blocks X position
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return A number that is used to determine the speed of fire growth around the block
+ */
+ public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, int face)
+ {
+ return blockFireSpreadSpeed[blockID];
+ }
+
+ /**
+ * Currently only called by fire when it is on top of this block.
+ * 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
+ * @param y The blocks Y position
+ * @param z The blocks Z position
+ * @param metadata The blocks current metadata
+ * @param face The face that the fire is coming from
+ * @return
+ */
+ public boolean isFireSource(World world, int x, int y, int z, int metadata, int face)
+ {
+ if (blockID == Block.netherrack.blockID && face == 0)
+ {
+ return true;
+ }
+ if ((world.worldProvider instanceof WorldProviderEnd) && blockID == Block.bedrock.blockID && face == 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Called by BlockFire to setup the burn values of vanilla blocks.
+ * @param id The block id
+ * @param encouragement How much the block encourages fire to spread
+ * @param flammability how easy a block is to catch fire
+ */
+ public static void setBurnProperties(int id, int encouragement, int flammability)
+ {
+ blockFireSpreadSpeed[id] = encouragement;
+ blockFlammability[id] = flammability;
+ }
+
+ /**
+ * Called throughout the code as a replacement for block instanceof BlockContainer
+ * Moving this to the Block base class allows for mods that wish to extend vinella
+ * blocks, and also want to have a tile entity on that block, may.
+ *
+ * Return true from this function to specify this block has a tile entity.
+ *
+ * @param metadata Metadata of the current block
+ * @return True if block has a tile entity, false otherwise
+ */
+ public boolean hasTileEntity(int metadata)
+ {
+ return isBlockContainer;
+ }
+
+ /**
+ * Called throughout the code as a replacement for BlockContainer.getBlockEntity
+ * Return the same thing you would from that function.
+ * This will fall back to BlockContainer.getBlockEntity if this block is a BlockContainer.
+ *
+ * @param metadata The Metadata of the current block
+ * @return A instance of a class extending TileEntity
+ */
+ public TileEntity getTileEntity(int metadata)
+ {
+ if (this instanceof BlockContainer)
+ {
+ return ((BlockContainer)this).getBlockEntity(metadata);
+ }
+ return null;
+ }
+
+ /**
+ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand)
+ * version in 1.1.
+ *
+ * @param meta Blocks Metadata
+ * @param fortune Current item fortune level
+ * @param random Random number generator
+ * @return The number of items to drop
+ */
+ public int quantityDropped(int meta, int fortune, Random random)
+ {
+ return quantityDroppedWithBonus(fortune, random);
+ }
+
+ /**
+ * This returns a complete list of items dropped from this block.
+ *
+ * @param world The current world
+ * @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)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+
+ int count = quantityDropped(metadata, fortune, world.rand);
+ for(int i = 0; i < count; i++)
+ {
+ int id = idDropped(metadata, world.rand, 0);
+ if (id > 0)
+ {
+ ret.add(new ItemStack(id, 1, damageDropped(metadata)));
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Return true from this function if the player with silk touch can harvest this block directly, and not it's normal drops.
+ *
+ * @param world The world
+ * @param player The player doing the harvesting
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param metadata The metadata
+ * @return True if the block can be directly harvested using silk touch
+ */
+ public boolean canSilkHarvest(World world, EntityPlayer player, int x, int y, int z, int metadata)
+ {
+ if (this instanceof BlockGlass)
+ {
+ return true;
+ }
+ return renderAsNormalBlock() && !hasTileEntity(metadata);
+ }
+
+ /**
+ * Determines if a specified mob type can spawn on this block, returning false will
+ * prevent any mob from spawning on the block.
+ *
+ * @param type The Mob Category Type
+ * @param world The current world
+ * @param x The X Position
+ * @param y The Y Position
+ * @param z The Z Position
+ * @return True to allow a mob of the specified category to spawn, false to prevent it.
+ */
+ public boolean canCreatureSpawn(EnumCreatureType type, World world, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if (this instanceof BlockStep)
+ {
+ if (mod_MinecraftForge.SPAWNER_ALLOW_ON_INVERTED)
+ {
+ return (((meta & 8) == 8) || isOpaqueCube());
+ }
+ else
+ {
+ return isNormalCube(this.blockID);
+ }
+ }
+ else if (this instanceof BlockStairs)
+ {
+ if (mod_MinecraftForge.SPAWNER_ALLOW_ON_INVERTED)
+ {
+ return ((meta & 4) != 0);
+ }
+ else
+ {
+ return isNormalCube(this.blockID);
+ }
+ }
+ return isBlockSolidOnSide(world, x, y, z, 1);
+ }
+
+ /**
+ * Determines if this block is classified as a Bed, Allowing
+ * players to sleep in it, though the block has to specifically
+ * perform the sleeping functionality in it's activated event.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param player The player or camera entity, null in some cases.
+ * @return True to treat this as a bed
+ */
+ public boolean isBed(World world, int x, int y, int z, EntityLiving player)
+ {
+ return blockID == Block.bed.blockID;
+ }
+
+ /**
+ * Returns the position that the player is moved to upon
+ * waking up, or respawning at the bed.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param player The player or camera entity, null in some cases.
+ * @return The spawn position
+ */
+ public ChunkCoordinates getBedSpawnPosition(World world, int x, int y, int z, EntityPlayer player)
+ {
+ return BlockBed.getNearestEmptyChunkCoordinates(world, x, y, z, 0);
+ }
+
+ /**
+ * Called when a user either starts or stops sleeping in the bed.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @param player The player or camera entity, null in some cases.
+ * @param occupied True if we are occupying the bed, or false if they are stopping use of the bed
+ */
+ public void setBedOccupied(World world, int x, int y, int z, EntityPlayer player, boolean occupied)
+ {
+ BlockBed.setBedOccupied(world, x, y, z, occupied);
+ }
+
+ /**
+ * Returns the direction of the block. Same values that
+ * are returned by BlockDirectional
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return Bed direction
+ */
+ public int getBedDirection(IBlockAccess world, int x, int y, int z)
+ {
+ return BlockBed.getDirection(world.getBlockMetadata(x, y, z));
+ }
+
+ /**
+ * Determines if the current block is the foot half of the bed.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return True if the current block is the foot side of a bed.
+ */
+ public boolean isBedFoot(IBlockAccess world, int x, int y, int z)
+ {
+ return BlockBed.isBlockFootOfBed(world.getBlockMetadata(x, y, z));
+ }
+
+ /**
+ * Called when a leaf should start its decay process.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ */
+ public void beginLeavesDecay(World world, int x, int y, int z){}
+
+ /**
+ * Determines if this block can prevent leaves connected to it from decaying.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return true if the presence this block can prevent leaves from decaying.
+ */
+ public boolean canSustainLeaves(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * Determines if this block is considered a leaf block, used to apply the leaf decay and generation system.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return true if this block is considered leaves.
+ */
+ public boolean isLeaves(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * Used during tree growth to determine if newly generated leaves can replace this block.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return true if this block can be replaced by growing leaves.
+ */
+ public boolean canBeReplacedByLeaves(World world, int x, int y, int z)
+ {
+ return !Block.opaqueCubeLookup[this.blockID];
+ }
+
+ /**
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return true if the block is wood (logs)
+ */
+ public boolean isWood(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * Determines if the current block is replaceable by Ore veins during world generation.
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ * @return True to allow this block to be replaced by a ore
+ */
+ public boolean isGenMineableReplaceable(World world, int x, int y, int z)
+ {
+ return blockID == stone.blockID;
+ }
+
+ /**
+ * Grabs the current texture file used for this block
+ */
+ @Override
+ public String getTextureFile()
+ {
+ return currentTexture;
+ }
+
+ /**
+ * Sets the current texture file for this block, used when rendering.
+ * Default is "/terrain.png"
+ *
+ * @param texture The texture file
+ */
+ public void setTextureFile(String texture)
+ {
+ currentTexture = texture;
+ isDefaultTexture = false;
+ }
+
static
{
Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setItemName("cloth");

View file

@ -1,90 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockButton.java 0000-00-00 00:00:00.000000000 -0000
@@ -49,7 +49,10 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
- return par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1) ? true : (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4)));
+ 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));
}
/**
@@ -57,7 +60,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2);
}
/**
@@ -70,19 +76,19 @@
int var7 = var6 & 8;
var6 &= 7;
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
var6 = 4;
}
- else if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ else if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
var6 = 3;
}
- else if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ else if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
var6 = 2;
}
- 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;
}
/**
@@ -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)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) && var6 == 2)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) && var6 == 4)
{
var7 = true;
}

View file

@ -1,35 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockChest.java 0000-00-00 00:00:00.000000000 -0000
@@ -497,7 +497,7 @@
{
return true;
}
- else if (par1World.isBlockNormalCube(par2, par3 + 1, par4))
+ else if (par1World.isBlockSolidOnSide(par2, par3 + 1, par4, 0))
{
return true;
}
@@ -505,19 +505,19 @@
{
return true;
}
- else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 - 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
+ else if (par1World.getBlockId(par2 - 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 - 1, par3 + 1, par4, 0) || isOcelotBlockingChest(par1World, par2 - 1, par3, par4)))
{
return true;
}
- else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockNormalCube(par2 + 1, par3 + 1, par4) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
+ else if (par1World.getBlockId(par2 + 1, par3, par4) == this.blockID && (par1World.isBlockSolidOnSide(par2 + 1, par3 + 1, par4, 0) || isOcelotBlockingChest(par1World, par2 + 1, par3, par4)))
{
return true;
}
- else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 - 1) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
+ else if (par1World.getBlockId(par2, par3, par4 - 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 - 1, 0) || isOcelotBlockingChest(par1World, par2, par3, par4 - 1)))
{
return true;
}
- else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockNormalCube(par2, par3 + 1, par4 + 1) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
+ else if (par1World.getBlockId(par2, par3, par4 + 1) == this.blockID && (par1World.isBlockSolidOnSide(par2, par3 + 1, par4 + 1, 0) || isOcelotBlockingChest(par1World, par2, par3, par4 + 1)))
{
return true;
}

View file

@ -1,26 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockContainer.java 0000-00-00 00:00:00.000000000 -0000
@@ -20,7 +20,7 @@
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
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)));
}
/**
@@ -51,4 +51,14 @@
var7.receiveClientEvent(par5, par6);
}
}
+
+ /**
+ * Metadata-sensitive version, to fix 1.8.1 regression.
+ * @param meta The current Metadata
+ * @return And instance of the TileEntity class for this block
+ */
+ public TileEntity getBlockEntity(int meta)
+ {
+ return getBlockEntity();
+ }
}

View file

@ -1,52 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockCrops.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
package net.minecraft.src;
import java.util.Random;
+import java.util.ArrayList;
public class BlockCrops extends BlockFlower
{
@@ -135,25 +136,26 @@
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, 0);
-
- if (!par1World.isRemote)
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ if (metadata == 7)
{
- int var8 = 3 + par7;
-
- for (int var9 = 0; var9 < var8; ++var9)
+ ret.add(new ItemStack(Item.wheat));
+ }
+
+ for (int n = 0; n < 3 + fortune; n++)
+ {
+ if (world.rand.nextInt(15) <= metadata)
{
- 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;
}
/**

View file

@ -1,29 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockDoor.java 0000-00-00 00:00:00.000000000 -0000
@@ -243,7 +243,7 @@
{
if (this.blockMaterial == Material.iron)
{
- return true;
+ return false;
}
else
{
@@ -325,7 +325,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;
@@ -378,7 +378,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,275 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockFire.java 0000-00-00 00:00:00.000000000 -0000
@@ -25,6 +25,8 @@
*/
public void initializeBlock()
{
+ abilityToCatchFire = Block.blockFlammability;
+ chanceToEncourageFire = Block.blockFireSpreadSpeed;
this.setBurnRate(Block.planks.blockID, 5, 20);
this.setBurnRate(Block.fence.blockID, 5, 20);
this.setBurnRate(Block.stairCompactPlanks.blockID, 5, 20);
@@ -44,8 +46,7 @@
*/
private void setBurnRate(int par1, int par2, int par3)
{
- this.chanceToEncourageFire[par1] = par2;
- this.abilityToCatchFire[par1] = par3;
+ Block.setBurnProperties(par1, par2, par3);
}
/**
@@ -103,8 +104,9 @@
*/
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
{
- 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)
{
var6 = true;
@@ -132,12 +134,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);
}
@@ -151,12 +153,12 @@
var9 = -50;
}
- this.tryToCatchBlockOnFire(par1World, par2 + 1, par3, par4, 300 + var9, par5Random, var7);
- this.tryToCatchBlockOnFire(par1World, par2 - 1, par3, par4, 300 + var9, par5Random, var7);
- this.tryToCatchBlockOnFire(par1World, par2, par3 - 1, par4, 250 + var9, par5Random, var7);
- this.tryToCatchBlockOnFire(par1World, par2, par3 + 1, par4, 250 + var9, par5Random, var7);
- this.tryToCatchBlockOnFire(par1World, par2, par3, par4 - 1, 300 + var9, par5Random, var7);
- this.tryToCatchBlockOnFire(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);
for (int var10 = par2 - 1; var10 <= par2 + 1; ++var10)
{
@@ -203,10 +205,22 @@
}
}
}
-
+
+ /** Deprecated for a side-sensitive version */
+ @Deprecated
private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7)
{
- int var8 = this.abilityToCatchFire[par1World.getBlockId(par2, par3, par4)];
+ tryToCatchBlockOnFire(par1World, par2, par3, par4, par5, par6Random, par7, 0);
+ }
+
+ private void tryToCatchBlockOnFire(World par1World, int par2, int par3, int par4, int par5, Random par6Random, int par7, int face)
+ {
+ int var8 = 0;
+ Block block = Block.blocksList[par1World.getBlockId(par2, par3, par4)];
+ if (block != null)
+ {
+ var8 = block.getFlammability(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), face);
+ }
if (par6Random.nextInt(par5) < var8)
{
@@ -240,7 +254,12 @@
*/
private boolean canNeighborBurn(World par1World, int par2, int par3, int par4)
{
- return this.canBlockCatchFire(par1World, par2 + 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2 - 1, par3, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 - 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3 + 1, par4) ? true : (this.canBlockCatchFire(par1World, par2, par3, par4 - 1) ? true : this.canBlockCatchFire(par1World, par2, par3, par4 + 1)))));
+ return canBlockCatchFire(par1World, par2 + 1, par3, par4, 4) ||
+ canBlockCatchFire(par1World, par2 - 1, par3, par4, 5) ||
+ canBlockCatchFire(par1World, par2, par3 - 1, par4, 1) ||
+ canBlockCatchFire(par1World, par2, par3 + 1, par4, 0) ||
+ canBlockCatchFire(par1World, par2, par3, par4 - 1, 3) ||
+ canBlockCatchFire(par1World, par2, par3, par4 + 1, 2);
}
/**
@@ -256,12 +275,12 @@
}
else
{
- 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;
}
}
@@ -276,21 +295,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);
}
/**
@@ -298,7 +320,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);
}
/**
@@ -307,7 +329,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);
}
@@ -320,7 +342,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);
}
@@ -346,9 +368,9 @@
float var8;
float var9;
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && !Block.fire.canBlockCatchFire(par1World, par2, par3 - 1, par4, 1))
{
- if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2 - 1, par3, par4, 5))
{
for (var6 = 0; var6 < 2; ++var6)
{
@@ -359,7 +381,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2 + 1, par3, par4, 4))
{
for (var6 = 0; var6 < 2; ++var6)
{
@@ -370,7 +392,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 - 1, 3))
{
for (var6 = 0; var6 < 2; ++var6)
{
@@ -381,7 +403,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3, par4 + 1, 2))
{
for (var6 = 0; var6 < 2; ++var6)
{
@@ -392,7 +414,7 @@
}
}
- if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4))
+ if (Block.fire.canBlockCatchFire(par1World, par2, par3 + 1, par4, 0))
{
for (var6 = 0; var6 < 2; ++var6)
{
@@ -414,4 +436,46 @@
}
}
}
+
+ /**
+ * 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 x, int y, int z, int face)
+ {
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ return block.isFlammable(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ return false;
+ }
+
+ /**
+ * 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 x, int y, int z, int oldChance, int face)
+ {
+ int newChance = 0;
+ Block block = Block.blocksList[world.getBlockId(x, y, z)];
+ if (block != null)
+ {
+ newChance = block.getFireSpreadSpeed(world, x, y, z, world.getBlockMetadata(x, y, z), face);
+ }
+ return (newChance > oldChance ? newChance : oldChance);
+ }
}

View file

@ -1,79 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLadder.java 0000-00-00 00:00:00.000000000 -0000
@@ -102,7 +102,10 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : par1World.isBlockNormalCube(par2, par3, par4 + 1)));
+ return par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5) ||
+ par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) ||
+ par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2);
}
/**
@@ -113,22 +116,22 @@
{
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))
{
var6 = 2;
}
- if ((var6 == 0 || par5 == 3) && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if ((var6 == 0 || par5 == 3) && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
var6 = 3;
}
- if ((var6 == 0 || par5 == 4) && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if ((var6 == 0 || par5 == 4) && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
var6 = 4;
}
- if ((var6 == 0 || par5 == 5) && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if ((var6 == 0 || par5 == 5) && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
var6 = 5;
}
@@ -145,22 +148,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))
{
var7 = true;
}
- if (var6 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (var6 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
var7 = true;
}
- if (var6 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (var6 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
var7 = true;
}
- if (var6 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (var6 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
var7 = true;
}
@@ -181,4 +184,10 @@
{
return 1;
}
+
+ @Override
+ public boolean isLadder(World world, int x, int y, int z)
+ {
+ return true;
+ }
}

View file

@ -1,94 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLeaves.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLeaves.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,8 +1,11 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
-public class BlockLeaves extends BlockLeavesBase
+import net.minecraft.src.forge.IShearable;
+
+public class BlockLeaves extends BlockLeavesBase implements IShearable
{
/**
* The base index in terrain.png corresponding to the fancy version of the leaf texture. This is stored so we can
@@ -88,10 +91,9 @@
{
int var10 = par1World.getBlockId(par2 + var7, par3 + var8, par4 + var9);
- if (var10 == Block.leaves.blockID)
+ if (Block.blocksList[var10] != null)
{
- int var11 = par1World.getBlockMetadata(par2 + var7, par3 + var8, par4 + var9);
- par1World.setBlockMetadata(par2 + var7, par3 + var8, par4 + var9, var11 | 8);
+ Block.blocksList[var10].beginLeavesDecay(par1World, par2 + var7, par3 + var8, par4 + var9);
}
}
}
@@ -136,12 +138,14 @@
for (var14 = -var7; var14 <= var7; ++var14)
{
var15 = par1World.getBlockId(par2 + var12, par3 + var13, par4 + var14);
-
- if (var15 == Block.wood.blockID)
+
+ Block block = Block.blocksList[var15];
+
+ if (block != null && block.canSustainLeaves(par1World, par2 + var12, par3 + var13, par4 + var14))
{
this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = 0;
}
- else if (var15 == Block.leaves.blockID)
+ else if (block != null && block.isLeaves(par1World, par2 + var12, par3 + var13, par4 + var14))
{
this.adjacentTreeBlocks[(var12 + var11) * var10 + (var13 + var11) * var9 + var14 + var11] = -2;
}
@@ -268,15 +272,7 @@
*/
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)
- {
- 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(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
}
/**
@@ -320,4 +316,30 @@
{
super.onEntityWalking(par1World, par2, par3, par4, par5Entity);
}
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3));
+ return ret;
+ }
+
+ @Override
+ public void beginLeavesDecay(World world, int x, int y, int z)
+ {
+ world.setBlockMetadata(x, y, z, world.getBlockMetadata(x, y, z) | 8);
+ }
+
+ @Override
+ public boolean isLeaves(World world, int x, int y, int z)
+ {
+ return true;
+ }
}

View file

@ -1,100 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLever.java 0000-00-00 00:00:00.000000000 -0000
@@ -46,7 +46,11 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
- 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));
}
/**
@@ -54,7 +58,11 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCube(par2 - 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2 + 1, par3, par4) ? true : (par1World.isBlockNormalCube(par2, par3, par4 - 1) ? true : (par1World.isBlockNormalCube(par2, par3, par4 + 1) ? 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);
}
/**
@@ -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))
{
var6 = 5 + par1World.rand.nextInt(2);
}
- if (par5 == 2 && par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
var6 = 4;
}
- if (par5 == 3 && par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
var6 = 3;
}
- if (par5 == 4 && par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
var6 = 2;
}
- if (par5 == 5 && par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
var6 = 1;
}
@@ -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)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2 + 1, par3, par4) && var6 == 2)
+ if (!par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4) && var6 == 2)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 - 1) && var6 == 3)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3) && var6 == 3)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2, par3, par4 + 1) && var6 == 4)
+ if (!par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2) && var6 == 4)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && var6 == 5)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && var6 == 5)
{
var7 = true;
}
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && var6 == 6)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && var6 == 6)
{
var7 = true;
}

View file

@ -1,36 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockLog.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockLog.java 0000-00-00 00:00:00.000000000 -0000
@@ -53,14 +53,9 @@
{
int var10 = par1World.getBlockId(par2 + var7, par3 + var8, par4 + var9);
- if (var10 == Block.leaves.blockID)
+ if (Block.blocksList[var10] != null)
{
- int var11 = par1World.getBlockMetadata(par2 + var7, par3 + var8, par4 + var9);
-
- if ((var11 & 8) == 0)
- {
- par1World.setBlockMetadata(par2 + var7, par3 + var8, par4 + var9, var11 | 8);
- }
+ Block.blocksList[var10].beginLeavesDecay(par1World, par2 + var7, par3 + var8, par4 + var9);
}
}
}
@@ -83,4 +78,16 @@
{
return par1;
}
+
+ @Override
+ public boolean canSustainLeaves(World world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isWood(World world, int x, int y, int z)
+ {
+ return true;
+ }
}

View file

@ -1,51 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockNetherStalk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockNetherStalk.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
public class BlockNetherStalk extends BlockFlower
@@ -71,25 +72,25 @@
*/
public void dropBlockAsItemWithChance(World par1World, int par2, int par3, int par4, int par5, float par6, int par7)
{
- if (!par1World.isRemote)
- {
- int var8 = 1;
-
- if (par5 >= 3)
- {
- var8 = 2 + par1World.rand.nextInt(3);
+ super.dropBlockAsItemWithChance(par1World, par2, par3, par4, par5, par6, par7);
+ }
+
+ @Override
+ public ArrayList<ItemStack> getBlockDropped(World world, int x, int y, int z, int metadata, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ int var8 = 1;
- if (par7 > 0)
- {
- var8 += par1World.rand.nextInt(par7 + 1);
- }
- }
+ if (metadata >= 3)
+ {
+ var8 = 2 + world.rand.nextInt(3) + (fortune > 0 ? world.rand.nextInt(fortune + 1) : 0);
+ }
- for (int var9 = 0; var9 < var8; ++var9)
- {
- this.dropBlockAsItem_do(par1World, par2, par3, par4, new ItemStack(Item.netherStalkSeeds));
- }
+ for (int var9 = 0; var9 < var8; ++var9)
+ {
+ ret.add(new ItemStack(Item.netherStalkSeeds));
}
+ return ret;
}
/**

View file

@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockPistonBase.java 0000-00-00 00:00:00.000000000 -0000
@@ -368,7 +368,7 @@
return false;
}
- return !(Block.blocksList[par0] instanceof BlockContainer);
+ return !(Block.blocksList[par0] != null && Block.blocksList[par0].hasTileEntity(par1World.getBlockMetadata(par2, par3, par4)));
}
}

View file

@ -1,20 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockPressurePlate.java 0000-00-00 00:00:00.000000000 -0000
@@ -61,7 +61,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- 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;
}
/**
@@ -77,7 +77,7 @@
{
boolean var6 = false;
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4) && par1World.getBlockId(par2, par3 - 1, par4) != Block.fence.blockID)
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1) && par1World.getBlockId(par2, par3 - 1, par4) != Block.fence.blockID)
{
var6 = true;
}

View file

@ -1,213 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRail.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,19 @@
{
/** Power related rails have this field at true. */
private final boolean isPowered;
+
+ /**
+ * Forge: Moved render type to a field and a setter.
+ * This allows for a mod to change the render type
+ * for vanilla rails, and any mod rails that extend
+ * this class.
+ */
+ private int renderType = 9;
+
+ public void setRenderType(int value)
+ {
+ renderType = value;
+ }
/**
* Returns true if the block at the coordinates of world passed is a valid rail block (current is rail, powered or
@@ -14,7 +27,7 @@
public static final boolean isRailBlockAt(World par0World, int par1, int par2, int par3)
{
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;
}
/**
@@ -22,7 +35,7 @@
*/
public static final boolean isRailBlock(int par0)
{
- return par0 == Block.rail.blockID || par0 == Block.railPowered.blockID || par0 == Block.railDetector.blockID;
+ return Block.blocksList[par0] instanceof BlockRail;
}
protected BlockRail(int par1, int par2, boolean par3)
@@ -118,7 +131,7 @@
*/
public int getRenderType()
{
- return 9;
+ return renderType;
}
/**
@@ -134,7 +147,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- return par1World.isBlockNormalCube(par2, par3 - 1, par4);
+ return par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1);
}
/**
@@ -171,27 +184,27 @@
boolean var8 = false;
- if (!par1World.isBlockNormalCube(par2, par3 - 1, par4))
+ if (!par1World.isBlockSolidOnSide(par2, par3 - 1, par4, 1))
{
var8 = true;
}
- if (var7 == 2 && !par1World.isBlockNormalCube(par2 + 1, par3, par4))
+ if (var7 == 2 && !par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 1))
{
var8 = true;
}
- if (var7 == 3 && !par1World.isBlockNormalCube(par2 - 1, par3, par4))
+ if (var7 == 3 && !par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 1))
{
var8 = true;
}
- if (var7 == 4 && !par1World.isBlockNormalCube(par2, par3, par4 - 1))
+ if (var7 == 4 && !par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 1))
{
var8 = true;
}
- if (var7 == 5 && !par1World.isBlockNormalCube(par2, par3, par4 + 1))
+ if (var7 == 5 && !par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 1))
{
var8 = true;
}
@@ -391,10 +404,120 @@
}
/**
- * Return true if the blocks passed is a power related rail.
+ * This function is no longer called by Minecraft
*/
+ @Deprecated
static boolean isPoweredBlockRail(BlockRail par0BlockRail)
{
return par0BlockRail.isPowered;
}
+
+ /**
+ * Return true if the rail can make corners.
+ * Used by placement logic.
+ * @param world The world.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return True if the rail can make corners.
+ */
+ public boolean isFlexibleRail(World world, int y, int x, int z)
+ {
+ return !isPowered;
+ }
+
+ /**
+ * Returns true if the rail can make up and down slopes.
+ * Used by placement logic.
+ * @param world The world.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return True if the rail can make slopes.
+ */
+ public boolean canMakeSlopes(World world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ /**
+ * Return the rails metadata (without the power bit if the rail uses one).
+ * Can be used to make the cart think the rail something other than it is,
+ * for example when making diamond junctions or switches.
+ * The cart parameter will often be null unless it it called from EntityMinecart.
+ *
+ * Valid rail metadata is defined as follows:
+ * 0x0: flat track going North-South
+ * 0x1: flat track going West-East
+ * 0x2: track ascending to the East
+ * 0x3: track ascending to the West
+ * 0x4: track ascending to the North
+ * 0x5: track ascending to the South
+ * 0x6: WestNorth corner (connecting East and South)
+ * 0x7: EastNorth corner (connecting West and South)
+ * 0x8: EastSouth corner (connecting West and North)
+ * 0x9: WestSouth corner (connecting East and North)
+ *
+ * All directions are Notch defined.
+ * In MC Beta 1.8.3 the Sun rises in the North.
+ * In MC 1.0.0 the Sun rises in the East.
+ *
+ * @param world The world.
+ * @param cart The cart asking for the metadata, null if it is not called by EntityMinecart.
+ * @param y The rail X coordinate.
+ * @param x The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return The metadata.
+ */
+ public int getBasicRailMetadata(IBlockAccess world, EntityMinecart cart, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if(isPowered)
+ {
+ meta = meta & 7;
+ }
+ return meta;
+ }
+
+ /**
+ * Returns the max speed of the rail at the specified position.
+ * @param world The world.
+ * @param cart The cart on the rail, may be null.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return The max speed of the current rail.
+ */
+ public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z)
+ {
+ return 0.4f;
+ }
+
+ /**
+ * This function is called by any minecart that passes over this rail.
+ * It is called once per update tick that the minecart is on the rail.
+ * @param world The world.
+ * @param cart The cart on the rail.
+ * @param y The rail X coordinate.
+ * @param x The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ */
+ public void onMinecartPass(World world, EntityMinecart cart, int y, int x, int z)
+ {
+ }
+
+ /**
+ * Return true if this rail uses the 4th bit as a power bit.
+ * Avoid using this function when getBasicRailMetadata() can be used instead.
+ * The only reason to use this function is if you wish to change the rails metadata.
+ * @param world The world.
+ * @param x The rail X coordinate.
+ * @param y The rail Y coordinate.
+ * @param z The rail Z coordinate.
+ * @return True if the 4th bit is a power bit.
+ */
+ public boolean hasPowerBit(World world, int x, int y, int z)
+ {
+ return isPowered;
+ }
}

View file

@ -1,20 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneRepeater.java 0000-00-00 00:00:00.000000000 -0000
@@ -33,7 +33,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- 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);
}
/**
@@ -41,7 +41,7 @@
*/
public boolean canBlockStay(World par1World, int par2, int par3, int par4)
{
- 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 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockRedstoneWire.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,8 @@
import java.util.Random;
import java.util.Set;
+import net.minecraft.src.forge.IConnectRedstone;
+
public class BlockRedstoneWire extends Block
{
/**
@@ -76,7 +78,7 @@
*/
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
- 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;
}
/**
@@ -548,6 +550,10 @@
}
else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID)
{
+ if (Block.blocksList[var5] instanceof IConnectRedstone)
+ {
+ return ((IConnectRedstone)Block.blocksList[var5]).canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4);
+ }
return Block.blocksList[var5].canProvidePower() && par4 != -1;
}
else

View file

@ -1,54 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockSnow.java 0000-00-00 00:00:00.000000000 -0000
@@ -54,7 +54,8 @@
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
- return var5 != 0 && (var5 == Block.leaves.blockID || Block.blocksList[var5].isOpaqueCube()) ? par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement() : false;
+ Block block = Block.blocksList[var5];
+ return block != null && (block.isLeaves(par1World, par2, par3 - 1, par4) || Block.blocksList[var5].isOpaqueCube()) ? par1World.getBlockMaterial(par2, par3 - 1, par4).blocksMovement() : false;
}
/**
@@ -73,7 +74,6 @@
{
if (!this.canPlaceBlockAt(par1World, par2, par3, par4))
{
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
return false;
}
@@ -89,15 +89,7 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- 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);
}
@@ -114,7 +106,7 @@
*/
public int quantityDropped(Random par1Random)
{
- return 0;
+ return 1;
}
/**
@@ -124,7 +116,6 @@
{
if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11)
{
- this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
par1World.setBlockWithNotify(par2, par3, par4, 0);
}
}

View file

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

View file

@ -1,102 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockTorch.java 0000-00-00 00:00:00.000000000 -0000
@@ -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) ||
+ canPlaceTorchOn(par1World, par2, par3 - 1, par4);
}
/**
@@ -99,22 +103,22 @@
var6 = 5;
}
- if (par5 == 2 && par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
var6 = 4;
}
- if (par5 == 3 && par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ if (par5 == 3 && par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
var6 = 3;
}
- if (par5 == 4 && par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ if (par5 == 4 && par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
var6 = 2;
}
- if (par5 == 5 && par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par5 == 5 && par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
var6 = 1;
}
@@ -140,19 +144,19 @@
*/
public void onBlockAdded(World par1World, int par2, int par3, int par4)
{
- if (par1World.isBlockNormalCubeDefault(par2 - 1, par3, par4, true))
+ if (par1World.isBlockSolidOnSide(par2 - 1, par3, par4, 5))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1);
}
- else if (par1World.isBlockNormalCubeDefault(par2 + 1, par3, par4, true))
+ else if (par1World.isBlockSolidOnSide(par2 + 1, par3, par4, 4))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2);
}
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 - 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 - 1, 3))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3);
}
- else if (par1World.isBlockNormalCubeDefault(par2, par3, par4 + 1, true))
+ else if (par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
par1World.setBlockMetadataWithNotify(par2, par3, par4, 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)
{
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

@ -1,53 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockTrapDoor.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,9 @@
public class BlockTrapDoor extends Block
{
+ /** Set this to allow trapdoors to remain free-floating */
+ public static boolean disableValidation = false;
+
protected BlockTrapDoor(int par1, Material par2Material)
{
super(par1, par2Material);
@@ -183,7 +186,7 @@
--var7;
}
- 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);
@@ -244,6 +247,10 @@
*/
public boolean canPlaceBlockOnSide(World par1World, int par2, int par3, int par4, int par5)
{
+ if (disableValidation)
+ {
+ return true;
+ }
if (par5 == 0)
{
return false;
@@ -274,7 +281,7 @@
--par2;
}
- return isValidSupportBlock(par1World.getBlockId(par2, par3, par4));
+ return isValidSupportBlock(par1World.getBlockId(par2, par3, par4)) || par1World.isBlockSolidOnSide(par2, par3, par4, 1);
}
}
@@ -289,6 +296,11 @@
*/
private static boolean isValidSupportBlock(int par0)
{
+ if (disableValidation)
+ {
+ return true;
+ }
+
if (par0 <= 0)
{
return false;

View file

@ -1,51 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/BlockVine.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/BlockVine.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,8 +1,11 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
-public class BlockVine extends Block
+import net.minecraft.src.forge.IShearable;
+
+public class BlockVine extends Block implements IShearable
{
public BlockVine(int par1)
{
@@ -424,14 +427,26 @@
*/
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
{
- if (!par1World.isRemote && par2EntityPlayer.getCurrentEquippedItem() != null && par2EntityPlayer.getCurrentEquippedItem().itemID == Item.shears.shiftedIndex)
- {
- par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
- this.dropBlockAsItem_do(par1World, par3, par4, par5, new ItemStack(Block.vine, 1, 0));
- }
- else
- {
- super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
- }
+ super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
+ }
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int x, int y, int z)
+ {
+ return true;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int x, int y, int z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ ret.add(new ItemStack(this, 1, 0));
+ return ret;
+ }
+
+ @Override
+ public boolean isLadder(World world, int x, int y, int z)
+ {
+ return true;
}
}

View file

@ -1,371 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Chunk.java 0000-00-00 00:00:00.000000000 -0000
@@ -8,6 +8,8 @@
import java.util.Map;
import java.util.Random;
+import net.minecraft.src.forge.ForgeHooks;
+
public class Chunk
{
/**
@@ -120,7 +122,9 @@
{
for (int var8 = 0; var8 < var5; ++var8)
{
- byte var9 = par2ArrayOfByte[var6 << 11 | var7 << 7 | var8];
+ /* FORGE: The following change, a cast from unsigned byte to int,
+ * fixes a vanilla bug when generating new chunks that contain a block ID > 127 */
+ int var9 = par2ArrayOfByte[var6 << 11 | var7 << 7 | var8] & 0xFF;
if (var9 != 0)
{
@@ -139,6 +143,48 @@
}
/**
+ * Metadata sensitive Chunk constructor for use in new ChunkProviders that
+ * use metadata sensitive blocks during generation.
+ *
+ * @param world The world this chunk belongs to
+ * @param ids A ByteArray containing all the BlockID's to set this chunk to
+ * @param metadata A ByteArray containing all the metadata to set this chunk to
+ * @param chunkX The chunk's X position
+ * @param chunkZ The Chunk's Z position
+ */
+ public Chunk(World world, byte[] ids, byte[] metadata, int chunkX, int chunkZ)
+ {
+ this(world, chunkX, chunkZ);
+ int height = ids.length / 256;
+
+ for (int x = 0; x < 16; ++x)
+ {
+ for (int z = 0; z < 16; ++z)
+ {
+ for (int y = 0; y < height; ++y)
+ {
+ int index = x << 11 | z << 7 | y;
+ int id = ids[index] & 0xFF;
+ int meta = metadata[index] & 0x0F;
+
+ if (id != 0)
+ {
+ int chunkY = y >> 4;
+
+ if (storageArrays[chunkY] == null)
+ {
+ storageArrays[chunkY] = new ExtendedBlockStorage(chunkY << 4);
+ }
+
+ storageArrays[chunkY].setExtBlockID(x, y & 15, z, id);
+ storageArrays[chunkY].setExtBlockMetadata(x, y & 15, z, meta);
+ }
+ }
+ }
+ }
+ }
+
+ /**
* Checks whether the chunk is at the X/Z location specified
*/
public boolean isAtLocation(int par1, int par2)
@@ -505,7 +551,7 @@
*/
public int getBlockID(int par1, int par2, int par3)
{
- if (par2 >> 4 >= this.storageArrays.length)
+ if (par2 >> 4 >= this.storageArrays.length || par2 >> 4 < 0)
{
return 0;
}
@@ -521,7 +567,7 @@
*/
public int getBlockMetadata(int par1, int par2, int par3)
{
- if (par2 >> 4 >= this.storageArrays.length)
+ if (par2 >> 4 >= this.storageArrays.length || par2 >> 4 < 0)
{
return 0;
}
@@ -561,6 +607,11 @@
}
else
{
+ if (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0)
+ {
+ return false;
+ }
+
ExtendedBlockStorage var9 = this.storageArrays[par2 >> 4];
boolean var10 = false;
@@ -585,7 +636,7 @@
{
Block.blocksList[var8].onBlockRemoval(this.worldObj, var11, par2, var12);
}
- else if (Block.blocksList[var8] instanceof BlockContainer && var8 != par4)
+ if (Block.blocksList[var8] != null && Block.blocksList[var8].hasTileEntity(getBlockMetadata(par1, par2, par3)))
{
this.worldObj.removeBlockTileEntity(var11, par2, var12);
}
@@ -629,32 +680,23 @@
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))
{
var13 = this.getChunkBlockTileEntity(par1, par2, par3);
if (var13 == null)
{
- var13 = ((BlockContainer)Block.blocksList[par4]).getBlockEntity();
+ var13 = Block.blocksList[par4].getTileEntity(par5);
this.worldObj.setBlockTileEntity(var11, par2, var12, var13);
}
if (var13 != null)
{
var13.updateContainingBlockInfo();
+ var13.blockMetadata = par5;
}
}
}
- else if (var8 > 0 && Block.blocksList[var8] instanceof BlockContainer)
- {
- var13 = this.getChunkBlockTileEntity(par1, par2, par3);
-
- if (var13 != null)
- {
- var13.updateContainingBlockInfo();
- }
- }
-
this.isModified = true;
return true;
}
@@ -666,7 +708,7 @@
*/
public boolean setBlockMetadata(int par1, int par2, int par3, int par4)
{
- ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4];
+ ExtendedBlockStorage var5 = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]);
if (var5 == null)
{
@@ -686,7 +728,7 @@
var5.setExtBlockMetadata(par1, par2 & 15, par3, par4);
int var7 = var5.getExtBlockID(par1, par2 & 15, par3);
- if (var7 > 0 && Block.blocksList[var7] instanceof BlockContainer)
+ if (var7 > 0 && Block.blocksList[var7] != null && Block.blocksList[var7].hasTileEntity(var5.getExtBlockMetadata(par1, par2 & 15, par3)))
{
TileEntity var8 = this.getChunkBlockTileEntity(par1, par2, par3);
@@ -707,7 +749,7 @@
*/
public int getSavedLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4)
{
- ExtendedBlockStorage var5 = this.storageArrays[par3 >> 4];
+ ExtendedBlockStorage var5 = (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0 ? null : storageArrays[par3 >> 4]);
return var5 == null ? par1EnumSkyBlock.defaultLightValue : (par1EnumSkyBlock == EnumSkyBlock.Sky ? var5.getExtSkylightValue(par2, par3 & 15, par4) : (par1EnumSkyBlock == EnumSkyBlock.Block ? var5.getExtBlocklightValue(par2, par3 & 15, par4) : par1EnumSkyBlock.defaultLightValue));
}
@@ -717,6 +759,11 @@
*/
public void setLightValue(EnumSkyBlock par1EnumSkyBlock, int par2, int par3, int par4, int par5)
{
+ if (par3 >> 4 >= storageArrays.length || par3 >> 4 < 0)
+ {
+ return;
+ }
+
ExtendedBlockStorage var6 = this.storageArrays[par3 >> 4];
if (var6 == null)
@@ -750,7 +797,7 @@
*/
public int getBlockLightValue(int par1, int par2, int par3, int par4)
{
- ExtendedBlockStorage var5 = this.storageArrays[par2 >> 4];
+ ExtendedBlockStorage var5 = (par2 >> 4 >= storageArrays.length || par2 >> 4 < 0 ? null : storageArrays[par2 >> 4]);
if (var5 == null)
{
@@ -852,34 +899,33 @@
{
ChunkPosition var4 = new ChunkPosition(par1, par2, par3);
TileEntity var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
+
+ if (var5 != null && var5.isInvalid())
+ {
+ chunkTileEntityMap.remove(var4);
+ var5 = null;
+ }
if (var5 == null)
{
int var6 = this.getBlockID(par1, par2, par3);
-
- if (var6 <= 0 || !Block.blocksList[var6].hasTileEntity())
+ int meta = getBlockMetadata(par1, par2, par3);
+
+ if (var6 <= 0 || Block.blocksList[var6] == null || !Block.blocksList[var6].hasTileEntity(meta))
{
return null;
}
if (var5 == null)
{
- 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);
}
var5 = (TileEntity)this.chunkTileEntityMap.get(var4);
}
- if (var5 != null && var5.isInvalid())
- {
- this.chunkTileEntityMap.remove(var4);
- return null;
- }
- else
- {
- return var5;
- }
+ return var5;
}
/**
@@ -894,7 +940,7 @@
if (this.isChunkLoaded)
{
- this.worldObj.loadedTileEntityList.add(par1TileEntity);
+ this.worldObj.addTileEntity(par1TileEntity);
}
}
@@ -909,8 +955,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)))
{
+ TileEntity old = (TileEntity)chunkTileEntityMap.get(var5);
+ if (old != null)
+ {
+ old.invalidate();
+ }
par4TileEntity.validate();
this.chunkTileEntityMap.put(var5, par4TileEntity);
}
@@ -946,6 +998,7 @@
{
this.worldObj.addLoadedEntities(this.entityLists[var1]);
}
+ ForgeHooks.onChunkLoad(worldObj, this);
}
/**
@@ -966,6 +1019,7 @@
{
this.worldObj.unloadEntities(this.entityLists[var3]);
}
+ ForgeHooks.onChunkUnload(worldObj, this);
}
/**
@@ -982,8 +1036,8 @@
*/
public void getEntitiesWithinAABBForEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB, List par3List)
{
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
if (var4 < 0)
{
@@ -1030,8 +1084,8 @@
*/
public void getEntitiesOfTypeWithinAAAB(Class par1Class, AxisAlignedBB par2AxisAlignedBB, List par3List)
{
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + 2.0D) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.minY - World.MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.maxY + World.MAX_ENTITY_RADIUS) / 16.0D);
if (var4 < 0)
{
@@ -1228,6 +1282,16 @@
public void func_48494_a(byte[] par1ArrayOfByte, int par2, int par3, boolean par4)
{
+
+ Iterator iterator = chunkTileEntityMap.values().iterator();
+ while(iterator.hasNext())
+ {
+ TileEntity tileEntity = (TileEntity)iterator.next();
+ tileEntity.updateContainingBlockInfo();
+ tileEntity.getBlockMetadata();
+ tileEntity.getBlockType();
+ }
+
int var5 = 0;
int var6;
@@ -1324,12 +1388,26 @@
}
this.generateHeightMap();
- Iterator var10 = this.chunkTileEntityMap.values().iterator();
-
- while (var10.hasNext())
+
+ List<TileEntity> invalidList = new ArrayList<TileEntity>();
+ iterator = chunkTileEntityMap.values().iterator();
+ while (iterator.hasNext())
+ {
+ TileEntity tileEntity = (TileEntity)iterator.next();
+ int x = tileEntity.xCoord & 15;
+ int y = tileEntity.yCoord;
+ int z = tileEntity.zCoord & 15;
+ Block block = tileEntity.getBlockType();
+ if (block == null || block.blockID != getBlockID(x, y, z) || tileEntity.getBlockMetadata() != getBlockMetadata(x, y, z))
+ {
+ invalidList.add(tileEntity);
+ }
+ tileEntity.updateContainingBlockInfo();
+ }
+
+ for (TileEntity tileEntity : invalidList)
{
- TileEntity var9 = (TileEntity)var10.next();
- var9.updateContainingBlockInfo();
+ tileEntity.invalidate();
}
}
@@ -1438,4 +1516,18 @@
}
}
}
+
+ /** FORGE: Used to remove only invalid TileEntities */
+ public void cleanChunkBlockTileEntity(int x, int y, int z)
+ {
+ ChunkPosition position = new ChunkPosition(x, y, z);
+ if (isChunkLoaded)
+ {
+ TileEntity entity = (TileEntity)chunkTileEntityMap.get(position);
+ if (entity != null && entity.isInvalid())
+ {
+ chunkTileEntityMap.remove(position);
+ }
+ }
+ }
}

View file

@ -1,23 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ChunkProvider.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ChunkProvider.java 0000-00-00 00:00:00.000000000 -0000
@@ -8,6 +8,8 @@
import cpw.mods.fml.client.FMLClientHandler;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ChunkProvider implements IChunkProvider
{
/** A set of dropped chunks. Currently not used in single player. */
@@ -53,6 +55,11 @@
*/
public void dropChunk(int par1, int par2)
{
+ if(!ForgeHooks.canUnloadChunk(worldObj.getChunkFromChunkCoords(par1, par2)))
+ {
+ return;
+ }
+
ChunkCoordinates var3 = this.worldObj.getSpawnPoint();
int var4 = par1 * 16 + 8 - var3.posX;
int var5 = par2 * 16 + 8 - var3.posZ;

View file

@ -1,29 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ContainerCreative.java 0000-00-00 00:00:00.000000000 -0000
@@ -68,17 +68,20 @@
this.itemList.add(new ItemStack(var2[var12], 1, var13));
}
- for (var12 = 256; var12 < Item.itemsList.length; ++var12)
+ for (Block block : Block.blocksList)
{
- if (Item.itemsList[var12] != null && Item.itemsList[var12].shiftedIndex != Item.potion.shiftedIndex && Item.itemsList[var12].shiftedIndex != Item.monsterPlacer.shiftedIndex)
+ if (block != null)
{
- this.itemList.add(new ItemStack(Item.itemsList[var12]));
+ block.addCreativeItems((ArrayList)itemList);
}
}
-
- for (var12 = 1; var12 < 16; ++var12)
+
+ for (Item item : Item.itemsList)
{
- this.itemList.add(new ItemStack(Item.dyePowder.shiftedIndex, 1, var12));
+ if (item != null && !(item instanceof ItemBlock))
+ {
+ item.addCreativeItems((ArrayList)itemList);
+ }
}
Iterator var15 = EntityList.entityEggs.keySet().iterator();

View file

@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ContainerFurnace.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ContainerFurnace.java 0000-00-00 00:00:00.000000000 -0000
@@ -108,7 +108,7 @@
}
else if (par1 != 1 && par1 != 0)
{
- if (FurnaceRecipes.smelting().getSmeltingResult(var4.getItem().shiftedIndex) != null)
+ if (FurnaceRecipes.smelting().getSmeltingResult(var4) != null)
{
if (!this.mergeItemStack(var4, 0, 1, false))
{

View file

@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/CraftingManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -242,7 +242,7 @@
}
}
- 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 var11 = Item.itemsList[var3.itemID];
int var10 = var11.getMaxDamage() - var3.getItemDamageForDisplay();

View file

@ -1,149 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EffectRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,10 +1,14 @@
package net.minecraft.src;
import java.util.ArrayList;
+import java.util.Hashtable;
import java.util.List;
+import java.util.Map.Entry;
import java.util.Random;
import org.lwjgl.opengl.GL11;
+import net.minecraft.src.forge.*;
+
public class EffectRenderer
{
/** Reference to the World object. */
@@ -15,6 +19,8 @@
/** RNG. */
private Random rand = new Random();
+ private Hashtable<String, ArrayList<EntityFX>> effectList = new Hashtable<String, ArrayList<EntityFX>>();
+
public EffectRenderer(World par1World, RenderEngine par2RenderEngine)
{
if (par1World != null)
@@ -57,6 +63,24 @@
}
}
}
+
+ for (String key : effectList.keySet())
+ {
+ ArrayList<EntityFX> entry = effectList.get(key);
+ for (int y = 0; y < entry.size(); y++)
+ {
+ EntityFX var3 = entry.get(y);
+ var3.onUpdate();
+ if (var3.isDead)
+ {
+ entry.remove(y--);
+ }
+ }
+ if (effectList.size() == 0)
+ {
+ effectList.remove(key);
+ }
+ }
}
/**
@@ -109,6 +133,23 @@
var10.draw();
}
}
+
+ Tessellator tessallator = Tessellator.instance;
+
+ for (Entry<String, ArrayList<EntityFX>> entry : effectList.entrySet())
+ {
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, renderer.getTexture(entry.getKey()));
+ tessallator.startDrawingQuads();
+ for (EntityFX entryfx : entry.getValue())
+ {
+ if (entryfx.getFXLayer() != 3)
+ {
+ tessallator.setBrightness(entryfx.getBrightnessForRender(par2));
+ entryfx.renderParticle(tessallator, par2, var3, var7, var4, var5, var6);
+ }
+ }
+ tessallator.draw();
+ }
}
public void func_1187_b(Entity par1Entity, float par2)
@@ -141,6 +182,12 @@
{
this.fxLayers[var2].clear();
}
+
+ for (ArrayList<EntityFX> entry : effectList.values())
+ {
+ entry.clear();
+ }
+ effectList.clear();
}
public void addBlockDestroyEffects(int par1, int par2, int par3, int par4, int par5)
@@ -160,7 +207,7 @@
double var13 = (double)par2 + ((double)var9 + 0.5D) / (double)var7;
double var15 = (double)par3 + ((double)var10 + 0.5D) / (double)var7;
int var17 = this.rand.nextInt(6);
- this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_4041_a(par1, par2, par3));
+ this.addEffect((new EntityDiggingFX(this.worldObj, var11, var13, var15, var11 - (double)par1 - 0.5D, var13 - (double)par2 - 0.5D, var15 - (double)par3 - 0.5D, var6, var17, par5)).func_4041_a(par1, par2, par3), var6);
}
}
}
@@ -212,12 +259,49 @@
var8 = (double)par1 + var6.maxX + (double)var7;
}
- this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_4041_a(par1, par2, par3).multiplyVelocity(0.2F).func_405_d(0.6F));
+ this.addEffect((new EntityDiggingFX(this.worldObj, var8, var10, var12, 0.0D, 0.0D, 0.0D, var6, par4, this.worldObj.getBlockMetadata(par1, par2, par3))).func_4041_a(par1, par2, par3).multiplyVelocity(0.2F).func_405_d(0.6F), var6);
}
}
public String getStatistics()
{
- return "" + (this.fxLayers[0].size() + this.fxLayers[1].size() + this.fxLayers[2].size());
+ int size = 0;
+ for (List x : fxLayers)
+ {
+ size += x.size();
+ }
+ for (ArrayList<EntityFX> entry : effectList.values())
+ {
+ size += entry.size();
+ }
+ return Integer.toString(size);
+ }
+
+ public void addEffect(EntityFX effect, Object effectObject)
+ {
+ if (effectObject == null || !(effect instanceof EntityDiggingFX || effect instanceof EntityBreakingFX))
+ {
+ addEffect(effect);
+ return;
+ }
+
+ String texture = "/terrain.png";
+ if (effect.getFXLayer() == 0)
+ {
+ texture = "/particles.png";
+ }
+ else if (effect.getFXLayer() == 2)
+ {
+ texture = "/gui/items.png";
+ }
+ texture = ForgeHooksClient.getTexture(texture, effectObject);
+
+ ArrayList<EntityFX> set = effectList.get(texture);
+ if (set == null)
+ {
+ set = new ArrayList<EntityFX>();
+ effectList.put(texture, set);
+ }
+ set.add(effect);
}
}

View file

@ -1,17 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Enchantment.java 0000-00-00 00:00:00.000000000 -0000
@@ -191,4 +191,14 @@
String var2 = StatCollector.translateToLocal(this.getName());
return var2 + " " + StatCollector.translateToLocal("enchantment.level." + par1);
}
+
+ /**
+ * Called to determine if this enchantment can be applied to a ItemStack
+ * @param item The ItemStack that the enchantment might be put on
+ * @return True if the item is valid, false otherwise
+ */
+ public boolean canEnchantItem(ItemStack item)
+ {
+ return type.canEnchantItem(item.getItem());
+ }
}

View file

@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EnchantmentHelper.java 0000-00-00 00:00:00.000000000 -0000
@@ -357,7 +357,7 @@
{
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)
{

View file

@ -1,98 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Entity.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
@@ -173,6 +174,11 @@
*/
public boolean ignoreFrustumCheck;
public boolean isAirBorne;
+
+ /** Forge: Used to store custom data for each entity. */
+ private NBTTagCompound customEntityData;
+ protected boolean captureDrops = false;
+ protected ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
public Entity(World par1World)
{
@@ -214,6 +220,29 @@
}
protected abstract void entityInit();
+
+ /**
+ * 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.
+ * @return A NBTTagCompound
+ */
+ public NBTTagCompound getEntityData()
+ {
+ if (customEntityData == null)
+ {
+ customEntityData = new NBTTagCompound();
+ }
+ return customEntityData;
+ }
+
+ /**
+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position.
+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation.
+ */
+ public boolean shouldRiderSit()
+ {
+ return true;
+ }
public DataWatcher getDataWatcher()
{
@@ -1318,6 +1347,10 @@
par1NBTTagCompound.setShort("Fire", (short)this.fire);
par1NBTTagCompound.setShort("Air", (short)this.getAir());
par1NBTTagCompound.setBoolean("OnGround", this.onGround);
+ if (customEntityData != null)
+ {
+ par1NBTTagCompound.setCompoundTag("ForgeData", customEntityData);
+ }
this.writeEntityToNBT(par1NBTTagCompound);
}
@@ -1359,6 +1392,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 = par1NBTTagCompound.getCompoundTag("ForgeData");
+ }
this.readEntityFromNBT(par1NBTTagCompound);
}
@@ -1444,7 +1481,14 @@
{
EntityItem var3 = new EntityItem(this.worldObj, this.posX, this.posY + (double)par2, this.posZ, par1ItemStack);
var3.delayBeforeCanPickup = 10;
- this.worldObj.spawnEntityInWorld(var3);
+ if (captureDrops)
+ {
+ capturedDrops.add(var3);
+ }
+ else
+ {
+ this.worldObj.spawnEntityInWorld(var3);
+ }
return var3;
}
@@ -1717,7 +1761,7 @@
*/
public boolean isRiding()
{
- return this.ridingEntity != null || this.getFlag(2);
+ return (this.ridingEntity != null && ridingEntity.shouldRiderSit()) || this.getFlag(2);
}
/**

View file

@ -1,11 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityEnderman.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityEnderman.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,7 +2,7 @@
public class EntityEnderman extends EntityMob
{
- private static boolean[] canCarryBlocks = new boolean[256];
+ private static boolean[] canCarryBlocks = new boolean[Block.blocksList.length];
/** Is the enderman attacking another entity? */
public boolean isAttacking = false;

View file

@ -1,34 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityItem.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import cpw.mods.fml.client.FMLClientHandler;
+import net.minecraft.src.forge.ForgeHooks;
+
public class EntityItem extends Entity
{
/** The item stack of this EntityItem. */
@@ -172,7 +174,21 @@
if (!this.worldObj.isRemote)
{
int var2 = this.item.stackSize;
-
+
+ if (delayBeforeCanPickup == 0 && !ForgeHooks.onItemPickup(par1EntityPlayer, this))
+ {
+ FMLClientHandler.instance().notifyItemPickup(this, par1EntityPlayer);
+ 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)
+ {
+ setDead();
+ }
+ return;
+ }
+
+ var2 = item.stackSize;
+
if (this.delayBeforeCanPickup == 0 && par1EntityPlayer.inventory.addItemStackToInventory(this.item))
{
FMLClientHandler.instance().notifyItemPickup(this, par1EntityPlayer);

View file

@ -1,150 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityLiving.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,8 @@
import java.util.List;
import java.util.Random;
+import net.minecraft.src.forge.ForgeHooks;
+
public abstract class EntityLiving extends Entity
{
public int heartsHalvesLife = 20;
@@ -59,7 +61,7 @@
* in each step in the damage calculations, this is set to the 'carryover' that would result if someone was damaged
* .25 hearts (for example), and added to the damage in the next step
*/
- protected int carryoverDamage;
+ public int carryoverDamage;
/** Number of ticks since this EntityLiving last produced its sound */
private int livingSoundTime;
@@ -303,6 +305,7 @@
public void setAttackTarget(EntityLiving par1EntityLiving)
{
this.attackTarget = par1EntityLiving;
+ ForgeHooks.onEntityLivingSetAttackTarget(this, par1EntityLiving);
}
public boolean func_48100_a(Class par1Class)
@@ -359,6 +362,7 @@
{
this.entityLivingToAttack = par1EntityLiving;
this.revengeTimer = this.entityLivingToAttack != null ? 60 : 0;
+ ForgeHooks.onEntityLivingSetAttackTarget(this, par1EntityLiving);
}
protected void entityInit()
@@ -641,7 +645,12 @@
* Called to update the entity's position/logic.
*/
public void onUpdate()
- {
+ {
+ if (ForgeHooks.onEntityLivingUpdate(this))
+ {
+ return;
+ }
+
super.onUpdate();
if (this.arrowHitTempCounter > 0)
@@ -834,6 +843,11 @@
*/
public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
{
+ if (ForgeHooks.onEntityLivingAttacked(this, par1DamageSource, par2))
+ {
+ return false;
+ }
+
if (this.worldObj.isRemote)
{
return false;
@@ -1012,6 +1026,12 @@
*/
protected void damageEntity(DamageSource par1DamageSource, int par2)
{
+ par2 = ForgeHooks.onEntityLivingHurt(this, par1DamageSource, par2);
+ if (par2 == 0)
+ {
+ return;
+ }
+
par2 = this.applyArmorCalculations(par1DamageSource, par2);
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.health -= par2;
@@ -1075,6 +1095,11 @@
*/
public void onDeath(DamageSource par1DamageSource)
{
+ if (ForgeHooks.onEntityLivingDeath(this, par1DamageSource))
+ {
+ return;
+ }
+
Entity var2 = par1DamageSource.getEntity();
if (this.scoreValue >= 0 && var2 != null)
@@ -1098,13 +1123,17 @@
var3 = EnchantmentHelper.getLootingModifier(((EntityPlayer)var2).inventory);
}
+ captureDrops = true;
+ capturedDrops.clear();
+ int var4 = 0;
+
if (!this.isChild())
{
this.dropFewItems(this.recentlyHit > 0, var3);
if (this.recentlyHit > 0)
{
- int var4 = this.rand.nextInt(200) - var3;
+ var4 = this.rand.nextInt(200) - var3;
if (var4 < 5)
{
@@ -1112,6 +1141,13 @@
}
}
}
+
+ captureDrops = false;
+ ForgeHooks.onEntityLivingDrops(this, par1DamageSource, capturedDrops, var3, recentlyHit > 0, var4);
+ for (EntityItem item : capturedDrops)
+ {
+ worldObj.spawnEntityInWorld(item);
+ }
}
this.worldObj.setEntityState(this, (byte)3);
@@ -1155,6 +1191,11 @@
*/
protected void fall(float par1)
{
+ if (ForgeHooks.onEntityLivingFall(this, par1))
+ {
+ return;
+ }
+
super.fall(par1);
int var2 = (int)Math.ceil((double)(par1 - 3.0F));
@@ -1342,7 +1383,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);
}
/**
@@ -1613,6 +1654,8 @@
}
this.isAirBorne = true;
+
+ ForgeHooks.onEntityLivingJump(this);
}
/**

View file

@ -1,975 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityMinecart.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,30 +1,50 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.List;
+import net.minecraft.src.forge.*;
+
public class EntityMinecart extends Entity implements IInventory
{
/** Array of item stacks stored in minecart (for storage minecarts). */
- private ItemStack[] cargoItems;
- private int fuel;
- private boolean field_856_i;
+ protected ItemStack[] cargoItems;
+ protected int fuel;
+ protected boolean field_856_i;
/** The type of minecart, 2 for powered, 1 for storage. */
public int minecartType;
public double pushX;
public double pushZ;
- private static final int[][][] field_855_j = new int[][][] {{{0, 0, -1}, {0, 0, 1}}, {{ -1, 0, 0}, {1, 0, 0}}, {{ -1, -1, 0}, {1, 0, 0}}, {{ -1, 0, 0}, {1, -1, 0}}, {{0, 0, -1}, {0, -1, 1}}, {{0, -1, -1}, {0, 0, 1}}, {{0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, { -1, 0, 0}}, {{0, 0, -1}, { -1, 0, 0}}, {{0, 0, -1}, {1, 0, 0}}};
+ protected static final int[][][] field_855_j = new int[][][] {{{0, 0, -1}, {0, 0, 1}}, {{ -1, 0, 0}, {1, 0, 0}}, {{ -1, -1, 0}, {1, 0, 0}}, {{ -1, 0, 0}, {1, -1, 0}}, {{0, 0, -1}, {0, -1, 1}}, {{0, -1, -1}, {0, 0, 1}}, {{0, 0, 1}, {1, 0, 0}}, {{0, 0, 1}, { -1, 0, 0}}, {{0, 0, -1}, { -1, 0, 0}}, {{0, 0, -1}, {1, 0, 0}}};
/** appears to be the progress of the turn */
- private int turnProgress;
- private double minecartX;
- private double minecartY;
- private double minecartZ;
- private double minecartYaw;
- private double minecartPitch;
- private double velocityX;
- private double velocityY;
- private double velocityZ;
+ protected int turnProgress;
+ protected double minecartX;
+ protected double minecartY;
+ protected double minecartZ;
+ protected double minecartYaw;
+ protected double minecartPitch;
+ protected double velocityX;
+ protected double velocityY;
+ protected double velocityZ;
+
+ /* Forge: Minecart Compatibility Layer Integration. */
+ public static float defaultMaxSpeedRail = 0.4f;
+ public static float defaultMaxSpeedGround = 0.4f;
+ public static float defaultMaxSpeedAirLateral = 0.4f;
+ public static float defaultMaxSpeedAirVertical = -1f;
+ public static double defaultDragAir = 0.94999998807907104D;
+ protected boolean canUseRail = true;
+ protected boolean canBePushed = true;
+ private static IMinecartCollisionHandler collisionHandler = null;
+
+ /* Instance versions of the above physics properties */
+ protected float maxSpeedRail;
+ protected float maxSpeedGround;
+ protected float maxSpeedAirLateral;
+ protected float maxSpeedAirVertical;
+ protected double dragAir;
public EntityMinecart(World par1World)
{
@@ -35,6 +55,18 @@
this.preventEntitySpawning = true;
this.setSize(0.98F, 0.7F);
this.yOffset = this.height / 2.0F;
+
+ maxSpeedRail = defaultMaxSpeedRail;
+ maxSpeedGround = defaultMaxSpeedGround;
+ maxSpeedAirLateral = defaultMaxSpeedAirLateral;
+ maxSpeedAirVertical = defaultMaxSpeedAirVertical;
+ dragAir = defaultDragAir;
+ }
+
+ public EntityMinecart(World world, int type)
+ {
+ this(world);
+ minecartType = type;
}
/**
@@ -60,6 +92,10 @@
*/
public AxisAlignedBB getCollisionBox(Entity par1Entity)
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getCollisionBox(this, par1Entity);
+ }
return par1Entity.boundingBox;
}
@@ -68,6 +104,10 @@
*/
public AxisAlignedBB getBoundingBox()
{
+ if (getCollisionHandler() != null)
+ {
+ return getCollisionHandler().getBoundingBox(this);
+ }
return null;
}
@@ -76,7 +116,7 @@
*/
public boolean canBePushed()
{
- return true;
+ return canBePushed;
}
public EntityMinecart(World par1World, double par2, double par4, double par6, int par8)
@@ -120,48 +160,7 @@
}
this.setDead();
- this.dropItemWithOffset(Item.minecartEmpty.shiftedIndex, 1, 0.0F);
-
- if (this.minecartType == 1)
- {
- EntityMinecart var3 = this;
-
- for (int var4 = 0; var4 < var3.getSizeInventory(); ++var4)
- {
- ItemStack var5 = var3.getStackInSlot(var4);
-
- if (var5 != null)
- {
- float var6 = this.rand.nextFloat() * 0.8F + 0.1F;
- float var7 = this.rand.nextFloat() * 0.8F + 0.1F;
- float var8 = this.rand.nextFloat() * 0.8F + 0.1F;
-
- while (var5.stackSize > 0)
- {
- int var9 = this.rand.nextInt(21) + 10;
-
- if (var9 > var5.stackSize)
- {
- var9 = var5.stackSize;
- }
-
- var5.stackSize -= var9;
- EntityItem var10 = new EntityItem(this.worldObj, this.posX + (double)var6, this.posY + (double)var7, this.posZ + (double)var8, new ItemStack(var5.itemID, var9, var5.getItemDamage()));
- float var11 = 0.05F;
- var10.motionX = (double)((float)this.rand.nextGaussian() * var11);
- var10.motionY = (double)((float)this.rand.nextGaussian() * var11 + 0.2F);
- var10.motionZ = (double)((float)this.rand.nextGaussian() * var11);
- this.worldObj.spawnEntityInWorld(var10);
- }
- }
- }
-
- this.dropItemWithOffset(Block.chest.blockID, 1, 0.0F);
- }
- else if (this.minecartType == 2)
- {
- this.dropItemWithOffset(Block.stoneOvenIdle.blockID, 1, 0.0F);
- }
+ dropCartAsItem();
}
return true;
@@ -254,7 +253,7 @@
this.kill();
}
- if (this.isMinecartPowered() && this.rand.nextInt(4) == 0)
+ if (this.isMinecartPowered() && this.rand.nextInt(4) == 0 && minecartType == 2 && getClass() == EntityMinecart.class)
{
this.worldObj.spawnParticle("largesmoke", this.posX, this.posY + 0.8D, this.posZ, 0.0D, 0.0D, 0.0D);
}
@@ -309,49 +308,26 @@
double var6 = 0.0078125D;
int var8 = this.worldObj.getBlockId(var1, var2, var3);
- if (BlockRail.isRailBlock(var8))
+ if (canUseRail() && BlockRail.isRailBlock(var8))
{
Vec3D var9 = this.func_514_g(this.posX, this.posY, this.posZ);
- int var10 = this.worldObj.getBlockMetadata(var1, var2, var3);
+ int var10 = ((BlockRail)Block.blocksList[var8]).getBasicRailMetadata(worldObj, this, var1, var2, var3);
this.posY = (double)var2;
boolean var11 = false;
boolean var12 = false;
if (var8 == Block.railPowered.blockID)
{
- var11 = (var10 & 8) != 0;
+ var11 = (worldObj.getBlockMetadata(var1, var2, var3) & 8) != 0;
var12 = !var11;
}
- if (((BlockRail)Block.blocksList[var8]).isPowered())
- {
- var10 &= 7;
- }
-
if (var10 >= 2 && var10 <= 5)
{
this.posY = (double)(var2 + 1);
}
-
- if (var10 == 2)
- {
- this.motionX -= var6;
- }
-
- if (var10 == 3)
- {
- this.motionX += var6;
- }
-
- if (var10 == 4)
- {
- this.motionZ += var6;
- }
-
- if (var10 == 5)
- {
- this.motionZ -= var6;
- }
+
+ adjustSlopeVelocities(var10);
int[][] var13 = field_855_j[var10];
double var14 = (double)(var13[1][0] - var13[0][0]);
@@ -370,7 +346,7 @@
this.motionZ = var22 * var16 / var18;
double var24;
- if (var12)
+ if (var12 && shouldDoRailFunctions())
{
var24 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
@@ -420,36 +396,8 @@
this.posX = var26 + var14 * var24;
this.posZ = var28 + var16 * var24;
this.setPosition(this.posX, this.posY + (double)this.yOffset, this.posZ);
- var34 = this.motionX;
- var36 = this.motionZ;
-
- if (this.riddenByEntity != null)
- {
- var34 *= 0.75D;
- var36 *= 0.75D;
- }
-
- if (var34 < -var4)
- {
- var34 = -var4;
- }
-
- if (var34 > var4)
- {
- var34 = var4;
- }
-
- if (var36 < -var4)
- {
- var36 = -var4;
- }
-
- if (var36 > var4)
- {
- var36 = var4;
- }
-
- this.moveEntity(var34, 0.0D, var36);
+
+ moveMinecartOnRail(var1, var2, var3);
if (var13[0][1] != 0 && MathHelper.floor_double(this.posX) - var1 == var13[0][0] && MathHelper.floor_double(this.posZ) - var3 == var13[0][2])
{
@@ -460,41 +408,7 @@
this.setPosition(this.posX, this.posY + (double)var13[1][1], this.posZ);
}
- if (this.riddenByEntity != null)
- {
- this.motionX *= 0.996999979019165D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.996999979019165D;
- }
- else
- {
- if (this.minecartType == 2)
- {
- var38 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ);
-
- if (var38 > 0.01D)
- {
- this.pushX /= var38;
- this.pushZ /= var38;
- double var40 = 0.04D;
- this.motionX *= 0.800000011920929D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.800000011920929D;
- this.motionX += this.pushX * var40;
- this.motionZ += this.pushZ * var40;
- }
- else
- {
- this.motionX *= 0.8999999761581421D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.8999999761581421D;
- }
- }
-
- this.motionX *= 0.9599999785423279D;
- this.motionY *= 0.0D;
- this.motionZ *= 0.9599999785423279D;
- }
+ applyDragAndPushForces();
Vec3D var52 = this.func_514_g(this.posX, this.posY, this.posZ);
@@ -523,30 +437,15 @@
}
double var41;
-
- if (this.minecartType == 2)
+
+ updatePushForces();
+
+ if(shouldDoRailFunctions())
{
- var41 = (double)MathHelper.sqrt_double(this.pushX * this.pushX + this.pushZ * this.pushZ);
-
- if (var41 > 0.01D && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.001D)
- {
- this.pushX /= var41;
- this.pushZ /= var41;
-
- if (this.pushX * this.motionX + this.pushZ * this.motionZ < 0.0D)
- {
- this.pushX = 0.0D;
- this.pushZ = 0.0D;
- }
- else
- {
- this.pushX = this.motionX;
- this.pushZ = this.motionZ;
- }
- }
+ ((BlockRail)Block.blocksList[var8]).onMinecartPass(worldObj, this, var1, var2, var3);
}
- if (var11)
+ if (var11 && shouldDoRailFunctions())
{
var41 = Math.sqrt(this.motionX * this.motionX + this.motionZ * this.motionZ);
@@ -582,41 +481,7 @@
}
else
{
- if (this.motionX < -var4)
- {
- this.motionX = -var4;
- }
-
- if (this.motionX > var4)
- {
- this.motionX = var4;
- }
-
- if (this.motionZ < -var4)
- {
- this.motionZ = -var4;
- }
-
- if (this.motionZ > var4)
- {
- this.motionZ = var4;
- }
-
- if (this.onGround)
- {
- this.motionX *= 0.5D;
- this.motionY *= 0.5D;
- this.motionZ *= 0.5D;
- }
-
- this.moveEntity(this.motionX, this.motionY, this.motionZ);
-
- if (!this.onGround)
- {
- this.motionX *= 0.949999988079071D;
- this.motionY *= 0.949999988079071D;
- this.motionZ *= 0.949999988079071D;
- }
+ moveMinecartOffRail(var1, var2, var3);
}
this.rotationPitch = 0.0F;
@@ -652,7 +517,18 @@
}
this.setRotation(this.rotationYaw, this.rotationPitch);
- List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ AxisAlignedBB box = null;
+ if (getCollisionHandler() != null)
+ {
+ box = getCollisionHandler().getMinecartCollisionBox(this);
+ }
+ else
+ {
+ box = boundingBox.expand(0.2D, 0.0D, 0.2D);
+ }
+
+ List var15 = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, box);
if (var15 != null && var15.size() > 0)
{
@@ -677,17 +553,8 @@
this.riddenByEntity = null;
}
- if (this.fuel > 0)
- {
- --this.fuel;
- }
-
- if (this.fuel <= 0)
- {
- this.pushX = this.pushZ = 0.0D;
- }
-
- this.setMinecartPowered(this.fuel > 0);
+ updateFuel();
+ ForgeHooks.onMinecartUpdate(this, var1, var2, var3);
}
}
@@ -710,12 +577,7 @@
}
else
{
- int var13 = this.worldObj.getBlockMetadata(var9, var10, var11);
-
- if (((BlockRail)Block.blocksList[var12]).isPowered())
- {
- var13 &= 7;
- }
+ int var13 = ((BlockRail)Block.blocksList[var12]).getBasicRailMetadata(worldObj, this, var9, var10, var11);
par3 = (double)var10;
@@ -761,14 +623,9 @@
if (BlockRail.isRailBlock(var10))
{
- int var11 = this.worldObj.getBlockMetadata(var7, var8, var9);
+ int var11 = ((BlockRail)Block.blocksList[var10]).getBasicRailMetadata(worldObj, this, var7, var8, var9);
par3 = (double)var8;
- if (((BlockRail)Block.blocksList[var10]).isPowered())
- {
- var11 &= 7;
- }
-
if (var11 >= 2 && var11 <= 5)
{
par3 = (double)(var8 + 1);
@@ -833,13 +690,14 @@
{
par1NBTTagCompound.setInteger("Type", this.minecartType);
- if (this.minecartType == 2)
+ if (isPoweredCart())
{
par1NBTTagCompound.setDouble("PushX", this.pushX);
par1NBTTagCompound.setDouble("PushZ", this.pushZ);
- par1NBTTagCompound.setShort("Fuel", (short)this.fuel);
+ par1NBTTagCompound.setInteger("Fuel", this.fuel);
}
- else if (this.minecartType == 1)
+
+ if (getSizeInventory() > 0)
{
NBTTagList var2 = new NBTTagList();
@@ -865,13 +723,21 @@
{
this.minecartType = par1NBTTagCompound.getInteger("Type");
- if (this.minecartType == 2)
+ if (isPoweredCart())
{
this.pushX = par1NBTTagCompound.getDouble("PushX");
this.pushZ = par1NBTTagCompound.getDouble("PushZ");
- this.fuel = par1NBTTagCompound.getShort("Fuel");
+ try
+ {
+ this.fuel = par1NBTTagCompound.getInteger("Fuel");
+ }
+ catch (ClassCastException e)
+ {
+ this.fuel = par1NBTTagCompound.getShort("Fuel");
+ }
}
- else if (this.minecartType == 1)
+
+ if (getSizeInventory() > 0)
{
NBTTagList var2 = par1NBTTagCompound.getTagList("Items");
this.cargoItems = new ItemStack[this.getSizeInventory()];
@@ -899,11 +765,18 @@
*/
public void applyEntityCollision(Entity par1Entity)
{
+ ForgeHooks.onMinecartEntityCollision(this, par1Entity);
+ if (getCollisionHandler() != null)
+ {
+ getCollisionHandler().onEntityCollision(this, par1Entity);
+ return;
+ }
+
if (!this.worldObj.isRemote)
{
if (par1Entity != this.riddenByEntity)
{
- if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && this.minecartType == 0 && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null)
+ if (par1Entity instanceof EntityLiving && !(par1Entity instanceof EntityPlayer) && !(par1Entity instanceof EntityIronGolem) && canBeRidden() && this.motionX * this.motionX + this.motionZ * this.motionZ > 0.01D && this.riddenByEntity == null && par1Entity.ridingEntity == null)
{
par1Entity.mountEntity(this);
}
@@ -949,7 +822,7 @@
double var18 = par1Entity.motionX + this.motionX;
double var20 = par1Entity.motionZ + this.motionZ;
- if (((EntityMinecart)par1Entity).minecartType == 2 && this.minecartType != 2)
+ if (((EntityMinecart)par1Entity).isPoweredCart() && !isPoweredCart())
{
this.motionX *= 0.20000000298023224D;
this.motionZ *= 0.20000000298023224D;
@@ -957,7 +830,7 @@
par1Entity.motionX *= 0.949999988079071D;
par1Entity.motionZ *= 0.949999988079071D;
}
- else if (((EntityMinecart)par1Entity).minecartType != 2 && this.minecartType == 2)
+ else if (!((EntityMinecart)par1Entity).isPoweredCart() && isPoweredCart())
{
par1Entity.motionX *= 0.20000000298023224D;
par1Entity.motionZ *= 0.20000000298023224D;
@@ -992,7 +865,7 @@
*/
public int getSizeInventory()
{
- return 27;
+ return (minecartType == 1 && getClass() == EntityMinecart.class ? 27 : 0);
}
/**
@@ -1095,7 +968,12 @@
*/
public boolean interact(EntityPlayer par1EntityPlayer)
{
- if (this.minecartType == 0)
+ if (!ForgeHooks.onMinecartInteract(this, par1EntityPlayer))
+ {
+ return true;
+ }
+
+ if (canBeRidden())
{
if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != par1EntityPlayer)
{
@@ -1107,14 +985,14 @@
par1EntityPlayer.mountEntity(this);
}
}
- else if (this.minecartType == 1)
+ else if (getSizeInventory() > 0)
{
if (!this.worldObj.isRemote)
{
par1EntityPlayer.displayGUIChest(this);
}
}
- else if (this.minecartType == 2)
+ else if (this.minecartType == 2 && getClass() == EntityMinecart.class)
{
ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
@@ -1173,7 +1051,7 @@
/**
* Is this minecart powered (Fuel > 0)
*/
- protected boolean isMinecartPowered()
+ public boolean isMinecartPowered()
{
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
}
@@ -1226,4 +1104,373 @@
{
return this.dataWatcher.getWatchableObjectInt(18);
}
+
+ /**
+ * Drops the cart as a item. The exact item dropped is defined by getItemDropped().
+ */
+ public void dropCartAsItem()
+ {
+ for(ItemStack item : getItemsDropped())
+ {
+ entityDropItem(item, 0);
+ }
+ }
+
+ /**
+ * Override this to define which items your cart drops when broken.
+ * This does not include items contained in the inventory,
+ * that is handled elsewhere.
+ * @return A list of items dropped.
+ */
+ public List<ItemStack> getItemsDropped()
+ {
+ List<ItemStack> items = new ArrayList<ItemStack>();
+ items.add(new ItemStack(Item.minecartEmpty));
+
+ switch(minecartType)
+ {
+ case 1:
+ items.add(new ItemStack(Block.chest));
+ break;
+ case 2:
+ items.add(new ItemStack(Block.stoneOvenIdle));
+ break;
+ }
+ return items;
+ }
+
+ /**
+ * This function returns an ItemStack that represents this cart.
+ * This should be an ItemStack that can be used by the player to place the cart.
+ * This is the item that was registered with the cart via the registerMinecart function,
+ * but is not necessary the item the cart drops when destroyed.
+ * @return An ItemStack that can be used to place the cart.
+ */
+ public ItemStack getCartItem()
+ {
+ return MinecraftForge.getItemForCart(this);
+ }
+
+ /**
+ * Returns true if this cart is self propelled.
+ * @return True if powered.
+ */
+ public boolean isPoweredCart()
+ {
+ return minecartType == 2 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart is a storage cart
+ * Some carts may have inventories but not be storage carts
+ * and some carts without inventories may be storage carts.
+ * @return True if this cart should be classified as a storage cart.
+ */
+ public boolean isStorageCart()
+ {
+ return minecartType == 1 && getClass() == EntityMinecart.class;
+ }
+
+ /**
+ * Returns true if this cart can be ridden by an Entity.
+ * @return True if this cart can be ridden.
+ */
+ public boolean canBeRidden()
+ {
+ if(minecartType == 0 && getClass() == EntityMinecart.class)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this cart can currently use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @return True if the minecart can use rails.
+ */
+ public boolean canUseRail()
+ {
+ return canUseRail;
+ }
+
+ /**
+ * Set whether the minecart can use rails.
+ * This function is mainly used to gracefully detach a minecart from a rail.
+ * @param use Whether the minecart can currently use rails.
+ */
+ public void setCanUseRail(boolean use)
+ {
+ canUseRail = use;
+ }
+
+ /**
+ * Return false if this cart should not call IRail.onMinecartPass() and should ignore Powered Rails.
+ * @return True if this cart should call IRail.onMinecartPass().
+ */
+ public boolean shouldDoRailFunctions()
+ {
+ return true;
+ }
+
+ /**
+ * Simply returns the minecartType variable.
+ * @return minecartType
+ */
+ public int getMinecartType()
+ {
+ return minecartType;
+ }
+
+ /**
+ * Gets the current global Minecart Collision handler if none
+ * is registered, returns null
+ * @return The collision handler or null
+ */
+ public static IMinecartCollisionHandler getCollisionHandler()
+ {
+ return collisionHandler;
+ }
+
+ /**
+ * Sets the global Minecart Collision handler, overwrites any
+ * that is currently set.
+ * @param handler The new handler
+ */
+ public static void setCollisionHandler(IMinecartCollisionHandler handler)
+ {
+ collisionHandler = handler;
+ }
+
+ /**
+ * Carts should return their drag factor here
+ * @return The drag rate.
+ */
+ protected double getDrag()
+ {
+ return riddenByEntity != null ? 0.99D : 0.96D;
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies drag and updates push forces.
+ */
+ protected void applyDragAndPushForces()
+ {
+ if(isPoweredCart())
+ {
+ double d27 = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(d27 > 0.01D)
+ {
+ pushX /= d27;
+ pushZ /= d27;
+ double d29 = 0.04;
+ motionX *= 0.8D;
+ motionY *= 0.0D;
+ motionZ *= 0.8D;
+ motionX += pushX * d29;
+ motionZ += pushZ * d29;
+ } else
+ {
+ motionX *= 0.9D;
+ motionY *= 0.0D;
+ motionZ *= 0.9D;
+ }
+ }
+ motionX *= getDrag();
+ motionY *= 0.0D;
+ motionZ *= getDrag();
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code updates push forces.
+ */
+ protected void updatePushForces()
+ {
+ if(isPoweredCart())
+ {
+ double push = MathHelper.sqrt_double(pushX * pushX + pushZ * pushZ);
+ if(push > 0.01D && motionX * motionX + motionZ * motionZ > 0.001D)
+ {
+ pushX /= push;
+ pushZ /= push;
+ if(pushX * motionX + pushZ * motionZ < 0.0D)
+ {
+ pushX = 0.0D;
+ pushZ = 0.0D;
+ } else
+ {
+ pushX = motionX;
+ pushZ = motionZ;
+ }
+ }
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when on a rail.
+ */
+ protected void moveMinecartOnRail(int i, int j, int k)
+ {
+ int id = worldObj.getBlockId(i, j, k);
+ if (!BlockRail.isRailBlock(id))
+ {
+ return;
+ }
+ float railMaxSpeed = ((BlockRail)Block.blocksList[id]).getRailMaxSpeed(worldObj, this, i, j, k);
+
+ double maxSpeed = Math.min(railMaxSpeed, getMaxSpeedRail());
+ double mX = motionX;
+ double mZ = motionZ;
+ if(riddenByEntity != null)
+ {
+ mX *= 0.75D;
+ mZ *= 0.75D;
+ }
+ if(mX < -maxSpeed) mX = -maxSpeed;
+ if(mX > maxSpeed) mX = maxSpeed;
+ if(mZ < -maxSpeed) mZ = -maxSpeed;
+ if(mZ > maxSpeed) mZ = maxSpeed;
+ moveEntity(mX, 0.0D, mZ);
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code handles minecart movement and speed capping when not on a rail.
+ */
+ protected void moveMinecartOffRail(int i, int j, int k)
+ {
+ double d2 = getMaxSpeedGround();
+ if(!onGround)
+ {
+ d2 = getMaxSpeedAirLateral();
+ }
+ if(motionX < -d2) motionX = -d2;
+ if(motionX > d2) motionX = d2;
+ if(motionZ < -d2) motionZ = -d2;
+ if(motionZ > d2) motionZ = d2;
+ double moveY = motionY;
+ if(getMaxSpeedAirVertical() > 0 && motionY > getMaxSpeedAirVertical())
+ {
+ moveY = getMaxSpeedAirVertical();
+ if(Math.abs(motionX) < 0.3f && Math.abs(motionZ) < 0.3f)
+ {
+ moveY = 0.15f;
+ motionY = moveY;
+ }
+ }
+ if(onGround)
+ {
+ motionX *= 0.5D;
+ motionY *= 0.5D;
+ motionZ *= 0.5D;
+ }
+ moveEntity(motionX, moveY, motionZ);
+ if(!onGround)
+ {
+ motionX *= getDragAir();
+ motionY *= getDragAir();
+ motionZ *= getDragAir();
+ }
+ }
+
+ /**
+ * Moved to allow overrides.
+ * This code applies fuel consumption.
+ */
+ protected void updateFuel()
+ {
+ if (fuel > 0) fuel--;
+ if (fuel <= 0) pushX = pushZ = 0.0D;
+ setMinecartPowered(fuel > 0);
+ }
+
+ /**
+ * Moved to allow overrides, This code handle slopes affecting velocity.
+ * @param metadata The blocks position metadata
+ */
+ protected void adjustSlopeVelocities(int metadata)
+ {
+ double acceleration = 0.0078125D;
+ if (metadata == 2)
+ {
+ motionX -= acceleration;
+ }
+ else if (metadata == 3)
+ {
+ motionX += acceleration;
+ }
+ else if (metadata == 4)
+ {
+ motionZ += acceleration;
+ }
+ else if (metadata == 5)
+ {
+ motionZ -= acceleration;
+ }
+ }
+
+ /**
+ * Getters/setters for physics variables
+ */
+
+ /**
+ * Returns the carts max speed.
+ * Carts going faster than 1.1 cause issues with chunk loading.
+ * Carts cant traverse slopes or corners at greater than 0.5 - 0.6.
+ * This value is compared with the rails max speed to determine
+ * the carts current max speed. A normal rails max speed is 0.4.
+ * @return Carts max speed.
+ */
+ public float getMaxSpeedRail()
+ {
+ return maxSpeedRail;
+ }
+
+ public void setMaxSpeedRail(float value)
+ {
+ maxSpeedRail = value;
+ }
+
+ public float getMaxSpeedGround()
+ {
+ return maxSpeedGround;
+ }
+
+ public void setMaxSpeedGround(float value)
+ {
+ maxSpeedGround = value;
+ }
+
+ public float getMaxSpeedAirLateral()
+ {
+ return maxSpeedAirLateral;
+ }
+
+ public void setMaxSpeedAirLateral(float value)
+ {
+ maxSpeedAirLateral = value;
+ }
+
+ public float getMaxSpeedAirVertical()
+ {
+ return maxSpeedAirVertical;
+ }
+
+ public void setMaxSpeedAirVertical(float value)
+ {
+ maxSpeedAirVertical = value;
+ }
+
+ public double getDragAir()
+ {
+ return dragAir;
+ }
+
+ public void setDragAir(double value)
+ {
+ dragAir = value;
+ }
}

View file

@ -1,78 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityMooshroom.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityMooshroom.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,10 @@
package net.minecraft.src;
-public class EntityMooshroom extends EntityCow
+import java.util.ArrayList;
+
+import net.minecraft.src.forge.IShearable;
+
+public class EntityMooshroom extends EntityCow implements IShearable
{
public EntityMooshroom(World par1World)
{
@@ -30,32 +34,7 @@
return true;
}
}
-
- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && this.getGrowingAge() >= 0)
- {
- this.setDead();
- 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)
- {
- EntityCow var3 = new EntityCow(this.worldObj);
- var3.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
- var3.setEntityHealth(this.getHealth());
- 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(par1EntityPlayer);
- }
+ return super.interact(par1EntityPlayer);
}
/**
@@ -65,4 +44,29 @@
{
return new EntityMooshroom(this.worldObj);
}
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
+ {
+ return getGrowingAge() >= 0;
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
+ {
+ setDead();
+ EntityCow entitycow = new EntityCow(worldObj);
+ entitycow.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch);
+ entitycow.setEntityHealth(getHealth());
+ entitycow.renderYawOffset = renderYawOffset;
+ worldObj.spawnEntityInWorld(entitycow);
+ worldObj.spawnParticle("largeexplode", posX, posY + (double)(height / 2.0F), posZ, 0.0D, 0.0D, 0.0D);
+
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ for (int x = 0; x < 5; x++)
+ {
+ ret.add(new ItemStack(Block.mushroomRed));
+ }
+ return ret;
+ }
}

View file

@ -1,12 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityOcelot.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityOcelot.java 0000-00-00 00:00:00.000000000 -0000
@@ -321,7 +321,8 @@
int var4 = this.worldObj.getBlockId(var1, var2 - 1, var3);
- if (var4 == Block.grass.blockID || var4 == Block.leaves.blockID)
+ Block block = Block.blocksList[var4];
+ if (var4 == Block.grass.blockID || (block != null && block.isLeaves(worldObj, var1, var2 - 1, var3)))
{
return true;
}

View file

@ -1,246 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
@@ -7,6 +7,8 @@
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.TickType;
+import net.minecraft.src.forge.*;
+
public abstract class EntityPlayer extends EntityLiving
{
/** Inventory of the player */
@@ -215,6 +217,7 @@
}
else
{
+ itemInUse.getItem().onUsingItemTick(itemInUse, this, itemInUseCount);
if (this.itemInUseCount <= 25 && this.itemInUseCount % 4 == 0)
{
this.updateItemUse(var1, 5);
@@ -624,7 +627,16 @@
*/
public EntityItem dropOneItem()
{
- return this.dropPlayerItemWithRandomChoice(this.inventory.decrStackSize(this.inventory.currentItem, 1), false);
+ ItemStack stack = inventory.getCurrentItem();
+ if (stack == null)
+ {
+ return null;
+ }
+ if (stack.getItem().onDroppedByPlayer(stack, this))
+ {
+ return dropPlayerItemWithRandomChoice(inventory.decrStackSize(inventory.currentItem, 1), false);
+ }
+ return null;
}
/**
@@ -690,14 +702,22 @@
/**
* 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 par1Block)
{
- 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);
- if (var4 > 0 && this.inventory.canHarvestBlock(par1Block))
+ if (var4 > 0 && ForgeHooks.canHarvestBlock(par1Block, this, meta))
{
var3 = var2 + (float)(var4 * var4 + 1);
}
@@ -984,12 +1004,22 @@
*/
protected void damageEntity(DamageSource par1DamageSource, int par2)
{
+ par2 = ForgeHooks.onEntityLivingHurt(this, par1DamageSource, par2);
+ if (par2 == 0)
+ {
+ return;
+ }
+
if (!par1DamageSource.isUnblockable() && this.isBlocking())
{
par2 = 1 + par2 >> 1;
}
- par2 = this.applyArmorCalculations(par1DamageSource, par2);
+ par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2);
+ if (par2 <= 0)
+ {
+ return;
+ }
par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
this.addExhaustion(par1DamageSource.getHungerDamage());
this.health -= par2;
@@ -1020,6 +1050,10 @@
*/
public void useCurrentItemOnEntity(Entity par1Entity)
{
+ if (!ForgeHooks.onEntityInteract(this, par1Entity, false))
+ {
+ return;
+ }
if (!par1Entity.interact(this))
{
ItemStack var2 = this.getCurrentEquippedItem();
@@ -1050,7 +1084,9 @@
*/
public void destroyCurrentEquippedItem()
{
+ ItemStack orig = inventory.getCurrentItem();
this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null);
+ ForgeHooks.onDestroyCurrentItem(this, orig);
}
/**
@@ -1079,6 +1115,15 @@
*/
public void attackTargetEntityWithCurrentItem(Entity par1Entity)
{
+ if (!ForgeHooks.onEntityInteract(this, par1Entity, true))
+ {
+ return;
+ }
+ ItemStack stack = getCurrentEquippedItem();
+ if (stack != null && stack.getItem().onLeftClickEntity(stack, this, par1Entity))
+ {
+ return;
+ }
if (par1Entity.canAttackWithItem())
{
int var2 = this.inventory.getDamageVsEntity(par1Entity);
@@ -1221,6 +1266,12 @@
*/
public EnumStatus sleepInBedAt(int par1, int par2, int par3)
{
+ EnumStatus customSleep = ForgeHooks.sleepInBedAt(this, par1, par2, par3);
+ if (customSleep != null)
+ {
+ return customSleep;
+ }
+
if (!this.worldObj.isRemote)
{
if (this.isPlayerSleeping() || !this.isEntityAlive())
@@ -1260,6 +1311,11 @@
{
int var9 = this.worldObj.getBlockMetadata(par1, par2, par3);
int var5 = BlockBed.getDirection(var9);
+ Block block = Block.blocksList[worldObj.getBlockId(par1, par2, par3)];
+ if (block != null)
+ {
+ var5 = block.getBedDirection(worldObj, par1, par2, par3);
+ }
float var10 = 0.5F;
float var7 = 0.5F;
@@ -1329,11 +1385,12 @@
this.resetHeight();
ChunkCoordinates var4 = this.playerLocation;
ChunkCoordinates var5 = this.playerLocation;
+ Block block = (var4 == null ? null : Block.blocksList[worldObj.getBlockId(var4.posX, var4.posY, var4.posZ)]);
- if (var4 != null && this.worldObj.getBlockId(var4.posX, var4.posY, var4.posZ) == Block.bed.blockID)
+ if (var4 != null && block != null && block.isBed(worldObj, var4.posX, var4.posY, var4.posZ, this))
{
- BlockBed.setBedOccupied(this.worldObj, var4.posX, var4.posY, var4.posZ, false);
- var5 = BlockBed.getNearestEmptyChunkCoordinates(this.worldObj, var4.posX, var4.posY, var4.posZ, 0);
+ block.setBedOccupied(this.worldObj, var4.posX, var4.posY, var4.posZ, this, false);
+ var5 = block.getBedSpawnPosition(worldObj, var4.posX, var4.posY, var4.posZ, this);
if (var5 == null)
{
@@ -1370,7 +1427,9 @@
*/
private boolean isInBed()
{
- return this.worldObj.getBlockId(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ) == Block.bed.blockID;
+ ChunkCoordinates c = playerLocation;
+ int blockID = worldObj.getBlockId(c.posX, c.posY, c.posZ);
+ return Block.blocksList[blockID] != null && Block.blocksList[blockID].isBed(worldObj, c.posX, c.posY, c.posZ, this);
}
/**
@@ -1385,13 +1444,15 @@
var2.loadChunk(par1ChunkCoordinates.posX - 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
var2.loadChunk(par1ChunkCoordinates.posX + 3 >> 4, par1ChunkCoordinates.posZ + 3 >> 4);
- if (par0World.getBlockId(par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ) != Block.bed.blockID)
+ ChunkCoordinates c = par1ChunkCoordinates;
+ Block block = Block.blocksList[par0World.getBlockId(c.posX, c.posY, c.posZ)];
+ if (block == null || !block.isBed(par0World, c.posX, c.posY, c.posZ, null))
{
return null;
}
else
{
- ChunkCoordinates var3 = BlockBed.getNearestEmptyChunkCoordinates(par0World, par1ChunkCoordinates.posX, par1ChunkCoordinates.posY, par1ChunkCoordinates.posZ, 0);
+ ChunkCoordinates var3 = block.getBedSpawnPosition(par0World, c.posX, c.posY, c.posZ, null);
return var3;
}
}
@@ -1403,8 +1464,11 @@
{
if (this.playerLocation != null)
{
- int var1 = this.worldObj.getBlockMetadata(this.playerLocation.posX, this.playerLocation.posY, this.playerLocation.posZ);
- int var2 = BlockBed.getDirection(var1);
+ int x = playerLocation.posX;
+ int y = playerLocation.posY;
+ int z = playerLocation.posZ;
+ Block block = Block.blocksList[worldObj.getBlockId(x, y, z)];
+ int var2 = (block == null ? 0 : block.getBedDirection(worldObj, x, y, z));
switch (var2)
{
@@ -1694,6 +1758,7 @@
return 101;
}
}
+ var3 = par1ItemStack.getItem().getIconIndex(par1ItemStack, par2, this, itemInUse, itemInUseCount);
}
return var3;
@@ -1866,4 +1931,30 @@
}
public void func_50009_aI() {}
+
+ /**
+ * Opens a Gui for the player.
+ *
+ * @param mod The mod associated with the gui
+ * @param ID The ID number for the Gui
+ * @param world The World
+ * @param x X Position
+ * @param y Y Position
+ * @param z Z Position
+ */
+ public void openGui(BaseMod mod, int ID, World world, int x, int y, int z)
+ {
+ if (this instanceof EntityPlayerSP)
+ {
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
+ if (handler != null)
+ {
+ GuiScreen screen = (GuiScreen)handler.getGuiElement(ID, this, world, x, y, z);
+ if (screen != null)
+ {
+ ModLoader.getMinecraftInstance().displayGuiScreen(screen);
+ }
+ }
+ }
+ }
}

View file

@ -1,97 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntityRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,8 @@
import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
@@ -287,8 +289,15 @@
*/
private void updateFovModifierHand()
{
- EntityPlayerSP var1 = (EntityPlayerSP)this.mc.renderViewEntity;
- this.fovMultiplierTemp = var1.getFOVMultiplier();
+ if (mc.renderViewEntity instanceof EntityPlayerSP)
+ {
+ EntityPlayerSP var1 = (EntityPlayerSP)this.mc.renderViewEntity;
+ this.fovMultiplierTemp = var1.getFOVMultiplier();
+ }
+ else
+ {
+ this.fovMultiplierTemp = mc.thePlayer.getFOVMultiplier();
+ }
this.fovModifierHandPrev = this.fovModifierHand;
this.fovModifierHand += (this.fovMultiplierTemp - this.fovModifierHand) * 0.5F;
}
@@ -304,7 +313,7 @@
}
else
{
- EntityPlayer var3 = (EntityPlayer)this.mc.renderViewEntity;
+ EntityLiving var3 = (EntityLiving)this.mc.renderViewEntity;
float var4 = 70.0F;
if (par2)
@@ -391,12 +400,14 @@
if (!this.mc.gameSettings.debugCamEnable)
{
- int var10 = this.mc.theWorld.getBlockId(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ));
-
- if (var10 == Block.bed.blockID)
+ int x = MathHelper.floor_double(var2.posX);
+ int y = MathHelper.floor_double(var2.posY);
+ int z = MathHelper.floor_double(var2.posZ);
+ Block block = Block.blocksList[mc.theWorld.getBlockId(x, y, z)];
+
+ if (block != null && block.isBed(mc.theWorld, x, y, z, var2))
{
- int var11 = this.mc.theWorld.getBlockMetadata(MathHelper.floor_double(var2.posX), MathHelper.floor_double(var2.posY), MathHelper.floor_double(var2.posZ));
- int var12 = var11 & 3;
+ int var12 = block.getBedDirection(mc.theWorld, x, y, z);
GL11.glRotatef((float)(var12 * 90), 0.0F, 1.0F, 0.0F);
}
@@ -1095,8 +1106,11 @@
var20 = (EntityPlayer)var4;
GL11.glDisable(GL11.GL_ALPHA_TEST);
Profiler.endStartSection("outline");
- var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
- var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
+ if (!ForgeHooksClient.onBlockHighlight(var5, var20, mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1))
+ {
+ var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
+ var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
+ }
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
}
@@ -1160,8 +1174,12 @@
var20 = (EntityPlayer)var4;
GL11.glDisable(GL11.GL_ALPHA_TEST);
Profiler.endStartSection("outline");
- var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
- var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
+
+ if (!ForgeHooksClient.onBlockHighlight(var5, var20, mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1))
+ {
+ var5.drawBlockBreaking(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
+ var5.drawSelectionBox(var20, this.mc.objectMouseOver, 0, var20.inventory.getCurrentItem(), par1);
+ }
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
@@ -1185,6 +1203,9 @@
this.setupFog(1, par1);
GL11.glPopMatrix();
}
+
+ Profiler.endStartSection("fhooks");
+ ForgeHooksClient.onRenderWorldLast(var5, par1);
Profiler.endStartSection("hand");

View file

@ -1,67 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/EntitySheep.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/EntitySheep.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,8 +1,11 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.Random;
-public class EntitySheep extends EntityAnimal
+import net.minecraft.src.forge.IShearable;
+
+public class EntitySheep extends EntityAnimal implements IShearable
{
/**
* Holds the RGB table of the sheep colors - in OpenGL glColor3f values - used to render the sheep colored fleece.
@@ -129,27 +132,6 @@
*/
public boolean interact(EntityPlayer par1EntityPlayer)
{
- ItemStack var2 = par1EntityPlayer.inventory.getCurrentItem();
-
- if (var2 != null && var2.itemID == Item.shears.shiftedIndex && !this.getSheared() && !this.isChild())
- {
- if (!this.worldObj.isRemote)
- {
- this.setSheared(true);
- int var3 = 1 + this.rand.nextInt(3);
-
- for (int var4 = 0; var4 < var3; ++var4)
- {
- 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);
- }
- }
-
- var2.damageItem(1, par1EntityPlayer);
- }
-
return super.interact(par1EntityPlayer);
}
@@ -282,4 +264,23 @@
this.setGrowingAge(var1);
}
}
+
+ @Override
+ public boolean isShearable(ItemStack item, World world, int X, int Y, int Z)
+ {
+ return !getSheared() && !isChild();
+ }
+
+ @Override
+ public ArrayList<ItemStack> onSheared(ItemStack item, World world, int X, int Y, int Z, int fortune)
+ {
+ ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
+ setSheared(true);
+ int i = 1 + rand.nextInt(3);
+ for (int j = 0; j < i; j++)
+ {
+ ret.add(new ItemStack(Block.cloth.blockID, 1, getFleeceColor()));
+ }
+ return ret;
+ }
}

View file

@ -1,28 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Explosion.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,8 @@
import java.util.Random;
import java.util.Set;
+import net.minecraft.src.forge.ISpecialResistance;
+
public class Explosion
{
/** whether or not the explosion sets fire to blocks around it */
@@ -72,7 +74,15 @@
if (var25 > 0)
{
- var14 -= (Block.blocksList[var25].getExplosionResistance(this.exploder) + 0.3F) * var21;
+ if (Block.blocksList[var25] instanceof ISpecialResistance)
+ {
+ 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 (var14 > 0.0F)

View file

@ -1,62 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/FurnaceRecipes.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,6 @@
package net.minecraft.src;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -9,6 +10,7 @@
/** 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)
{
return (ItemStack)this.smeltingList.get(Integer.valueOf(par1));
@@ -57,4 +61,34 @@
{
return this.smeltingList;
}
+
+ /**
+ * Add a metadata-sensitive furnace recipe
+ * @param itemID The Item ID
+ * @param metadata The Item Metadata
+ * @param itemstack The ItemStack for the result
+ */
+ public void addSmelting(int itemID, int metadata, ItemStack itemstack)
+ {
+ metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
+ }
+
+ /**
+ * Used to get the resulting ItemStack form a source ItemStack
+ * @param item The Source ItemStack
+ * @return The result ItemStack
+ */
+ public ItemStack getSmeltingResult(ItemStack item)
+ {
+ if (item == null)
+ {
+ return null;
+ }
+ ItemStack ret = (ItemStack)metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
+ if (ret != null)
+ {
+ return ret;
+ }
+ return (ItemStack)smeltingList.get(Integer.valueOf(item.itemID));
+ }
}

View file

@ -1,108 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/GuiAchievements.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/GuiAchievements.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,11 @@
package net.minecraft.src;
+import java.util.LinkedList;
+import java.util.List;
import java.util.Random;
+
+import net.minecraft.src.forge.MinecraftForge;
+
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -40,6 +45,10 @@
/** Whether the Mouse Button is down or not */
private int isMouseButtonDown = 0;
private StatFileWriter statFileWriter;
+
+ private int currentPage = -1;
+ private GuiSmallButton button;
+ private LinkedList<Achievement> minecraftAchievements = new LinkedList<Achievement>();
public GuiAchievements(StatFileWriter par1StatFileWriter)
{
@@ -48,6 +57,15 @@
short var3 = 141;
this.field_27116_m = this.guiMapX = this.field_27112_q = (double)(AchievementList.openInventory.displayColumn * 24 - var2 / 2 - 12);
this.field_27115_n = this.guiMapY = this.field_27111_r = (double)(AchievementList.openInventory.displayRow * 24 - var3 / 2);
+
+ minecraftAchievements.clear();
+ for (Object achievement : AchievementList.achievementList)
+ {
+ if (!MinecraftForge.isAchievementInPages((Achievement)achievement))
+ {
+ minecraftAchievements.add((Achievement)achievement);
+ }
+ }
}
/**
@@ -57,6 +75,8 @@
{
this.controlList.clear();
this.controlList.add(new GuiSmallButton(1, this.width / 2 + 24, this.height / 2 + 74, 80, 20, StatCollector.translateToLocal("gui.done")));
+ button = new GuiSmallButton(2, (width - achievementsPaneWidth) / 2 + 24, height / 2 + 74, 125, 20, getAchievementPageTitle(currentPage));
+ this.controlList.add(button);
}
/**
@@ -69,6 +89,16 @@
this.mc.displayGuiScreen((GuiScreen)null);
this.mc.setIngameFocus();
}
+
+ if (par1GuiButton.id == 2)
+ {
+ currentPage++;
+ if (currentPage >= MinecraftForge.getAchievementPages().size())
+ {
+ currentPage = -1;
+ }
+ button.displayString = getAchievementPageTitle(currentPage);
+ }
super.actionPerformed(par1GuiButton);
}
@@ -289,11 +319,12 @@
int var27;
int var30;
- for (var22 = 0; var22 < AchievementList.achievementList.size(); ++var22)
+ List<Achievement> achievementList = (currentPage == -1 ? minecraftAchievements : MinecraftForge.getAchievementPage(currentPage).getAchievements());
+ for (var22 = 0; var22 < achievementList.size(); ++var22)
{
- Achievement var33 = (Achievement)AchievementList.achievementList.get(var22);
+ Achievement var33 = achievementList.get(var22);
- if (var33.parentAchievement != null)
+ if (var33.parentAchievement != null && achievementList.contains(var33.parentAchievement))
{
var24 = var33.displayColumn * 24 - var4 + 11 + var10;
var25 = var33.displayRow * 24 - var5 + 11 + var11;
@@ -327,9 +358,9 @@
int var42;
int var41;
- for (var24 = 0; var24 < AchievementList.achievementList.size(); ++var24)
+ for (var24 = 0; var24 < achievementList.size(); ++var24)
{
- Achievement var35 = (Achievement)AchievementList.achievementList.get(var24);
+ Achievement var35 = achievementList.get(var24);
var26 = var35.displayColumn * 24 - var4;
var27 = var35.displayRow * 24 - var5;
@@ -453,4 +484,12 @@
{
return true;
}
+
+ /**
+ * FORGE: Gets the name for an achievement page by its index
+ */
+ public static String getAchievementPageTitle(int index)
+ {
+ return index == -1 ? "Minecraft" : MinecraftForge.getAchievementPage(index).getName();
+ }
}

View file

@ -1,144 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/GuiControls.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/GuiControls.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.GuiControlsScrollPanel;
+
public class GuiControls extends GuiScreen
{
/**
@@ -15,6 +17,8 @@
/** The ID of the button that has been pressed. */
private int buttonId = -1;
+
+ private GuiControlsScrollPanel scrollPane;
public GuiControls(GuiScreen par1GuiScreen, GameSettings par2GameSettings)
{
@@ -32,15 +36,12 @@
*/
public void initGui()
{
+ scrollPane = new GuiControlsScrollPanel(this, options, mc);
StringTranslate var1 = StringTranslate.getInstance();
int var2 = this.func_20080_j();
- for (int var3 = 0; var3 < this.options.keyBindings.length; ++var3)
- {
- this.controlList.add(new GuiSmallButton(var3, var2 + var3 % 2 * 160, this.height / 6 + 24 * (var3 >> 1), 70, 20, this.options.getOptionDisplayString(var3)));
- }
-
- this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, var1.translateKey("gui.done")));
+ this.controlList.add(new GuiButton(200, this.width / 2 - 100, this.height - 28, var1.translateKey("gui.done")));
+ scrollPane.registerScrollButtons(controlList, 7, 8);
this.screenTitle = var1.translateKey("controls.title");
}
@@ -49,20 +50,10 @@
*/
protected void actionPerformed(GuiButton par1GuiButton)
{
- for (int var2 = 0; var2 < this.options.keyBindings.length; ++var2)
- {
- ((GuiButton)this.controlList.get(var2)).displayString = this.options.getOptionDisplayString(var2);
- }
-
if (par1GuiButton.id == 200)
{
this.mc.displayGuiScreen(this.parentScreen);
}
- else
- {
- this.buttonId = par1GuiButton.id;
- par1GuiButton.displayString = "> " + this.options.getOptionDisplayString(par1GuiButton.id) + " <";
- }
}
/**
@@ -70,17 +61,7 @@
*/
protected void mouseClicked(int par1, int par2, int par3)
{
- if (this.buttonId >= 0)
- {
- this.options.setKeyBinding(this.buttonId, -100 + par3);
- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
- {
- super.mouseClicked(par1, par2, par3);
- }
+ super.mouseClicked(par1, par2, par3);
}
/**
@@ -88,14 +69,7 @@
*/
protected void keyTyped(char par1, int par2)
{
- if (this.buttonId >= 0)
- {
- this.options.setKeyBinding(this.buttonId, par2);
- ((GuiButton)this.controlList.get(this.buttonId)).displayString = this.options.getOptionDisplayString(this.buttonId);
- this.buttonId = -1;
- KeyBinding.resetKeyBindingArrayAndHash();
- }
- else
+ if (scrollPane.keyTyped(par1, par2))
{
super.keyTyped(par1, par2);
}
@@ -107,47 +81,8 @@
public void drawScreen(int par1, int par2, float par3)
{
this.drawDefaultBackground();
- this.drawCenteredString(this.fontRenderer, this.screenTitle, this.width / 2, 20, 16777215);
- int var4 = this.func_20080_j();
- int var5 = 0;
-
- while (var5 < this.options.keyBindings.length)
- {
- boolean var6 = false;
- int var7 = 0;
-
- while (true)
- {
- if (var7 < this.options.keyBindings.length)
- {
- if (var7 == var5 || this.options.keyBindings[var5].keyCode != this.options.keyBindings[var7].keyCode)
- {
- ++var7;
- continue;
- }
-
- var6 = true;
- }
-
- if (this.buttonId == var5)
- {
- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7f> \u00a7e??? \u00a7f<";
- }
- else if (var6)
- {
- ((GuiButton)this.controlList.get(var5)).displayString = "\u00a7c" + this.options.getOptionDisplayString(var5);
- }
- else
- {
- ((GuiButton)this.controlList.get(var5)).displayString = this.options.getOptionDisplayString(var5);
- }
-
- this.drawString(this.fontRenderer, this.options.getKeyBindingDescription(var5), var4 + var5 % 2 * 160 + 70 + 6, this.height / 6 + 24 * (var5 >> 1) + 7, -1);
- ++var5;
- break;
- }
- }
-
+ scrollPane.drawScreen(par1, par2, par3);
+ drawCenteredString(fontRenderer, screenTitle, width / 2, 4, 0xffffff);
super.drawScreen(par1, par2, par3);
}
}

View file

@ -1,32 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/GuiIngame.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/GuiIngame.java 0000-00-00 00:00:00.000000000 -0000
@@ -9,6 +9,8 @@
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
+import net.minecraft.src.forge.*;
+
public class GuiIngame extends Gui
{
private static RenderItem itemRenderer = new RenderItem();
@@ -142,7 +144,19 @@
var46 = var7 - 39;
var22 = var46 - 10;
- var23 = this.mc.thePlayer.getTotalArmorValue();
+ var23 = 0;
+ for (int x = 0; x < mc.thePlayer.inventory.armorInventory.length; x++)
+ {
+ ItemStack stack = mc.thePlayer.inventory.armorInventory[x];
+ if (stack != null && stack.getItem() instanceof ISpecialArmor)
+ {
+ var23 += ((ISpecialArmor)stack.getItem()).getArmorDisplay(mc.thePlayer, stack, x);
+ }
+ else if (stack != null && stack.getItem() instanceof ItemArmor)
+ {
+ var23 += ((ItemArmor)stack.getItem()).damageReduceAmount;
+ }
+ }
int var24 = -1;
if (this.mc.thePlayer.isPotionActive(Potion.regeneration))

View file

@ -1,234 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Item.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,9 +1,12 @@
package net.minecraft.src;
+import java.util.ArrayList;
import java.util.List;
import java.util.Random;
-public class Item
+import net.minecraft.src.forge.ITextureProvider;
+
+public class Item implements ITextureProvider
{
/** The RNG used by the Item subclasses. */
protected static Random itemRand = new Random();
@@ -188,14 +191,17 @@
/** full name of item from language file */
private String itemName;
-
+
+ /** FORGE: To disable repair recipes. */
+ protected boolean canRepair = true;
+
protected Item(int par1)
{
this.shiftedIndex = 256 + par1;
if (itemsList[256 + par1] != null)
{
- System.out.println("CONFLICT @ " + par1);
+ System.out.println("CONFLICT @ " + par1 + " item slot already occupied by " + itemsList[256 + par1] + " while adding " + this);
}
itemsList[256 + par1] = this;
@@ -551,7 +557,7 @@
float var17 = MathHelper.sin(-var5 * 0.017453292F);
float var18 = var15 * var16;
float var20 = var14 * var16;
- double var21 = 5.0D;
+ double var21 = ModLoader.getMinecraftInstance().playerController.getBlockReachDistance();
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;
@@ -579,4 +585,188 @@
{
StatList.initStats();
}
+
+ /* =========================================================== FORGE START ===============================================================*/
+ public boolean isDefaultTexture = true;
+ private String currentTexture = "/gui/items.png";
+ /**
+ * 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
+ * to have access to.
+ *
+ * @param itemList The list of items currently in the creative inventory
+ */
+ public void addCreativeItems(ArrayList itemList)
+ {
+ if (this.shiftedIndex != Item.potion.shiftedIndex && this.shiftedIndex != Item.monsterPlacer.shiftedIndex)
+ {
+ itemList.add(new ItemStack(this, 1));
+ }
+ }
+
+ /**
+ * Called when a player drops the item into the world,
+ * returning false from this will prevent the item from
+ * being removed from the players inventory and spawning
+ * in the world
+ *
+ * @param player The player that dropped the item
+ * @param item The item stack, before the item is removed.
+ */
+ public boolean onDroppedByPlayer(ItemStack item, EntityPlayer player)
+ {
+ return true;
+ }
+
+ /**
+ * This is called when the item is used, before the block is activated.
+ * @param stack The Item Stack
+ * @param player The Player that used the item
+ * @param world The Current World
+ * @param X Target X Position
+ * @param Y Target Y Position
+ * @param Z Target Z Position
+ * @param side The side of the target hit
+ * @return Return true to prevent any further processing.
+ */
+ public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int X, int Y, int Z, int side)
+ {
+ return false;
+ }
+
+ /**
+ * Metadata-sensitive version of getStrVsBlock
+ * @param itemstack The Item Stack
+ * @param block The block the item is trying to break
+ * @param metadata The items current metadata
+ * @return The damage strength
+ */
+ public float getStrVsBlock(ItemStack itemstack, Block block, int metadata)
+ {
+ return getStrVsBlock(itemstack, block);
+ }
+
+ /**
+ * Called by CraftingManager to determine if an item is reparable.
+ * @return True if reparable
+ */
+ public boolean isRepairable()
+ {
+ return canRepair && isDamageable();
+ }
+
+ /**
+ * Call to disable repair recipes.
+ * @return The current Item instance
+ */
+ public Item setNoRepair()
+ {
+ canRepair = false;
+ return this;
+ }
+
+ /**
+ * Called before a block is broken. Return true to prevent default block harvesting.
+ *
+ * Note: In SMP, this is called on both client and server sides!
+ *
+ * @param itemstack The current ItemStack
+ * @param X The X Position
+ * @param Y The X Position
+ * @param Z The X Position
+ * @param player The Player that is wielding the item
+ * @return True to prevent harvesting, false to continue as normal
+ */
+ public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
+ {
+ return false;
+ }
+
+ /**
+ * Called each tick while using an item.
+ * @param stack The Item being used
+ * @param player The Player using the item
+ * @param count The amount of time in tick the item has been used for continuously
+ */
+ public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count)
+ {
+ }
+
+ /**
+ * Called when the player Left Clicks (attacks) an entity.
+ * Processed before damage is done, if return value is true further processing is canceled
+ * and the entity is not attacked.
+ *
+ * @param stack The Item being used
+ * @param player The player that is attacking
+ * @param entity The entity being attacked
+ * @return True to cancel the rest of the interaction.
+ */
+ public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
+ {
+ return false;
+ }
+
+ /**
+ * Player, Render pass, and item usage sensitive version of getIconIndex.
+ *
+ * @param stack The item stack to get the icon for. (Usually this, and usingItem will be the same if usingItem is not null)
+ * @param renderPass The pass to get the icon for, 0 is default.
+ * @param player The player holding the item
+ * @param usingItem The item the player is actively using. Can be null if not using anything.
+ * @param useRemaining The ticks remaining for the active item.
+ * @return The icon index
+ */
+ public int getIconIndex(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
+ {
+ /*
+ * Here is an example usage for Vanilla bows.
+ if (usingItem != null && usingItem.getItem().shiftedIndex == Item.bow.shiftedIndex)
+ {
+ int k = usingItem.getMaxItemUseDuration() - useRemaining;
+ if (k >= 18) return 133;
+ if (k > 13) return 117;
+ if (k > 0) return 101;
+ }
+ */
+ return getIconIndex(stack);
+ }
+
+ /**
+ * Returns the number of render passes/layers this item has.
+ * Usually equates to ItemRenderer.renderItem being called for this many passes.
+ * Does not get called unless requiresMultipleRenderPasses() is true;
+ *
+ * @param metadata The item's metadata
+ * @return The number of passes to run.
+ */
+ public int getRenderPasses(int metadata)
+ {
+ return requiresMultipleRenderPasses() ? 2 : 1;
+ }
+
+ /**
+ * Grabs the current texture file used for this block
+ */
+ @Override
+ public String getTextureFile()
+ {
+ if (this instanceof ItemBlock)
+ {
+ return Block.blocksList[((ItemBlock)this).getBlockID()].getTextureFile();
+ }
+ return currentTexture;
+ }
+
+ /**
+ * Sets the current texture file for this item, used when rendering.
+ * Default is "/gui/items.png"
+ *
+ * @param texture The texture file
+ */
+ public void setTextureFile(String texture)
+ {
+ currentTexture = texture;
+ isDefaultTexture = false;
+ }
}

View file

@ -1,12 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemBlock.java 0000-00-00 00:00:00.000000000 -0000
@@ -32,7 +32,8 @@
{
par7 = 1;
}
- else if (var8 != Block.vine.blockID && var8 != Block.tallGrass.blockID && var8 != Block.deadBush.blockID)
+ else if (var8 != Block.vine.blockID && var8 != Block.tallGrass.blockID && var8 != Block.deadBush.blockID
+ && (Block.blocksList[var8] != null && !Block.blocksList[var8].isBlockReplaceable(par3World, par4, par5, par6)))
{
if (par7 == 0)
{

View file

@ -1,35 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemBow.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemBow.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemBow extends Item
{
public ItemBow(int par1)
@@ -14,6 +16,11 @@
*/
public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
{
+ if (ForgeHooks.onArrowLoose(par1ItemStack, par2World, par3EntityPlayer, getMaxItemUseDuration(par1ItemStack) - par4))
+ {
+ return;
+ }
+
boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0;
if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
@@ -103,6 +110,12 @@
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
+ ItemStack stack = ForgeHooks.onArrowNock(par1ItemStack, par2World, par3EntityPlayer);
+ if (stack != null)
+ {
+ return stack;
+ }
+
if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.shiftedIndex))
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));

View file

@ -1,23 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemBucket.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.MinecraftForge;
+
public class ItemBucket extends Item
{
/** field for checking if the bucket has been filled. */
@@ -47,6 +49,12 @@
{
return par1ItemStack;
}
+
+ ItemStack stack = MinecraftForge.fillCustomBucket(par2World, var13, var14, var15);
+ if (stack != null)
+ {
+ return stack;
+ }
if (par2World.getBlockMaterial(var13, var14, var15) == Material.water && par2World.getBlockMetadata(var13, var14, var15) == 0)
{

View file

@ -1,70 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemDye.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,9 @@
package net.minecraft.src;
+import java.util.ArrayList;
+
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemDye extends Item
{
/** List of dye color names */
@@ -43,6 +47,15 @@
if (par1ItemStack.getItemDamage() == 15)
{
int var8 = par3World.getBlockId(par4, par5, par6);
+
+ if (ForgeHooks.onUseBonemeal(par3World, var8, par4, par5, par6))
+ {
+ if (!par3World.isRemote)
+ {
+ par1ItemStack.stackSize--;
+ }
+ return true;
+ }
if (var8 == Block.sapling.blockID)
{
@@ -116,15 +129,15 @@
{
if (itemRand.nextInt(10) != 0)
{
+ if (mod_MinecraftForge.DISABLE_DARK_ROOMS && !Block.tallGrass.canBlockStay(par3World, var10, var11, var12))
+ {
+ continue;
+ }
par3World.setBlockAndMetadataWithNotify(var10, var11, var12, Block.tallGrass.blockID, 1);
}
- else if (itemRand.nextInt(3) != 0)
- {
- par3World.setBlockWithNotify(var10, var11, var12, Block.plantYellow.blockID);
- }
else
{
- par3World.setBlockWithNotify(var10, var11, var12, Block.plantRed.blockID);
+ ForgeHooks.plantGrassPlant(par3World, var10, var11, var12);
}
}
}
@@ -155,4 +168,20 @@
}
}
}
+
+ /**
+ * 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
+ * to have access to.
+ *
+ * @param itemList The list of items currently in the creative inventory
+ */
+ @Override
+ public void addCreativeItems(ArrayList itemList)
+ {
+ for (int x = 0; x < 16; x++)
+ {
+ itemList.add(new ItemStack(this, 1, x));
+ }
+ }
}

View file

@ -1,22 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemHoe.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,7 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemHoe extends Item
{
public ItemHoe(int par1, EnumToolMaterial par2EnumToolMaterial)
@@ -21,6 +23,11 @@
}
else
{
+ if (ForgeHooks.onUseHoe(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6))
+ {
+ par1ItemStack.damageItem(1, par2EntityPlayer);
+ return true;
+ }
int var8 = par3World.getBlockId(par4, par5, par6);
int var9 = par3World.getBlockId(par4, par5 + 1, par6);

View file

@ -1,20 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemMap.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemMap.java 0000-00-00 00:00:00.000000000 -0000
@@ -83,7 +83,7 @@
byte var23 = 0;
byte var24 = 0;
byte var25 = 0;
- int[] var26 = new int[256];
+ int[] var26 = new int[Block.blocksList.length];
Chunk var27 = par1World.getChunkFromBlockCoords(var21, var22);
int var28 = var21 & 15;
int var29 = var22 & 15;
@@ -173,7 +173,7 @@
var33 = 0;
var34 = 0;
- for (var35 = 0; var35 < 256; ++var35)
+ for (var35 = 0; var35 < Block.blocksList.length; ++var35)
{
if (var26[var35] > var33)
{

View file

@ -1,99 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemRenderer.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,12 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooksClient;
+import net.minecraft.src.forge.IItemRenderer;
+import net.minecraft.src.forge.MinecraftForgeClient;
+import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.*;
+import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.*;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -35,22 +41,21 @@
public void renderItem(EntityLiving par1EntityLiving, ItemStack par2ItemStack, int par3)
{
GL11.glPushMatrix();
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(par2ItemStack, EQUIPPED);
- if (par2ItemStack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
+ if (customRenderer != null)
+ {
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
+ ForgeHooksClient.renderEquippedItem(customRenderer, renderBlocksInstance, par1EntityLiving, par2ItemStack);
+ }
+ else if (par2ItemStack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par2ItemStack.itemID].getRenderType()))
{
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
this.renderBlocksInstance.renderBlockAsItem(Block.blocksList[par2ItemStack.itemID], par2ItemStack.getItemDamage(), 1.0F);
}
else
{
- if (par2ItemStack.itemID < 256)
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/terrain.png"));
- }
- else
- {
- GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture("/gui/items.png"));
- }
+ GL11.glBindTexture(GL11.GL_TEXTURE_2D, this.mc.renderEngine.getTexture(par2ItemStack.getItem().getTextureFile()));
Tessellator var4 = Tessellator.instance;
int var5 = par1EntityLiving.getItemIcon(par2ItemStack, par3);
@@ -246,8 +251,10 @@
float var11;
float var13;
- if (var14 != null && var14.itemID == Item.map.shiftedIndex)
+ if (var14 != null && var14.getItem() instanceof ItemMap)
{
+ IItemRenderer custom = MinecraftForgeClient.getItemRenderer(var14, FIRST_PERSON_MAP);
+
GL11.glPushMatrix();
var7 = 0.8F;
var17 = var3.getSwingProgress(par1);
@@ -313,8 +320,15 @@
var26.addVertexWithUV((double)(128 + var27), (double)(0 - var27), 0.0D, 1.0D, 0.0D);
var26.addVertexWithUV((double)(0 - var27), (double)(0 - var27), 0.0D, 0.0D, 0.0D);
var26.draw();
- MapData var23 = Item.map.getMapData(var14, this.mc.theWorld);
- this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var23);
+ MapData var23 = ((ItemMap)var14.getItem()).getMapData(var14, this.mc.theWorld);
+ if (custom == null)
+ {
+ this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, var23);
+ }
+ else
+ {
+ custom.renderItem(FIRST_PERSON_MAP, var14, mc.thePlayer, mc.renderEngine, var23);
+ }
GL11.glPopMatrix();
}
else if (var14 != null)
@@ -414,12 +428,15 @@
if (var14.getItem().requiresMultipleRenderPasses())
{
this.renderItem(var3, var14, 0);
- var9 = Item.itemsList[var14.itemID].getColorFromDamage(var14.getItemDamage(), 1);
- var10 = (float)(var9 >> 16 & 255) / 255.0F;
- var11 = (float)(var9 >> 8 & 255) / 255.0F;
- var12 = (float)(var9 & 255) / 255.0F;
- GL11.glColor4f(var6 * var10, var6 * var11, var6 * var12, 1.0F);
- this.renderItem(var3, var14, 1);
+ for (int x = 1; x < var14.getItem().getRenderPasses(var14.getItemDamage()); x++)
+ {
+ var9 = Item.itemsList[var14.itemID].getColorFromDamage(var14.getItemDamage(), x);
+ var10 = (float)(var9 >> 16 & 255) / 255.0F;
+ var11 = (float)(var9 >> 8 & 255) / 255.0F;
+ var12 = (float)(var9 & 255) / 255.0F;
+ GL11.glColor4f(var6 * var10, var6 * var11, var6 * var12, 1.0F);
+ this.renderItem(var3, var14, x);
+ }
}
else
{

View file

@ -1,89 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemShears.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemShears.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,8 @@
package net.minecraft.src;
+import java.util.ArrayList;
+import net.minecraft.src.forge.IShearable;
+
public class ItemShears extends Item
{
public ItemShears(int par1)
@@ -11,13 +14,12 @@
public boolean onBlockDestroyed(ItemStack par1ItemStack, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving)
{
- 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))
{
return super.onBlockDestroyed(par1ItemStack, par2, par3, par4, par5, par6EntityLiving);
}
else
{
- par1ItemStack.damageItem(1, par6EntityLiving);
return true;
}
}
@@ -38,4 +40,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)
+ {
+ if (entity.worldObj.isRemote)
+ {
+ return;
+ }
+ if (entity instanceof IShearable)
+ {
+ IShearable target = (IShearable)entity;
+ if (target.isShearable(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ))
+ {
+ ArrayList<ItemStack> drops = target.onSheared(itemstack, entity.worldObj, (int)entity.posX, (int)entity.posY, (int)entity.posZ,
+ EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
+ for(ItemStack stack : drops)
+ {
+ EntityItem ent = entity.entityDropItem(stack, 1.0F);
+ ent.motionY += entity.rand.nextFloat() * 0.05F;
+ ent.motionX += (entity.rand.nextFloat() - entity.rand.nextFloat()) * 0.1F;
+ ent.motionZ += (entity.rand.nextFloat() - entity.rand.nextFloat()) * 0.1F;
+ }
+ itemstack.damageItem(1, entity);
+ }
+ }
+ }
+
+ @Override
+ public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player)
+ {
+ if (player.worldObj.isRemote)
+ {
+ return false;
+ }
+ int id = player.worldObj.getBlockId(x, y, z);
+ if (Block.blocksList[id] != null && Block.blocksList[id] instanceof IShearable)
+ {
+ IShearable target = (IShearable)Block.blocksList[id];
+ if (target.isShearable(itemstack, player.worldObj, x, y, z))
+ {
+ ArrayList<ItemStack> drops = target.onSheared(itemstack, player.worldObj, x, y, z,
+ EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
+ for(ItemStack stack : drops)
+ {
+ float f = 0.7F;
+ double d = (double)(player.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
+ double d1 = (double)(player.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
+ double d2 = (double)(player.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
+ EntityItem entityitem = new EntityItem(player.worldObj, (double)x + d, (double)y + d1, (double)z + d2, stack);
+ entityitem.delayBeforeCanPickup = 10;
+ player.worldObj.spawnEntityInWorld(entityitem);
+ }
+ itemstack.damageItem(1, player);
+ player.addStat(StatList.mineBlockStatArray[id], 1);
+ }
+ }
+ return false;
+ }
}

View file

@ -1,36 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/ItemTool.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,13 +1,15 @@
package net.minecraft.src;
+import net.minecraft.src.forge.ForgeHooks;
+
public class ItemTool extends Item
{
/** 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 int damageVsEntity;
/** The material this tool is made from. */
protected EnumToolMaterial toolMaterial;
@@ -79,4 +81,15 @@
{
return this.toolMaterial.getEnchantability();
}
+
+ /** FORGE: Overridden to allow custom tool effectiveness */
+ @Override
+ public float getStrVsBlock(ItemStack stack, Block block, int meta)
+ {
+ if (ForgeHooks.isToolEffective(stack, block, meta))
+ {
+ return efficiencyOnProperMaterial;
+ }
+ return getStrVsBlock(stack, block);
+ }
}

View file

@ -1,12 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/MovingObjectPosition.java 0000-00-00 00:00:00.000000000 -0000
@@ -25,6 +25,9 @@
/** The hit entity */
public Entity entityHit;
+
+ /** Used to determine what sub-segment is hit */
+ public int subHit = -1;
public MovingObjectPosition(int par1, int par2, int par3, int par4, Vec3D par5Vec3D)
{

View file

@ -1,155 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/NetClientHandler.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/NetClientHandler.java 0000-00-00 00:00:00.000000000 -0000
@@ -14,9 +14,16 @@
import java.util.List;
import java.util.Map;
import java.util.Random;
+import java.util.logging.Level;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.ForgeHooksClient;
+import net.minecraft.src.forge.MessageManager;
+import net.minecraft.src.forge.ModCompatibilityClient;
+import net.minecraft.src.forge.packets.ForgePacket;
+import java.io.UnsupportedEncodingException;
public class NetClientHandler extends NetHandler
{
@@ -50,6 +57,8 @@
this.mc = par1Minecraft;
Socket var4 = new Socket(InetAddress.getByName(par2Str), par3);
this.netManager = new NetworkManager(var4, "Client", this);
+
+ ForgeHooks.onConnect(netManager);
}
/**
@@ -78,6 +87,7 @@
this.currentServerMaxPlayers = par1Packet1Login.maxPlayers;
((PlayerControllerMP)this.mc.playerController).setCreative(par1Packet1Login.serverMode == 1);
FMLClientHandler.instance().handleServerLogin(par1Packet1Login, this, netManager);
+ ForgeHooksClient.onLogin(par1Packet1Login, this, netManager);
}
public void handlePickupSpawn(Packet21PickupSpawn par1Packet21PickupSpawn)
@@ -182,6 +192,19 @@
{
var8 = new EntityFallingSand(this.worldClient, var2, var4, var6, Block.dragonEgg.blockID);
}
+
+ try
+ {
+ var8 = ModCompatibilityClient.mlmpVehicleSpawn(par1Packet23VehicleSpawn.type,
+ worldClient, var2, var4, var6,
+ getEntityByID(par1Packet23VehicleSpawn.throwerEntityId), var8);
+ }
+ catch (Exception e)
+ {
+ ModLoader.getLogger().throwing("NetClientHandler", "handleVehicleSpawn", e);
+ ModLoader.throwException(String.format("Error initalizing entity of type %d", par1Packet23VehicleSpawn.type), e);
+ return;
+ }
if (var8 != null)
{
@@ -438,7 +461,7 @@
{
short var6 = var4.readShort();
short var7 = var4.readShort();
- int var8 = (var7 & 4095) >> 4;
+ int var8 = (var7 & 0xFFF0) >> 4; //4096 fix, And vanilla bug fix
int var9 = var7 & 15;
int var10 = var6 >> 12 & 15;
int var11 = var6 >> 8 & 15;
@@ -486,7 +509,7 @@
public void handleKickDisconnect(Packet255KickDisconnect par1Packet255KickDisconnect)
{
- this.netManager.networkShutdown("disconnect.kicked", new Object[0]);
+ this.netManager.networkShutdown("disconnect.kicked", par1Packet255KickDisconnect.reason);
this.disconnected = true;
this.mc.changeWorld1((World)null);
this.mc.displayGuiScreen(new GuiDisconnected("disconnect.disconnected", "disconnect.genericReason", new Object[] {par1Packet255KickDisconnect.reason}));
@@ -550,8 +573,12 @@
public void handleChat(Packet3Chat par1Packet3Chat)
{
- FMLClientHandler.instance().handleChatPacket(par1Packet3Chat);
- this.mc.ingameGUI.addChatMessage(par1Packet3Chat.message);
+ par1Packet3Chat.message = ForgeHooks.onClientChatRecv(par1Packet3Chat.message);
+ if (par1Packet3Chat.message != null)
+ {
+ FMLClientHandler.instance().handleChatPacket(par1Packet3Chat);
+ this.mc.ingameGUI.addChatMessage(par1Packet3Chat.message);
+ }
}
public void handleAnimation(Packet18Animation par1Packet18Animation)
@@ -641,7 +668,7 @@
}
else if (par1Packet2Handshake.username.equals("-"))
{
- this.addToSendQueue(new Packet1Login(this.mc.session.username, 29));
+ this.addToSendQueue(ForgeHooksClient.onSendLogin(new Packet1Login(this.mc.session.username, 29)));
}
else
{
@@ -654,7 +681,7 @@
if (var6.equalsIgnoreCase("ok"))
{
- this.addToSendQueue(new Packet1Login(this.mc.session.username, 29));
+ this.addToSendQueue(ForgeHooksClient.onSendLogin(new Packet1Login(this.mc.session.username, 29)));
}
else
{
@@ -835,6 +862,9 @@
case 5:
var2.displayGUIBrewingStand(new TileEntityBrewingStand());
var2.craftingInventory.windowId = par1Packet100OpenWindow.windowId;
+ break;
+ default:
+ ModCompatibilityClient.mlmpOpenWindow(par1Packet100OpenWindow);
}
}
@@ -941,6 +971,19 @@
{
((TileEntityMobSpawner)var2).setMobID(EntityList.getStringFromID(par1Packet132TileEntityData.customParam1));
}
+ else if (var2 != null)
+ {
+ var2.onDataPacket(netManager, par1Packet132TileEntityData);
+ }
+ else
+ {
+ Packet132TileEntityData pkt = par1Packet132TileEntityData;
+ ModLoader.getLogger().log(Level.WARNING, String.format(
+ "Received a TileEntityData packet for a location that did not have a TileEntity: (%d, %d, %d) %d: %d, %d, %d",
+ pkt.xPosition, pkt.yPosition, pkt.zPosition,
+ pkt.actionType,
+ pkt.customParam1, pkt.customParam2, pkt.customParam3));
+ }
}
}
@@ -1014,6 +1057,10 @@
{
ItemMap.getMPMapData(par1Packet131MapData.uniqueID, this.mc.theWorld).updateMPMapData(par1Packet131MapData.itemData);
}
+ else if (ForgeHooks.onItemDataPacket(netManager, par1Packet131MapData))
+ {
+ ;
+ }
else
{
System.out.println("Unknown itemid: " + par1Packet131MapData.uniqueID);
@@ -1120,5 +1167,6 @@
public void handleCustomPayload(Packet250CustomPayload par1Packet250CustomPayload)
{
FMLClientHandler.instance().handlePacket250(par1Packet250CustomPayload);
+ ForgeHooksClient.onCustomPayload(par1Packet250CustomPayload, netManager);
}
}

View file

@ -1,34 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/NetworkManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/NetworkManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -11,6 +11,8 @@
import java.util.Collections;
import java.util.List;
+import net.minecraft.src.forge.ForgeHooks;
+
public class NetworkManager
{
/** Synchronization object used for read and write threads. */
@@ -307,6 +309,7 @@
{
;
}
+ ForgeHooks.onDisconnect(this, par1Str, par2ArrayOfObj);
}
}
@@ -430,4 +433,14 @@
{
return par0NetworkManager.writeThread;
}
+
+ /**
+ * Retrieves the current associated network handler.
+ * Added so modders don't have to use reflection.
+ * @return The current registered Network Handler
+ */
+ public NetHandler getNetHandler()
+ {
+ return netHandler;
+ }
}

View file

@ -1,51 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Packet53BlockChange.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Packet53BlockChange.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,6 +4,8 @@
import java.io.DataOutputStream;
import java.io.IOException;
+import net.minecraft.src.forge.ForgeHooksClient;
+
public class Packet53BlockChange extends Packet
{
/** Block X position. */
@@ -34,7 +36,14 @@
this.xPosition = par1DataInputStream.readInt();
this.yPosition = par1DataInputStream.read();
this.zPosition = par1DataInputStream.readInt();
- this.type = par1DataInputStream.read();
+ if (ForgeHooksClient.enable4096)
+ {
+ this.type = par1DataInputStream.readInt();
+ }
+ else
+ {
+ this.type = par1DataInputStream.read();
+ }
this.metadata = par1DataInputStream.read();
}
@@ -46,7 +55,14 @@
par1DataOutputStream.writeInt(this.xPosition);
par1DataOutputStream.write(this.yPosition);
par1DataOutputStream.writeInt(this.zPosition);
- par1DataOutputStream.write(this.type);
+ if (ForgeHooksClient.enable4096)
+ {
+ par1DataOutputStream.writeInt(this.type);
+ }
+ else
+ {
+ par1DataOutputStream.write(this.type);
+ }
par1DataOutputStream.write(this.metadata);
}
@@ -63,6 +79,6 @@
*/
public int getPacketSize()
{
- return 11;
+ return ForgeHooksClient.enable4096 ? 14 : 11;
}
}

View file

@ -1,27 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerController.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
public abstract class PlayerController
{
@@ -39,7 +40,7 @@
{
var5.playAuxSFX(2001, par1, par2, par3, var6.blockID + (var5.getBlockMetadata(par1, par2, par3) << 12));
int var7 = var5.getBlockMetadata(par1, par2, par3);
- boolean var8 = var5.setBlockWithNotify(par1, par2, par3, 0);
+ boolean var8 = var6.removeBlockByPlayer(var5, mc.thePlayer, par1, par2, par3);
if (var8)
{
@@ -86,6 +87,7 @@
if (var5.stackSize == 0)
{
par1EntityPlayer.inventory.mainInventory[par1EntityPlayer.inventory.currentItem] = null;
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, var5);
}
return true;

View file

@ -1,28 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerCreative.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerCreative.java 0000-00-00 00:00:00.000000000 -0000
@@ -52,6 +52,11 @@
*/
public static void clickBlockCreative(Minecraft par0Minecraft, PlayerController par1PlayerController, int par2, int par3, int par4, int par5)
{
+ ItemStack itemstack = par0Minecraft.thePlayer.getCurrentEquippedItem();
+ if (itemstack != null && itemstack.getItem().onBlockStartBreak(itemstack, par2, par3, par4, par0Minecraft.thePlayer))
+ {
+ return;
+ }
if (!par0Minecraft.theWorld.func_48457_a(par0Minecraft.thePlayer, par2, par3, par4, par5))
{
par1PlayerController.onPlayerDestroyBlock(par2, par3, par4, par5);
@@ -63,6 +68,13 @@
*/
public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7)
{
+ if (par3ItemStack != null &&
+ par3ItemStack.getItem() != null &&
+ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return true;
+ }
+
int var8 = par2World.getBlockId(par4, par5, par6);
if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer))

View file

@ -1,72 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
public class PlayerControllerMP extends PlayerController
{
@@ -75,6 +76,11 @@
*/
public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4)
{
+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
+ if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, mc.thePlayer))
+ {
+ return false;
+ }
if (this.creativeMode)
{
return super.onPlayerDestroyBlock(par1, par2, par3, par4);
@@ -121,7 +127,7 @@
Block.blocksList[var5].onBlockClicked(this.mc.theWorld, par1, par2, par3, this.mc.thePlayer);
}
- if (var5 > 0 && Block.blocksList[var5].blockStrength(this.mc.thePlayer) >= 1.0F)
+ if (var5 > 0 && Block.blocksList[var5].blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3) >= 1.0F)
{
this.onPlayerDestroyBlock(par1, par2, par3, par4);
}
@@ -177,7 +183,7 @@
}
Block var6 = Block.blocksList[var5];
- this.curBlockDamageMP += var6.blockStrength(this.mc.thePlayer);
+ this.curBlockDamageMP += var6.blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3);
if (this.stepSoundTickCounter % 4.0F == 0.0F && var6 != null)
{
@@ -263,6 +269,14 @@
{
this.syncCurrentPlayItem();
this.netClientHandler.addToSendQueue(new Packet15Place(par4, par5, par6, par7, par1EntityPlayer.inventory.getCurrentItem()));
+
+ if (par3ItemStack != null &&
+ par3ItemStack.getItem() != null &&
+ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return true;
+ }
+
int var8 = par2World.getBlockId(par4, par5, par6);
if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer))
@@ -284,7 +298,15 @@
}
else
{
- return par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7);
+ if (!par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return false;
+ }
+ if (par3ItemStack.stackSize <= 0)
+ {
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack);
+ }
+ return true;
}
}

View file

@ -1,83 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerSP.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,7 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooks;
public class PlayerControllerSP extends PlayerController
{
@@ -35,11 +36,17 @@
*/
public boolean onPlayerDestroyBlock(int par1, int par2, int par3, int par4)
{
+ ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
+ if (stack != null && stack.getItem().onBlockStartBreak(stack, par1, par2, par3, mc.thePlayer))
+ {
+ return false;
+ }
+
int var5 = this.mc.theWorld.getBlockId(par1, par2, par3);
int var6 = this.mc.theWorld.getBlockMetadata(par1, par2, par3);
boolean var7 = super.onPlayerDestroyBlock(par1, par2, par3, par4);
ItemStack var8 = this.mc.thePlayer.getCurrentEquippedItem();
- boolean var9 = this.mc.thePlayer.canHarvestBlock(Block.blocksList[var5]);
+ boolean var9 = Block.blocksList[var5].canHarvestBlock(mc.thePlayer, var6);
if (var8 != null)
{
@@ -75,7 +82,7 @@
Block.blocksList[var5].onBlockClicked(this.mc.theWorld, par1, par2, par3, this.mc.thePlayer);
}
- if (var5 > 0 && Block.blocksList[var5].blockStrength(this.mc.thePlayer) >= 1.0F)
+ if (var5 > 0 && Block.blocksList[var5].blockStrength(mc.theWorld, mc.thePlayer, par1, par2, par3) >= 1.0F)
{
this.onPlayerDestroyBlock(par1, par2, par3, par4);
}
@@ -117,7 +124,7 @@
}
Block var6 = Block.blocksList[var5];
- this.curBlockDamage += var6.blockStrength(this.mc.thePlayer);
+ this.curBlockDamage += var6.blockStrength(mc.theWorld, this.mc.thePlayer, par1, par2, par3);
if (this.blockDestroySoundCounter % 4.0F == 0.0F && var6 != null)
{
@@ -195,8 +202,34 @@
*/
public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7)
{
+ if (par3ItemStack != null &&
+ par3ItemStack.getItem() != null &&
+ par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return true;
+ }
+
int var8 = par2World.getBlockId(par4, par5, par6);
- return var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer) ? true : (par3ItemStack == null ? false : par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7));
+ if (var8 > 0 && Block.blocksList[var8].blockActivated(par2World, par4, par5, par6, par1EntityPlayer))
+ {
+ return true;
+ }
+
+ if (par3ItemStack == null)
+ {
+ return false;
+ }
+
+ if (!par3ItemStack.useItem(par1EntityPlayer, par2World, par4, par5, par6, par7))
+ {
+ return false;
+ }
+
+ if (par3ItemStack.stackSize <= 0)
+ {
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, par3ItemStack);
+ }
+ return true;
}
public boolean func_35642_f()

View file

@ -1,89 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RailLogic.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;
-class RailLogic
+public class RailLogic
{
/** Reference to the World object. */
private World worldObj;
@@ -18,6 +18,7 @@
private List connectedTracks;
final BlockRail rail;
+ private final boolean canMakeSlopes;
public RailLogic(BlockRail par1BlockRail, World par2World, int par3, int par4, int par5)
{
@@ -28,18 +29,12 @@
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]))
- {
- this.isPoweredRail = true;
- var7 &= -9;
- }
- else
- {
- this.isPoweredRail = false;
- }
-
+
+ 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);
+
this.setConnections(var7);
}
@@ -258,7 +253,7 @@
}
}
- if (var6 == 0)
+ if (var6 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -271,7 +266,7 @@
}
}
- if (var6 == 1)
+ if (var6 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{
@@ -422,7 +417,7 @@
}
}
- if (var7 == 0)
+ if (var7 == 0 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX, this.trackY + 1, this.trackZ - 1))
{
@@ -435,7 +430,7 @@
}
}
- if (var7 == 1)
+ if (var7 == 1 && canMakeSlopes)
{
if (BlockRail.isRailBlockAt(this.worldObj, this.trackX + 1, this.trackY + 1, this.trackZ))
{
@@ -485,7 +480,7 @@
/**
* get number of adjacent tracks
*/
- static int getNAdjacentTracks(RailLogic par0RailLogic)
+ public static int getNAdjacentTracks(RailLogic par0RailLogic)
{
return par0RailLogic.getAdjacentTracks();
}

View file

@ -1,37 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderBiped.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderBiped.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,10 @@
package net.minecraft.src;
+import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.EQUIPPED;
+import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.BLOCK_3D;
+import net.minecraft.src.forge.IItemRenderer;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
public class RenderBiped extends RenderLiving
@@ -32,7 +37,10 @@
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
float var4;
- if (var3.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
+
+ if (var3.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType())))
{
var4 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -72,7 +80,10 @@
if (var3.getItem().requiresMultipleRenderPasses())
{
- this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, 1);
+ for (int x = 1; x < var3.getItem().getRenderPasses(var3.getItemDamage()); x++)
+ {
+ this.renderManager.itemRenderer.renderItem(par1EntityLiving, var3, x);
+ }
}
GL11.glPopMatrix();

View file

@ -1,140 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderBlocks.java 0000-00-00 00:00:00.000000000 -0000
@@ -456,9 +456,8 @@
public boolean renderBlockBed(Block par1Block, int par2, int par3, int par4)
{
Tessellator var5 = Tessellator.instance;
- int var6 = this.blockAccess.getBlockMetadata(par2, par3, par4);
- int var7 = BlockBed.getDirection(var6);
- boolean var8 = BlockBed.isBlockFootOfBed(var6);
+ int var7 = par1Block.getBedDirection(blockAccess, par2, par3, par4);
+ boolean var8 = par1Block.isBedFoot(blockAccess, par2, par3, par4);
float var9 = 0.5F;
float var10 = 1.0F;
float var11 = 0.8F;
@@ -1386,7 +1385,7 @@
double var30;
double var32;
- if (!this.blockAccess.isBlockNormalCube(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4))
+ if (!this.blockAccess.isBlockNormalCube(par2, par3 - 1, par4) && !Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 - 1, par4, 1))
{
float var36 = 0.2F;
float var19 = 0.0625F;
@@ -1406,7 +1405,7 @@
var9 = var20;
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 - 1, par3, par4, 5))
{
var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var11, var13);
var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 1), var11, var15);
@@ -1418,7 +1417,7 @@
var5.addVertexWithUV((double)((float)par2 + var36), (double)((float)par3 + var17 + var19), (double)(par4 + 1), var11, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2 + 1, par3, par4, 4))
{
var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var13);
var5.addVertexWithUV((double)(par2 + 1 - 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var9, var15);
@@ -1430,7 +1429,7 @@
var5.addVertexWithUV((double)((float)(par2 + 1) - var36), (double)((float)par3 + var17 + var19), (double)(par4 + 0), var9, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 - 1, 3))
{
var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var11, var13);
var5.addVertexWithUV((double)(par2 + 0), (double)((float)(par3 + 0) + var19), (double)(par4 + 0), var11, var15);
@@ -1442,7 +1441,7 @@
var5.addVertexWithUV((double)(par2 + 0), (double)((float)par3 + var17 + var19), (double)((float)par4 + var36), var11, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3, par4 + 1, 2))
{
var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var13);
var5.addVertexWithUV((double)(par2 + 1), (double)((float)(par3 + 0) + var19), (double)(par4 + 1 - 0), var9, var15);
@@ -1454,7 +1453,7 @@
var5.addVertexWithUV((double)(par2 + 1), (double)((float)par3 + var17 + var19), (double)((float)(par4 + 1) - var36), var9, var13);
}
- if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4))
+ if (Block.fire.canBlockCatchFire(this.blockAccess, par2, par3 + 1, par4, 0))
{
var20 = (double)par2 + 0.5D + 0.5D;
var22 = (double)par2 + 0.5D - 0.5D;
@@ -3610,7 +3609,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var27);
- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -3733,7 +3732,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3));
- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -3856,7 +3855,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var27);
- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -3979,7 +3978,7 @@
var27 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var27);
- if (cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var27 == 3 && this.overrideBlockTexture < 0)
{
this.colorRedTopLeft *= par5;
this.colorRedBottomLeft *= par5;
@@ -4091,7 +4090,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 2);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7);
this.renderEastFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -4107,7 +4106,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 3);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var18 * par5, var21 * par6, var24 * par7);
this.renderWestFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -4123,7 +4122,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 4);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7);
this.renderNorthFace(par1Block, (double)par2, (double)par3, (double)par4, 38);
@@ -4139,7 +4138,7 @@
var28 = par1Block.getBlockTexture(this.blockAccess, par2, par3, par4, 5);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, var28);
- if (cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
+ if (Tessellator.instance.defaultTexture && cfgGrassFix && var28 == 3 && this.overrideBlockTexture < 0)
{
var8.setColorOpaque_F(var19 * par5, var22 * par6, var25 * par7);
this.renderSouthFace(par1Block, (double)par2, (double)par3, (double)par4, 38);

View file

@ -1,36 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderEngine.java 0000-00-00 00:00:00.000000000 -0000
@@ -27,6 +27,8 @@
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
+import net.minecraft.src.forge.ForgeHooksClient;
+
public class RenderEngine
{
/** Use mipmaps for all bound textures (unused at present) */
@@ -59,7 +61,7 @@
public boolean blurTexture = false;
/** Texture pack */
- private TexturePackList texturePack;
+ public TexturePackList texturePack;
/** Missing texture image */
private BufferedImage missingTextureImage = new BufferedImage(64, 64, 2);
@@ -169,6 +171,7 @@
{
try
{
+ ForgeHooksClient.onTextureLoadPre(par1Str);
this.singleIntBuffer.clear();
GLAllocation.generateTextureNames(this.singleIntBuffer);
int var6 = this.singleIntBuffer.get(0);
@@ -212,6 +215,7 @@
}
this.textureMap.put(par1Str, Integer.valueOf(var6));
+ ForgeHooksClient.onTextureLoad(par1Str, var6);
return var6;
}
catch (Exception var5)

View file

@ -1,73 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderGlobal.java 0000-00-00 00:00:00.000000000 -0000
@@ -15,10 +15,10 @@
public List tileEntities = new ArrayList();
/** A reference to the World object. */
- private World worldObj;
+ public World worldObj;
/** The RenderEngine instance used by RenderGlobal */
- private RenderEngine renderEngine;
+ public RenderEngine renderEngine;
private List worldRenderersToUpdate = new ArrayList();
private WorldRenderer[] sortedWorldRenderers;
private WorldRenderer[] worldRenderers;
@@ -30,10 +30,10 @@
private int glRenderListBase;
/** A reference to the Minecraft object. */
- private Minecraft mc;
+ public Minecraft mc;
/** Global render blocks */
- private RenderBlocks globalRenderBlocks;
+ public RenderBlocks globalRenderBlocks;
/** OpenGL occlusion query base */
private IntBuffer glOcclusionQueryBase;
@@ -1835,6 +1835,7 @@
double var17 = this.mc.renderViewEntity.posY - par4;
double var19 = this.mc.renderViewEntity.posZ - par6;
EntityFX var21 = null;
+ Object effectObject = null;
if (par1Str.equals("hugeexplosion"))
{
@@ -1954,6 +1955,7 @@
else if (par1Str.equals("snowballpoof"))
{
var21 = new EntityBreakingFX(this.worldObj, par2, par4, par6, Item.snowball);
+ effectObject = Item.snowball;
}
else if (par1Str.equals("dripWater"))
{
@@ -1970,6 +1972,7 @@
else if (par1Str.equals("slime"))
{
var21 = new EntityBreakingFX(this.worldObj, par2, par4, par6, Item.slimeBall);
+ effectObject = Item.slimeBall;
}
else if (par1Str.equals("heart"))
{
@@ -1983,17 +1986,19 @@
{
var24 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1));
var21 = new EntityBreakingFX(this.worldObj, par2, par4, par6, par8, par10, par12, Item.itemsList[var24]);
+ effectObject = Item.itemsList[var24];
}
else if (par1Str.startsWith("tilecrack_"))
{
var24 = Integer.parseInt(par1Str.substring(par1Str.indexOf("_") + 1));
var21 = new EntityDiggingFX(this.worldObj, par2, par4, par6, par8, par10, par12, Block.blocksList[var24], 0, 0);
+ effectObject = Block.blocksList[var24];
}
}
if (var21 != null)
{
- this.mc.effectRenderer.addEffect((EntityFX)var21);
+ this.mc.effectRenderer.addEffect((EntityFX)var21, effectObject);
}
return (EntityFX)var21;

View file

@ -1,115 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderItem.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,9 @@
package net.minecraft.src;
import java.util.Random;
+
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@@ -54,11 +57,15 @@
float var19;
float var18;
float var23;
-
- if (var10.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType()))
+
+ if (ForgeHooksClient.renderEntityItem(par1EntityItem, var10, var11, var12, random, renderManager.renderEngine, renderBlocks))
+ {
+ ;
+ }
+ else if (var10.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[var10.itemID].getRenderType()))
{
GL11.glRotatef(var12, 0.0F, 1.0F, 0.0F);
- this.loadTexture("/terrain.png");
+ this.loadTexture(Block.blocksList[var10.itemID].getTextureFile());
float var21 = 0.25F;
var15 = Block.blocksList[var10.itemID].getRenderType();
@@ -94,10 +101,11 @@
if (var10.getItem().requiresMultipleRenderPasses())
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
- this.loadTexture("/gui/items.png");
+ this.loadTexture(Item.itemsList[var10.itemID].getTextureFile());
- for (var14 = 0; var14 <= 1; ++var14)
+ for (var14 = 0; var14 < var10.getItem().getRenderPasses(var10.getItemDamage()); ++var14)
{
+ this.random.setSeed(187L); //Fixes Vanilla bug where layers would not render aligns properly.
var15 = var10.getItem().func_46057_a(var10.getItemDamage(), var14);
var16 = 1.0F;
@@ -117,15 +125,8 @@
{
GL11.glScalef(0.5F, 0.5F, 0.5F);
var14 = var10.getIconIndex();
-
- if (var10.itemID < 256)
- {
- this.loadTexture("/terrain.png");
- }
- else
- {
- this.loadTexture("/gui/items.png");
- }
+
+ this.loadTexture(var10.getItem().getTextureFile());
if (this.field_27004_a)
{
@@ -187,9 +188,9 @@
float var12;
float var13;
- if (par3 < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[par3].getRenderType()))
+ if (Item.itemsList[par3] instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.blocksList[par3].getRenderType()))
{
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png"));
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Block.blocksList[par3].getTextureFile()));
Block var15 = Block.blocksList[par3];
GL11.glPushMatrix();
GL11.glTranslatef((float)(par6 - 2), (float)(par7 + 3), -3.0F + this.zLevel);
@@ -221,9 +222,9 @@
if (Item.itemsList[par3].requiresMultipleRenderPasses())
{
GL11.glDisable(GL11.GL_LIGHTING);
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Item.itemsList[par3].getTextureFile()));
- for (var8 = 0; var8 <= 1; ++var8)
+ for (var8 = 0; var8 < Item.itemsList[par3].getRenderPasses(par4); ++var8)
{
int var9 = Item.itemsList[par3].func_46057_a(par4, var8);
var10 = Item.itemsList[par3].getColorFromDamage(par4, var8);
@@ -245,14 +246,7 @@
{
GL11.glDisable(GL11.GL_LIGHTING);
- if (par3 < 256)
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/terrain.png"));
- }
- else
- {
- par2RenderEngine.bindTexture(par2RenderEngine.getTexture("/gui/items.png"));
- }
+ par2RenderEngine.bindTexture(par2RenderEngine.getTexture(Item.itemsList[par3].getTextureFile()));
var8 = Item.itemsList[par3].getColorFromDamage(par4, 0);
float var14 = (float)(var8 >> 16 & 255) / 255.0F;
@@ -279,7 +273,10 @@
{
if (par3ItemStack != null)
{
- this.drawItemIntoGui(par1FontRenderer, par2RenderEngine, par3ItemStack.itemID, par3ItemStack.getItemDamage(), par3ItemStack.getIconIndex(), par4, par5);
+ if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, field_27004_a, zLevel, (float)par4, (float)par5))
+ {
+ this.drawItemIntoGui(par1FontRenderer, par2RenderEngine, par3ItemStack.itemID, par3ItemStack.getItemDamage(), par3ItemStack.getIconIndex(), par4, par5);
+ }
if (par3ItemStack != null && par3ItemStack.hasEffect())
{

View file

@ -1,21 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -124,12 +124,14 @@
if (par4EntityLiving.isPlayerSleeping())
{
- int var7 = par1World.getBlockId(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ));
+ int x = MathHelper.floor_double(par4EntityLiving.posX);
+ int y = MathHelper.floor_double(par4EntityLiving.posY);
+ int z = MathHelper.floor_double(par4EntityLiving.posZ);
+ Block block = Block.blocksList[par1World.getBlockId(x, y, z)];
- if (var7 == Block.bed.blockID)
+ if (block != null && block.isBed(par1World, x, y, z, par4EntityLiving))
{
- int var8 = par1World.getBlockMetadata(MathHelper.floor_double(par4EntityLiving.posX), MathHelper.floor_double(par4EntityLiving.posY), MathHelper.floor_double(par4EntityLiving.posZ));
- int var9 = var8 & 3;
+ int var9 = block.getBedDirection(par1World, x, y, z);
this.playerViewY = (float)(var9 * 90 + 180);
this.playerViewX = 0.0F;
}

View file

@ -1,73 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderPlayer.java 0000-00-00 00:00:00.000000000 -0000
@@ -4,8 +4,13 @@
import java.util.Arrays;
import java.util.List;
+import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.EQUIPPED;
+import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import net.minecraft.client.Minecraft;
import org.lwjgl.opengl.GL11;
+import net.minecraft.src.forge.IArmorTextureProvider;
+import net.minecraft.src.forge.IItemRenderer;
+import net.minecraft.src.forge.MinecraftForgeClient;
public class RenderPlayer extends RenderLiving
{
@@ -36,7 +41,14 @@
if (var5 instanceof ItemArmor)
{
ItemArmor var6 = (ItemArmor)var5;
- this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png");
+ if (var5 instanceof IArmorTextureProvider)
+ {
+ loadTexture(((IArmorTextureProvider)var5).getArmorTextureFile(var4));
+ }
+ else
+ {
+ this.loadTexture("/armor/" + armorFilenamePrefix[var6.renderIndex] + "_" + (par2 == 2 ? 2 : 1) + ".png");
+ }
ModelBiped var7 = par2 == 2 ? this.modelArmor : this.modelArmorChestplate;
var7.bipedHead.showModel = par2 == 0;
var7.bipedHeadwear.showModel = par2 == 0;
@@ -163,12 +175,15 @@
super.renderEquippedItems(par1EntityPlayer, par2);
ItemStack var3 = par1EntityPlayer.inventory.armorItemInSlot(3);
- if (var3 != null && var3.getItem().shiftedIndex < 256)
+ if (var3 != null && var3.getItem() instanceof ItemBlock)
{
GL11.glPushMatrix();
this.modelBipedMain.bipedHead.postRender(0.0625F);
- if (RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
+
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
{
float var4 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
@@ -269,8 +284,11 @@
{
var20 = var21.getItemUseAction();
}
-
- if (var21.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType()))
+
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var21, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var21, BLOCK_3D));
+
+ if (var21.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var21.itemID].getRenderType())))
{
var6 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
@@ -323,7 +341,7 @@
if (var21.getItem().requiresMultipleRenderPasses())
{
- for (int var25 = 0; var25 <= 1; ++var25)
+ for (int var25 = 0; var25 < var21.getItem().getRenderPasses(var21.getItemDamage()); ++var25)
{
int var24 = var21.getItem().getColorFromDamage(var21.getItemDamage(), var25);
float var26 = (float)(var24 >> 16 & 255) / 255.0F;

View file

@ -1,31 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/RenderSnowMan.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/RenderSnowMan.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,5 +1,10 @@
package net.minecraft.src;
+import static net.minecraft.src.forge.IItemRenderer.ItemRenderType.EQUIPPED;
+import static net.minecraft.src.forge.IItemRenderer.ItemRendererHelper.BLOCK_3D;
+import net.minecraft.src.forge.IItemRenderer;
+import net.minecraft.src.forge.MinecraftForgeClient;
+
import org.lwjgl.opengl.GL11;
public class RenderSnowMan extends RenderLiving
@@ -19,12 +24,15 @@
super.renderEquippedItems(par1EntitySnowman, par2);
ItemStack var3 = new ItemStack(Block.pumpkin, 1);
- if (var3 != null && var3.getItem().shiftedIndex < 256)
+ if (var3 != null && var3.getItem() instanceof ItemBlock)
{
GL11.glPushMatrix();
this.snowmanModel.field_40305_c.postRender(0.0625F);
- if (RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
+ IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(var3, EQUIPPED);
+ boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, var3, BLOCK_3D));
+
+ if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[var3.itemID].getRenderType()))
{
float var4 = 0.625F;
GL11.glTranslatef(0.0F, -0.34375F, 0.0F);

View file

@ -1,20 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/SlotCrafting.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,9 @@
import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.client.FMLClientHandler;
+import net.minecraft.src.forge.ForgeHooks;
+
public class SlotCrafting extends Slot
{
/** The craft matrix inventory linked to this result slot. */
@@ -99,6 +102,7 @@
public void onPickupFromSlot(ItemStack par1ItemStack)
{
FMLClientHandler.instance().onItemCrafted(thePlayer, par1ItemStack, craftMatrix);
+ ForgeHooks.onTakenFromCrafting(thePlayer, par1ItemStack, craftMatrix);
this.func_48434_c(par1ItemStack);
for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2)

View file

@ -1,108 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/SoundManager.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/SoundManager.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,9 @@
import java.io.File;
import java.util.Random;
+
+import net.minecraft.src.forge.ForgeHooksClient;
+import net.minecraft.src.forge.ModCompatibilityClient;
import paulscode.sound.SoundSystem;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.codecs.CodecJOrbis;
@@ -36,10 +39,12 @@
/** RNG. */
private Random rand = new Random();
private int ticksBeforeMusic;
+
+ public static int MUSIC_INTERVAL = 12000;
public SoundManager()
{
- this.ticksBeforeMusic = this.rand.nextInt(12000);
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL);
}
/**
@@ -54,6 +59,8 @@
{
this.tryToSetLibraryAndCodecs();
}
+ ModCompatibilityClient.audioModLoad(this);
+ ForgeHooksClient.onLoadSoundSettings(this);
}
/**
@@ -73,6 +80,8 @@
SoundSystemConfig.setCodec("ogg", CodecJOrbis.class);
SoundSystemConfig.setCodec("mus", CodecMus.class);
SoundSystemConfig.setCodec("wav", CodecWav.class);
+ ModCompatibilityClient.audioModAddCodecs();
+ ForgeHooksClient.onSetupAudio(this);
sndSystem = new SoundSystem();
this.options.soundVolume = var1;
this.options.musicVolume = var2;
@@ -161,10 +170,12 @@
}
SoundPoolEntry var1 = this.soundPoolMusic.getRandomSound();
+ var1 = ModCompatibilityClient.audioModPickBackgroundMusic(this, var1);
+ var1 = ForgeHooksClient.onPlayBackgroundMusic(this, var1);
if (var1 != null)
{
- this.ticksBeforeMusic = this.rand.nextInt(12000) + 12000;
+ this.ticksBeforeMusic = this.rand.nextInt(MUSIC_INTERVAL) + MUSIC_INTERVAL;
sndSystem.backgroundMusic("BgMusic", var1.soundUrl, var1.soundName, false);
sndSystem.setVolume("BgMusic", this.options.musicVolume);
sndSystem.play("BgMusic");
@@ -214,6 +225,7 @@
if (par1Str != null)
{
SoundPoolEntry var8 = this.soundPoolStreaming.getRandomSoundFromSoundPool(par1Str);
+ var8 = ForgeHooksClient.onPlayStreaming(this, var8, par1Str, par2, par3, par4);
if (var8 != null && par5 > 0.0F)
{
@@ -239,6 +251,7 @@
if (loaded && this.options.soundVolume != 0.0F)
{
SoundPoolEntry var7 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
+ var7 = ForgeHooksClient.onPlaySound(this, var7, par1Str, par2, par3, par4, par5, par6);
if (var7 != null && par5 > 0.0F)
{
@@ -274,6 +287,7 @@
if (loaded && this.options.soundVolume != 0.0F)
{
SoundPoolEntry var4 = this.soundPoolSounds.getRandomSoundFromSoundPool(par1Str);
+ var4 = ForgeHooksClient.onPlaySoundEffect(this, var4, par1Str, par2, par3);
if (var4 != null)
{
@@ -293,4 +307,25 @@
}
}
}
+
+ /** Getters for private class members **/
+ public static SoundSystem getSoundSystem()
+ {
+ return sndSystem;
+ }
+
+ public SoundPool getSoundsPool()
+ {
+ return soundPoolSounds;
+ }
+
+ public SoundPool getStreamingPool()
+ {
+ return soundPoolStreaming;
+ }
+
+ public SoundPool getMusicPool()
+ {
+ return soundPoolMusic;
+ }
}

View file

@ -1,52 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/SoundPool.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/SoundPool.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,7 @@
import java.io.File;
import java.net.MalformedURLException;
+import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -33,6 +34,25 @@
*/
public SoundPoolEntry addSound(String par1Str, File par2File)
{
+ try
+ {
+ return addSound(par1Str, par2File.toURI().toURL());
+ }
+ catch (MalformedURLException ex)
+ {
+ ex.printStackTrace();
+ throw new RuntimeException(ex);
+ }
+ }
+ /**
+ * URL version of addSound, as the back-end sound engine has full support for various types of URLs
+ *
+ * @param par1Str The name of the sound to add
+ * @param url The url of the sound resource
+ * @return A SoundPoolEntry for the newly added sound
+ */
+ public SoundPoolEntry addSound(String par1Str, URL url)
+ {
try
{
String var3 = par1Str;
@@ -53,13 +73,13 @@
this.nameToSoundPoolEntriesMapping.put(par1Str, new ArrayList());
}
- SoundPoolEntry var4 = new SoundPoolEntry(var3, par2File.toURI().toURL());
+ SoundPoolEntry var4 = new SoundPoolEntry(var3, url);
((List)this.nameToSoundPoolEntriesMapping.get(par1Str)).add(var4);
this.allSoundPoolEntries.add(var4);
++this.numberOfSoundPoolEntries;
return var4;
}
- catch (MalformedURLException var5)
+ catch (Exception var5)
{
var5.printStackTrace();
throw new RuntimeException(var5);

View file

@ -1,66 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/SpawnerAnimals.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,10 +1,14 @@
package net.minecraft.src;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
+import net.minecraft.src.forge.ForgeHooks;
+
public final class SpawnerAnimals
{
/** The 17x17 area around the player where mobs can spawn */
@@ -20,7 +24,7 @@
{
Chunk var3 = par0World.getChunkFromChunkCoords(par1, par2);
int var4 = par1 * 16 + par0World.rand.nextInt(16);
- int var5 = par0World.rand.nextInt(var3 == null ? 128 : Math.max(128, var3.getTopFilledSegment()));
+ int var5 = par0World.rand.nextInt(var3 == null ? 128 : Math.max(128, var3.getTopFilledSegment() + 15)); //Vanilla Bug that causes mobs to not spawn on the topmost chunk with blocks.
int var6 = par2 * 16 + par0World.rand.nextInt(16);
return new ChunkPosition(var4, var5, var6);
}
@@ -78,6 +82,12 @@
if ((!var34.getPeacefulCreature() || par2) && (var34.getPeacefulCreature() || par1) && par0World.countEntities(var34.getCreatureClass()) <= var34.getMaxNumberOfCreature() * eligibleChunksForSpawning.size() / 256)
{
Iterator var35 = eligibleChunksForSpawning.keySet().iterator();
+ if (mod_MinecraftForge.SPAWNER_MAKE_MORE_RANDOM)
+ {
+ ArrayList<ChunkCoordIntPair> tmp = new ArrayList(eligibleChunksForSpawning.keySet());
+ Collections.shuffle(tmp);
+ var35 = tmp.iterator();
+ }
label108:
while (var35.hasNext())
@@ -202,7 +212,8 @@
else
{
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
- return Block.isNormalCube(var5) && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4);
+ boolean spawnBlock = (Block.blocksList[var5] != null && Block.blocksList[var5].canCreatureSpawn(par0EnumCreatureType, par1World, par2, par3 - 1, par4));
+ return spawnBlock && var5 != Block.bedrock.blockID && !par1World.isBlockNormalCube(par2, par3, par4) && !par1World.getBlockMaterial(par2, par3, par4).isLiquid() && !par1World.isBlockNormalCube(par2, par3 + 1, par4);
}
}
@@ -211,6 +222,16 @@
*/
private static void creatureSpecificInit(EntityLiving par0EntityLiving, World par1World, float par2, float par3, float par4)
{
+ if (ForgeHooks.onEntitySpawnSpecial(par0EntityLiving, par1World, par2, par3, par4)) //Deprecated in 1.2.5, remove in 1.3
+ {
+ return;
+ }
+
+ if (ForgeHooks.onEntityLivingSpawn(par0EntityLiving, par1World, par2, par3, par4))
+ {
+ return;
+ }
+
if (par0EntityLiving instanceof EntitySpider && par1World.rand.nextInt(100) == 0)
{
EntitySkeleton var7 = new EntitySkeleton(par1World);

View file

@ -1,14 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/StatList.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/StatList.java 0000-00-00 00:00:00.000000000 -0000
@@ -166,9 +166,9 @@
*/
private static StatBase[] initMinableStats(String par0Str, int par1)
{
- StatBase[] var2 = new StatBase[256];
+ StatBase[] var2 = new StatBase[Block.blocksList.length];
- for (int var3 = 0; var3 < 256; ++var3)
+ for (int var3 = 0; var3 < Block.blocksList.length; ++var3)
{
if (Block.blocksList[var3] != null && Block.blocksList[var3].getEnableStats())
{

View file

@ -1,41 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Teleporter.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Teleporter.java 0000-00-00 00:00:00.000000000 -0000
@@ -70,7 +70,7 @@
{
double var15 = (double)var14 + 0.5D - par2Entity.posZ;
- for (int var17 = 127; var17 >= 0; --var17)
+ for (int var17 = par1World.getHeight() - 1; var17 >= 0; --var17) //BugFix
{
if (par1World.getBlockId(var11, var17, var14) == Block.portal.blockID)
{
@@ -170,7 +170,7 @@
var18 = (double)var17 + 0.5D - par2Entity.posZ;
label274:
- for (var20 = 127; var20 >= 0; --var20)
+ for (var20 = par1World.getHeight() - 1; var20 >= 0; --var20) //BugFix
{
if (par1World.isAirBlock(var14, var20, var17))
{
@@ -236,7 +236,7 @@
var18 = (double)var17 + 0.5D - par2Entity.posZ;
label222:
- for (var20 = 127; var20 >= 0; --var20)
+ for (var20 = par1World.getHeight() - 1; var20 >= 0; --var20) //BugFix
{
if (par1World.isAirBlock(var14, var20, var17))
{
@@ -304,9 +304,9 @@
var10 = 70;
}
- if (var10 > 118)
+ if (var10 > par1World.getHeight() - 10) //BugFix
{
- var10 = 118;
+ var10 = par1World.getHeight() - 10; //BugFix
}
var16 = var10;

View file

@ -1,219 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/Tessellator.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,12 +5,20 @@
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
+import java.util.Arrays;
+
import org.lwjgl.opengl.ARBVertexBufferObject;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GLContext;
public class Tessellator
{
+ private static int nativeBufferSize = 0x200000;
+ private static int trivertsInBuffer = (nativeBufferSize / 48) * 6;
+ public static boolean renderingWorldRenderer = false;
+ public boolean defaultTexture = false;
+ private int rawBufferSize = 0;
+ public int textureID = 0;
/**
* Boolean used to check whether quads should be drawn as four triangles. Initialized to true and never changed.
*/
@@ -22,16 +30,16 @@
private static boolean tryVBO = false;
/** The byte buffer used for GL allocation. */
- private ByteBuffer byteBuffer;
+ private static ByteBuffer byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4);
/** The same memory as byteBuffer, but referenced as an integer buffer. */
- private IntBuffer intBuffer;
+ private static IntBuffer intBuffer = byteBuffer.asIntBuffer();
/** The same memory as byteBuffer, but referenced as an float buffer. */
- private FloatBuffer floatBuffer;
+ private static FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
/** Short buffer */
- private ShortBuffer shortBuffer;
+ private static ShortBuffer shortBuffer = byteBuffer.asShortBuffer();
/** Raw integer array. */
private int[] rawBuffer;
@@ -80,37 +88,37 @@
private boolean isColorDisabled = false;
/** The draw mode currently being used by the tessellator. */
- private int drawMode;
+ public int drawMode;
/**
* An offset to be applied along the x-axis for all vertices in this draw call.
*/
- private double xOffset;
+ public double xOffset;
/**
* An offset to be applied along the y-axis for all vertices in this draw call.
*/
- private double yOffset;
+ public double yOffset;
/**
* An offset to be applied along the z-axis for all vertices in this draw call.
*/
- private double zOffset;
+ public double zOffset;
/** The normal to be applied to the face being drawn. */
private int normal;
/** The static instance of the Tessellator. */
- public static final Tessellator instance = new Tessellator(2097152);
+ public static Tessellator instance = new Tessellator();
/** Whether this tessellator is currently in draw mode. */
- private boolean isDrawing = false;
+ public boolean isDrawing = false;
/** Whether we are currently using VBO or not. */
- private boolean useVBO = false;
+ private static boolean useVBO = false;
/** An IntBuffer used to store the indices of vertex buffer objects. */
- private IntBuffer vertexBuffers;
+ private static IntBuffer vertexBuffers;
/**
* The index of the last VBO used. This is used in round-robin fashion, sequentially, through the vboCount vertex
@@ -119,27 +127,23 @@
private int vboIndex = 0;
/** Number of vertex buffer objects allocated for use. */
- private int vboCount = 10;
-
- /** The size of the buffers used (in integers). */
- private int bufferSize;
+ private static int vboCount = 10;
- private Tessellator(int par1)
+ static
{
- this.bufferSize = par1;
- this.byteBuffer = GLAllocation.createDirectByteBuffer(par1 * 4);
- this.intBuffer = this.byteBuffer.asIntBuffer();
- this.floatBuffer = this.byteBuffer.asFloatBuffer();
- this.shortBuffer = this.byteBuffer.asShortBuffer();
- this.rawBuffer = new int[par1];
- this.useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
-
- if (this.useVBO)
+ instance.defaultTexture = true;
+ useVBO = tryVBO && GLContext.getCapabilities().GL_ARB_vertex_buffer_object;
+ if (useVBO)
{
- this.vertexBuffers = GLAllocation.createDirectIntBuffer(this.vboCount);
- ARBVertexBufferObject.glGenBuffersARB(this.vertexBuffers);
+ vertexBuffers = GLAllocation.createDirectIntBuffer(vboCount);
+ ARBVertexBufferObject.glGenBuffersARB(vertexBuffers);
}
}
+
+ public Tessellator()
+ {
+ this.rawBuffer = null;
+ }
/**
* Draws the data set up in this tessellator and resets the state to prepare for new drawing.
@@ -154,12 +158,23 @@
{
this.isDrawing = false;
- if (this.vertexCount > 0)
+ int offs = 0;
+ while (offs < vertexCount)
{
+ int vtc = 0;
+ if (drawMode == 7 && convertQuadsToTriangles)
+ {
+ Math.min(vertexCount - offs, trivertsInBuffer);
+ }
+ else
+ {
+ vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5);
+ }
this.intBuffer.clear();
- this.intBuffer.put(this.rawBuffer, 0, this.rawBufferIndex);
+ intBuffer.put(rawBuffer, offs * 8, vtc * 8);
this.byteBuffer.position(0);
- this.byteBuffer.limit(this.rawBufferIndex * 4);
+ byteBuffer.limit(vtc * 32);
+ offs += vtc;
if (this.useVBO)
{
@@ -245,11 +260,11 @@
if (this.drawMode == 7 && convertQuadsToTriangles)
{
- GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, this.vertexCount);
+ GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vtc);
}
else
{
- GL11.glDrawArrays(this.drawMode, 0, this.vertexCount);
+ GL11.glDrawArrays(this.drawMode, 0, vtc);
}
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
@@ -276,7 +291,13 @@
GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
}
}
-
+
+ if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3))
+ {
+ rawBufferSize = 0;
+ rawBuffer = null;
+ }
+
int var1 = this.rawBufferIndex * 4;
this.reset();
return var1;
@@ -439,6 +460,19 @@
*/
public void addVertex(double par1, double par3, double par5)
{
+ if (rawBufferIndex >= rawBufferSize - 32)
+ {
+ if (rawBufferSize == 0)
+ {
+ rawBufferSize = 0x10000;
+ rawBuffer = new int[rawBufferSize];
+ }
+ else
+ {
+ rawBufferSize *= 2;
+ rawBuffer = Arrays.copyOf(rawBuffer, rawBufferSize);
+ }
+ }
++this.addedVertices;
if (this.drawMode == 7 && convertQuadsToTriangles && this.addedVertices % 4 == 0)
@@ -497,12 +531,6 @@
this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(par5 + this.zOffset));
this.rawBufferIndex += 8;
++this.vertexCount;
-
- if (this.vertexCount % 4 == 0 && this.rawBufferIndex >= this.bufferSize - 32)
- {
- this.draw();
- this.isDrawing = true;
- }
}
/**

View file

@ -1,32 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntity.java 0000-00-00 00:00:00.000000000 -0000
@@ -223,4 +223,29 @@
public static void addNewTileEntityMapping(Class<? extends TileEntity> tileEntityClass, String id) {
addMapping(tileEntityClass, id);
}
+
+ /**
+ * Determines if this TileEntity requires update calls.
+ * @return True if you want updateEntity() to be called, false if not
+ */
+ public boolean canUpdate()
+ {
+ return true;
+ }
+
+ /**
+ * Called when you receive a TileEntityData packet for the location this
+ * TileEntity is currently in. On the client, the NetworkManager will always
+ * be the remote server. On the server, it will be whomever is responsible for
+ * sending the packet.
+ *
+ * @param net The NetworkManager the packet originated from
+ * @param pkt The data packet
+ */
+ public void onDataPacket(NetworkManager net, Packet132TileEntityData pkt){}
+
+ /**
+ * Called when the chunk this TileEntity is on is Unloaded.
+ */
+ public void onChunkUnload(){}
}

View file

@ -1,30 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntityBrewingStand.java 0000-00-00 00:00:00.000000000 -0000
@@ -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, ISidedInventory
{
/** The itemstacks currently placed in the slots of the brewing stand */
private ItemStack[] brewingItemStacks = new ItemStack[4];
@@ -322,4 +324,16 @@
return var1;
}
+
+ @Override
+ public int getStartInventorySide(int side)
+ {
+ return (side == 1 ? 3 : 0);
+ }
+
+ @Override
+ public int getSizeInventorySide(int side)
+ {
+ return (side == 1 ? 1 : 3);
+ }
}

View file

@ -1,96 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntityFurnace.java 0000-00-00 00:00:00.000000000 -0000
@@ -3,7 +3,10 @@
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
-public class TileEntityFurnace extends TileEntity implements IInventory
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.ISidedInventory;
+
+public class TileEntityFurnace extends TileEntity implements IInventory, ISidedInventory
{
/**
* The ItemStacks that hold the items currently being used in the furnace
@@ -275,8 +278,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 <= getInventoryStackLimit() && result <= var1.getMaxStackSize());
}
}
@@ -287,15 +294,25 @@
{
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;
+ //==========================================================
+ //Adding extra importance here, so this really small bug
+ //fix stops slipping through the cracks.
+ //
+ //Makes it so that items that result in multiple items are
+ //smelted correctly each time.
+ //
+ //
+ //
+ this.furnaceItemStacks[2].stackSize += var1.stackSize;
+ //==========================================================
}
--this.furnaceItemStacks[0].stackSize;
@@ -320,12 +337,17 @@
else
{
int var1 = par1ItemStack.getItem().shiftedIndex;
- if (var1 < 256 && Block.blocksList[var1].blockMaterial == Material.wood) return 300;
+ if (par1ItemStack.getItem() instanceof ItemBlock && Block.blocksList[var1].blockMaterial == Material.wood) return 300;
if (var1 == Item.stick.shiftedIndex) return 100;
if (var1 == Item.coal.shiftedIndex) return 1600;
if (var1 == Item.bucketLava.shiftedIndex) return 20000;
if (var1 == Block.sapling.blockID) return 100;
if (var1 == Item.blazeRod.shiftedIndex) return 2400;
+ int ret = ForgeHooks.getItemBurnTime(par1ItemStack);
+ if (ret > 0)
+ {
+ return ret;
+ }
return FMLCommonHandler.instance().fuelLookup(var1, par1ItemStack.getItemDamageForDisplay());
}
}
@@ -349,4 +371,18 @@
public void openChest() {}
public void closeChest() {}
+
+ @Override
+ public int getStartInventorySide(int side)
+ {
+ if (side == 0) return 1;
+ if (side == 1) return 0;
+ return 2;
+ }
+
+ @Override
+ public int getSizeInventorySide(int side)
+ {
+ return 1;
+ }
}

View file

@ -1,28 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/TileEntityRendererPiston.java 0000-00-00 00:00:00.000000000 -0000
@@ -1,6 +1,8 @@
package net.minecraft.src;
import net.minecraft.client.Minecraft;
+import net.minecraft.src.forge.ForgeHooksClient;
+
import org.lwjgl.opengl.GL11;
public class TileEntityRendererPiston extends TileEntitySpecialRenderer
@@ -29,7 +31,7 @@
{
GL11.glShadeModel(GL11.GL_FLAT);
}
-
+ ForgeHooksClient.beforeBlockRender(var9, blockRenderer);
var10.startDrawingQuads();
var10.setTranslation((double)((float)par2 - (float)par1TileEntityPiston.xCoord + par1TileEntityPiston.getOffsetX(par8)), (double)((float)par4 - (float)par1TileEntityPiston.yCoord + par1TileEntityPiston.getOffsetY(par8)), (double)((float)par6 - (float)par1TileEntityPiston.zCoord + par1TileEntityPiston.getOffsetZ(par8)));
var10.setColorOpaque(1, 1, 1);
@@ -53,6 +55,7 @@
var10.setTranslation(0.0D, 0.0D, 0.0D);
var10.draw();
+ ForgeHooksClient.afterBlockRender(var9, blockRenderer);
RenderHelper.enableStandardItemLighting();
}
}

View file

@ -1,380 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/World.java 0000-00-00 00:00:00.000000000 -0000
@@ -9,8 +9,18 @@
import java.util.Set;
import java.util.TreeSet;
+import net.minecraft.src.forge.ForgeHooks;
+import net.minecraft.src.forge.ForgeHooksClient;
+
public class World implements IBlockAccess
{
+ /**
+ * Used in the getEntitiesWithinAABB functions to expand the search area for entities.
+ * Modders should change this variable to a higher value if it is less then the radius
+ * of one of there entities.
+ */
+ public static double MAX_ENTITY_RADIUS = 2.0D;
+
/**
* boolean; if true updates scheduled by scheduleBlockUpdate happen immediately
*/
@@ -79,7 +89,7 @@
* Contains a timestamp from when the World object was created. Is used in the session.lock file
*/
private long lockTimestamp;
- protected int autosavePeriod;
+ public int autosavePeriod;
/** Option > Difficulty setting (0 - 3) */
public int difficultySetting;
@@ -214,6 +224,7 @@
this.chunkProvider = this.createChunkProvider();
this.calculateInitialSkylight();
this.calculateInitialWeather();
+ ForgeHooks.onWorldLoad(this);
}
public World(World par1World, WorldProvider par2WorldProvider)
@@ -259,6 +270,7 @@
this.chunkProvider = this.createChunkProvider();
this.calculateInitialSkylight();
this.calculateInitialWeather();
+ ForgeHooks.onWorldLoad(this);
}
public World(ISaveHandler par1ISaveHandler, String par2Str, WorldSettings par3WorldSettings)
@@ -340,6 +352,7 @@
this.calculateInitialSkylight();
this.calculateInitialWeather();
+ ForgeHooks.onWorldLoad(this);
}
/**
@@ -507,6 +520,7 @@
}
this.chunkProvider.saveChunks(par1, par2IProgressUpdate);
+ ForgeHooks.onWorldSave(this);
}
}
@@ -559,7 +573,8 @@
*/
public boolean isAirBlock(int par1, int par2, int par3)
{
- 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);
}
/**
@@ -1253,7 +1268,9 @@
int var12 = this.getBlockMetadata(var8, var9, var10);
Block var13 = Block.blocksList[var11];
- if ((!par4 || var13 == null || var13.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) && var11 > 0 && var13.canCollideCheck(var12, par3))
+ if (var13 != null && //BugFix NPE on misconfigured block ids.
+ (!par4 || var13 == null || var13.getCollisionBoundingBoxFromPool(this, var8, var9, var10) != null) &&
+ var11 > 0 && var13.canCollideCheck(var12, par3))
{
MovingObjectPosition var14 = var13.collisionRayTrace(this, var8, var9, var10, par1Vec3D, par2Vec3D);
@@ -1453,6 +1470,12 @@
*/
public void playSoundAtEntity(Entity par1Entity, String par2Str, float par3, float par4)
{
+ par2Str = ForgeHooksClient.onPlaySoundAtEntity(par1Entity, par2Str, par3, par4);
+ if (par2Str == null)
+ {
+ return;
+ }
+
for (int var5 = 0; var5 < this.worldAccesses.size(); ++var5)
{
((IWorldAccess)this.worldAccesses.get(var5)).playSound(par2Str, par1Entity.posX, par1Entity.posY - (double)par1Entity.yOffset, par1Entity.posZ, par3, par4);
@@ -2068,7 +2091,7 @@
if (var7 != null)
{
- var7.removeChunkBlockTileEntity(var5.xCoord & 15, var5.yCoord, var5.zCoord & 15);
+ var7.cleanChunkBlockTileEntity(var5.xCoord & 15, var5.yCoord, var5.zCoord & 15);
}
}
}
@@ -2078,6 +2101,10 @@
if (!this.entityRemoval.isEmpty())
{
+ for (Object tile : entityRemoval)
+ {
+ ((TileEntity)tile).onChunkUnload();
+ }
this.loadedTileEntityList.removeAll(this.entityRemoval);
this.entityRemoval.clear();
}
@@ -2098,18 +2125,18 @@
{
this.loadedTileEntityList.add(var8);
}
-
+ }
+ else
+ {
if (this.chunkExists(var8.xCoord >> 4, var8.zCoord >> 4))
{
Chunk var9 = this.getChunkFromChunkCoords(var8.xCoord >> 4, var8.zCoord >> 4);
if (var9 != null)
{
- var9.setChunkBlockTileEntity(var8.xCoord & 15, var8.yCoord, var8.zCoord & 15, var8);
+ var9.cleanChunkBlockTileEntity(var8.xCoord & 15, var8.yCoord, var8.zCoord & 15);
}
}
-
- this.markBlockNeedsUpdate(var8.xCoord, var8.yCoord, var8.zCoord);
}
}
@@ -2122,13 +2149,13 @@
public void addTileEntity(Collection par1Collection)
{
- if (this.scanningTileEntities)
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ for(Object entity : par1Collection)
{
- this.addedTileEntityList.addAll(par1Collection);
- }
- else
- {
- this.loadedTileEntityList.addAll(par1Collection);
+ if(((TileEntity)entity).canUpdate())
+ {
+ dest.add(entity);
+ }
}
}
@@ -2150,7 +2177,7 @@
int var4 = MathHelper.floor_double(par1Entity.posZ);
byte var5 = 32;
- if (!par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5))
+ if (!par2 || this.checkChunksExist(var3 - var5, 0, var4 - var5, var3 + var5, 0, var4 + var5) || ForgeHooks.canUpdateEntity(par1Entity))
{
par1Entity.lastTickPosX = par1Entity.posX;
par1Entity.lastTickPosY = par1Entity.posY;
@@ -2327,7 +2354,14 @@
if (var11 == Block.fire.blockID || var11 == Block.lavaMoving.blockID || var11 == Block.lavaStill.blockID)
{
return true;
- }
+ }
+ else
+ {
+ if(var11 > 0 && Block.blocksList[var11].isBlockBurning(this, var8, var9, var10))
+ {
+ return true;
+ }
+ }
}
}
}
@@ -2631,25 +2665,19 @@
*/
public void setBlockTileEntity(int par1, int par2, int par3, TileEntity par4TileEntity)
{
- if (par4TileEntity != null && !par4TileEntity.isInvalid())
+ if (par4TileEntity == null || par4TileEntity.isInvalid())
{
- if (this.scanningTileEntities)
- {
- par4TileEntity.xCoord = par1;
- par4TileEntity.yCoord = par2;
- par4TileEntity.zCoord = par3;
- this.addedTileEntityList.add(par4TileEntity);
- }
- else
- {
- this.loadedTileEntityList.add(par4TileEntity);
- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
-
- if (var5 != null)
- {
- var5.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity);
- }
- }
+ return;
+ }
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if (par4TileEntity.canUpdate())
+ {
+ dest.add(par4TileEntity);
+ }
+ Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
+ if (chunk != null)
+ {
+ chunk.setChunkBlockTileEntity(par1 & 15, par2, par3 & 15, par4TileEntity);
}
}
@@ -2658,27 +2686,10 @@
*/
public void removeBlockTileEntity(int par1, int par2, int par3)
{
- TileEntity var4 = this.getBlockTileEntity(par1, par2, par3);
-
- if (var4 != null && this.scanningTileEntities)
+ Chunk chunk = getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
+ if (chunk != null)
{
- var4.invalidate();
- this.addedTileEntityList.remove(var4);
- }
- else
- {
- if (var4 != null)
- {
- this.addedTileEntityList.remove(var4);
- this.loadedTileEntityList.remove(var4);
- }
-
- Chunk var5 = this.getChunkFromChunkCoords(par1 >> 4, par3 >> 4);
-
- if (var5 != null)
- {
- var5.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
- }
+ chunk.removeChunkBlockTileEntity(par1 & 15, par2, par3 & 15);
}
}
@@ -2704,7 +2715,8 @@
*/
public boolean isBlockNormalCube(int par1, int par2, int par3)
{
- return Block.isNormalCube(this.getBlockId(par1, par2, par3));
+ Block block = Block.blocksList[getBlockId(par1, par2, par3)];
+ return block != null && block.isBlockNormalCube(this, par1, par2, par3);
}
/**
@@ -2720,7 +2732,7 @@
if (var5 != null && !var5.isEmpty())
{
Block var6 = Block.blocksList[this.getBlockId(par1, par2, par3)];
- return var6 == null ? false : var6.blockMaterial.isOpaque() && var6.renderAsNormalBlock();
+ return var6 == null ? false : isBlockNormalCube(par1, par2, par3);
}
else
{
@@ -2985,6 +2997,7 @@
}
}
}
+ ForgeHooks.addActiveChunks(this, activeChunkSet);
Profiler.endSection();
@@ -3308,7 +3321,7 @@
private int computeBlockLightValue(int par1, int par2, int par3, int par4, int par5, int par6)
{
- 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;
@@ -3668,10 +3681,10 @@
public List getEntitiesWithinAABBExcludingEntity(Entity par1Entity, AxisAlignedBB par2AxisAlignedBB)
{
this.entitiesWithinAABBExcludingEntity.clear();
- int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D);
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D);
- int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D);
+ int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
+ int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
for (int var7 = var3; var7 <= var4; ++var7)
{
@@ -3692,10 +3705,10 @@
*/
public List getEntitiesWithinAABB(Class par1Class, AxisAlignedBB par2AxisAlignedBB)
{
- int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - 2.0D) / 16.0D);
- int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + 2.0D) / 16.0D);
- int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - 2.0D) / 16.0D);
- int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + 2.0D) / 16.0D);
+ int var3 = MathHelper.floor_double((par2AxisAlignedBB.minX - MAX_ENTITY_RADIUS) / 16.0D);
+ int var4 = MathHelper.floor_double((par2AxisAlignedBB.maxX + MAX_ENTITY_RADIUS) / 16.0D);
+ int var5 = MathHelper.floor_double((par2AxisAlignedBB.minZ - MAX_ENTITY_RADIUS) / 16.0D);
+ int var6 = MathHelper.floor_double((par2AxisAlignedBB.maxZ + MAX_ENTITY_RADIUS) / 16.0D);
ArrayList var7 = new ArrayList();
for (int var8 = var3; var8 <= var4; ++var8)
@@ -3840,7 +3853,10 @@
{
var8 = null;
}
-
+ if (var8 != null && var8.isBlockReplaceable(this, par2, par3, par4))
+ {
+ var8 = null;
+ }
return par1 > 0 && var8 == null && var9.canPlaceBlockOnSide(this, par2, par3, par4, par6);
}
}
@@ -4399,7 +4415,7 @@
*/
public int getHeight()
{
- return 256;
+ return worldProvider.hasNoSky ? 128 : 256; //Nether is 128, overworld is 256, Bugfix related to Portal generation
}
/**
@@ -4449,4 +4465,39 @@
{
return this.worldInfo.getTerrainType().getHorizon(this);
}
+
+
+ /**
+ * Adds a single TileEntity to the world.
+ * TODO: Eloraam fully describe the bug this fixes.
+ * @param entity The TileEntity to be added.
+ */
+ public void addTileEntity(TileEntity entity)
+ {
+ List dest = scanningTileEntities ? addedTileEntityList : loadedTileEntityList;
+ if(entity.canUpdate())
+ {
+ dest.add(entity);
+ }
+ }
+
+ /**
+ * Determine if the given block is considered solid on the
+ * specified side. Used by placement logic.
+ *
+ * @param X Block X Position
+ * @param Y Block Y Position
+ * @param Z Block Z Position
+ * @param side The Side in question
+ * @return True if the side is solid
+ */
+ public boolean isBlockSolidOnSide(int X, int Y, int Z, int side)
+ {
+ Block block = Block.blocksList[getBlockId(X, Y, Z)];
+ if(block == null)
+ {
+ return false;
+ }
+ return block.isBlockSolidOnSide(this, X, Y, Z, side);
+ }
}

View file

@ -1,35 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenBigMushroom.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenBigMushroom.java 0000-00-00 00:00:00.000000000 -0000
@@ -54,7 +54,9 @@
{
var13 = par1World.getBlockId(var11, var9, var12);
- if (var13 != 0 && var13 != Block.leaves.blockID)
+ Block block = Block.blocksList[var13];
+
+ if (var13 != 0 && block != null && !block.isLeaves(par1World, var11, var9, var12))
{
var8 = false;
}
@@ -186,7 +188,9 @@
var15 = 0;
}
- if ((var15 != 0 || par4 >= par4 + var7 - 1) && !Block.opaqueCubeLookup[par1World.getBlockId(var13, var11, var14)])
+ Block block = Block.blocksList[par1World.getBlockId(var13, var11, var14)];
+
+ if ((var15 != 0 || par4 >= par4 + var7 - 1) && (block == null || block.canBeReplacedByLeaves(par1World, var13, var11, var14)))
{
this.setBlockAndMetadata(par1World, var13, var11, var14, Block.mushroomCapBrown.blockID + var6, var15);
}
@@ -198,7 +202,9 @@
{
var12 = par1World.getBlockId(par3, par4 + var11, par5);
- if (!Block.opaqueCubeLookup[var12])
+ Block block = Block.blocksList[var12];
+
+ if (block == null || block.canBeReplacedByLeaves(par1World, par3, par4 + var11, par5))
{
this.setBlockAndMetadata(par1World, par3, par4 + var11, par5, Block.mushroomCapBrown.blockID + var6, 10);
}

View file

@ -1,22 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenDeadBush.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenDeadBush.java 0000-00-00 00:00:00.000000000 -0000
@@ -16,10 +16,16 @@
{
int var11;
- for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4)
+ Block block = null;
+ do
{
- ;
- }
+ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)];
+ if (block != null && !block.isLeaves(par1World, par3, par4, par5))
+ {
+ break;
+ }
+ par4--;
+ } while (par4 > 0);
for (int var7 = 0; var7 < 4; ++var7)
{

View file

@ -1,23 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenDungeons.java 0000-00-00 00:00:00.000000000 -0000
@@ -2,6 +2,8 @@
import java.util.Random;
+import net.minecraft.src.forge.MinecraftForge;
+
public class WorldGenDungeons extends WorldGenerator
{
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
@@ -117,9 +119,9 @@
if (var16 != null)
{
- for (int var17 = 0; var17 < 8; ++var17)
+ for (int var17 = 0; var17 < MinecraftForge.getDungeonLootTries(); ++var17)
{
- ItemStack var18 = this.pickCheckLootItem(par2Random);
+ ItemStack var18 = MinecraftForge.getRandomDungeonLoot(par2Random);
if (var18 != null)
{

View file

@ -1,36 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenForest.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenForest.java 0000-00-00 00:00:00.000000000 -0000
@@ -43,7 +43,9 @@
{
var12 = par1World.getBlockId(var10, var8, var11);
- if (var12 != 0 && var12 != Block.leaves.blockID)
+ Block block = Block.blocksList[var12];
+
+ if (var12 != 0 && (block != null && !block.isLeaves(par1World, var10, var8, var11)))
{
var7 = false;
}
@@ -82,7 +84,10 @@
{
int var15 = var14 - par5;
- if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)])
+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var14)];
+
+ if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) &&
+ (block == null || block.canBeReplacedByLeaves(par1World, var12, var16, var14)))
{
this.setBlockAndMetadata(par1World, var12, var16, var14, Block.leaves.blockID, 2);
}
@@ -94,7 +99,9 @@
{
var10 = par1World.getBlockId(par3, par4 + var16, par5);
- if (var10 == 0 || var10 == Block.leaves.blockID)
+ Block block = Block.blocksList[var10];
+
+ if (var10 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5))
{
this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 2);
}

View file

@ -1,66 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenHugeTrees.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenHugeTrees.java 0000-00-00 00:00:00.000000000 -0000
@@ -55,7 +55,12 @@
{
var12 = par1World.getBlockId(var10, var8, var11);
- if (var12 != 0 && var12 != Block.leaves.blockID && var12 != Block.grass.blockID && var12 != Block.dirt.blockID && var12 != Block.wood.blockID && var12 != Block.sapling.blockID)
+ if (var12 != 0 &&
+ (Block.blocksList[var12] != null && !Block.blocksList[var12].isLeaves(par1World, var10, var8, var11)) &&
+ var12 != Block.grass.blockID &&
+ var12 != Block.dirt.blockID &&
+ (Block.blocksList[var12] != null && !Block.blocksList[var12].isWood(par1World, var10, var8, var11)) &&
+ var12 != Block.sapling.blockID)
{
var7 = false;
}
@@ -103,7 +108,7 @@
{
var11 = par1World.getBlockId(par3, par4 + var10, par5);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3, par4 + var10, par5))
{
this.setBlockAndMetadata(par1World, par3, par4 + var10, par5, Block.wood.blockID, this.woodMetadata);
@@ -125,7 +130,7 @@
{
var11 = par1World.getBlockId(par3 + 1, par4 + var10, par5);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3 + 1, par4 + var10, par5))
{
this.setBlockAndMetadata(par1World, par3 + 1, par4 + var10, par5, Block.wood.blockID, this.woodMetadata);
@@ -145,7 +150,7 @@
var11 = par1World.getBlockId(par3 + 1, par4 + var10, par5 + 1);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3 + 1, par4 + var10, par5 + 1))
{
this.setBlockAndMetadata(par1World, par3 + 1, par4 + var10, par5 + 1, Block.wood.blockID, this.woodMetadata);
@@ -165,7 +170,7 @@
var11 = par1World.getBlockId(par3, par4 + var10, par5 + 1);
- if (var11 == 0 || var11 == Block.leaves.blockID)
+ if (var11 == 0 || Block.blocksList[var11] == null || Block.blocksList[var11].isLeaves(par1World, par3, par4 + var10, par5 + 1))
{
this.setBlockAndMetadata(par1World, par3, par4 + var10, par5 + 1, Block.wood.blockID, this.woodMetadata);
@@ -216,7 +221,12 @@
{
int var14 = var13 - par3;
- if ((var12 >= 0 || var14 >= 0 || var12 * var12 + var14 * var14 <= var10 * var10) && (var12 <= 0 && var14 <= 0 || var12 * var12 + var14 * var14 <= (var10 + 1) * (var10 + 1)) && (par6Random.nextInt(4) != 0 || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) && !Block.opaqueCubeLookup[par1World.getBlockId(var11, var8, var13)])
+ Block block = Block.blocksList[par1World.getBlockId(var11, var8, var13)];
+
+ if ((var12 >= 0 || var14 >= 0 || var12 * var12 + var14 * var14 <= var10 * var10) &&
+ (var12 <= 0 && var14 <= 0 || var12 * var12 + var14 * var14 <= (var10 + 1) * (var10 + 1)) &&
+ (par6Random.nextInt(4) != 0 || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) &&
+ (block == null || block.canBeReplacedByLeaves(par1World, var11, var8, var13)))
{
this.setBlockAndMetadata(par1World, var11, var8, var13, Block.leaves.blockID, this.leavesMetadata);
}

View file

@ -1,36 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenMinable.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenMinable.java 0000-00-00 00:00:00.000000000 -0000
@@ -6,6 +6,7 @@
{
/** The block ID of the ore to be placed using this generator. */
private int minableBlockId;
+ private int minableBlockMeta = 0;
/** The number of blocks to generate. */
private int numberOfBlocks;
@@ -15,6 +16,12 @@
this.minableBlockId = par1;
this.numberOfBlocks = par2;
}
+
+ public WorldGenMinable(int id, int meta, int number)
+ {
+ this(id, number);
+ minableBlockMeta = meta;
+ }
public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)
{
@@ -57,9 +64,10 @@
{
double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D);
- if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && par1World.getBlockId(var38, var41, var44) == Block.stone.blockID)
+ Block block = Block.blocksList[par1World.getBlockId(var38, var41, var44)];
+ if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (block != null && block.isGenMineableReplaceable(par1World, var38, var41, var44)))
{
- par1World.setBlock(var38, var41, var44, this.minableBlockId);
+ par1World.setBlockAndMetadata(var38, var41, var44, this.minableBlockId, minableBlockMeta);
}
}
}

View file

@ -1,33 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenShrub.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenShrub.java 0000-00-00 00:00:00.000000000 -0000
@@ -17,10 +17,16 @@
{
int var15;
- for (boolean var6 = false; ((var15 = par1World.getBlockId(par3, par4, par5)) == 0 || var15 == Block.leaves.blockID) && par4 > 0; --par4)
+ Block block = null;
+ do
{
- ;
- }
+ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)];
+ if (block != null && !block.isLeaves(par1World, par3, par4, par5))
+ {
+ break;
+ }
+ par4--;
+ } while (par4 > 0);
int var7 = par1World.getBlockId(par3, par4, par5);
@@ -42,7 +48,9 @@
{
int var14 = var13 - par5;
- if ((Math.abs(var12) != var10 || Math.abs(var14) != var10 || par2Random.nextInt(2) != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var11, var8, var13)])
+ block = Block.blocksList[par1World.getBlockId(var11, var8, var13)];
+
+ if ((Math.abs(var12) != var10 || Math.abs(var14) != var10 || par2Random.nextInt(2) != 0) && (block == null || block.canBeReplacedByLeaves(par1World, var11, var8, var13)))
{
this.setBlockAndMetadata(par1World, var11, var8, var13, Block.leaves.blockID, this.field_48197_a);
}

View file

@ -1,44 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenSwamp.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenSwamp.java 0000-00-00 00:00:00.000000000 -0000
@@ -44,7 +44,7 @@
{
var12 = par1World.getBlockId(var10, var8, var11);
- if (var12 != 0 && var12 != Block.leaves.blockID)
+ if (var12 != 0 && (Block.blocksList[var12] != null && !Block.blocksList[var12].isLeaves(par1World, var10, var8, var11)))
{
if (var12 != Block.waterStill.blockID && var12 != Block.waterMoving.blockID)
{
@@ -91,7 +91,10 @@
{
int var15 = var14 - par5;
- if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var12, var16, var14)])
+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var14)];
+
+ if ((Math.abs(var13) != var11 || Math.abs(var15) != var11 || par2Random.nextInt(2) != 0 && var10 != 0) &&
+ (block == null || block.canBeReplacedByLeaves(par1World, var12, var16, var14)))
{
this.setBlock(par1World, var12, var16, var14, Block.leaves.blockID);
}
@@ -103,7 +106,9 @@
{
var10 = par1World.getBlockId(par3, par4 + var16, par5);
- if (var10 == 0 || var10 == Block.leaves.blockID || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID)
+ Block block = Block.blocksList[var10];
+
+ if (var10 == 0 || (block != null && block.isLeaves(par1World, par3, par4 + var16, par5)) || var10 == Block.waterMoving.blockID || var10 == Block.waterStill.blockID)
{
this.setBlock(par1World, par3, par4 + var16, par5, Block.wood.blockID);
}
@@ -118,7 +123,8 @@
{
for (var13 = par5 - var11; var13 <= par5 + var11; ++var13)
{
- if (par1World.getBlockId(var12, var16, var13) == Block.leaves.blockID)
+ Block block = Block.blocksList[par1World.getBlockId(var12, var16, var13)];
+ if (block != null && block.isLeaves(par1World, var12, var16, var13))
{
if (par2Random.nextInt(4) == 0 && par1World.getBlockId(var12 - 1, var16, var13) == 0)
{

View file

@ -1,36 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenTaiga1.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenTaiga1.java 0000-00-00 00:00:00.000000000 -0000
@@ -41,7 +41,9 @@
{
var15 = par1World.getBlockId(var13, var11, var14);
- if (var15 != 0 && var15 != Block.leaves.blockID)
+ Block block = Block.blocksList[var15];
+
+ if (var15 != 0 && (block == null || !block.isLeaves(par1World, var13, var11, var14)))
{
var10 = false;
}
@@ -77,7 +79,10 @@
{
int var17 = var16 - par5;
- if ((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var14, var13, var16)])
+ Block block = Block.blocksList[par1World.getBlockId(var14, var13, var16)];
+
+ if ((Math.abs(var15) != var18 || Math.abs(var17) != var18 || var18 <= 0) &&
+ (block == null || block.canBeReplacedByLeaves(par1World, var14, var13, var16)))
{
this.setBlockAndMetadata(par1World, var14, var13, var16, Block.leaves.blockID, 1);
}
@@ -98,7 +103,9 @@
{
var14 = par1World.getBlockId(par3, par4 + var13, par5);
- if (var14 == 0 || var14 == Block.leaves.blockID)
+ Block block = Block.blocksList[var14];
+
+ if (var14 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var13, par5))
{
this.setBlockAndMetadata(par1World, par3, par4 + var13, par5, Block.wood.blockID, 1);
}

View file

@ -1,35 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenTaiga2.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenTaiga2.java 0000-00-00 00:00:00.000000000 -0000
@@ -45,7 +45,9 @@
{
var15 = par1World.getBlockId(var13, var11, var14);
- if (var15 != 0 && var15 != Block.leaves.blockID)
+ Block block = Block.blocksList[var15];
+
+ if (var15 != 0 && block != null && !block.isLeaves(par1World, var13, var11, var14))
{
var10 = false;
}
@@ -87,7 +89,9 @@
{
int var20 = var19 - par5;
- if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && !Block.opaqueCubeLookup[par1World.getBlockId(var17, var16, var19)])
+ Block block = Block.blocksList[par1World.getBlockId(var17, var16, var19)];
+
+ if ((Math.abs(var18) != var21 || Math.abs(var20) != var21 || var21 <= 0) && (block == null || block.canBeReplacedByLeaves(par1World, var17, var16, var19)))
{
this.setBlockAndMetadata(par1World, var17, var16, var19, Block.leaves.blockID, 1);
}
@@ -117,7 +121,9 @@
{
var17 = par1World.getBlockId(par3, par4 + var16, par5);
- if (var17 == 0 || var17 == Block.leaves.blockID)
+ Block block = Block.blocksList[var17];
+
+ if (var17 == 0 || block == null || block.isLeaves(par1World, par3, par4 + var16, par5))
{
this.setBlockAndMetadata(par1World, par3, par4 + var16, par5, Block.wood.blockID, 1);
}

View file

@ -1,22 +0,0 @@
--- ../src_base/minecraft/net/minecraft/src/WorldGenTallGrass.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src_work/minecraft/net/minecraft/src/WorldGenTallGrass.java 0000-00-00 00:00:00.000000000 -0000
@@ -18,10 +18,16 @@
{
int var11;
- for (boolean var6 = false; ((var11 = par1World.getBlockId(par3, par4, par5)) == 0 || var11 == Block.leaves.blockID) && par4 > 0; --par4)
+ Block block = null;
+ do
{
- ;
- }
+ block = Block.blocksList[par1World.getBlockId(par3, par4, par5)];
+ if (block != null && !block.isLeaves(par1World, par3, par4, par5))
+ {
+ break;
+ }
+ par4--;
+ } while (par4 > 0);
for (int var7 = 0; var7 < 128; ++var7)
{

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