Compare commits
1
Commits
49.2
...
v164-pregradle
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f7ad51a02 |
No files matched your search
@@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IFluidContainerItem}. Use/extend this or implement your own.
|
||||
*
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ItemFluidContainer extends Item implements IFluidContainerItem
|
||||
{
|
||||
@@ -124,7 +124,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem
|
||||
@Override
|
||||
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain)
|
||||
{
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid"))
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Fluid") || maxDrain == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -135,10 +135,10 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem
|
||||
return null;
|
||||
}
|
||||
|
||||
stack.amount = Math.min(stack.amount, maxDrain);
|
||||
int drained = Math.min(stack.amount, maxDrain);
|
||||
if (doDrain)
|
||||
{
|
||||
if (maxDrain >= capacity)
|
||||
if (maxDrain >= stack.amount)
|
||||
{
|
||||
container.stackTagCompound.removeTag("Fluid");
|
||||
|
||||
@@ -153,6 +153,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem
|
||||
fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain);
|
||||
container.stackTagCompound.setTag("Fluid", fluidTag);
|
||||
}
|
||||
stack.amount = drained;
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,11 @@ public class OreDictionary
|
||||
new ItemStack(Block.stoneBrick),
|
||||
new ItemStack(Block.stoneSingleSlab),
|
||||
new ItemStack(Block.stairsCobblestone),
|
||||
new ItemStack(Block.cobblestoneWall)
|
||||
new ItemStack(Block.cobblestoneWall),
|
||||
new ItemStack(Block.stairsWoodOak),
|
||||
new ItemStack(Block.stairsWoodBirch),
|
||||
new ItemStack(Block.stairsWoodJungle),
|
||||
new ItemStack(Block.stairsWoodSpruce)
|
||||
};
|
||||
|
||||
List recipes = CraftingManager.getInstance().getRecipeList();
|
||||
|
||||
@@ -145,7 +145,7 @@
|
||||
- this.worldObj.removeBlockTileEntity(j2, par2, k2);
|
||||
+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(i2))
|
||||
+ {
|
||||
+ TileEntity te = worldObj.getBlockTileEntity(j2, par2, k2);
|
||||
+ TileEntity te = getChunkBlockTileEntityUnsafe(j2 & 0xf, par2, k2 & 0xf);
|
||||
+ if (te != null && te.shouldRefresh(l1, par4, i2, par5, worldObj, j2, par2, k2))
|
||||
+ {
|
||||
+ this.worldObj.removeBlockTileEntity(j2, par2, k2);
|
||||
@@ -361,7 +361,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1468,4 +1585,18 @@
|
||||
@@ -1468,4 +1585,44 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,5 +378,31 @@
|
||||
+ chunkTileEntityMap.remove(position);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /** FORGE: backport TE false creation fix */
|
||||
+ /**
|
||||
+ *
|
||||
+ * Retrieves the tile entity, WITHOUT creating it. Good for checking if it
|
||||
+ * exists.
|
||||
+ *
|
||||
+ * @param x
|
||||
+ * @param y
|
||||
+ * @param z
|
||||
+ * @return The tile entity at the specified location, if it exists and is
|
||||
+ * valid.
|
||||
+ */
|
||||
+ public TileEntity getChunkBlockTileEntityUnsafe(int x, int y, int z)
|
||||
+ {
|
||||
+ ChunkPosition chunkposition = new ChunkPosition(x, y, z);
|
||||
+ TileEntity tileentity = (TileEntity) this.chunkTileEntityMap.get(chunkposition);
|
||||
+
|
||||
+ if (tileentity != null && tileentity.isInvalid())
|
||||
+ {
|
||||
+ chunkTileEntityMap.remove(chunkposition);
|
||||
+ tileentity = null;
|
||||
+ }
|
||||
+
|
||||
+ return tileentity;
|
||||
+ }
|
||||
}
|
||||
Reference in new issue
Block a user