100 lines
4.3 KiB
Diff
100 lines
4.3 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java
|
|
@@ -180,6 +187,7 @@
|
|
|
|
public void func_70071_h_()
|
|
{
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this);
|
|
this.field_70145_X = this.func_175149_v();
|
|
|
|
if (this.func_175149_v())
|
|
@@ -367,6 +375,7 @@
|
|
this.func_70105_a(f, f1);
|
|
}
|
|
}
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this);
|
|
}
|
|
|
|
public int func_82145_z()
|
|
@@ -896,6 +943,7 @@
|
|
p_70014_1_.func_74768_a("XpTotal", this.field_71067_cb);
|
|
p_70014_1_.func_74768_a("XpSeed", this.field_175152_f);
|
|
p_70014_1_.func_74768_a("Score", this.func_71037_bA());
|
|
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(p_70014_1_); //Moved down so it doesn't keep missing every MC update.
|
|
|
|
if (this.field_71077_c != null)
|
|
{
|
|
@@ -2421,6 +2534,168 @@
|
|
return this.field_71075_bZ.field_75098_d && this.func_70003_b(2, "");
|
|
}
|
|
|
|
+ /**
|
|
+ * Opens a GUI with this player, uses FML's IGuiHandler system.
|
|
+ * Allows for extension by modders.
|
|
+ *
|
|
+ * @param mod The mod trying to open a GUI
|
|
+ * @param modGuiId GUI ID
|
|
+ * @param world Current World
|
|
+ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position
|
|
+ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position
|
|
+ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position
|
|
+ */
|
|
+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z)
|
|
+ {
|
|
+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z);
|
|
+ }
|
|
+ private String displayname;
|
|
+
|
|
+ /**
|
|
+ * Get the currently computed display name, cached for efficiency.
|
|
+ * @return the current display name
|
|
+ */
|
|
+ public String getDisplayNameString()
|
|
+ {
|
|
+ if(this.displayname == null)
|
|
+ {
|
|
+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_());
|
|
+ }
|
|
+ return this.displayname;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Force the displayed name to refresh
|
|
+ */
|
|
+ public void refreshDisplayName()
|
|
+ {
|
|
+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_());
|
|
+ }
|
|
+
|
|
+ private final net.minecraftforge.items.IItemHandler playerMainHandler = new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by);
|
|
+ private final net.minecraftforge.items.IItemHandler playerEquipmentHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(
|
|
+ new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by),
|
|
+ new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by));
|
|
+ private final net.minecraftforge.items.IItemHandler playerJoinedHandler = new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by);
|
|
+
|
|
+ @SuppressWarnings("unchecked")
|
|
+ @Override
|
|
+ @Nullable
|
|
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
|
+ {
|
|
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
|
|
+ {
|
|
+ if (facing == null) return (T) playerJoinedHandler;
|
|
+ else if (facing.func_176740_k().func_176720_b()) return (T) playerMainHandler;
|
|
+ else if (facing.func_176740_k().func_176722_c()) return (T) playerEquipmentHandler;
|
|
+ }
|
|
+ return super.getCapability(capability, facing);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
|
|
+ {
|
|
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
|
|
+ }
|
|
+
|
|
+ /* ======================================== FORGE END =====================================*/
|
|
+
|
|
public static enum EnumChatVisibility
|
|
{
|
|
FULL(0, "options.chat.visibility.full"),
|