-
-
Save JayZX535/1b9d46ce36a83574cbadf6013d950784 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.wildcraft.wildcraft.client.gui; | |
import com.wildcraft.wildcraft.entity.canine.EntityWildCraftCanine; | |
import com.wildcraft.wildcraft.entity.canine.EntityWildCraftWolf; | |
import com.wildcraft.wildcraft.entity.util.container.WCCanineInventoryContainer; | |
import com.wildcraft.wildcraft.items.genetics.WCGeneTester; | |
import com.wildcraft.wildcraft.items.util.container.WCGeneTesterContainer; | |
import com.wildcraft.wildcraft.util.ModItems; | |
import net.minecraft.entity.player.EntityPlayer; | |
import net.minecraft.item.ItemFood; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.util.math.AxisAlignedBB; | |
import net.minecraft.util.math.BlockPos; | |
import net.minecraft.world.World; | |
import net.minecraftforge.fml.common.network.IGuiHandler; | |
import net.minecraftforge.items.CapabilityItemHandler; | |
public class GuiHandler implements IGuiHandler{ | |
public static final int GENE_TESTER = -1; | |
public static final int CANINE_INVENTORY = 0; | |
@Override | |
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { | |
if (ID == CANINE_INVENTORY) | |
{ | |
EntityWildCraftCanine canine = (EntityWildCraftCanine)world.getEntityByID(x); | |
if (canine != null) | |
{ | |
return new WCCanineInventoryContainer(player.inventory, canine); | |
} | |
} | |
if (ID == GENE_TESTER) | |
{ | |
ItemStack stack = player.getHeldItem(player.getActiveHand()); | |
if (stack != null) | |
{ | |
System.out.println("Server: Player hand stack is not null"); | |
if (stack.getItem() == ModItems.genetester) | |
{ | |
System.out.println("Server: Open Gene Tester GUI"); | |
WCGeneTester gt = (WCGeneTester)stack.getItem(); | |
return new WCGeneTesterContainer(player.inventory, gt); | |
} | |
} | |
} | |
return null; | |
} | |
@Override | |
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { | |
if (ID == CANINE_INVENTORY) | |
{ | |
EntityWildCraftCanine canine = (EntityWildCraftCanine)world.getEntityByID(x); | |
if (canine != null) | |
{ | |
return new GuiWCCanineInv(player.inventory, canine); | |
} | |
if (ID == GENE_TESTER) | |
{ | |
ItemStack stack = player.getHeldItem(player.getActiveHand()); | |
if (stack != null) | |
{ | |
System.out.println("Client: Player hand stack is not null"); | |
if (stack.getItem() == ModItems.genetester) | |
{ | |
System.out.println("Client: Open Gene Tester GUI"); | |
WCGeneTester gt = (WCGeneTester)stack.getItem(); | |
return new GuiWCGeneTester(player.inventory, gt); | |
} | |
} | |
} | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment