mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Added EntityLiving to Block.isLadder arguments, deperacating older version. New parameter has the possibility of being null, so modders must take care. Closes #608
This commit is contained in:
1 parent
ff95f73cd1
commit
0ec313abb1
5 files changed
+31
-12
No files matched your search
@@ -344,6 +344,11 @@ public class ForgeHooks
|
||||
return (MinecraftForge.EVENT_BUS.post(event) ? 0.0f : event.distance);
|
||||
}
|
||||
|
||||
public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z, EntityLiving entity)
|
||||
{
|
||||
return block != null && block.isLadder(world, x, y, z, entity);
|
||||
}
|
||||
@Deprecated //See above
|
||||
public static boolean isLivingOnLadder(Block block, World world, int x, int y, int z)
|
||||
{
|
||||
return block != null && block.isLadder(world, x, y, z);
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1443,4 +1464,944 @@
|
||||
@@ -1443,4 +1464,950 @@
|
||||
canBlockGrass[0] = true;
|
||||
StatList.initBreakableStats();
|
||||
}
|
||||
@@ -197,8 +197,14 @@
|
||||
+ * @param x X Position
|
||||
+ * @param y Y position
|
||||
+ * @param z Z position
|
||||
+ * @param entity The entity trying to use the ladder, CAN be null.
|
||||
+ * @return True if the block should act like a ladder
|
||||
+ */
|
||||
+ public boolean isLadder(World world, int x, int y, int z, EntityLiving entity)
|
||||
+ {
|
||||
+ return isLadder(world, x, y, z);
|
||||
+ }
|
||||
+ @Deprecated //See EntityLiving sensitive version above
|
||||
+ public boolean isLadder(World world, int x, int y, int z)
|
||||
+ {
|
||||
+ return false;
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockLadder.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockLadder.java
|
||||
@@ -8,6 +8,9 @@
|
||||
@@ -5,9 +5,13 @@
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
+import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -10,7 +14,7 @@
|
||||
|
||||
public class BlockLadder extends Block
|
||||
{
|
||||
@@ -104,7 +107,10 @@
|
||||
@@ -104,7 +108,10 @@
|
||||
*/
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
@@ -22,7 +26,7 @@
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,22 +120,22 @@
|
||||
@@ -114,22 +121,22 @@
|
||||
{
|
||||
int j1 = par9;
|
||||
|
||||
@@ -49,7 +53,7 @@
|
||||
{
|
||||
j1 = 5;
|
||||
}
|
||||
@@ -146,22 +152,22 @@
|
||||
@@ -146,22 +153,22 @@
|
||||
int i1 = par1World.getBlockMetadata(par2, par3, par4);
|
||||
boolean flag = false;
|
||||
|
||||
@@ -76,13 +80,13 @@
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
@@ -182,4 +188,10 @@
|
||||
@@ -182,4 +189,10 @@
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLadder(World world, int x, int y, int z)
|
||||
+ public boolean isLadder(World world, int x, int y, int z, EntityLiving entity)
|
||||
+ {
|
||||
+ return true;
|
||||
+ }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- ../src_base/minecraft/net/minecraft/block/BlockVine.java
|
||||
+++ ../src_work/minecraft/net/minecraft/block/BlockVine.java
|
||||
@@ -2,6 +2,8 @@
|
||||
@@ -2,9 +2,12 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -9,7 +9,11 @@
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -15,7 +17,9 @@
|
||||
+import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -15,7 +18,9 @@
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -20,7 +24,7 @@
|
||||
{
|
||||
public BlockVine(int par1)
|
||||
{
|
||||
@@ -439,14 +443,26 @@
|
||||
@@ -439,14 +444,26 @@
|
||||
*/
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
@@ -51,7 +55,7 @@
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isLadder(World world, int x, int y, int z)
|
||||
+ public boolean isLadder(World world, int x, int y, int z, EntityLiving entity)
|
||||
+ {
|
||||
+ return true;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
int k = MathHelper.floor_double(this.posZ);
|
||||
int l = this.worldObj.getBlockId(i, j, k);
|
||||
- return l == Block.ladder.blockID || l == Block.vine.blockID;
|
||||
+ return ForgeHooks.isLivingOnLadder(Block.blocksList[l], worldObj, i, j, k);
|
||||
+ return ForgeHooks.isLivingOnLadder(Block.blocksList[l], worldObj, i, j, k, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user