Fix a missed patch and cleaned up other patches

Rollback a method name change that breaks a lot of mods
Update FML: fb701cd
fb701cd Revert MCP name change for canConnectRedstone - it conflicts with a forge method of the same name and breaks 1
This commit is contained in:
Christian 2012-12-29 00:29:15 -05:00
parent 19347c5322
commit e4a1693495
5 changed files with 129 additions and 128 deletions

View file

@ -145,55 +145,55 @@
canBlockGrass[0] = true;
StatList.initBreakableStats();
}
+
+ /* =================================================== FORGE START =====================================*/
+
+ /* =================================================== FORGE START =====================================*/
+ /**
+ * Get a light value for this block, normal ranges are between 0 and 15
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y position
+ * @param z Z position
+ * @return The light value
+ */
+ public int getLightValue(IBlockAccess world, int x, int y, int z)
+ 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)
+ 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)
+ 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
@ -201,7 +201,7 @@
+ * @param side 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, ForgeDirection side)
+ public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if (this instanceof BlockHalfSlab)
@ -223,14 +223,14 @@
+ /**
+ * 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)
+ public boolean isBlockReplaceable(World world, int x, int y, int z)
+ {
+ return false;
+ }
@ -238,43 +238,43 @@
+ /**
+ * 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)
+ 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
+ * 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)
+ public boolean isAirBlock(World world, int x, int y, int z)
+ {
+ return false;
+ }
+
+ /**
+ * 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 to spawn the drops
+ */
+ public boolean canHarvestBlock(EntityPlayer player, int meta)
+ public boolean canHarvestBlock(EntityPlayer player, int meta)
+ {
+ return ForgeHooks.canHarvestBlock(this, player, meta);
+ }
@ -283,13 +283,13 @@
+ * 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.
+ *
+ * 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
@ -297,26 +297,26 @@
+ * @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)
+ 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
+ * 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
@ -329,11 +329,11 @@
+ {
+ 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
@ -346,11 +346,11 @@
+ {
+ 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
@ -363,12 +363,12 @@
+ {
+ 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
@ -404,11 +404,11 @@
+
+ /**
+ * 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
+ * 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
+ */
@ -416,12 +416,12 @@
+ {
+ 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
+ */
@ -432,12 +432,12 @@
+ return ((BlockContainer)this).createNewTileEntity(world, metadata);
+ }
+ return null;
+ }
+
+ }
+
+ /**
+ * Metadata and fortune sensitive version, this replaces the old (int meta, Random rand)
+ * version in 1.1.
+ *
+ * version in 1.1.
+ *
+ * @param meta Blocks Metadata
+ * @param fortune Current item fortune level
+ * @param random Random number generator
@ -447,10 +447,10 @@
+ {
+ 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
@ -462,7 +462,7 @@
+ 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++)
+ {
@ -474,10 +474,10 @@
+ }
+ 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
@ -494,11 +494,11 @@
+ }
+ return renderAsNormalBlock() && !hasTileEntity(metadata);
+ }
+
+
+ /**
+ * Determines if a specified mob type can spawn on this block, returning false will
+ * 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
@ -506,7 +506,7 @@
+ * @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)
+ public boolean canCreatureSpawn(EnumCreatureType type, World world, int x, int y, int z)
+ {
+ int meta = world.getBlockMetadata(x, y, z);
+ if (this instanceof BlockStep)
@ -519,12 +519,12 @@
+ }
+ return isBlockSolidOnSide(world, x, y, z, UP);
+ }
+
+
+ /**
+ * Determines if this block is classified as a Bed, Allowing
+ * players to sleep in it, though the block has to specifically
+ * 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
@ -536,11 +536,11 @@
+ {
+ return blockID == Block.bed.blockID;
+ }
+
+
+ /**
+ * Returns the position that the player is moved to upon
+ * 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
@ -555,7 +555,7 @@
+
+ /**
+ * 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
@ -565,27 +565,27 @@
+ */
+ public void setBedOccupied(World world, int x, int y, int z, EntityPlayer player, boolean occupied)
+ {
+ BlockBed.setBedOccupied(world, x, y, z, occupied);
+ BlockBed.setBedOccupied(world, x, y, z, occupied);
+ }
+
+ /**
+ * Returns the direction of the block. Same values that
+ * 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)
+ 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
@ -596,20 +596,20 @@
+ {
+ return BlockBed.isBlockHeadOfBed(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
@ -620,10 +620,10 @@
+ {
+ 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
@ -634,10 +634,10 @@
+ {
+ 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
@ -648,9 +648,9 @@
+ {
+ return !Block.opaqueCubeLookup[this.blockID];
+ }
+
+
+ /**
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
@ -661,10 +661,10 @@
+ {
+ 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
@ -687,7 +687,7 @@
+ /**
+ * Sets the current texture file for this block, used when rendering.
+ * Default is "/terrain.png"
+ *
+ *
+ * @param texture The texture file
+ */
+ public Block setTextureFile(String texture)
@ -696,11 +696,11 @@
+ isDefaultTexture = false;
+ return this;
+ }
+
+
+
+ /**
+ * Location sensitive version of getExplosionRestance
+ *
+ *
+ * @param par1Entity The entity that caused the explosion
+ * @param world The current world
+ * @param x X Position
@ -719,7 +719,7 @@
+ /**
+ * Determine if this block can make a redstone connection on the side provided,
+ * Useful to control which sides are inputs and outputs for redstone wires.
+ *
+ *
+ * Side:
+ * -1: UP
+ * 0: NORTH
@ -734,15 +734,15 @@
+ * @param side The side that is trying to make the connection
+ * @return True to make the connection
+ */
+ public boolean canMakeRedstoneConnectionOnSide(IBlockAccess world, int x, int y, int z, int side)
+ public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side)
+ {
+ return Block.blocksList[blockID].canProvidePower() && side != -1;
+ }
+
+
+ /**
+ * Determines if a torch can be placed on the top surface of this block.
+ * Useful for creating your own block that torches can be on, such as fences.
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
@ -761,11 +761,11 @@
+ return id == Block.fence.blockID || id == Block.netherFence.blockID || id == Block.glass.blockID || id == Block.cobblestoneWall.blockID;
+ }
+ }
+
+
+
+ /**
+ * Determines if this block should render in this pass.
+ *
+ *
+ * @param pass The pass in question
+ * @return True to render
+ */
@ -776,14 +776,14 @@
+
+ /**
+ * Called when a user uses the creative pick block button on this block
+ *
+ *
+ * @param target The full target the player is looking at
+ * @return A ItemStack to add to the player's inventory, Null if nothing should be added.
+ */
+ public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
+ {
+ int id = idPicked(world, x, y, z);
+
+
+ if (id == 0)
+ {
+ return null;
@ -801,7 +801,7 @@
+ /**
+ * Used by getTopSolidOrLiquidBlock while placing biome decorations, villages, etc
+ * Also used to determine if the player can spawn on this block.
+ *
+ *
+ * @return False to disallow spawning
+ */
+ public boolean isBlockFoliage(World world, int x, int y, int z)
@ -810,11 +810,11 @@
+ }
+
+ /**
+ * Spawn a digging particle effect in the world, this is a wrapper
+ * around EffectRenderer.addBlockHitEffects to allow the block more
+ * Spawn a digging particle effect in the world, this is a wrapper
+ * around EffectRenderer.addBlockHitEffects to allow the block more
+ * control over the particles. Useful when you have entirely different
+ * texture sheets for different sides/locations in the world.
+ *
+ *
+ * @param world The current world
+ * @param target The target the player is looking at {x/y/z/side/sub}
+ * @param effectRenderer A reference to the current effect renderer.
@ -827,11 +827,11 @@
+ }
+
+ /**
+ * Spawn particles for when the block is destroyed. Due to the nature
+ * of how this is invoked, the x/y/z locations are not always guaranteed
+ * Spawn particles for when the block is destroyed. Due to the nature
+ * of how this is invoked, the x/y/z locations are not always guaranteed
+ * to host your block. So be sure to do proper sanity checks before assuming
+ * that the location is this block.
+ *
+ *
+ * @param world The current world
+ * @param x X position to spawn the particle
+ * @param y Y position to spawn the particle
@ -856,7 +856,7 @@
+ * Caves check if it's a colid surface
+ * Plains check if its grass or dirt
+ * Water check if its still water
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
@ -895,8 +895,8 @@
+ case Water: return world.getBlockMaterial(x, y, z) == Material.water && world.getBlockMetadata(x, y, z) == 0;
+ case Beach:
+ boolean isBeach = (blockID == Block.grass.blockID || blockID == Block.dirt.blockID || blockID == Block.sand.blockID);
+ boolean hasWater = (world.getBlockMaterial(x - 1, y, z ) == Material.water ||
+ world.getBlockMaterial(x + 1, y, z ) == Material.water ||
+ boolean hasWater = (world.getBlockMaterial(x - 1, y, z ) == Material.water ||
+ world.getBlockMaterial(x + 1, y, z ) == Material.water ||
+ world.getBlockMaterial(x, y, z - 1) == Material.water ||
+ world.getBlockMaterial(x, y, z + 1) == Material.water);
+ return isBeach && hasWater;
@ -906,10 +906,10 @@
+ }
+
+ /**
+ * Checks if this soil is fertile, typically this means that growth rates
+ * Checks if this soil is fertile, typically this means that growth rates
+ * of plants on this soil will be slightly sped up.
+ * Only vanilla case is tilledField when it is within range of water.
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
@ -925,15 +925,15 @@
+
+ return false;
+ }
+
+
+ /**
+ * Location aware and overrideable version of the lightOpacity array,
+ * return the number to subtract from the light value when it passes through this block.
+ *
+ *
+ * This is not guaranteed to have the tile entity in place before this is called, so it is
+ * Recommended that you have your tile entity call relight after being placed if you
+ * rely on it for light info.
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
@ -948,7 +948,7 @@
+ /**
+ * Determines if this block is destroyed when a ender dragon tries to fly through it.
+ * The block will be set to 0, nothing will drop.
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position
@ -962,7 +962,7 @@
+
+ /**
+ * Determines if this block can be used as the base of a beacon.
+ *
+ *
+ * @param world The current world
+ * @param x X Position
+ * @param y Y Position

View file

@ -5,7 +5,7 @@
else if (var5 != Block.redstoneRepeaterIdle.blockID && var5 != Block.redstoneRepeaterActive.blockID)
{
- return Block.blocksList[var5].canProvidePower() && par4 != -1;
+ return (Block.blocksList[var5] != null && Block.blocksList[var5].canMakeRedstoneConnectionOnSide(par0IBlockAccess, par1, par2, par3, par4));
+ return (Block.blocksList[var5] != null && Block.blocksList[var5].canConnectRedstone(par0IBlockAccess, par1, par2, par3, par4));
}
else
{

View file

@ -17,7 +17,7 @@
public Packet51MapChunk()
{
this.isChunkDataPacket = true;
@@ -59,24 +62,29 @@
@@ -59,17 +62,22 @@
this.zCh = par1Chunk.zPosition;
this.includeInitialize = par2;
Packet51MapChunkData var4 = getMapChunkData(par1Chunk, par2, par3);
@ -46,15 +46,6 @@
}
finally
{
var5.end();
}
- }
-
+
+ }
/**
* Abstract. Reads the raw packet data from the data stream.
*/
@@ -97,13 +105,16 @@
par1DataInputStream.readFully(temp, 0, this.tempLength);
int var2 = 0;

View file

@ -34,7 +34,7 @@
var3 += var6.compressedData.length;
this.chunkPostX[var4] = var5.xPosition;
this.chunkPosZ[var4] = var5.zPosition;
@@ -60,21 +55,35 @@
@@ -60,15 +55,29 @@
this.field_73588_b[var4] = var6.chunkHasAddSectionFlag;
this.field_73584_f[var4] = var6.compressedData;
}
@ -53,7 +53,7 @@
+ }
Deflater var11 = new Deflater(-1);
-
try
{
- var11.setInput(chunkDataNotCompressed, 0, var3);
@ -67,10 +67,20 @@
}
finally
{
var11.end();
}
}
@@ -150,6 +159,16 @@
*/
public void writePacketData(DataOutputStream par1DataOutputStream) throws IOException
{
+ if (this.chunkDataBuffer == null)
+ {
+ deflateGate.acquireUninterruptibly();
+ if (this.chunkDataBuffer == null)
+ {
+ deflate();
+ }
+ deflateGate.release();
+ }
+
/**
* Abstract. Reads the raw packet data from the data stream.
par1DataOutputStream.writeShort(this.chunkPostX.length);
par1DataOutputStream.writeInt(this.dataLength);
par1DataOutputStream.writeBoolean(this.field_92024_h);