Compare commits

...
1 Commits
Author SHA1 Message Date
Christian 2f7ad51a02 Fix the ghost tile entity issue @ the client. Closes #884
Fix stairs using fungible blocks
Fix fluid draining

Updated FML:
MinecraftForge/FML@b33e7808d8 Fix for new asset URLs
MinecraftForge/FML@82851384f1 Don't delete if md5 fails. Stops derpitude with new assets stuffs.
MinecraftForge/FML@3eb3c2700c Really fix asset and library downloading -.- Wish we could switch over to gradle and not have to go through this headake.
MinecraftForge/FML@f1b3381e61 Fix the "ordering" issue on windows. Windows is poop.
2013-12-18 00:26:02 -05:00
3 changed files with 39 additions and 8 deletions

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. * Reference implementation of {@link IFluidContainerItem}. Use/extend this or implement your own.
* *
* @author King Lemming * @author King Lemming
* *
*/ */
public class ItemFluidContainer extends Item implements IFluidContainerItem public class ItemFluidContainer extends Item implements IFluidContainerItem
{ {
@@ -124,7 +124,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem
@Override @Override
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) 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; return null;
} }
@@ -135,10 +135,10 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem
return null; return null;
} }
stack.amount = Math.min(stack.amount, maxDrain); int drained = Math.min(stack.amount, maxDrain);
if (doDrain) if (doDrain)
{ {
if (maxDrain >= capacity) if (maxDrain >= stack.amount)
{ {
container.stackTagCompound.removeTag("Fluid"); container.stackTagCompound.removeTag("Fluid");
@@ -153,6 +153,7 @@ public class ItemFluidContainer extends Item implements IFluidContainerItem
fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain); fluidTag.setInteger("Amount", fluidTag.getInteger("Amount") - maxDrain);
container.stackTagCompound.setTag("Fluid", fluidTag); container.stackTagCompound.setTag("Fluid", fluidTag);
} }
stack.amount = drained;
return stack; return stack;
} }
} }
@@ -124,7 +124,11 @@ public class OreDictionary
new ItemStack(Block.stoneBrick), new ItemStack(Block.stoneBrick),
new ItemStack(Block.stoneSingleSlab), new ItemStack(Block.stoneSingleSlab),
new ItemStack(Block.stairsCobblestone), 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(); List recipes = CraftingManager.getInstance().getRecipeList();
@@ -145,7 +145,7 @@
- this.worldObj.removeBlockTileEntity(j2, par2, k2); - this.worldObj.removeBlockTileEntity(j2, par2, k2);
+ else if (Block.blocksList[l1] != null && Block.blocksList[l1].hasTileEntity(i2)) + 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)) + if (te != null && te.shouldRefresh(l1, par4, i2, par5, worldObj, j2, par2, k2))
+ { + {
+ this.worldObj.removeBlockTileEntity(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); + 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;
+ } + }
} }