ForgePatch/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch

88 lines
4.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
@@ -297,6 +305,204 @@
{
}
+
+ public boolean shouldRenderInPass(int pass)
+ {
+ return pass == 0;
+ }
+
+ /**
+ * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}.
+ */
+ public static final net.minecraft.util.math.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.math.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
+ /**
+ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity}
+ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block
+ * at this location.
+ *
+ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity}
+ */
+ @SideOnly(Side.CLIENT)
+ public net.minecraft.util.math.AxisAlignedBB getRenderBoundingBox()
+ {
+ net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB;
+ Block type = func_145838_q();
+ BlockPos pos = func_174877_v();
+ if (type == Blocks.field_150381_bn)
+ {
+ bb = new net.minecraft.util.math.AxisAlignedBB(pos, pos.func_177982_a(1, 1, 1));
+ }
+ else if (type == Blocks.field_150486_ae || type == Blocks.field_150447_bR)
+ {
+ bb = new net.minecraft.util.math.AxisAlignedBB(pos.func_177982_a(-1, 0, -1), pos.func_177982_a(2, 2, 2));
+ }
+ else if (type == Blocks.field_185779_df)
+ {
+ bb = INFINITE_EXTENT_AABB;
+ }
+ else if (type != null && type != Blocks.field_150461_bJ)
+ {
+ net.minecraft.util.math.AxisAlignedBB cbb = null;
+ try
+ {
+ cbb = field_145850_b.func_180495_p(func_174877_v()).func_185890_d(field_145850_b, pos).func_186670_a(pos);
+ }
+ catch (Exception e)
+ {
+ // We have to capture any exceptions that may occur here because BUKKIT servers like to send
+ // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does!
+ // So we can not GARENTEE that the world state is the real state for the block...
+ // So, once again in the long line of US having to accommodate BUKKIT breaking things,
+ // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may
+ // cause the TileEntity renderer to error further down the line! But alas, nothing we can do.
+ cbb = new net.minecraft.util.math.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(1, 1, 1));
+ }
+ if (cbb != null) bb = cbb;
+ }
+ return bb;
+ }
+
+ /**
+ * Checks if this tile entity knows how to render its 'breaking' overlay effect.
+ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set.
+ * @return True to re-render tile with breaking effect.
+ */
+ public boolean canRenderBreaking()
+ {
+ Block block = this.func_145838_q();
+ return (block instanceof net.minecraft.block.BlockChest ||
+ block instanceof net.minecraft.block.BlockEnderChest ||
+ block instanceof net.minecraft.block.BlockSign ||
+ block instanceof net.minecraft.block.BlockSkull);
+ }
+ /**
+ * If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state.
+ * If TileEntity returns true, then TESR should have the same functionality as (and probably extend) the FastTESR class.
+ */
+ public boolean hasFastRenderer()
+ {
+ return false;
+ }
+
static
{
func_190560_a("furnace", TileEntityFurnace.class);