mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Moved Client side EntityPlayer.openGui work code to EntityPlayer for compatibility between player API.
This commit is contained in:
1 parent
f8ad250cc7
commit
76830e7fe2
2 files changed
+27
-51
No files matched your search
@@ -1,17 +1,19 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayer.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -2,6 +2,10 @@
|
||||
@@ -2,6 +2,12 @@
|
||||
|
||||
import java.util.*;
|
||||
|
||||
+import net.minecraft.src.forge.ArmorProperties;
|
||||
+import net.minecraft.src.forge.ForgeHooks;
|
||||
+import net.minecraft.src.forge.IGuiHandler;
|
||||
+import net.minecraft.src.forge.ISpecialArmor;
|
||||
+import net.minecraft.src.forge.MinecraftForge;
|
||||
+
|
||||
public abstract class EntityPlayer extends EntityLiving
|
||||
{
|
||||
public InventoryPlayer inventory;
|
||||
@@ -149,6 +153,7 @@
|
||||
@@ -149,6 +155,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -19,7 +21,7 @@
|
||||
if (itemInUseCount <= 25 && itemInUseCount % 4 == 0)
|
||||
{
|
||||
func_35201_a(itemstack, 5);
|
||||
@@ -490,7 +495,16 @@
|
||||
@@ -490,7 +497,16 @@
|
||||
|
||||
public void dropCurrentItem()
|
||||
{
|
||||
@@ -37,7 +39,7 @@
|
||||
}
|
||||
|
||||
public void dropPlayerItem(ItemStack itemstack)
|
||||
@@ -537,6 +551,9 @@
|
||||
@@ -537,6 +553,9 @@
|
||||
worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
@@ -47,7 +49,7 @@
|
||||
public float getCurrentPlayerStrVsBlock(Block block)
|
||||
{
|
||||
float f = inventory.getStrVsBlock(block);
|
||||
@@ -565,6 +582,45 @@
|
||||
@@ -565,6 +584,45 @@
|
||||
return f1;
|
||||
}
|
||||
|
||||
@@ -93,7 +95,7 @@
|
||||
public boolean canHarvestBlock(Block block)
|
||||
{
|
||||
return inventory.canHarvestBlock(block);
|
||||
@@ -768,7 +824,11 @@
|
||||
@@ -768,7 +826,11 @@
|
||||
{
|
||||
i = 1 + i >> 1;
|
||||
}
|
||||
@@ -106,7 +108,7 @@
|
||||
i = applyPotionDamageCalculations(damagesource, i);
|
||||
addExhaustion(damagesource.getHungerDamage());
|
||||
health -= i;
|
||||
@@ -815,7 +875,9 @@
|
||||
@@ -815,7 +877,9 @@
|
||||
|
||||
public void destroyCurrentEquippedItem()
|
||||
{
|
||||
@@ -116,7 +118,7 @@
|
||||
}
|
||||
|
||||
public double getYOffset()
|
||||
@@ -834,6 +896,11 @@
|
||||
@@ -834,6 +898,11 @@
|
||||
|
||||
public void attackTargetEntityWithCurrentItem(Entity entity)
|
||||
{
|
||||
@@ -128,7 +130,7 @@
|
||||
int i = inventory.getDamageVsEntity(entity);
|
||||
if (isPotionActive(Potion.damageBoost))
|
||||
{
|
||||
@@ -947,6 +1014,11 @@
|
||||
@@ -947,6 +1016,11 @@
|
||||
|
||||
public EnumStatus sleepInBedAt(int i, int j, int k)
|
||||
{
|
||||
@@ -140,7 +142,7 @@
|
||||
if (!worldObj.isRemote)
|
||||
{
|
||||
if (isPlayerSleeping() || !isEntityAlive())
|
||||
@@ -1473,4 +1545,16 @@
|
||||
@@ -1473,4 +1547,30 @@
|
||||
experience = entityplayer.experience;
|
||||
score = entityplayer.score;
|
||||
}
|
||||
@@ -155,5 +157,19 @@
|
||||
+ * @param Y Y Position
|
||||
+ * @param Z Z Position
|
||||
+ */
|
||||
+ public void openGui(BaseMod mod, int ID, World world, int X, int Y, int Z){}
|
||||
+ public void openGui(BaseMod mod, int ID, World world, int X, int Y, int Z)
|
||||
+ {
|
||||
+ if (this instanceof EntityPlayerSP)
|
||||
+ {
|
||||
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
|
||||
+ if (handler != null)
|
||||
+ {
|
||||
+ GuiScreen screen = handler.getGuiScreen(ID, (EntityPlayerSP)this, world, X, Y, Z);
|
||||
+ if (screen != null)
|
||||
+ {
|
||||
+ ModLoader.getMinecraftInstance().displayGuiScreen(screen);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
--- ../src_base/minecraft/net/minecraft/src/EntityPlayerSP.java 0000-00-00 00:00:00.000000000 -0000
|
||||
+++ ../src_work/minecraft/net/minecraft/src/EntityPlayerSP.java 0000-00-00 00:00:00.000000000 -0000
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
import java.util.Random;
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraft.src.forge.IGuiHandler;
|
||||
+import net.minecraft.src.forge.MinecraftForge;
|
||||
|
||||
public class EntityPlayerSP extends EntityPlayer
|
||||
{
|
||||
@@ -474,4 +476,28 @@
|
||||
experienceTotal = i;
|
||||
experienceLevel = j;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Opens a Gui for the player.
|
||||
+ *
|
||||
+ * @param mod The mod associated with the gui
|
||||
+ * @param ID The ID number for the Gui
|
||||
+ * @param world The World
|
||||
+ * @param X X Position
|
||||
+ * @param Y Y Position
|
||||
+ * @param Z Z Position
|
||||
+ */
|
||||
+ @Override
|
||||
+ public void openGui(BaseMod mod, int ID, World world, int X, int Y, int Z)
|
||||
+ {
|
||||
+ IGuiHandler handler = MinecraftForge.getGuiHandler(mod);
|
||||
+ if (handler != null)
|
||||
+ {
|
||||
+ GuiScreen screen = handler.getGuiScreen(ID, this, world, X, Y, Z);
|
||||
+ if (screen != null)
|
||||
+ {
|
||||
+ mc.displayGuiScreen(screen);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
Reference in new issue
Block a user