-
-
Save JayZX535/fef6d0bd0a09415f020ff23e372f2454 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 io.netty.buffer.Unpooled; | |
import java.io.IOException; | |
import javax.annotation.Nullable; | |
import org.lwjgl.input.Keyboard; | |
import com.wildcraft.wildcraft.WildCraft; | |
import com.wildcraft.wildcraft.entity.canine.EntityWildCraftCanine; | |
import com.wildcraft.wildcraft.entity.canine.EntityWildCraftWolf; | |
import com.wildcraft.wildcraft.items.genetics.WCGeneTester; | |
import com.wildcraft.wildcraft.items.util.container.WCGeneTesterContainer; | |
import com.wildcraft.wildcraft.util.ModItems; | |
import com.wildcraft.wildcraft.util.messages.MessageSendGeneTesterSlot; | |
import com.wildcraft.wildcraft.util.messages.WildCraftPacketHandler; | |
import net.minecraft.client.gui.GuiButton; | |
import net.minecraft.client.gui.GuiTextField; | |
import net.minecraft.client.gui.achievement.GuiAchievements; | |
import net.minecraft.client.gui.achievement.GuiStats; | |
import net.minecraft.client.gui.inventory.GuiContainer; | |
import net.minecraft.client.gui.inventory.GuiContainerCreative; | |
import net.minecraft.client.gui.inventory.GuiEditCommandBlockMinecart; | |
import net.minecraft.client.gui.inventory.GuiInventory; | |
import net.minecraft.client.renderer.GlStateManager; | |
import net.minecraft.client.resources.I18n; | |
import net.minecraft.inventory.Container; | |
import net.minecraft.inventory.ContainerRepair; | |
import net.minecraft.inventory.IContainerListener; | |
import net.minecraft.inventory.IInventory; | |
import net.minecraft.inventory.Slot; | |
import net.minecraft.item.ItemStack; | |
import net.minecraft.network.PacketBuffer; | |
import net.minecraft.network.play.client.CPacketCustomPayload; | |
import net.minecraft.util.NonNullList; | |
import net.minecraft.util.ResourceLocation; | |
import net.minecraft.util.TabCompleter; | |
import net.minecraft.util.math.BlockPos; | |
public class GuiWCGeneTester extends GuiContainer implements IContainerListener{ | |
private WCGeneTester genetester; | |
private IInventory playerInv; | |
private final WCGeneTesterContainer genetesterinv; | |
/** The mouse x-position recorded during the last rendered frame. */ | |
private float mousePosX; | |
/** The mouse y-position recorded during the last renderered frame. */ | |
private float mousePosY; | |
/** Amount scrolled in Creative mode inventory (0 = top, 1 = bottom) */ | |
private float currentScroll; | |
/** True if the scrollbar is being dragged */ | |
private boolean isScrolling; | |
private static final ResourceLocation GENE_TESTER_GUI = new ResourceLocation("wildcraft:textures/gui/genetics/genetestergui.png"); | |
public GuiWCGeneTester(IInventory playerInv, WCGeneTester genetester) { | |
super(new WCGeneTesterContainer (playerInv, genetester)); | |
this.xSize = 200; | |
this.ySize = 194; | |
this.genetester = genetester; | |
this.playerInv = playerInv; | |
this.genetesterinv = (WCGeneTesterContainer)this.inventorySlots; | |
} | |
/** | |
* Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the | |
* window resizes, the buttonList is cleared beforehand. | |
*/ | |
public void initGui() | |
{ | |
super.initGui(); | |
this.buttonList.clear(); | |
Keyboard.enableRepeatEvents(true); | |
int i = (this.width - this.xSize) / 2; | |
int j = (this.height - this.ySize) / 2; | |
this.inventorySlots.removeListener(this); | |
this.inventorySlots.addListener(this); | |
this.genetesterinv.removeListener(this); | |
this.genetesterinv.addListener(this); | |
} | |
/** | |
* Called when the screen is unloaded. Used to disable keyboard repeat events | |
*/ | |
public void onGuiClosed() | |
{ | |
super.onGuiClosed(); | |
Keyboard.enableRepeatEvents(false); | |
this.inventorySlots.removeListener(this); | |
this.genetesterinv.removeListener(this); | |
} | |
/** | |
* Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton | |
*/ | |
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException | |
{ | |
super.mouseClicked(mouseX, mouseY, mouseButton); | |
} | |
@Override | |
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) { | |
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); | |
int i = (this.width - this.xSize) / 2; | |
int j = (this.height - this.ySize) / 2; | |
WCGeneTesterContainer genetesterinv = this.genetesterinv; | |
this.mc.getTextureManager().bindTexture(GENE_TESTER_GUI); | |
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize); | |
for (int k = 0; k < genetesterinv.inventorySlots.size(); ++k) | |
{ | |
Slot slot = genetesterinv.inventorySlots.get(k); | |
} | |
} | |
@Override | |
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) | |
{ | |
} | |
/** | |
* Draws the screen and all the components in it. | |
*/ | |
public void drawScreen(int mouseX, int mouseY, float partialTicks) | |
{ | |
super.drawScreen(mouseX, mouseY, partialTicks); | |
this.mousePosX = (float)mouseX; | |
this.mousePosY = (float)mouseY; | |
GlStateManager.disableLighting(); | |
GlStateManager.disableBlend(); | |
} | |
/** | |
* Called from the main game loop to update the screen. | |
*/ | |
public void updateScreen() | |
{ | |
super.updateScreen(); | |
System.out.println(genetesterinv.getSlot(0).getStack()); | |
/**ItemStack stack = this.genetesterinv.getSlot(0).getStack(); | |
int id; | |
if (stack != null) | |
{ | |
if (stack.getItem() == ModItems.syringeempty) | |
{ | |
id = 1; | |
} | |
else if (stack.getItem() == ModItems.syringefull) | |
{ | |
id = 2; | |
} | |
else | |
{ | |
id = 0; | |
} | |
WildCraftPacketHandler.INSTANCE.sendToServer(new MessageSendGeneTesterSlot(id, stack.getTagCompound().getString("DNA"))); | |
}*/ | |
} | |
@Override | |
public void updateCraftingInventory(Container containerToSend, NonNullList<ItemStack> itemsList) { | |
this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack()); | |
} | |
@Override | |
public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack) { | |
} | |
@Override | |
public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) { | |
} | |
@Override | |
public void sendAllWindowProperties(Container containerIn, IInventory inventory) { | |
} | |
//ENTITY SPECIFIC GENETICS | |
/**public void drawWolfGenetics(EntityWildCraftCanine wccanine) | |
{ | |
String gene1 = "a"; | |
String gene2 = "a"; | |
String genetics = "aa"; | |
String finalgenetics = ""; | |
int result1 = Integer.parseInt(wccanine.getGenetics().substring(1,2)); | |
int result2 = Integer.parseInt(wccanine.getGenetics().substring(0,1)); | |
if (result2 == 0) | |
{ | |
gene1 = "a"; | |
} | |
else if (result2 == 1) | |
{ | |
gene1 = "at"; | |
} | |
else if (result2 == 2) | |
{ | |
gene1 = "aw"; | |
} | |
else | |
{ | |
gene1 = "Ay"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "a"; | |
} | |
else if (result1 == 1) | |
{ | |
gene2 = "at"; | |
} | |
else if (result1 == 2) | |
{ | |
gene2 = "aw"; | |
} | |
else | |
{ | |
gene2 = "Ay"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
result1 = Integer.parseInt(wccanine.getGenetics().substring(3,4)); | |
result2 = Integer.parseInt(wccanine.getGenetics().substring(2,3)); | |
if (result2 == 0) | |
{ | |
gene1 = "b"; | |
} | |
else | |
{ | |
gene1 = "B"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "b"; | |
} | |
else | |
{ | |
gene2 = "B"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
result1 = Integer.parseInt(wccanine.getGenetics().substring(5,6)); | |
result2 = Integer.parseInt(wccanine.getGenetics().substring(4,5)); | |
if (result2 == 0) | |
{ | |
gene1 = "d"; | |
} | |
else | |
{ | |
gene1 = "D"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "d"; | |
} | |
else | |
{ | |
gene2 = "D"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
result1 = Integer.parseInt(wccanine.getGenetics().substring(7,8)); | |
result2 = Integer.parseInt(wccanine.getGenetics().substring(6,7)); | |
if (result2 == 0) | |
{ | |
gene1 = "e"; | |
} | |
else if (result2 == 1) | |
{ | |
gene1 = "E"; | |
} | |
else if (result2 == 2) | |
{ | |
gene1 = "Eg"; | |
} | |
else | |
{ | |
gene1 = "Em"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "e"; | |
} | |
else if (result1 == 1) | |
{ | |
gene2 = "E"; | |
} | |
else if (result1 == 2) | |
{ | |
gene2 = "Eg"; | |
} | |
else | |
{ | |
gene2 = "Em"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
result1 = Integer.parseInt(wccanine.getGenetics().substring(9,10)); | |
result2 = Integer.parseInt(wccanine.getGenetics().substring(8,9)); | |
if (result2 == 0) | |
{ | |
gene1 = "g"; | |
} | |
else | |
{ | |
gene1 = "G"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "g"; | |
} | |
else | |
{ | |
gene2 = "G"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
result1 = Integer.parseInt(wccanine.getGenetics().substring(11,12)); | |
result2 = Integer.parseInt(wccanine.getGenetics().substring(10,11)); | |
if (result2 == 0) | |
{ | |
gene1 = "h"; | |
} | |
else | |
{ | |
gene1 = "H"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "h"; | |
} | |
else | |
{ | |
gene2 = "H"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
result1 = Integer.parseInt(wccanine.getGenetics().substring(13,14)); | |
result2 = Integer.parseInt(wccanine.getGenetics().substring(12,13)); | |
if (result2 == 0) | |
{ | |
gene1 = "k"; | |
} | |
else if (result2 == 1) | |
{ | |
gene1 = "kbr"; | |
} | |
else | |
{ | |
gene1 = "K"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "k"; | |
} | |
else if (result1 == 1) | |
{ | |
gene2 = "kbr"; | |
} | |
else | |
{ | |
gene2 = "K"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
result1 = Integer.parseInt(wccanine.getGenetics().substring(15,16)); | |
result2 = Integer.parseInt(wccanine.getGenetics().substring(14,15)); | |
if (result2 == 0) | |
{ | |
gene1 = "m"; | |
} | |
else | |
{ | |
gene1 = "M"; | |
} | |
if (result1 == 0) | |
{ | |
gene2 = "m"; | |
} | |
else | |
{ | |
gene2 = "M"; | |
} | |
if (result1 > result2) | |
{ | |
genetics = gene2 + gene1; | |
} | |
else | |
{ | |
genetics = gene1 + gene2; | |
} | |
finalgenetics = finalgenetics + genetics; | |
}*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment