Improved the ladder hook. Added a new hook for sustained-use items.
This commit is contained in:
parent
bdda88d74e
commit
ad378151cf
10 changed files with 68 additions and 22 deletions
|
@ -139,7 +139,7 @@
|
|||
{
|
||||
ItemStack itemstack = createStackedBlock(l);
|
||||
if(itemstack != null)
|
||||
@@ -805,6 +848,238 @@
|
||||
@@ -805,6 +848,248 @@
|
||||
return iblockaccess.isBlockNormalCube(i, j, k) ? 0.2F : 1.0F;
|
||||
}
|
||||
|
||||
|
@ -151,11 +151,21 @@
|
|||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ *
|
||||
+ * This is deprecated in favor of the more flexible version below.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public boolean isLadder() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ */
|
||||
+ public boolean isLadder(World world, int i, int j, int k) {
|
||||
+ return isLadder();
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the block is a normal, solid cube. This
|
||||
+ * determines indirect power state, entity ejection from blocks, and a few
|
||||
+ * others.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
}
|
||||
|
||||
+ /* FORGE: Implemented base method, see Block.isLadder */
|
||||
+ public boolean isLadder() {
|
||||
+ public boolean isLadder(World world, int i, int j, int k) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID;
|
||||
+ Block block=Block.blocksList[worldObj.getBlockId(i,j,k)];
|
||||
+ if(block==null) return false;
|
||||
+ return block.isLadder();
|
||||
+ return block.isLadder(worldObj,i,j,k);
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
|
||||
|
|
|
@ -11,7 +11,15 @@
|
|||
import java.util.*;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
@@ -502,7 +506,16 @@
|
||||
@@ -166,6 +170,7 @@
|
||||
clearItemInUse();
|
||||
} else
|
||||
{
|
||||
+ itemInUse.getItem().onUsingItemTick(itemInUse,this,itemInUseCount);
|
||||
if(itemInUseCount <= 25 && itemInUseCount % 4 == 0)
|
||||
{
|
||||
func_35201_a(itemstack, 5);
|
||||
@@ -502,7 +507,16 @@
|
||||
|
||||
public void dropCurrentItem()
|
||||
{
|
||||
|
@ -29,7 +37,7 @@
|
|||
}
|
||||
|
||||
public void dropPlayerItem(ItemStack itemstack)
|
||||
@@ -548,6 +561,8 @@
|
||||
@@ -548,6 +562,8 @@
|
||||
worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
|
@ -38,7 +46,7 @@
|
|||
public float getCurrentPlayerStrVsBlock(Block block)
|
||||
{
|
||||
float f = inventory.getStrVsBlock(block);
|
||||
@@ -576,6 +591,45 @@
|
||||
@@ -576,6 +592,45 @@
|
||||
return f1;
|
||||
}
|
||||
|
||||
|
@ -84,7 +92,7 @@
|
|||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
return inventory.canHarvestBlock(block);
|
||||
@@ -774,6 +828,25 @@
|
||||
@@ -774,6 +829,25 @@
|
||||
|
||||
protected void damageEntity(DamageSource damagesource, int i)
|
||||
{
|
||||
|
@ -110,7 +118,7 @@
|
|||
if(!damagesource.isUnblockable() && func_35162_ad())
|
||||
{
|
||||
i = 1 + i >> 1;
|
||||
@@ -825,7 +898,9 @@
|
||||
@@ -825,7 +899,9 @@
|
||||
|
||||
public void destroyCurrentEquippedItem()
|
||||
{
|
||||
|
@ -120,7 +128,7 @@
|
|||
}
|
||||
|
||||
public double getYOffset()
|
||||
@@ -957,6 +1032,10 @@
|
||||
@@ -957,6 +1033,10 @@
|
||||
|
||||
public EnumStatus sleepInBedAt(int i, int j, int k)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
return itemstack;
|
||||
@@ -278,6 +297,29 @@
|
||||
@@ -278,6 +297,34 @@
|
||||
return maxDamage > 0 && !hasSubtypes;
|
||||
}
|
||||
|
||||
|
@ -73,11 +73,16 @@
|
|||
+ EntityPlayer player) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called each tick while using an item.
|
||||
+ */
|
||||
+ public void onUsingItemTick(ItemStack ist, EntityPlayer player, int count) {
|
||||
+ }
|
||||
+
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
|
||||
{
|
||||
return false;
|
||||
@@ -473,6 +515,32 @@
|
||||
@@ -473,6 +520,32 @@
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@
|
|||
{
|
||||
ItemStack itemstack = createStackedBlock(l);
|
||||
if(itemstack != null)
|
||||
@@ -725,6 +767,236 @@
|
||||
@@ -725,6 +767,246 @@
|
||||
return blockMaterial.getMaterialMobility();
|
||||
}
|
||||
|
||||
|
@ -136,11 +136,21 @@
|
|||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ *
|
||||
+ * This is deprecated in favor of the more flexible version below.
|
||||
+ */
|
||||
+ @Deprecated
|
||||
+ public boolean isLadder() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Implement and return true if you wish this block to behave
|
||||
+ * like a ladder when the player is inside.
|
||||
+ */
|
||||
+ public boolean isLadder(World world, int i, int j, int k) {
|
||||
+ return isLadder();
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Return true if the block is a normal, solid cube. This
|
||||
+ * determines indirect power state, entity ejection from blocks, and a few
|
||||
+ * others.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
}
|
||||
|
||||
+ /* FORGE: Implemented base method, see Block.isLadder */
|
||||
+ public boolean isLadder() {
|
||||
+ public boolean isLadder(World world, int i, int j, int k) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
- return worldObj.getBlockId(i, j, k) == Block.ladder.blockID;
|
||||
+ Block block=Block.blocksList[worldObj.getBlockId(i,j,k)];
|
||||
+ if(block==null) return false;
|
||||
+ return block.isLadder();
|
||||
+ return block.isLadder(worldObj,i,j,k);
|
||||
}
|
||||
|
||||
public void writeEntityToNBT(NBTTagCompound nbttagcompound)
|
||||
|
|
|
@ -11,7 +11,15 @@
|
|||
// Referenced classes of package net.minecraft.src:
|
||||
// EntityLiving, InventoryPlayer, FoodStats, PlayerCapabilities,
|
||||
// ContainerPlayer, World, ChunkCoordinates, DataWatcher,
|
||||
@@ -447,7 +451,16 @@
|
||||
@@ -142,6 +146,7 @@
|
||||
clearItemInUse();
|
||||
} else
|
||||
{
|
||||
+ itemInUse.getItem().onUsingItemTick(itemInUse,this,itemInUseCount);
|
||||
if(itemInUseCount <= 25 && itemInUseCount % 4 == 0)
|
||||
{
|
||||
func_35208_b(itemstack, 5);
|
||||
@@ -447,7 +452,16 @@
|
||||
|
||||
public void dropCurrentItem()
|
||||
{
|
||||
|
@ -29,7 +37,7 @@
|
|||
}
|
||||
|
||||
public void dropPlayerItem(ItemStack itemstack)
|
||||
@@ -493,6 +506,8 @@
|
||||
@@ -493,6 +507,8 @@
|
||||
worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
|
@ -38,7 +46,7 @@
|
|||
public float getCurrentPlayerStrVsBlock(Block block)
|
||||
{
|
||||
float f = inventory.getStrVsBlock(block);
|
||||
@@ -521,6 +536,45 @@
|
||||
@@ -521,6 +537,45 @@
|
||||
return f1;
|
||||
}
|
||||
|
||||
|
@ -84,7 +92,7 @@
|
|||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
return inventory.canHarvestBlock(block);
|
||||
@@ -718,7 +772,26 @@
|
||||
@@ -718,7 +773,26 @@
|
||||
}
|
||||
|
||||
protected void damageEntity(DamageSource damagesource, int i)
|
||||
|
@ -112,7 +120,7 @@
|
|||
if(!damagesource.isUnblockable() && func_35180_G())
|
||||
{
|
||||
i = 1 + i >> 1;
|
||||
@@ -770,7 +843,9 @@
|
||||
@@ -770,7 +844,9 @@
|
||||
|
||||
public void destroyCurrentEquippedItem()
|
||||
{
|
||||
|
@ -122,7 +130,7 @@
|
|||
}
|
||||
|
||||
public double getYOffset()
|
||||
@@ -896,6 +971,10 @@
|
||||
@@ -896,6 +972,10 @@
|
||||
|
||||
public EnumStatus sleepInBedAt(int i, int j, int k)
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
return itemstack;
|
||||
@@ -266,6 +285,29 @@
|
||||
@@ -266,6 +285,34 @@
|
||||
return maxDamage > 0 && !hasSubtypes;
|
||||
}
|
||||
|
||||
|
@ -73,11 +73,16 @@
|
|||
+ EntityPlayer player) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ /* FORGE: Called each tick while using an item.
|
||||
+ */
|
||||
+ public void onUsingItemTick(ItemStack ist, EntityPlayer player, int count) {
|
||||
+ }
|
||||
+
|
||||
public boolean hitEntity(ItemStack itemstack, EntityLiving entityliving, EntityLiving entityliving1)
|
||||
{
|
||||
return false;
|
||||
@@ -414,6 +456,26 @@
|
||||
@@ -414,6 +461,26 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue