3
0
Fork 1
KCauldronX/patches/net/minecraft/tileentity/TileEntity.java.patch

63 lines
2.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
@@ -22,18 +22,23 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import org.spigotmc.CustomTimingsHandler; // Spigot
+import org.bukkit.inventory.InventoryHolder; // CraftBukkit
+
public class TileEntity
{
private static final Logger logger = LogManager.getLogger();
private static Map nameToClassMap = new HashMap();
- private static Map classToNameMap = new HashMap();
- protected World worldObj;
+ public static Map classToNameMap = new HashMap(); // Cauldron - private -> public
+ public World worldObj; // CraftBukkit - protected -> public
public int xCoord;
public int yCoord;
public int zCoord;
protected boolean tileEntityInvalid;
public int blockMetadata = -1;
public Block blockType;
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
+ public boolean markedForRemoval = false;
private static final String __OBFID = "CL_00000340";
public static void addMapping(Class p_145826_0_, String p_145826_1_)
@@ -106,7 +111,11 @@
}
catch (Exception exception)
{
- exception.printStackTrace();
+ // Cauldron start - better debug
+ FMLLog.log(Level.ERROR, exception,
+ "A TileEntity %s(%s) located @ %s,%s,%s has thrown an exception during creation, it cannot be created. Report this to the mod author",
+ p_145827_0_.getString("id"), oclass.getName(), p_145827_0_.getInteger("x"), p_145827_0_.getInteger("y"), p_145827_0_.getInteger("z"));
+ // Cauldron end
}
if (tileentity != null)
@@ -282,6 +291,20 @@
addMapping(TileEntityFlowerPot.class, "FlowerPot");
}
+ // CraftBukkit start
+ public InventoryHolder getOwner()
+ {
+ org.bukkit.block.BlockState state = worldObj.getWorld().getBlockAt(xCoord, yCoord, zCoord).getState();
+
+ if (state instanceof InventoryHolder)
+ {
+ return (InventoryHolder) state;
+ }
+
+ return null;
+ }
+ // CraftBukkit end
+
// -- BEGIN FORGE PATCHES --
/**
* Determines if this TileEntity requires update calls.