diff --git a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java index 84ec414e..45db8929 100644 --- a/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java +++ b/src/main/java/binnie/botany/craftgui/ControlColorMixSymbol.java @@ -42,7 +42,7 @@ public class ControlColorMixSymbol extends Control implements ITooltip { public void setValue(IColorMix value) { this.value = value; - setColour(0xffffff); + setColor(0xffffff); } @Override diff --git a/src/main/java/binnie/core/craftgui/IWidget.java b/src/main/java/binnie/core/craftgui/IWidget.java index 8cab1663..8063fa58 100644 --- a/src/main/java/binnie/core/craftgui/IWidget.java +++ b/src/main/java/binnie/core/craftgui/IWidget.java @@ -53,9 +53,9 @@ public interface IWidget { Point getRelativeMousePosition(); - int getColour(); + int getColor(); - void setColour(final int p0); + void setColor(final int p0); @SideOnly(Side.CLIENT) void render(int guiWidth, int guiHeight); diff --git a/src/main/java/binnie/core/craftgui/Widget.java b/src/main/java/binnie/core/craftgui/Widget.java index 130677ac..64db8703 100644 --- a/src/main/java/binnie/core/craftgui/Widget.java +++ b/src/main/java/binnie/core/craftgui/Widget.java @@ -209,12 +209,12 @@ public class Widget implements IWidget { } @Override - public final int getColour() { + public final int getColor() { return this.colour; } @Override - public final void setColour(final int colour) { + public final void setColor(final int colour) { if (this.colour != colour) { this.colour = colour; this.callEvent(new EventWidget.ChangeColour(this)); diff --git a/src/main/java/binnie/core/craftgui/WindowFieldKit.java b/src/main/java/binnie/core/craftgui/WindowFieldKit.java index f84c0d05..6a5e66b2 100644 --- a/src/main/java/binnie/core/craftgui/WindowFieldKit.java +++ b/src/main/java/binnie/core/craftgui/WindowFieldKit.java @@ -120,8 +120,8 @@ public class WindowFieldKit extends Window { this.GlassControl = new ControlImage(this, handGlass.x(), handGlass.y(), new StandardTexture(0, 160, 96, 96, ExtraBeeTexture.GUIPunnett)); new ControlSlot.Builder(this, handGlass.x() + 54, handGlass.y() + 26).assign(InventoryType.Window, 0); new ControlSlot.Builder(this, 208, 8).assign(InventoryType.Window, 1); - (this.text = new ControlText(this, new Point(232, 13), "Paper")).setColour(2236962); - (this.text = new ControlText(this, new Area(0, 120, this.width(), 24), "", TextJustification.MIDDLE_CENTER)).setColour(2236962); + (this.text = new ControlText(this, new Point(232, 13), "Paper")).setColor(2236962); + (this.text = new ControlText(this, new Area(0, 120, this.width(), 24), "", TextJustification.MIDDLE_CENTER)).setColor(2236962); this.chromo = new ControlChromosome(this, 150, 24); this.addEventHandler(new EventValueChanged.Handler() { @Override diff --git a/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java b/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java index a702c05b..d302c190 100644 --- a/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java +++ b/src/main/java/binnie/core/craftgui/controls/ControlCheckbox.java @@ -29,7 +29,7 @@ public class ControlCheckbox extends Control implements IControlValue { this.text = text; this.value = bool; if (w > 16) { - new ControlText(this, new Area(16, 1, w - 16, 16), text, TextJustification.MIDDLE_CENTER).setColour(4473924); + new ControlText(this, new Area(16, 1, w - 16, 16), text, TextJustification.MIDDLE_CENTER).setColor(4473924); } this.addAttribute(Attribute.MouseOver); this.addEventHandler(new EventMouse.Down.Handler() { diff --git a/src/main/java/binnie/core/craftgui/controls/ControlText.java b/src/main/java/binnie/core/craftgui/controls/ControlText.java index 07f6e31a..781c8fa3 100644 --- a/src/main/java/binnie/core/craftgui/controls/ControlText.java +++ b/src/main/java/binnie/core/craftgui/controls/ControlText.java @@ -32,7 +32,7 @@ public class ControlText extends Control implements IControlValue { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), this.align, this.text, this.getColour()); + RenderUtil.drawText(this.getArea(), this.align, this.text, this.getColor()); } @Override diff --git a/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java b/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java index e1686ae1..10adc033 100644 --- a/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java +++ b/src/main/java/binnie/core/craftgui/controls/listbox/ControlOption.java @@ -35,7 +35,7 @@ public class ControlOption extends Control implements IControlValue { if (this.isCurrentSelection()) { colour = 0xffffff; } - this.setColour(colour); + this.setColor(colour); } @Override diff --git a/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java b/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java index cbd72614..ad677498 100644 --- a/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java +++ b/src/main/java/binnie/core/craftgui/controls/listbox/ControlTextOption.java @@ -15,7 +15,7 @@ public class ControlTextOption extends ControlOption { this.addEventHandler(new EventWidget.ChangeColour.Handler() { @Override public void onEvent(final EventWidget.ChangeColour event) { - ControlTextOption.this.textWidget.setColour(ControlTextOption.this.getColour()); + ControlTextOption.this.textWidget.setColor(ControlTextOption.this.getColor()); } }.setOrigin(EventHandler.Origin.Self, this)); } diff --git a/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java b/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java index a959b0c4..ed147ec4 100644 --- a/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java +++ b/src/main/java/binnie/core/craftgui/controls/tab/ControlTab.java @@ -96,9 +96,9 @@ public class ControlTab extends Control implements ITooltip, IControlValue final ControlTabIcon icon = (ControlTabIcon) this; final ControlItemDisplay item = (ControlItemDisplay) this.getWidgets().get(0); if (texture == CraftGUITexture.TabDisabled) { - item.setColour(-1431655766); + item.setColor(-1431655766); } else { - item.setColour(-1); + item.setColor(-1); } if (icon.hasOutline()) { iTexture = CraftGUI.render.getTexture(CraftGUITexture.TabOutline); diff --git a/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java b/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java index 0780b2a0..34e17199 100644 --- a/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java +++ b/src/main/java/binnie/core/craftgui/database/ControlMutationSymbol.java @@ -50,9 +50,9 @@ class ControlMutationSymbol extends Control implements ITooltip { final BreedingSystem system = ((WindowAbstractDatabase) this.getTopParent()).getBreedingSystem(); this.discovered = (isNEI || system.isMutationDiscovered(value, Window.get(this).getWorld(), Window.get(this).getUsername())); if (this.discovered) { - this.setColour(16777215); + this.setColor(16777215); } else { - this.setColour(7829367); + this.setColor(7829367); } } diff --git a/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java b/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java index 013b7872..00ca592f 100644 --- a/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java +++ b/src/main/java/binnie/core/craftgui/database/PageSpeciesClassification.java @@ -20,11 +20,11 @@ public class PageSpeciesClassification extends PageSpecies { int y = 16; for (final IClassification.EnumClassLevel level : IClassification.EnumClassLevel.values()) { final ControlText text = new ControlTextCentered(this, y, ""); - text.setColour(level.getColour()); + text.setColor(level.getColour()); this.levels.put(level, text); y += 12; } - (this.genus = new ControlTextCentered(this, y, "")).setColour(16759415); + (this.genus = new ControlTextCentered(this, y, "")).setColor(16759415); } @Override diff --git a/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java b/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java index 4c304584..186408b4 100644 --- a/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java +++ b/src/main/java/binnie/core/craftgui/database/WindowAbstractDatabase.java @@ -133,8 +133,8 @@ public abstract class WindowAbstractDatabase extends Window { } }.setOrigin(EventHandler.Origin.DirectChild, this)); new ControlHelp(this, 4, 4); - (this.panelInformation = new Panel(this, 24, 24, 144, 176, MinecraftGUI.PanelType.Black)).setColour(860416); - (this.panelSearch = new Panel(this, 176, 24, this.selectionBoxWidth, 160, MinecraftGUI.PanelType.Black)).setColour(860416); + (this.panelInformation = new Panel(this, 24, 24, 144, 176, MinecraftGUI.PanelType.Black)).setColor(860416); + (this.panelSearch = new Panel(this, 176, 24, this.selectionBoxWidth, 160, MinecraftGUI.PanelType.Black)).setColor(860416); this.modePages = new ControlPages<>(this, 0, 0, this.getSize().x(), this.getSize().y()); new ControlTextEdit(this, 176, 184, this.selectionBoxWidth, 16); this.createMode(Mode.SPECIES, new SpeciesModeWidgets()); diff --git a/src/main/java/binnie/core/craftgui/minecraft/Window.java b/src/main/java/binnie/core/craftgui/minecraft/Window.java index 384cd874..c20a3127 100644 --- a/src/main/java/binnie/core/craftgui/minecraft/Window.java +++ b/src/main/java/binnie/core/craftgui/minecraft/Window.java @@ -179,7 +179,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG } public void setTitle(final String title) { - (this.title = new ControlTextCentered(this, 12, title)).setColour(4210752); + (this.title = new ControlTextCentered(this, 12, title)).setColor(4210752); } @SideOnly(Side.CLIENT) @@ -229,7 +229,7 @@ public abstract class Window extends TopLevelWidget implements INetwork.ReceiveG if (this.getBackground2() != null) { CraftGUI.render.texture(this.getBackground2(), new Point(256, 0)); } - RenderUtil.setColour(this.getColour()); + RenderUtil.setColour(this.getColor()); CraftGUI.render.texture(CraftGUITexture.Window, this.getArea()); } diff --git a/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java b/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java index ca02f5cd..89bd2f04 100644 --- a/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java +++ b/src/main/java/binnie/core/craftgui/renderer/TextureRenderer.java @@ -98,7 +98,7 @@ public class TextureRenderer { public final void preRender(final IWidget widget, int guiWidth, int guiHeight) { GlStateManager.pushMatrix(); GlStateManager.translate(widget.getPosition().x(), widget.getPosition().y(), 0.0f); - RenderUtil.setColour(widget.getColour()); + RenderUtil.setColour(widget.getColor()); if (widget.isCroppedWidet()) { final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget; final Point pos = cropRelative.getAbsolutePosition(); diff --git a/src/main/java/binnie/core/machines/storage/ControlColourSelector.java b/src/main/java/binnie/core/machines/storage/ControlColourSelector.java index 8ab8731d..f991e171 100644 --- a/src/main/java/binnie/core/machines/storage/ControlColourSelector.java +++ b/src/main/java/binnie/core/machines/storage/ControlColourSelector.java @@ -34,7 +34,7 @@ class ControlColourSelector extends Control implements ITooltip, IControlValue WindowApiaristDatabase.create(player, side, false)), - BeeDatabaseNEI((player, inventory, side) -> WindowApiaristDatabase.create(player, side, true)), - PunnettSquare(WindowPunnettSquare::create); + GENEPOOL(WindowGenepool::new), + ISOLATOR(WindowIsolator::new), + SEQUENCER(WindowSequencer::new), + POLYMERISER(WindowPolymeriser::new), + INOCULATOR(WindowInoculator::new), + GENE_BANK(WindowGeneBank::new), + ANALYSER(WindowAnalyser::new), + INCUBATOR(WindowIncubator::new), + DATABASE(WindowGeneBank::new), + DATABASE_NEI(WindowGeneBankNEI::new), + ACCLIMATISER(WindowAcclimatiser::new), + SPLICER(WindowSplicer::new), + ANALYST(WindowAnalyst.create(false, false)), + REGISTRY(WindowAnalyst.create(true, false)), + MASTER_REGISTRY(WindowAnalyst.create(true, true)), + BEE_DATABASE((player, inventory, side) -> WindowApiaristDatabase.create(player, side, false)), + BEE_DATABASE_NEI((player, inventory, side) -> WindowApiaristDatabase.create(player, side, true)), + PUNNETT_SQUARE(WindowPunnettSquare::create); private final WindowFactory windowFactory; - GeneticsGUI(final WindowFactory windowFactory) { + GeneticsGUI(WindowFactory windowFactory) { this.windowFactory = windowFactory; } - public Window getWindow(final EntityPlayer player, @Nullable final IInventory object, final Side side) { - return this.windowFactory.create(player, object, side); + public Window getWindow(EntityPlayer player, @Nullable IInventory object, Side side) { + return windowFactory.create(player, object, side); } @Override - public Window getWindow(final EntityPlayer player, final World world, final int x, final int y, final int z, final Side side) { - final TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); + public Window getWindow(EntityPlayer player, World world, int x, int y, int z, Side side) { + TileEntity tileEntity = world.getTileEntity(new BlockPos(x, y, z)); IInventory object = null; if (tileEntity instanceof IInventory) { object = (IInventory) tileEntity; } - return getWindow(player, object, side); } public interface WindowFactory { - Window create(final EntityPlayer player, @Nullable final IInventory inventory, final Side side); + Window create(EntityPlayer player, @Nullable IInventory inventory, Side side); } } diff --git a/src/main/java/binnie/genetics/core/GeneticsPacket.java b/src/main/java/binnie/genetics/core/GeneticsPacket.java index 31cbff93..43bed372 100644 --- a/src/main/java/binnie/genetics/core/GeneticsPacket.java +++ b/src/main/java/binnie/genetics/core/GeneticsPacket.java @@ -12,17 +12,16 @@ import binnie.core.network.packet.MessageNBT; import binnie.genetics.genetics.GeneTracker; public enum GeneticsPacket implements IPacketID { - GeneTrackerSync; + GENE_TRACKER_SYNC; @Override - public void onMessage(final MessageBinnie message, final MessageContext context) { - if (this == GeneticsPacket.GeneTrackerSync && context.side == Side.CLIENT) { - final MessageNBT packet = new MessageNBT(message); - final EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer(); - GeneTracker tracker = GeneTracker.getTracker(BinnieCore.getBinnieProxy().getWorld(), player.getGameProfile()); - if (tracker != null) { - tracker.readFromNBT(packet.getTagCompound()); - } + public void onMessage(MessageBinnie message, MessageContext context) { + if (this != GeneticsPacket.GENE_TRACKER_SYNC || context.side != Side.CLIENT) { + return; } + MessageNBT packet = new MessageNBT(message); + EntityPlayer player = BinnieCore.getBinnieProxy().getPlayer(); + GeneTracker tracker = GeneTracker.getTracker(BinnieCore.getBinnieProxy().getWorld(), player.getGameProfile()); + tracker.readFromNBT(packet.getTagCompound()); } } diff --git a/src/main/java/binnie/genetics/core/GeneticsTexture.java b/src/main/java/binnie/genetics/core/GeneticsTexture.java index b7c7e71b..1192a29b 100644 --- a/src/main/java/binnie/genetics/core/GeneticsTexture.java +++ b/src/main/java/binnie/genetics/core/GeneticsTexture.java @@ -13,40 +13,42 @@ import binnie.core.resource.ResourceType; import binnie.genetics.Genetics; public enum GeneticsTexture implements IBinnieTexture { - GeneticMachine(ResourceType.Tile, "GeneticMachine"), - Genepool(ResourceType.Tile, "genepool"), - Incubator(ResourceType.Tile, "incubator"), - GUIProcess(ResourceType.GUI, "process"), - GUIProcess2(ResourceType.GUI, "process2"), - GUIProcess3(ResourceType.GUI, "process3"), - Isolator(ResourceType.Tile, "isolator"), - Sequencer(ResourceType.Tile, "sequencer"), - Polymeriser(ResourceType.Tile, "polymeriser"), - Inoculator(ResourceType.Tile, "inoculator"), - Analyser(ResourceType.Tile, "analyser"), - MachineGlow(ResourceType.Tile, "MachineGlow"), - GeneBank(ResourceType.Tile, "GeneBank"), - LabMachine(ResourceType.Tile, "lab_machine"), - Acclimatiser(ResourceType.Tile, "acclimatiser"), - Splicer(ResourceType.Tile, "splicer"); + GENETIC_MACHINE(ResourceType.Tile, "GeneticMachine"), + GENEPOOL(ResourceType.Tile, "genepool"), + INCUBATOR(ResourceType.Tile, "incubator"), + GUI_PROCESS(ResourceType.GUI, "process"), + GUI_PROCESS_2(ResourceType.GUI, "process2"), + GUI_PROCESS_3(ResourceType.GUI, "process3"), + ISOLATOR(ResourceType.Tile, "isolator"), + SEQUENCER(ResourceType.Tile, "sequencer"), + POLYMERISER(ResourceType.Tile, "polymeriser"), + INOCULATOR(ResourceType.Tile, "inoculator"), + ANALYSER(ResourceType.Tile, "analyser"), + MACHINE_GLOW(ResourceType.Tile, "MachineGlow"), + GENE_BANK(ResourceType.Tile, "GeneBank"), + LAB_MACHINE(ResourceType.Tile, "lab_machine"), + ACCLIMATISER(ResourceType.Tile, "acclimatiser"), + SPLICER(ResourceType.Tile, "splicer"); public static BinnieSprite dnaIcon = Binnie.RESOURCE.getItemSprite(Genetics.instance, "dna"); + private final String texture; private final ResourceType type; + @SideOnly(Side.CLIENT) @Nullable private BinnieResource resource; - GeneticsTexture(final ResourceType base, final String texture) { + GeneticsTexture(ResourceType base, String texture) { this.texture = texture; - this.type = base; + type = base; } @Override @SideOnly(Side.CLIENT) public BinnieResource getTexture() { if (resource == null) { - resource = Binnie.RESOURCE.getPNG(Genetics.instance, this.type, this.texture); + resource = Binnie.RESOURCE.getPNG(Genetics.instance, type, texture); } return resource; } diff --git a/src/main/java/binnie/genetics/genetics/AlleleHelper.java b/src/main/java/binnie/genetics/genetics/AlleleHelper.java index 82adea27..f714b08a 100644 --- a/src/main/java/binnie/genetics/genetics/AlleleHelper.java +++ b/src/main/java/binnie/genetics/genetics/AlleleHelper.java @@ -21,133 +21,133 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { public static IAllele getAllele(EnumTemperature temperature) { return getAllele(getUid(temperature)); } - + public static IAllele getAllele(EnumHumidity humidity) { return getAllele(getUid(humidity)); } - + public static IAllele getAllele(EnumTolerance tolerance) { return getAllele(getUid(tolerance)); } - + public static IAllele getAllele(EnumAllele.Fertility fertility) { return getAllele(getUid(fertility)); } - + public static IAllele getAllele(EnumAllele.Territory territory) { return getAllele(getUid(territory)); } - + public static IAllele getAllele(EnumAllele.Lifespan lifespan) { return getAllele(getUid(lifespan)); } - + public static IAllele getAllele(EnumAllele.Sappiness sappiness) { return getAllele(getUid(sappiness)); } - + public static IAllele getAllele(EnumAllele.Speed speed) { return getAllele(getUid(speed)); } - + public static IAllele getAllele(EnumAllele.Flowering flowering) { return getAllele(getUid(flowering)); } - + public static IAllele getAllele(EnumAllele.Height height) { return getAllele(getUid(height)); } - + public static IAllele getAllele(EnumAllele.Maturation maturation) { return getAllele(getUid(maturation)); } - + public static IAllele getAllele(EnumAllele.Yield yield) { return getAllele(getUid(yield)); } - + public static IAllele getAllele(EnumAllele.Saplings saplings) { return getAllele(getUid(saplings)); } - + public static IAllele getAllele(EnumFlowerColor color) { return color.getFlowerColorAllele(); } - + public static IAllele getAllele(int number) { return getAllele("forestry.i" + number + "d"); } - + public static IAllele getAllele(boolean bool) { if (bool) { return getAllele("forestry.boolTrue"); } return getAllele("forestry.boolFalse"); } - + public static IAllele getAllele(String uid) { return AlleleManager.alleleRegistry.getAllele(uid); } - + public static String toDisplay(EnumTemperature temperature) { return AlleleManager.climateHelper.toDisplay(temperature); } - + public static String toDisplay(EnumHumidity humidity) { return AlleleManager.climateHelper.toDisplay(humidity); } - + public static String toDisplay(EnumMoisture moisture) { return I18N.localise("botany.moisture." + moisture.getName()); } - + public static String toDisplay(EnumAcidity acidity) { return I18N.localise("botany.ph." + acidity.getName()); } - + public static String toDisplay(EnumSoilType soilType) { return I18N.localise("botany.soil." + soilType.getName()); } - + public static String toDisplay(EnumTolerance tolerance) { return toAlleleDisplay("tolerance", tolerance.name()); } - + public static String toDisplay(EnumAllele.Flowering flowering) { if (flowering == EnumAllele.Flowering.AVERAGE) { return toAlleleDisplay("flowering", "normal"); } return toAlleleDisplay(null, flowering.name()); } - + public static String toDisplay(EnumAllele.Speed speed) { return toAlleleDisplay(null, speed.name()); } - + public static String toDisplay(EnumAllele.Lifespan lifespan) { return toAlleleDisplay("lifespan", lifespan.name()); } - + public static String getUid(EnumAllele.Fertility fertility) { return getUid("fertility", fertility.name()); } - + public static String getUid(EnumAllele.Lifespan lifespan) { return getUid("lifespan", lifespan.name()); } - + public static String getUid(EnumAllele.Sappiness sappiness) { return getUid("sappiness", sappiness.name()); } - + private static String getUid(EnumTemperature temperature) { return getUid("temperature", temperature.name()); } - + private static String getUid(EnumHumidity humidity) { return getUid("humidity", humidity.name()); } - + public static String getUid(EnumAllele.Saplings saplings) { if (saplings == EnumAllele.Saplings.AVERAGE) { return getUid("saplings", "Default"); @@ -160,49 +160,49 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { } return getUid("saplings", saplings.name()); } - + public static String getUid(EnumAllele.Height height) { if (height == EnumAllele.Height.AVERAGE) { return getUid("height", "Max10", false); } return getUid("height", height.name()); } - + public static String getUid(EnumAllele.Maturation maturation) { return getUid("maturation", maturation.name()); } - + public static String getUid(EnumAllele.Territory territory) { return getUid("territory", territory.name()); } - + public static String getUid(EnumAllele.Yield yield) { if (yield == EnumAllele.Yield.AVERAGE) { return getUid("yield", "Default", false); } return getUid("yield", yield.name()); } - + public static String getUid(EnumAllele.Fireproof fireproof) { return getUid("bool", fireproof.name()); } - + public static String getUid(EnumAllele.Flowering flowering) { return getUid("flowering", flowering.name()); } - + public static String getUid(EnumTolerance tolerance) { return getUid("tolerance", tolerance.name()); } - + public static String getUid(EnumAllele.Speed speed) { return getUid("speed", speed.name()); } - + protected static String getUid(String key, String valueName) { return getUid(key, valueName, true); } - + private static String getUid(String key, String valueName, boolean needCapitalize) { if (needCapitalize) { valueName = WordUtils.capitalize(valueName.toLowerCase(Locale.ENGLISH)); @@ -210,7 +210,7 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper { valueName = valueName.replace("_", ""); return "forestry." + key + valueName; } - + private static String toAlleleDisplay(String key, String valueName) { String name = valueName.toLowerCase().replace("_", ""); if (key == null) { diff --git a/src/main/java/binnie/genetics/genetics/Engineering.java b/src/main/java/binnie/genetics/genetics/Engineering.java index 0495817f..689c949b 100644 --- a/src/main/java/binnie/genetics/genetics/Engineering.java +++ b/src/main/java/binnie/genetics/genetics/Engineering.java @@ -14,19 +14,22 @@ import binnie.genetics.item.ItemSerum; import binnie.genetics.item.ItemSerumArray; public class Engineering { - public static boolean isGeneAcceptor(final ItemStack stack) { + public static boolean isGeneAcceptor(ItemStack stack) { if (stack.isEmpty()) { return false; } + Item item = stack.getItem(); if (item instanceof IItemSerum) { return ((IItemSerum) item).getCharges(stack) == 0; } + int metadata = stack.getMetadata(); - return item == Genetics.items().getItemGenetics() && (metadata == GeneticsItems.EMPTY_SERUM.ordinal() || metadata == GeneticsItems.EMPTY_GENOME.ordinal()); + return item == Genetics.items().getItemGenetics() + && (metadata == GeneticsItems.EMPTY_SERUM.ordinal() || metadata == GeneticsItems.EMPTY_GENOME.ordinal()); } - public static boolean canAcceptGene(final ItemStack stack, final IGene gene) { + public static boolean canAcceptGene(ItemStack stack, IGene gene) { Item item = stack.getItem(); if (item instanceof ItemSerum) { return true; @@ -38,19 +41,20 @@ public class Engineering { } @Nullable - public static IGene getGene(final ItemStack stack, final int chromosome) { + public static IGene getGene(ItemStack stack, int chromosome) { if (stack.getItem() instanceof IItemSerum) { return ((IItemSerum) stack.getItem()).getGene(stack, chromosome); } return null; } - public static ItemStack addGene(final ItemStack stack, final IGene gene) { + public static ItemStack addGene(ItemStack stack, IGene gene) { Item item = stack.getItem(); int metadata = stack.getMetadata(); if (item instanceof IItemSerum) { ((IItemSerum) item).addGene(stack, gene); } + if (item == Genetics.items().getItemGenetics()) { if (metadata == GeneticsItems.EMPTY_SERUM.ordinal()) { return ItemSerum.create(gene); @@ -61,12 +65,13 @@ public class Engineering { return stack; } - public static IGene[] getGenes(final ItemStack serum) { + public static IGene[] getGenes(ItemStack serum) { if (!serum.isEmpty()) { Item item = serum.getItem(); if (item instanceof IItemSerum) { return ((IItemSerum) item).getGenes(serum); } + if (item == Genetics.items().itemSequencer) { SequencerItem sequencerItem = SequencerItem.create(serum); if (sequencerItem != null) { @@ -77,7 +82,7 @@ public class Engineering { return new IGene[0]; } - public static int getCharges(final ItemStack serum) { + public static int getCharges(ItemStack serum) { return ((IItemChargeable) serum.getItem()).getCharges(serum); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneArrayItem.java b/src/main/java/binnie/genetics/genetics/GeneArrayItem.java index c53fffe9..7c012ace 100644 --- a/src/main/java/binnie/genetics/genetics/GeneArrayItem.java +++ b/src/main/java/binnie/genetics/genetics/GeneArrayItem.java @@ -24,87 +24,91 @@ import binnie.core.util.I18N; import binnie.genetics.api.IGene; public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem { - static final String GENES_NBT = "genes"; - List genes; + private static final String GENES_NBT = "genes"; - public GeneArrayItem(final ItemStack stack) { - this.genes = new ArrayList<>(); - this.readFromNBT(stack.getTagCompound()); + private List genes; + + public GeneArrayItem(ItemStack stack) { + genes = new ArrayList<>(); + readFromNBT(stack.getTagCompound()); } - public GeneArrayItem(final IGene gene) { - this.genes = new ArrayList<>(); - this.addGene(gene); + public GeneArrayItem(IGene gene) { + genes = new ArrayList<>(); + addGene(gene); } public GeneArrayItem() { - this.genes = new ArrayList<>(); + genes = new ArrayList<>(); } @Override - public int getColour(final int renderPass) { + public int getColor(int renderPass) { if (renderPass == 2) { - BreedingSystem breedingSystem = this.getBreedingSystem(); + BreedingSystem breedingSystem = getBreedingSystem(); if (breedingSystem != null) { return breedingSystem.getColour(); } } - return 16777215; + return 0xffffff; } @Override @SideOnly(Side.CLIENT) - public void getInfo(final List list) { - final List totalList = new ArrayList<>(); - - BreedingSystem breedingSystem = this.getBreedingSystem(); + public void getInfo(List list) { + List totalList = new ArrayList<>(); + BreedingSystem breedingSystem = getBreedingSystem(); if (breedingSystem != null) { - for (IGene gene : this.genes) { - final String chromosomeName = breedingSystem.getChromosomeName(gene.getChromosome()); + for (IGene gene : genes) { + String chromosomeName = breedingSystem.getChromosomeName(gene.getChromosome()); totalList.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + gene.getName()); } } + if (totalList.size() < 4 || GuiScreen.isShiftKeyDown()) { list.addAll(totalList); } else { list.add(totalList.get(0)); list.add(totalList.get(1)); - list.add(totalList.size() - 2 + " " + I18N.localise("genetics.item.gene.more.genes")); + list.add((totalList.size() - 2) + " " + I18N.localise("genetics.item.gene.more.genes")); } } @Nullable public BreedingSystem getBreedingSystem() { - if (this.genes.size() == 0) { + if (genes.size() == 0) { return null; } - final BreedingSystem system = Binnie.GENETICS.getSystem(this.genes.get(0).getSpeciesRoot().getUID()); + BreedingSystem system = Binnie.GENETICS.getSystem(genes.get(0).getSpeciesRoot().getUID()); return (system == null) ? Binnie.GENETICS.getActiveSystems().iterator().next() : system; } public List getGenes() { - return this.genes; + return genes; } @Override public void readFromNBT(@Nullable NBTTagCompound nbt) { - this.genes.clear(); - if (nbt != null) { - NBTTagList list = nbt.getTagList(GENES_NBT, 10); - for (int i = 0; i < list.tagCount(); ++i) { - Gene gene = Gene.create(list.getCompoundTagAt(i)); - this.genes.add(gene); - } + genes.clear(); + if (nbt == null) { + return; + } + + NBTTagList list = nbt.getTagList(GENES_NBT, 10); + for (int i = 0; i < list.tagCount(); ++i) { + Gene gene = Gene.create(list.getCompoundTagAt(i)); + genes.add(gene); } } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { - if (this.genes.size() == 0) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + if (genes.size() == 0) { return nbt; } + NBTTagList list = new NBTTagList(); - for (IGene gene : this.genes) { + for (IGene gene : genes) { list.appendTag(gene.getNBTTagCompound()); } nbt.setTag(GENES_NBT, list); @@ -114,15 +118,15 @@ public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem { @Override @Nullable public ISpeciesRoot getSpeciesRoot() { - if (this.genes.size() == 0) { + if (genes.size() == 0) { return null; } - return this.genes.get(0).getSpeciesRoot(); + return genes.get(0).getSpeciesRoot(); } @Nullable - public IGene getGene(final int chromosome) { - for (final IGene gene : this.genes) { + public IGene getGene(int chromosome) { + for (IGene gene : genes) { if (gene.getChromosome().ordinal() == chromosome) { return gene; } @@ -131,20 +135,20 @@ public class GeneArrayItem implements INbtReadable, INbtWritable, IGeneItem { } @Override - public void writeToItem(final ItemStack stack) { + public void writeToItem(ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); if (nbt == null) { nbt = new NBTTagCompound(); } - this.writeToNBT(nbt); + writeToNBT(nbt); stack.setTagCompound(nbt); } @Override - public void addGene(final IGene gene) { - if (this.getGene(gene.getChromosome().ordinal()) != null) { - this.genes.remove(this.getGene(gene.getChromosome().ordinal())); + public void addGene(IGene gene) { + if (getGene(gene.getChromosome().ordinal()) != null) { + genes.remove(getGene(gene.getChromosome().ordinal())); } - this.genes.add(gene); + genes.add(gene); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneItem.java b/src/main/java/binnie/genetics/genetics/GeneItem.java index d4db1bc8..899c7520 100644 --- a/src/main/java/binnie/genetics/genetics/GeneItem.java +++ b/src/main/java/binnie/genetics/genetics/GeneItem.java @@ -23,12 +23,12 @@ import binnie.genetics.api.IGene; public class GeneItem implements INbtWritable, IGeneItem { private IGene gene; - public GeneItem(final IGene gene) { + public GeneItem(IGene gene) { this.gene = gene; } @Nullable - public static GeneItem create(final ItemStack stack) { + public static GeneItem create(ItemStack stack) { NBTTagCompound tagCompound = stack.getTagCompound(); if (tagCompound != null && tagCompound.hasKey("gene", Constants.NBT.TAG_COMPOUND)) { NBTTagCompound geneNbt = tagCompound.getCompoundTag("gene"); @@ -39,52 +39,52 @@ public class GeneItem implements INbtWritable, IGeneItem { } @Override - public void writeToItem(final ItemStack stack) { + public void writeToItem(ItemStack stack) { NBTTagCompound nbt = stack.getTagCompound(); if (nbt == null) { nbt = new NBTTagCompound(); } - this.writeToNBT(nbt); + writeToNBT(nbt); stack.setTagCompound(nbt); } @Override - public int getColour(final int renderPass) { + public int getColor(int renderPass) { if (renderPass == 2) { - return this.getBreedingSystem().getColour(); + return getBreedingSystem().getColour(); } - return 16777215; + return 0xffffff; } @Override @SideOnly(Side.CLIENT) - public void getInfo(final List list) { - final String chromosomeName = this.getBreedingSystem().getChromosomeName(this.gene.getChromosome()); - list.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + this.gene.getName()); + public void getInfo(List list) { + String chromosomeName = getBreedingSystem().getChromosomeName(gene.getChromosome()); + list.add(TextFormatting.GOLD + chromosomeName + TextFormatting.GRAY + ": " + gene.getName()); } public BreedingSystem getBreedingSystem() { - return Binnie.GENETICS.getSystem(this.gene.getSpeciesRoot()); + return Binnie.GENETICS.getSystem(gene.getSpeciesRoot()); } public IGene getGene() { - return this.gene; + return gene; } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { - final NBTTagCompound geneNBT = this.gene.getNBTTagCompound(); + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + NBTTagCompound geneNBT = gene.getNBTTagCompound(); nbt.setTag("gene", geneNBT); return nbt; } @Override public ISpeciesRoot getSpeciesRoot() { - return this.gene.getSpeciesRoot(); + return gene.getSpeciesRoot(); } @Override - public void addGene(final IGene gene) { + public void addGene(IGene gene) { this.gene = gene; } } diff --git a/src/main/java/binnie/genetics/genetics/GeneProject.java b/src/main/java/binnie/genetics/genetics/GeneProject.java index b8f3d0cf..81bc45a2 100644 --- a/src/main/java/binnie/genetics/genetics/GeneProject.java +++ b/src/main/java/binnie/genetics/genetics/GeneProject.java @@ -11,51 +11,52 @@ public class GeneProject { private GameProfile leader; private List members; - public GeneProject(final int id, final String name, final GameProfile leader) { + public GeneProject(int id, String name, GameProfile leader) { this.id = 0; this.leader = leader; - this.members = new ArrayList<>(); - this.setID(id); this.name = name; + members = new ArrayList<>(); + setID(id); } public int getID() { - return this.id; + return id; } - public void setID(final int id) { + public void setID(int id) { this.id = id; } public String getName() { - return this.name; + return name; } - public void setName(final String name) { + public void setName(String name) { this.name = name; } public GameProfile getLeader() { - return this.leader; + return leader; } public boolean isEmpty() { - return this.members.isEmpty(); + return members.isEmpty(); } - public void addPlayer(final GameProfile player) { - if (!this.members.contains(player)) { - this.members.add(player); + public void addPlayer(GameProfile player) { + if (!members.contains(player)) { + members.add(player); } - if (this.leader == null) { - this.leader = player; + // TODO always false? + if (leader == null) { + leader = player; } } - public void removePlayer(final GameProfile player) { - if (player == this.leader) { + public void removePlayer(GameProfile player) { + if (player == leader) { throw new RuntimeException("Can't remove leader of a Gene Project"); } - this.members.remove(player); + members.remove(player); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java b/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java index 3ab86609..8739715e 100644 --- a/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java +++ b/src/main/java/binnie/genetics/genetics/GeneProjectTracker.java @@ -12,17 +12,17 @@ import net.minecraft.world.WorldSavedData; import com.mojang.authlib.GameProfile; public class GeneProjectTracker extends WorldSavedData { - Map projects; - Map> TeamInvites; + private Map projects; + private Map> TeamInvites; - public GeneProjectTracker(final String s) { + public GeneProjectTracker(String s) { super(s); - this.projects = new HashMap<>(); - this.TeamInvites = new HashMap<>(); + projects = new HashMap<>(); + TeamInvites = new HashMap<>(); } - public static GeneProjectTracker getTracker(final World world) { - final String filename = "GeneProjectTracker.common"; + public static GeneProjectTracker getTracker(World world) { + String filename = "GeneProjectTracker.common"; GeneProjectTracker tracker = (GeneProjectTracker) world.loadData(GeneProjectTracker.class, filename); if (tracker == null) { tracker = new GeneProjectTracker(filename); @@ -32,87 +32,90 @@ public class GeneProjectTracker extends WorldSavedData { } @Override - public void readFromNBT(final NBTTagCompound nbt) { + public void readFromNBT(NBTTagCompound nbt) { + // ignored } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { return nbt; } - public int createProject(final String name, final GameProfile leader) { + public int createProject(String name, GameProfile leader) { int i; - for (i = 1; this.projects.keySet().contains(i); ++i) { + for (i = 1; projects.keySet().contains(i); ++i) { } - final GeneProject project = new GeneProject(i, name, leader); - this.projects.put(i, project); - this.markDirty(); + GeneProject project = new GeneProject(i, name, leader); + projects.put(i, project); + markDirty(); return i; } - public void removeProject(final int id) { - this.projects.remove(id); - for (final Map.Entry> entry : this.TeamInvites.entrySet()) { + public void removeProject(int id) { + projects.remove(id); + for (Map.Entry> entry : TeamInvites.entrySet()) { entry.getValue().remove(id); } - this.markDirty(); + markDirty(); } - public void leaveProject(final int id, final GameProfile player) { - final GeneProject project = this.projects.get(id); + public void leaveProject(int id, GameProfile player) { + GeneProject project = projects.get(id); if (project == null) { return; } + project.removePlayer(player); if (project.isEmpty()) { - this.removeProject(id); + removeProject(id); } - this.markDirty(); + markDirty(); } - public void joinProject(final int id, final GameProfile player) { - final GeneProject project = this.projects.get(id); + public void joinProject(int id, GameProfile player) { + GeneProject project = projects.get(id); if (project == null) { return; } project.addPlayer(player); - this.markDirty(); + markDirty(); } - public void reassignPlayer(final int id, final int id2, final GameProfile player) { - final GeneProject project = this.projects.get(id); + public void reassignPlayer(int id, int id2, GameProfile player) { + GeneProject project = projects.get(id); if (project == null) { return; } - final GeneProject project2 = this.projects.get(id2); + + GeneProject project2 = projects.get(id2); if (project2 == null) { return; } - this.leaveProject(id, player); - this.joinProject(id2, player); + leaveProject(id, player); + joinProject(id2, player); } - public void renameProject(final int id, final String newName) { - final GeneProject project = this.projects.get(id); + public void renameProject(int id, String newName) { + GeneProject project = projects.get(id); if (project != null) { project.setName(newName); } - this.markDirty(); + markDirty(); } - public void invitePlayer(final int id, final GameProfile player) { - if (!this.TeamInvites.containsKey(player)) { - this.TeamInvites.put(player, new LinkedHashSet<>()); + public void invitePlayer(int id, GameProfile player) { + if (!TeamInvites.containsKey(player)) { + TeamInvites.put(player, new LinkedHashSet<>()); } - this.TeamInvites.get(player).add(id); - this.markDirty(); + TeamInvites.get(player).add(id); + markDirty(); } - public void revokeInvite(final int id, final GameProfile player) { - if (!this.TeamInvites.containsKey(player)) { - this.TeamInvites.put(player, new LinkedHashSet<>()); + public void revokeInvite(int id, GameProfile player) { + if (!TeamInvites.containsKey(player)) { + TeamInvites.put(player, new LinkedHashSet<>()); } - this.TeamInvites.get(player).add(id); - this.markDirty(); + TeamInvites.get(player).add(id); + markDirty(); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneTracker.java b/src/main/java/binnie/genetics/genetics/GeneTracker.java index d62ae602..d935178e 100644 --- a/src/main/java/binnie/genetics/genetics/GeneTracker.java +++ b/src/main/java/binnie/genetics/genetics/GeneTracker.java @@ -25,26 +25,27 @@ import binnie.genetics.core.GeneticsPacket; public class GeneTracker extends WorldSavedData { private ArrayList discoveredGenes; + @Nullable private GameProfile username; - public GeneTracker(final String s, @Nullable final GameProfile username) { + public GeneTracker(String s, @Nullable GameProfile username) { super(s); - this.discoveredGenes = new ArrayList<>(); + discoveredGenes = new ArrayList<>(); this.username = username; } - public GeneTracker(final String s) { + public GeneTracker(String s) { super(s); - this.discoveredGenes = new ArrayList<>(); + discoveredGenes = new ArrayList<>(); } - protected static GeneTracker getCommonTracker(final EntityPlayer player) { + protected static GeneTracker getCommonTracker(EntityPlayer player) { return getTracker(player.world, null); } - public static GeneTracker getTracker(final World world, @Nullable final GameProfile player) { - final String filename = "GeneTracker." + ((player == null) ? "common" : player.getId()); + public static GeneTracker getTracker(World world, @Nullable GameProfile player) { + String filename = "GeneTracker." + ((player == null) ? "common" : player.getId()); GeneTracker tracker = (GeneTracker) world.loadData(GeneTracker.class, filename); if (tracker == null) { tracker = new GeneTracker(filename, player); @@ -55,31 +56,36 @@ public class GeneTracker extends WorldSavedData { return tracker; } - public void synchToPlayer(final EntityPlayer player) { - final NBTTagCompound nbttagcompound = new NBTTagCompound(); - this.writeToNBT(nbttagcompound); - Genetics.proxy.sendToPlayer(new MessageNBT(GeneticsPacket.GeneTrackerSync.ordinal(), nbttagcompound), player); + public void synchToPlayer(EntityPlayer player) { + NBTTagCompound nbttagcompound = new NBTTagCompound(); + writeToNBT(nbttagcompound); + Genetics.proxy.sendToPlayer(new MessageNBT(GeneticsPacket.GENE_TRACKER_SYNC.ordinal(), nbttagcompound), player); } @Override - public void readFromNBT(final NBTTagCompound nbt) { - for (final ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { + public void readFromNBT(NBTTagCompound nbt) { + for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { if (!nbt.hasKey(root.getUID())) { continue; } - final NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID()); - for (final IChromosomeType chromo : root.getKaryotype()) { - if (nbtRoot.hasKey("" + chromo.ordinal())) { - final NBTTagList nbtChromo = nbtRoot.getTagList("" + chromo.ordinal(), 8); - for (int i = 0; i < nbtChromo.tagCount(); ++i) { - final String uid = nbtChromo.getStringTagAt(i); - final IAllele allele = AlleleManager.alleleRegistry.getAllele(uid); - if (allele != null) { - final Gene gene = new Gene(allele, chromo, root); - if (!this.discoveredGenes.contains(gene)) { - this.discoveredGenes.add(gene); - } - } + + NBTTagCompound nbtRoot = nbt.getCompoundTag(root.getUID()); + for (IChromosomeType chromo : root.getKaryotype()) { + if (!nbtRoot.hasKey("" + chromo.ordinal())) { + continue; + } + + NBTTagList nbtChromo = nbtRoot.getTagList("" + chromo.ordinal(), 8); + for (int i = 0; i < nbtChromo.tagCount(); ++i) { + String uid = nbtChromo.getStringTagAt(i); + IAllele allele = AlleleManager.alleleRegistry.getAllele(uid); + if (allele == null) { + continue; + } + + Gene gene = new Gene(allele, chromo, root); + if (!discoveredGenes.contains(gene)) { + discoveredGenes.add(gene); } } } @@ -87,12 +93,12 @@ public class GeneTracker extends WorldSavedData { } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt) { - for (final ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { - final NBTTagCompound nbtRoot = new NBTTagCompound(); - for (final IChromosomeType chromo : root.getKaryotype()) { - final NBTTagList nbtChromo = new NBTTagList(); - for (final IGene gene : this.discoveredGenes) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { + for (ISpeciesRoot root : AlleleManager.alleleRegistry.getSpeciesRoot().values()) { + NBTTagCompound nbtRoot = new NBTTagCompound(); + for (IChromosomeType chromo : root.getKaryotype()) { + NBTTagList nbtChromo = new NBTTagList(); + for (IGene gene : discoveredGenes) { if (gene.getSpeciesRoot() == root && gene.getChromosome() == chromo) { nbtChromo.appendTag(new NBTTagString(gene.getAllele().getUID())); } @@ -104,18 +110,18 @@ public class GeneTracker extends WorldSavedData { return nbt; } - public void registerGene(final IGene iGene) { - if (!this.discoveredGenes.contains(iGene)) { - this.discoveredGenes.add(iGene); + public void registerGene(IGene iGene) { + if (!discoveredGenes.contains(iGene)) { + discoveredGenes.add(iGene); } - this.markDirty(); + markDirty(); } public int getGenesSequenced() { - return this.discoveredGenes.size(); + return discoveredGenes.size(); } - public boolean isSequenced(final Gene gene) { - return this.discoveredGenes.contains(gene); + public boolean isSequenced(Gene gene) { + return discoveredGenes.contains(gene); } } diff --git a/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java b/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java index 66016274..533f9dcc 100644 --- a/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java +++ b/src/main/java/binnie/genetics/genetics/GeneticEngineeringSystem.java @@ -23,45 +23,45 @@ public class GeneticEngineeringSystem { public Map> chromosomeMap; BreedingSystem breedingSystem; - public GeneticEngineeringSystem(final BreedingSystem system) { - this.chromosomeMap = new HashMap<>(); - this.breedingSystem = system; - for (final IIndividual indiv : this.breedingSystem.getSpeciesRoot().getIndividualTemplates()) { - for (final IChromosomeType chromosome : this.breedingSystem.getSpeciesRoot().getKaryotype()) { - if (!this.chromosomeMap.containsKey(chromosome)) { - this.chromosomeMap.put(chromosome, new ArrayList<>()); + public GeneticEngineeringSystem(BreedingSystem system) { + chromosomeMap = new HashMap<>(); + breedingSystem = system; + for (IIndividual indiv : breedingSystem.getSpeciesRoot().getIndividualTemplates()) { + for (IChromosomeType chromosome : breedingSystem.getSpeciesRoot().getKaryotype()) { + if (!chromosomeMap.containsKey(chromosome)) { + chromosomeMap.put(chromosome, new ArrayList<>()); } try { - final IAllele a1 = indiv.getGenome().getActiveAllele(chromosome); - final IAllele a2 = indiv.getGenome().getInactiveAllele(chromosome); - this.chromosomeMap.get(chromosome).add(a1); - this.chromosomeMap.get(chromosome).add(a2); + IAllele a1 = indiv.getGenome().getActiveAllele(chromosome); + IAllele a2 = indiv.getGenome().getInactiveAllele(chromosome); + chromosomeMap.get(chromosome).add(a1); + chromosomeMap.get(chromosome).add(a2); } catch (Exception ex) { throw Throwables.propagate(ex); } } } - for (final IChromosomeType chromosome2 : this.breedingSystem.getSpeciesRoot().getKaryotype()) { - final List alleles = this.getAlleles(chromosome2); - final TreeSet set = new TreeSet<>(new ComparatorAllele()); + for (IChromosomeType chromosome2 : breedingSystem.getSpeciesRoot().getKaryotype()) { + List alleles = getAlleles(chromosome2); + TreeSet set = new TreeSet<>(new ComparatorAllele()); set.addAll(alleles); - final List list = new ArrayList<>(); + List list = new ArrayList<>(); list.addAll(set); - this.chromosomeMap.put(chromosome2, list); + chromosomeMap.put(chromosome2, list); } } - public List getAlleles(final IChromosomeType chromosome) { - return this.chromosomeMap.get(chromosome); + public List getAlleles(IChromosomeType chromosome) { + return chromosomeMap.get(chromosome); } public ISpeciesRoot getSpeciesRoot() { - return this.breedingSystem.getSpeciesRoot(); + return breedingSystem.getSpeciesRoot(); } class ComparatorAllele implements Comparator { @Override - public int compare(final IAllele o1, final IAllele o2) { + public int compare(IAllele o1, IAllele o2) { if (o1 instanceof IAlleleFloat && o2 instanceof IAlleleFloat) { return Float.valueOf(((IAlleleFloat) o1).getValue()).compareTo(((IAlleleFloat) o2).getValue()); } diff --git a/src/main/java/binnie/genetics/genetics/IGeneItem.java b/src/main/java/binnie/genetics/genetics/IGeneItem.java index 504281e6..b1308b55 100644 --- a/src/main/java/binnie/genetics/genetics/IGeneItem.java +++ b/src/main/java/binnie/genetics/genetics/IGeneItem.java @@ -19,9 +19,9 @@ public interface IGeneItem { @SideOnly(Side.CLIENT) void getInfo(List info); - int getColour(int p0); + int getColor(int renderPass); - void writeToItem(ItemStack itemStack); + void writeToItem(ItemStack stack); void addGene(IGene gene); } diff --git a/src/main/java/binnie/genetics/genetics/SequencerItem.java b/src/main/java/binnie/genetics/genetics/SequencerItem.java index 8e0e8e9c..e11920a6 100644 --- a/src/main/java/binnie/genetics/genetics/SequencerItem.java +++ b/src/main/java/binnie/genetics/genetics/SequencerItem.java @@ -14,14 +14,14 @@ public class SequencerItem extends GeneItem { public int sequenced; public boolean analysed; - public SequencerItem(final IGene gene) { + public SequencerItem(IGene gene) { super(gene); - this.sequenced = 0; - this.analysed = false; + sequenced = 0; + analysed = false; } @Nullable - public static SequencerItem create(final ItemStack itemStack) { + public static SequencerItem create(ItemStack itemStack) { NBTTagCompound nbt = itemStack.getTagCompound(); if (nbt != null && nbt.hasKey("gene", Constants.NBT.TAG_COMPOUND) && @@ -39,10 +39,10 @@ public class SequencerItem extends GeneItem { } @Override - public NBTTagCompound writeToNBT(final NBTTagCompound nbt2) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt2) { NBTTagCompound nbt = super.writeToNBT(nbt2); - nbt.setByte("seq", (byte) this.sequenced); - nbt.setBoolean("ana", this.analysed); + nbt.setByte("seq", (byte) sequenced); + nbt.setBoolean("ana", analysed); return nbt; } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java index a6066fde..6205e133 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageBehaviour.java @@ -25,47 +25,47 @@ import binnie.core.util.I18N; //TODO:localise @SideOnly(Side.CLIENT) public class AnalystPageBehaviour extends ControlAnalystPage { - public AnalystPageBehaviour(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageBehaviour(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(6684723); + setColor(6684723); int y = 4; - new ControlTextCentered(this, y, "§nBehaviour").setColour(this.getColour()); + new ControlTextCentered(this, y, "§nBehaviour").setColor(getColor()); y += 12; if (ind instanceof IBee) { - final IBee bee = (IBee) ind; + IBee bee = (IBee) ind; y += 8; - final int fertility = bee.getGenome().getFlowering(); - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColour(this.getColour()); + int fertility = bee.getGenome().getFlowering(); + new ControlTextCentered(this, y, "Pollinates nearby\n" + bee.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "§oEvery " + this.getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§oEvery " + getTimeString(PluginApiculture.ticksPerBeeWorkCycle * 100 / fertility)).setColor(getColor()); y += 22; - final IAlleleBeeEffect effect = bee.getGenome().getEffect(); - final Vec3i t = bee.getGenome().getTerritory(); + IAlleleBeeEffect effect = bee.getGenome().getEffect(); + Vec3i t = bee.getGenome().getTerritory(); if (!effect.getUID().contains("None")) { - final String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc"); - final String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc; - new ControlText(this, new Area(4, y, this.width() - 8, 0), loc, TextJustification.TOP_CENTER).setColour(this.getColour()); - y += CraftGUI.render.textHeight(loc, this.width() - 8) + 1; - new ControlTextCentered(this, y, "§oWithin " + t.getX() / 2 + " blocks").setColour(this.getColour()); + String effectDesc = I18N.localiseOrBlank("binniecore.allele." + effect.getUID() + ".desc"); + String loc = effectDesc.equals("") ? ("Effect: " + effect.getName()) : effectDesc; + new ControlText(this, new Area(4, y, width() - 8, 0), loc, TextJustification.TOP_CENTER).setColor(getColor()); + y += CraftGUI.render.textHeight(loc, width() - 8) + 1; + new ControlTextCentered(this, y, "§oWithin " + t.getX() / 2 + " blocks").setColor(getColor()); y += 22; } - new ControlTextCentered(this, y, "Territory: §o" + t.getX() + "x" + t.getY() + "x" + t.getZ()).setColour(this.getColour()); + new ControlTextCentered(this, y, "Territory: §o" + t.getX() + "x" + t.getY() + "x" + t.getZ()).setColor(getColor()); y += 22; } if (ind instanceof IButterfly) { - final IButterfly bee2 = (IButterfly) ind; - new ControlTextCentered(this, y, "§oMetabolism: " + Binnie.GENETICS.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))).setColour(this.getColour()); + IButterfly bee2 = (IButterfly) ind; + new ControlTextCentered(this, y, "§oMetabolism: " + Binnie.GENETICS.mothBreedingSystem.getAlleleName(EnumButterflyChromosome.METABOLISM, ind.getGenome().getActiveAllele(EnumButterflyChromosome.METABOLISM))).setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "Pollinates nearby\n" + bee2.getGenome().getFlowerProvider().getDescription()).setColour(this.getColour()); + new ControlTextCentered(this, y, "Pollinates nearby\n" + bee2.getGenome().getFlowerProvider().getDescription()).setColor(getColor()); y += 20; - new ControlTextCentered(this, y, "§oEvery " + this.getTimeString(1500)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§oEvery " + getTimeString(1500)).setColor(getColor()); y += 22; - final IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect(); + IAlleleButterflyEffect effect2 = bee2.getGenome().getEffect(); if (!effect2.getUID().contains("None")) { - final String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc"); - final String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2; - new ControlText(this, new Area(4, y, this.width() - 8, 0), loc2, TextJustification.TOP_CENTER).setColour(this.getColour()); - y += CraftGUI.render.textHeight(loc2, this.width() - 8) + 1; + String effectDesc2 = I18N.localiseOrBlank("binniecore.allele." + effect2.getUID() + ".desc"); + String loc2 = effectDesc2.equals("") ? ("Effect: " + effect2.getName()) : effectDesc2; + new ControlText(this, new Area(4, y, width() - 8, 0), loc2, TextJustification.TOP_CENTER).setColor(getColor()); + y += CraftGUI.render.textHeight(loc2, width() - 8) + 1; y += 22; } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageBiology.java b/src/main/java/binnie/genetics/gui/AnalystPageBiology.java index 33232beb..d6d9dce8 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageBiology.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageBiology.java @@ -28,14 +28,14 @@ import binnie.genetics.item.ModuleItems; //TODO:localise @SideOnly(Side.CLIENT) public class AnalystPageBiology extends ControlAnalystPage { - public AnalystPageBiology(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageBiology(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(26214); + setColor(26214); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; if (ind instanceof IBee) { - final IBee bee = (IBee) ind; + IBee bee = (IBee) ind; if (bee.getGenome().getNeverSleeps()) { new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay).addTooltip(I18N.localise("genetics.gui.analyst.biology.bee.allday")); } else if (bee.getGenome().getPrimary().isNocturnal()) { @@ -55,7 +55,7 @@ public class AnalystPageBiology extends ControlAnalystPage { } y += 30; } else if (ind instanceof IButterfly) { - final IButterfly moth = (IButterfly) ind; + IButterfly moth = (IButterfly) ind; if (moth.getGenome().getNocturnal()) { new ControlIconDisplay(this, (width() - 64) / 2, y, ModuleItems.iconAllDay).addTooltip("Active all day and night"); } else if (moth.getGenome().getPrimary().isNocturnal()) { @@ -75,92 +75,92 @@ public class AnalystPageBiology extends ControlAnalystPage { } y += 30; } else if (ind instanceof ITree) { - new ControlTextCentered(this, y, "§oSappiness: " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColour(this.getColour()); + new ControlTextCentered(this, y, "§oSappiness: " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.SAPPINESS, ind.getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS))).setColor(getColor()); y += 20; } else { y += 10; } if (ind instanceof IBee) { - final IBee bee = (IBee) ind; - final int fertility = bee.getGenome().getFertility(); - new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColour(this.getColour()); + IBee bee = (IBee) ind; + int fertility = bee.getGenome().getFertility(); + new ControlTextCentered(this, y, "§l" + fertility + "§r drone" + ((fertility > 1) ? "s" : "") + " per hive").setColor(getColor()); y += 22; - final int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle; - new ControlTextCentered(this, y, "Average Lifespan").setColour(this.getColour()); + int lifespan = bee.getGenome().getLifespan() * PluginApiculture.ticksPerBeeWorkCycle; + new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f))).setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan * (bee.getGenome().getNeverSleeps() ? 1.0f : 2.0f))).setColor(getColor()); y += 22; } if (ind instanceof IButterfly) { - final IButterfly bee2 = (IButterfly) ind; - final int fertility = bee2.getGenome().getFertility(); - new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColour(this.getColour()); + IButterfly bee2 = (IButterfly) ind; + int fertility = bee2.getGenome().getFertility(); + new ControlTextCentered(this, y, "Lays §l" + fertility + "§r caterpillar" + ((fertility > 1) ? "s" : "") + " before dying").setColor(getColor()); y += 32; - final float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2)); - new ControlTextCentered(this, y, "Caterpillar Gestation").setColour(this.getColour()); + float caterpillarMatureTime = 1365.3999f * Math.round(bee2.getGenome().getLifespan() / (bee2.getGenome().getFertility() * 2)); + new ControlTextCentered(this, y, "Caterpillar Gestation").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + this.getMCDayString(caterpillarMatureTime)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + getMCDayString(caterpillarMatureTime)).setColor(getColor()); y += 22; - final int speed = (int) (20.0f * bee2.getGenome().getSpeed()); - new ControlTextCentered(this, y, "Flight Speed").setColour(this.getColour()); + int speed = (int) (20.0f * bee2.getGenome().getSpeed()); + new ControlTextCentered(this, y, "Flight Speed").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + speed + "§r blocks per second").setColor(getColor()); y += 22; } if (ind instanceof ITree) { - final ITree tree = (ITree) ind; - final int fertility = (int) (1.0f / tree.getGenome().getFertility()); - new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColour(this.getColour()); + ITree tree = (ITree) ind; + int fertility = (int) (1.0f / tree.getGenome().getFertility()); + new ControlTextCentered(this, y, "1 Sapling per §l" + fertility + "§r leave" + ((fertility > 1) ? "s" : "")).setColor(getColor()); y += 22; - final int butterflySpawn = Math.round(1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f)); - new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn) + " per leaf").setColour(this.getColour()); + int butterflySpawn = Math.round(1365.3999f / (tree.getGenome().getSappiness() * tree.getGenome().getYield() * 0.5f)); + new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn) + " per leaf").setColor(getColor()); y += 34; - new ControlTextCentered(this, y, "Plant Type").setColour(this.getColour()); + new ControlTextCentered(this, y, "Plant Type").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§o" + tree.getGenome().getPrimary().getPlantType().toString().toLowerCase(Locale.ENGLISH)).setColor(getColor()); } if (ind instanceof IFlower) { - final IFlower flower = (IFlower) ind; - final int butterflySpawn2 = Math.round(1365.3999f / (flower.getGenome().getSappiness() * 0.2f)); - new ControlTextCentered(this, y, "Butterfies spawn every\n" + this.getTimeString(butterflySpawn2)).setColour(this.getColour()); + IFlower flower = (IFlower) ind; + int butterflySpawn2 = Math.round(1365.3999f / (flower.getGenome().getSappiness() * 0.2f)); + new ControlTextCentered(this, y, "Butterfies spawn every\n" + getTimeString(butterflySpawn2)).setColor(getColor()); y += 30; float CHANCE_DISPERSAL = 0.8f; CHANCE_DISPERSAL += 0.2f * flower.getGenome().getFertility(); float CHANCE_POLLINATE = 0.6f; CHANCE_POLLINATE += 0.25f * flower.getGenome().getFertility(); - final float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE; + float CHANCE_SELFPOLLINATE = 0.2f * CHANCE_POLLINATE; if (CHANCE_DISPERSAL > 1.0f) { CHANCE_DISPERSAL = 1.0f; } if (CHANCE_POLLINATE > 1.0f) { CHANCE_POLLINATE = 1.0f; } - final float dispersalTime = 1365.3999f / CHANCE_DISPERSAL; - final float pollinateTime = 1365.3999f / CHANCE_POLLINATE; - final float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance(); + float dispersalTime = 1365.3999f / CHANCE_DISPERSAL; + float pollinateTime = 1365.3999f / CHANCE_POLLINATE; + float lifespan2 = flower.getMaxAge() * 20.0f * 68.27f / flower.getGenome().getAgeChance(); float floweringLifespan = (flower.getMaxAge() - 1) * 20.0f * 68.27f / flower.getGenome().getAgeChance(); floweringLifespan -= 1365.3999f; - new ControlTextCentered(this, y, "Average Lifespan").setColour(this.getColour()); + new ControlTextCentered(this, y, "Average Lifespan").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§l" + this.getMCDayString(lifespan2)).setColour(this.getColour()); + new ControlTextCentered(this, y, "§l" + getMCDayString(lifespan2)).setColor(getColor()); y += 22; - new ControlTextCentered(this, y, "Seed Dispersal").setColour(this.getColour()); + new ControlTextCentered(this, y, "Seed Dispersal").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColour(this.getColour()); + new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / dispersalTime) + " per lifetime").setColor(getColor()); y += 22; - new ControlTextCentered(this, y, "Pollination").setColour(this.getColour()); + new ControlTextCentered(this, y, "Pollination").setColor(getColor()); y += 12; - new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColour(this.getColour()); + new ControlTextCentered(this, y, "§o" + (int) (floweringLifespan / pollinateTime) + " per lifetime").setColor(getColor()); y += 22; } - this.setSize(new Point(this.width(), y)); + setSize(new Point(width(), y)); } - private String getMCDayString(final float time) { - final float seconds = time / 20.0f; - final float minutes = seconds / 60.0f; - final float days = minutes / 20.0f; - final DecimalFormat df = new DecimalFormat("#.0"); + private String getMCDayString(float time) { + float seconds = time / 20.0f; + float minutes = seconds / 60.0f; + float days = minutes / 20.0f; + DecimalFormat df = new DecimalFormat("#.0"); return df.format(days) + " MC days"; } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java index 50aada3d..b409c6f4 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDatabase.java @@ -36,29 +36,29 @@ public class AnalystPageDatabase extends ControlAnalystPage { private final ControlScrollableContent scroll; boolean isMaster; - public AnalystPageDatabase(final IWidget parent, final Area area, final BreedingSystem system, final boolean isMaster) { + public AnalystPageDatabase(IWidget parent, Area area, BreedingSystem system, boolean isMaster) { super(parent, area); this.isMaster = isMaster; - final int cOfSystem = system.getColour(); - final int cr = (0xFF0000 & cOfSystem) >> 16; - final int cg = (0xFF00 & cOfSystem) >> 8; - final int cb = 0xFF & cOfSystem; + int cOfSystem = system.getColour(); + int cr = (0xFF0000 & cOfSystem) >> 16; + int cg = (0xFF00 & cOfSystem) >> 8; + int cb = 0xFF & cOfSystem; float brightness = 0.1f * cb / 255.0f + 0.35f * cr / 255.0f + 0.55f * cg / 255.0f; brightness = 0.3f / brightness; if (brightness > 1.0f) { brightness = 1.0f; } - final int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness); - this.setColour(newColour); + int newColour = (int) (cr * brightness) * 65536 + (int) (cg * brightness) * 256 + (int) (cb * brightness); + setColor(newColour); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlTextEdit(this, 20, y, this.width() - 40, 16) { + new ControlTextEdit(this, 20, y, width() - 40, 16) { @Override - public void onTextEdit(final String value) { - final Collection options = new ArrayList<>(); - AnalystPageDatabase.this.getSpecies(system); - for (final IAlleleSpecies species : AnalystPageDatabase.this.getSpecies(system)) { + public void onTextEdit(String value) { + Collection options = new ArrayList<>(); + getSpecies(system); + for (IAlleleSpecies species : getSpecies(system)) { if (value != null) { if (!Objects.equals(value, "")) { if (!species.getName().toLowerCase().contains(value.toLowerCase())) { @@ -68,87 +68,87 @@ public class AnalystPageDatabase extends ControlAnalystPage { } options.add(species); } - AnalystPageDatabase.this.scroll.deleteAllChildren(); - AnalystPageDatabase.this.scroll.setScrollableContent(AnalystPageDatabase.this.getItemScrollList(system, options)); + scroll.deleteAllChildren(); + scroll.setScrollableContent(getItemScrollList(system, options)); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { RenderUtil.setColour(5592405); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1)); - RenderUtil.setColour(AnalystPageDatabase.this.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea()); - super.renderTextField(); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1)); + RenderUtil.setColour(AnalystPageDatabase.this.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea()); + renderTextField(); } }; y += 22; - new Panel(this, 3, y - 1, this.width() - 6, this.height() - y - 8 + 2, MinecraftGUI.PanelType.TabOutline).setColour(this.getColour()); - final boolean textView = false; - final Collection options = this.getSpecies(system); - for (final IAlleleSpecies species : options) { - final String height = system.getAlleleName(EnumTreeChromosome.HEIGHT, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT)); - final String fertility = system.getAlleleName(EnumTreeChromosome.FERTILITY, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY)); - final String yield = system.getAlleleName(EnumTreeChromosome.YIELD, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD)); - final String sappiness = system.getAlleleName(EnumTreeChromosome.SAPPINESS, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS)); - final String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION)); + new Panel(this, 3, y - 1, width() - 6, height() - y - 8 + 2, MinecraftGUI.PanelType.TabOutline).setColor(getColor()); + boolean textView = false; + Collection options = getSpecies(system); + for (IAlleleSpecies species : options) { + String height = system.getAlleleName(EnumTreeChromosome.HEIGHT, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT)); + String fertility = system.getAlleleName(EnumTreeChromosome.FERTILITY, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.FERTILITY)); + String yield = system.getAlleleName(EnumTreeChromosome.YIELD, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.YIELD)); + String sappiness = system.getAlleleName(EnumTreeChromosome.SAPPINESS, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.SAPPINESS)); + String maturation = system.getAlleleName(EnumTreeChromosome.MATURATION, system.getIndividual(species.getUID()).getGenome().getActiveAllele(EnumTreeChromosome.MATURATION)); } if (textView) { - this.scroll = new ControlListBox(this, 4, y, this.width() - 8, this.height() - y - 8 - 20, 0) { + scroll = new ControlListBox(this, 4, y, width() - 8, height() - y - 8 - 20, 0) { @Override public void initialise() { super.initialise(); - this.setOptions(options); + setOptions(options); } @Override - public IWidget createOption(final IAlleleSpecies v, final int y) { - return new Control(this.getContent(), 0, y, this.width(), 12) { + public IWidget createOption(IAlleleSpecies v, int y) { + return new Control(getContent(), 0, y, width(), 12) { IAlleleSpecies value = v; @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), TextJustification.MIDDLE_CENTER, this.value.getName(), 16777215); + RenderUtil.drawText(getArea(), TextJustification.MIDDLE_CENTER, value.getName(), 16777215); } }; } }; } else { - this.scroll = new ControlScrollableContent(this, 4, y, this.width() - 8, this.height() - y - 8, 0); - this.scroll.setScrollableContent(this.getItemScrollList(system, options)); + scroll = new ControlScrollableContent(this, 4, y, width() - 8, height() - y - 8, 0); + scroll.setScrollableContent(getItemScrollList(system, options)); } - new ControlScrollBar(this, this.scroll.xPos() + this.scroll.width() - 6, this.scroll.yPos() + 3, 3, this.scroll.height() - 6, this.scroll) { + new ControlScrollBar(this, scroll.xPos() + scroll.width() - 6, scroll.yPos() + 3, 3, scroll.height() - 6, scroll) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (!this.isEnabled()) { + if (!isEnabled()) { return; } - RenderUtil.drawGradientRect(this.getArea(), 1140850688 + AnalystPageDatabase.this.getColour(), 1140850688 + AnalystPageDatabase.this.getColour()); - RenderUtil.drawSolidRect(this.getRenderArea(), AnalystPageDatabase.this.getColour()); + RenderUtil.drawGradientRect(getArea(), 1140850688 + AnalystPageDatabase.this.getColor(), 1140850688 + AnalystPageDatabase.this.getColor()); + RenderUtil.drawSolidRect(getRenderArea(), AnalystPageDatabase.this.getColor()); } }; } - private IWidget getItemScrollList(final BreedingSystem system, final Collection options) { - return new Control(this.scroll, 0, 0, this.scroll.width(), this.scroll.height()) { + private IWidget getItemScrollList(BreedingSystem system, Collection options) { + return new Control(scroll, 0, 0, scroll.width(), scroll.height()) { @Override public void initialise() { - final int maxBiomePerLine = (this.width() - 4 + 2) / 18; - final int biomeListX = -6 + (this.width() - (maxBiomePerLine * 18 - 2)) / 2; + int maxBiomePerLine = (width() - 4 + 2) / 18; + int biomeListX = -6 + (width() - (maxBiomePerLine * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final IAlleleSpecies species : options) { - final IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species)); + for (IAlleleSpecies species : options) { + IIndividual ind = system.getSpeciesRoot().templateAsIndividual(system.getSpeciesRoot().getTemplate(species)); new ControlIndividualDisplay(this, biomeListX + dx, 2 + dy, ind) { @Override public void initialise() { - this.addSelfEventHandler(new EventMouse.Down.Handler() { + addSelfEventHandler(new EventMouse.Down.Handler() { @Override @SideOnly(Side.CLIENT) - public void onEvent(final EventMouse.Down event) { - final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); + public void onEvent(EventMouse.Down event) { + WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); window.setIndividual(ind); } }); @@ -157,15 +157,15 @@ public class AnalystPageDatabase extends ControlAnalystPage { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - final WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); + WindowAnalyst window = (WindowAnalyst) AnalystPageDatabase.this.getTopParent(); if (window.getIndividual() != null && window.getIndividual().getGenome().getPrimary() == species) { RenderUtil.setColour(15658734); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1)); - RenderUtil.setColour(AnalystPageDatabase.this.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().outset(1)); - } else if (this.calculateIsMouseOver()) { + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1)); + RenderUtil.setColour(AnalystPageDatabase.this.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(1)); + } else if (calculateIsMouseOver()) { RenderUtil.setColour(15658734); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(1)); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(1)); } super.onRenderBackground(guiWidth, guiHeight); } @@ -176,7 +176,7 @@ public class AnalystPageDatabase extends ControlAnalystPage { dy += 18; } } - this.setSize(new Point(this.width(), 4 + dy + 18)); + setSize(new Point(width(), 4 + dy + 18)); } }; } @@ -186,9 +186,9 @@ public class AnalystPageDatabase extends ControlAnalystPage { return I18N.localise("genetics.gui.analyst.registry.title"); } - private Collection getSpecies(final BreedingSystem system) { - final Collection species = new ArrayList<>(); - species.addAll(this.isMaster ? system.getAllSpecies() : system.getDiscoveredSpecies(this.getWindow().getWorld(), this.getWindow().getPlayer().getGameProfile())); + private Collection getSpecies(BreedingSystem system) { + Collection species = new ArrayList<>(); + species.addAll(isMaster ? system.getAllSpecies() : system.getDiscoveredSpecies(getWindow().getWorld(), getWindow().getPlayer().getGameProfile())); return species; } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java index b53e1a08..176b41bd 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageDescription.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageDescription.java @@ -21,20 +21,20 @@ import binnie.core.util.I18N; @SideOnly(Side.CLIENT) public class AnalystPageDescription extends ControlAnalystPage { - public AnalystPageDescription(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageDescription(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; - final IAlleleSpecies species = ind.getGenome().getPrimary(); - final String branchBinomial = species.getBranch().getScientific(); - final String branchName = species.getBranch().getName(); - final String desc = species.getDescription(); + IAlleleSpecies species = ind.getGenome().getPrimary(); + String branchBinomial = species.getBranch().getScientific(); + String branchName = species.getBranch().getName(); + String desc = species.getDescription(); StringBuilder descBody = new StringBuilder(TextFormatting.ITALIC.toString()); String descSig = ""; if (Objects.equals(desc, "") || desc.contains("for.description")) { descBody.append(""); } else { - final String[] descStrings = desc.split("\\|"); + String[] descStrings = desc.split("\\|"); descBody.append(descStrings[0]); for (int i = 1; i < descStrings.length - 1; ++i) { descBody.append(" ").append(descStrings[i]); @@ -53,24 +53,24 @@ public class AnalystPageDescription extends ControlAnalystPage { if (authority.contains("MysteriousAges")) { authority = TextFormatting.DARK_PURPLE.toString() + TextFormatting.BOLD + authority; } - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlTextCentered(this, y, species.getName() + TextFormatting.RESET).setColour(this.getColour()); + new ControlTextCentered(this, y, species.getName() + TextFormatting.RESET).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + TextFormatting.RESET).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + branchBinomial + " " + species.getBinomial() + TextFormatting.RESET).setColor(getColor()); y += 20; String discovered = I18N.localise("genetics.gui.analyst.desc.discovered") + " " + TextFormatting.BOLD + authority + TextFormatting.RESET; - new ControlTextCentered(this, y, discovered).setColour(this.getColour()); - y += (int) (3.0f + CraftGUI.render.textHeight(discovered, this.width())); - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.desc.complexity") + ": " + species.getComplexity()).setColour(this.getColour()); + new ControlTextCentered(this, y, discovered).setColor(getColor()); + y += (int) (3.0f + CraftGUI.render.textHeight(discovered, width())); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.desc.complexity") + ": " + species.getComplexity()).setColor(getColor()); y += 26; - final ControlText descText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); - final IWidget signatureText = new ControlText(this, new Area(8, y, this.width() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); - descText.setColour(this.getColour()); - signatureText.setColour(this.getColour()); - final int descHeight = CraftGUI.render.textHeight(descText.getValue(), descText.getSize().x()); + ControlText descText = new ControlText(this, new Area(8, y, width() - 16, 0), descBody + "§r", TextJustification.TOP_CENTER); + IWidget signatureText = new ControlText(this, new Area(8, y, width() - 16, 0), descSig + "§r", TextJustification.BOTTOM_RIGHT); + descText.setColor(getColor()); + signatureText.setColor(getColor()); + int descHeight = CraftGUI.render.textHeight(descText.getValue(), descText.getSize().x()); signatureText.setPosition(new Point(signatureText.pos().x(), descText.getPosition().y() + descHeight + 10)); - this.setSize(new Point(this.width(), 20 + signatureText.yPos())); + setSize(new Point(width(), 20 + signatureText.yPos())); } @Override diff --git a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java index af72022b..179a319f 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageGenome.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageGenome.java @@ -28,16 +28,16 @@ import binnie.core.util.I18N; public class AnalystPageGenome extends ControlAnalystPage { boolean active; - public AnalystPageGenome(final IWidget parent, final Area area, final boolean active, final IIndividual ind) { + public AnalystPageGenome(IWidget parent, Area area, boolean active, IIndividual ind) { super(parent, area); this.active = active; - this.setColour(26265); + setColor(26265); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + this.getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); - final BreedingSystem system = Binnie.GENETICS.getSystem(root); - final Control scaled = new Control(this, 0, y, 0, 0) { + ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); + BreedingSystem system = Binnie.GENETICS.getSystem(root); + Control scaled = new Control(this, 0, y, 0, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { @@ -52,19 +52,19 @@ public class AnalystPageGenome extends ControlAnalystPage { GlStateManager.popMatrix(); } }; - for (final IChromosomeType chromo : system.getActiveKaryotype()) { - final IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo); - final String alleleName = system.getAlleleName(chromo, allele); - final int height = CraftGUI.render.textHeight(alleleName, this.width() / 2 - 2); - new ControlText(scaled, new Area(0, y + (height - 9) / 2, this.width() / 2 - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColour(this.getColour()); - new ControlText(scaled, new Area(this.width() / 2 + 2, y, this.width() / 2 - 2, 0), alleleName, TextJustification.TOP_LEFT).setColour(this.getColour()); + for (IChromosomeType chromo : system.getActiveKaryotype()) { + IAllele allele = active ? ind.getGenome().getActiveAllele(chromo) : ind.getGenome().getInactiveAllele(chromo); + String alleleName = system.getAlleleName(chromo, allele); + int height = CraftGUI.render.textHeight(alleleName, width() / 2 - 2); + new ControlText(scaled, new Area(0, y + (height - 9) / 2, width() / 2 - 2, 0), system.getChromosomeShortName(chromo) + " :", TextJustification.TOP_RIGHT).setColor(getColor()); + new ControlText(scaled, new Area(width() / 2 + 2, y, width() / 2 - 2, 0), alleleName, TextJustification.TOP_LEFT).setColor(getColor()); y += 3 + height; } - this.setSize(new Point(this.width(), y + 8)); + setSize(new Point(width(), y + 8)); } @Override public String getTitle() { - return I18N.localise("genetics.gui.analyst.genome." + (this.active ? "active" : "inactive")) + " " + I18N.localise("genetics.gui.analyst.genome.title"); + return I18N.localise("genetics.gui.analyst.genome." + (active ? "active" : "inactive")) + " " + I18N.localise("genetics.gui.analyst.genome.title"); } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java b/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java index edc723cc..b3299422 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageKaryogram.java @@ -15,21 +15,21 @@ import binnie.core.genetics.BreedingSystem; import binnie.core.util.I18N; public class AnalystPageKaryogram extends ControlAnalystPage { - public AnalystPageKaryogram(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageKaryogram(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(10040319); + setColor(10040319); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; y += 8; - final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); - final BreedingSystem system = Binnie.GENETICS.getSystem(root); - final int maxBiomePerLine = (int) ((this.width() + 4.0f - 16.0f) / 22.0f); - int karygramX = (this.width() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2; + ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(ind); + BreedingSystem system = Binnie.GENETICS.getSystem(root); + int maxBiomePerLine = (int) ((width() + 4.0f - 16.0f) / 22.0f); + int karygramX = (width() - (Math.min(maxBiomePerLine, system.getActiveKaryotype().size()) * 18 - 4)) / 2; int dx = 0; int dy = 0; int rem = system.getActiveKaryotype().size(); - for (final IChromosomeType type : system.getActiveKaryotype()) { + for (IChromosomeType type : system.getActiveKaryotype()) { new ControlAnalystChromosome(this, karygramX + dx, y + dy, root, type, ind.getGenome().getActiveAllele(type), ind.getGenome().getInactiveAllele(type)); dx += 22; if (dx >= 22 * maxBiomePerLine - 22) { diff --git a/src/main/java/binnie/genetics/gui/AnalystPageMutations.java b/src/main/java/binnie/genetics/gui/AnalystPageMutations.java index fb5c43ef..2bc410de 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageMutations.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageMutations.java @@ -37,17 +37,17 @@ import binnie.core.util.I18N; import binnie.genetics.item.ModuleItems; public class AnalystPageMutations extends ControlAnalystPage { - public AnalystPageMutations(final IWidget parent, final Area area, final IIndividual ind, final boolean isMaster) { + public AnalystPageMutations(IWidget parent, Area area, IIndividual ind, boolean isMaster) { super(parent, area); - this.setColour(3355392); + setColor(3355392); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 18; - final BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); - final List discovered = system.getDiscoveredMutations(Window.get(this).getWorld(), Window.get(this).getUsername()); - final IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary(); - final Collection resultant = system.getResultantMutations(speciesCurrent); - final Collection further = system.getFurtherMutations(speciesCurrent); + BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); + List discovered = system.getDiscoveredMutations(Window.get(this).getWorld(), Window.get(this).getUsername()); + IAlleleSpecies speciesCurrent = ind.getGenome().getPrimary(); + Collection resultant = system.getResultantMutations(speciesCurrent); + Collection further = system.getFurtherMutations(speciesCurrent); if (ind instanceof IBee) { ItemStack hive = null; if (ExtraBeesIntegration.isLoaded()) { @@ -86,19 +86,19 @@ public class AnalystPageMutations extends ControlAnalystPage { hive = new ItemStack(Blocks.CHEST); } if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Valiant.getAllele()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.hive")).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.hive")).setColor(getColor()); y += 22; } else if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Monastic.getAllele()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); y += 10; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.villager")).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.mutations.bee.villager")).setColor(getColor()); y += 22; } else if (hive != null) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.bee.natural")).setColor(getColor()); y += 10; - final ControlItemDisplay display = new ControlItemDisplay(this, (this.width() - 16) / 2, y); + ControlItemDisplay display = new ControlItemDisplay(this, (width() - 16) / 2, y); if (ind.getGenome().getPrimary() == ForestryAllele.BeeSpecies.Steadfast.getAllele()) { display.addTooltip(I18N.localise("genetics.gui.analyst.mutations.bee.dungeon")); } else { @@ -108,33 +108,33 @@ public class AnalystPageMutations extends ControlAnalystPage { y += 24; } } - int ox = (this.width() - 88 - 8) / 2; + int ox = (width() - 88 - 8) / 2; int dx = 0; if (!resultant.isEmpty()) { if (resultant.size() == 1) { - ox = (this.width() - 44) / 2; + ox = (width() - 44) / 2; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultant")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.resultant")).setColor(getColor()); y += 10; - for (final IMutation mutation : resultant) { - final float specificChance = this.getSpecificChance(ind, mutation, system); - if (!isMaster && !this.isKnown(system, mutation)) { + for (IMutation mutation : resultant) { + float specificChance = getSpecificChance(ind, mutation, system); + if (!isMaster && !isKnown(system, mutation)) { new ControlUnknownMutation(this, ox + dx, y, 44, 16); } else { new Control(this, ox + dx, y, 44, 16) { @Override public void initialise() { - final IAlleleSpecies species0 = mutation.getAllele0(); - final IAlleleSpecies species2 = mutation.getAllele1(); - final String comb = species0.getName() + " + " + species2.getName(); - this.addTooltip(comb); + IAlleleSpecies species0 = mutation.getAllele0(); + IAlleleSpecies species2 = mutation.getAllele1(); + String comb = species0.getName() + " + " + species2.getName(); + addTooltip(comb); String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise("genetics.gui.analyst.mutations.chance"); if (specificChance != mutation.getBaseChance()) { chance = chance + getMutationColour(specificChance).getCode() + " (" + (int) specificChance + "% " + I18N.localise("genetics.gui.analyst.mutations.currently") + ")"; } - this.addTooltip(chance); - for (final String s : mutation.getSpecialConditions()) { - this.addTooltip(s); + addTooltip(chance); + for (String s : mutation.getSpecialConditions()) { + addTooltip(s); } } @@ -165,35 +165,35 @@ public class AnalystPageMutations extends ControlAnalystPage { } y += 10; } - ox = (this.width() - 88 - 8) / 2; + ox = (width() - 88 - 8) / 2; dx = 0; if (!further.isEmpty()) { if (further.size() == 1) { - ox = (this.width() - 44) / 2; + ox = (width() - 44) / 2; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.further")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.mutations.further")).setColor(getColor()); y += 10; - for (final IMutation mutation : further) { - final IAllele speciesComb = mutation.getPartner(speciesCurrent); - final float specificChance2 = this.getSpecificChance(ind, mutation, system); - if (!isMaster && !this.isKnown(system, mutation)) { + for (IMutation mutation : further) { + IAllele speciesComb = mutation.getPartner(speciesCurrent); + float specificChance2 = getSpecificChance(ind, mutation, system); + if (!isMaster && !isKnown(system, mutation)) { new ControlUnknownMutation(this, ox + dx, y, 44, 16); } else { new Control(this, ox + dx, y, 44, 16) { @Override public void initialise() { - final IAlleleSpecies species0 = (IAlleleSpecies) speciesComb; - final IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0]; - this.addTooltip(species2.getName()); - final String comb = speciesCurrent.getName() + " + " + species0.getName(); - this.addTooltip(comb); + IAlleleSpecies species0 = (IAlleleSpecies) speciesComb; + IAlleleSpecies species2 = (IAlleleSpecies) mutation.getTemplate()[0]; + addTooltip(species2.getName()); + String comb = speciesCurrent.getName() + " + " + species0.getName(); + addTooltip(comb); String chance = getMutationColour(mutation.getBaseChance()).getCode() + (int) mutation.getBaseChance() + "% " + I18N.localise("genetics.gui.analyst.mutations.chance"); if (specificChance2 != mutation.getBaseChance()) { chance = chance + getMutationColour(specificChance2).getCode() + " (" + (int) specificChance2 + "% " + I18N.localise("genetics.gui.analyst.mutations.currently") + ")"; } - this.addTooltip(chance); - for (final String s : mutation.getSpecialConditions()) { - this.addTooltip(s); + addTooltip(chance); + for (String s : mutation.getSpecialConditions()) { + addTooltip(s); } } @@ -225,7 +225,7 @@ public class AnalystPageMutations extends ControlAnalystPage { } } y += 8; - this.setSize(new Point(this.width(), y)); + setSize(new Point(width(), y)); } @SideOnly(Side.CLIENT) @@ -233,12 +233,12 @@ public class AnalystPageMutations extends ControlAnalystPage { RenderUtil.drawSprite(new Point(14, 0), sprite.getSprite()); } - private boolean isKnown(final BreedingSystem system, final IMutation mutation) { - return system.getDiscoveredMutations(this.getWindow().getWorld(), this.getWindow().getPlayer().getGameProfile()).contains(mutation); + private boolean isKnown(BreedingSystem system, IMutation mutation) { + return system.getDiscoveredMutations(getWindow().getWorld(), getWindow().getPlayer().getGameProfile()).contains(mutation); } - private float getSpecificChance(final IIndividual ind, final IMutation mutation, final BreedingSystem system) { - return system.getChance(mutation, this.getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1()); + private float getSpecificChance(IIndividual ind, IMutation mutation, BreedingSystem system) { + return system.getChance(mutation, getWindow().getPlayer(), mutation.getAllele0(), mutation.getAllele1()); } @Override @@ -246,7 +246,7 @@ public class AnalystPageMutations extends ControlAnalystPage { return I18N.localise("genetics.gui.analyst.mutations.title"); } - protected EnumColor getMutationColour(final float percent) { + protected EnumColor getMutationColour(float percent) { if (percent >= 20.0f) { return EnumColor.DarkGreen; } @@ -266,16 +266,16 @@ public class AnalystPageMutations extends ControlAnalystPage { } static class ControlUnknownMutation extends Control { - public ControlUnknownMutation(final IWidget parent, final int x, final int y, final int w, final int h) { + public ControlUnknownMutation(IWidget parent, int x, int y, int w, int h) { super(parent, x, y, w, h); - this.addAttribute(Attribute.MouseOver); - this.addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknown.tooltip")); + addAttribute(Attribute.MouseOver); + addTooltip(I18N.localise("genetics.gui.analyst.mutations.unknown.tooltip")); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawText(this.getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 11184810); + RenderUtil.drawText(getArea(), TextJustification.MIDDLE_CENTER, I18N.localise("genetics.gui.analyst.mutations.unknown"), 11184810); } } } diff --git a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java index 9481d41f..586e8061 100644 --- a/src/main/java/binnie/genetics/gui/AnalystPageProduce.java +++ b/src/main/java/binnie/genetics/gui/AnalystPageProduce.java @@ -31,28 +31,28 @@ import binnie.extratrees.machines.fruitpress.FruitPressRecipes; import binnie.genetics.gui.bee.AnalystPageProducts; public abstract class AnalystPageProduce extends ControlAnalystPage { - public AnalystPageProduce(final IWidget parent, final Area area) { + public AnalystPageProduce(IWidget parent, Area area) { super(parent, area); } - protected Collection getAllProducts(final ItemStack key) { - final Collection products = new UniqueItemStackSet(); - products.addAll(this.getCentrifuge(key)); - products.addAll(this.getSqueezer(key)); + protected Collection getAllProducts(ItemStack key) { + Collection products = new UniqueItemStackSet(); + products.addAll(getCentrifuge(key)); + products.addAll(getSqueezer(key)); products.add(FurnaceRecipes.instance().getSmeltingResult(key)); - products.addAll(this.getCrafting(key)); + products.addAll(getCrafting(key)); return products; } - public Collection getCentrifuge(final ItemStack stack) { - final List products = new ArrayList<>(); - for (final ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) { + public Collection getCentrifuge(ItemStack stack) { + List products = new ArrayList<>(); + for (ICentrifugeRecipe recipe : RecipeManagers.centrifugeManager.recipes()) { boolean isRecipe = false; if (stack.isItemEqual(recipe.getInput())) { isRecipe = true; } if (isRecipe) { - for (final Object obj : recipe.getAllProducts().keySet()) { + for (Object obj : recipe.getAllProducts().keySet()) { if (obj instanceof ItemStack) { products.add((ItemStack) obj); } @@ -62,11 +62,11 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - public NonNullList getSqueezer(final ItemStack stack) { - final NonNullList products = NonNullList.create(); + public NonNullList getSqueezer(ItemStack stack) { + NonNullList products = NonNullList.create(); for (ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) { boolean isRecipe = false; - for (final Object obj : recipe.getResources()) { + for (Object obj : recipe.getResources()) { if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) { isRecipe = true; } @@ -80,13 +80,13 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - public Collection getCrafting(final ItemStack stack) { - final List products = new ArrayList<>(); - for (final Object recipeO : CraftingManager.getInstance().getRecipeList()) { + public Collection getCrafting(ItemStack stack) { + List products = new ArrayList<>(); + for (Object recipeO : CraftingManager.getInstance().getRecipeList()) { if (recipeO instanceof ShapelessRecipes) { - final ShapelessRecipes recipe = (ShapelessRecipes) recipeO; + ShapelessRecipes recipe = (ShapelessRecipes) recipeO; boolean match = true; - for (final Object rec : recipe.recipeItems) { + for (Object rec : recipe.recipeItems) { if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) { match = false; } @@ -96,9 +96,9 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { } } if (recipeO instanceof ShapedRecipes) { - final ShapedRecipes recipe2 = (ShapedRecipes) recipeO; + ShapedRecipes recipe2 = (ShapedRecipes) recipeO; boolean match = true; - for (final Object rec2 : recipe2.recipeItems) { + for (Object rec2 : recipe2.recipeItems) { if (rec2 != null && (!(rec2 instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec2))) { match = false; } @@ -108,9 +108,9 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { } } if (recipeO instanceof ShapelessOreRecipe) { - final ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO; + ShapelessOreRecipe recipe3 = (ShapelessOreRecipe) recipeO; boolean match = true; - for (final Object rec : recipe3.getInput()) { + for (Object rec : recipe3.getInput()) { if (rec != null && (!(rec instanceof ItemStack) || !stack.isItemEqual((ItemStack) rec))) { match = false; } @@ -124,20 +124,20 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - public Collection getAllFluids(final ItemStack stack) { - final List products = new ArrayList<>(); - products.addAll(this.getSqueezerFluid(stack)); + public Collection getAllFluids(ItemStack stack) { + List products = new ArrayList<>(); + products.addAll(getSqueezerFluid(stack)); if (FruitPressRecipes.getOutput(stack) != null) { products.add(FruitPressRecipes.getOutput(stack)); } return products; } - public Collection getSqueezerFluid(final ItemStack stack) { - final List products = new ArrayList<>(); - for (final ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) { + public Collection getSqueezerFluid(ItemStack stack) { + List products = new ArrayList<>(); + for (ISqueezerRecipe recipe : RecipeManagers.squeezerManager.recipes()) { boolean isRecipe = false; - for (final Object obj : recipe.getResources()) { + for (Object obj : recipe.getResources()) { if (obj instanceof ItemStack && stack.isItemEqual((ItemStack) obj)) { isRecipe = true; } @@ -149,8 +149,8 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - protected Collection getAllProducts(final FluidStack stack) { - final Collection fluids = new UniqueFluidStackSet(); + protected Collection getAllProducts(FluidStack stack) { + Collection fluids = new UniqueFluidStackSet(); fluids.add(BreweryRecipes.getOutput(stack)); fluids.add(DistilleryRecipes.getOutput(stack, 0)); fluids.add(DistilleryRecipes.getOutput(stack, 1)); @@ -158,36 +158,36 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return fluids; } - protected Collection getAllProductsAndFluids(final Collection collection) { - final Collection products = new UniqueItemStackSet(); - for (final ItemStack stack : collection) { - products.addAll(this.getAllProducts(stack)); + protected Collection getAllProductsAndFluids(Collection collection) { + Collection products = new UniqueItemStackSet(); + for (ItemStack stack : collection) { + products.addAll(getAllProducts(stack)); } - final Collection products2 = new UniqueItemStackSet(); - for (final ItemStack stack2 : products) { - products2.addAll(this.getAllProducts(stack2)); + Collection products2 = new UniqueItemStackSet(); + for (ItemStack stack2 : products) { + products2.addAll(getAllProducts(stack2)); } - final Collection products3 = new UniqueItemStackSet(); - for (final ItemStack stack3 : products2) { - products3.addAll(this.getAllProducts(stack3)); + Collection products3 = new UniqueItemStackSet(); + for (ItemStack stack3 : products2) { + products3.addAll(getAllProducts(stack3)); } products.addAll(products2); products.addAll(products3); - final Collection allFluids = new UniqueFluidStackSet(); - for (final ItemStack stack4 : collection) { - allFluids.addAll(this.getAllFluids(stack4)); + Collection allFluids = new UniqueFluidStackSet(); + for (ItemStack stack4 : collection) { + allFluids.addAll(getAllFluids(stack4)); } - final Collection fluids2 = new UniqueFluidStackSet(); - for (final FluidStack stack5 : allFluids) { - fluids2.addAll(this.getAllProducts(stack5)); + Collection fluids2 = new UniqueFluidStackSet(); + for (FluidStack stack5 : allFluids) { + fluids2.addAll(getAllProducts(stack5)); } - final Collection fluids3 = new UniqueFluidStackSet(); - for (final FluidStack stack6 : fluids2) { - fluids3.addAll(this.getAllProducts(stack6)); + Collection fluids3 = new UniqueFluidStackSet(); + for (FluidStack stack6 : fluids2) { + fluids3.addAll(getAllProducts(stack6)); } allFluids.addAll(fluids2); allFluids.addAll(fluids3); - for (final FluidStack fluid : allFluids) { + for (FluidStack fluid : allFluids) { ItemStack container = AnalystPageProducts.getContainer(fluid); if (container != null) { products.add(container); @@ -196,21 +196,21 @@ public abstract class AnalystPageProduce extends ControlAnalystPage { return products; } - protected int getRefined(final String string, int y, final Collection products) { - new ControlTextCentered(this, y, string).setColour(this.getColour()); + protected int getRefined(String string, int y, Collection products) { + new ControlTextCentered(this, y, string).setColor(getColor()); y += 10; - final int maxBiomePerLine = (this.width() + 2 - 16) / 18; - final int biomeListX = (this.width() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2; + int maxBiomePerLine = (width() + 2 - 16) / 18; + int biomeListX = (width() - (Math.min(maxBiomePerLine, products.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final ItemStack soilStack : products) { + for (ItemStack soilStack : products) { if (dx >= 18 * maxBiomePerLine) { dx = 0; dy += 18; } - final FluidStack fluid = FluidUtil.getFluidContained(soilStack); + FluidStack fluid = FluidUtil.getFluidContained(soilStack); soilStack.setCount(1); - final ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null); + ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy, soilStack, fluid == null); if (fluid != null) { display.addTooltip(fluid.getLocalizedName()); } diff --git a/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java b/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java index 15ebc877..dad0933e 100644 --- a/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java +++ b/src/main/java/binnie/genetics/gui/ControlAnalystChromosome.java @@ -28,37 +28,37 @@ public class ControlAnalystChromosome extends Control implements ITooltip { Texture Homozygous; Texture Heterozygous; - public ControlAnalystChromosome(final IWidget parent, final int x, final int y, final ISpeciesRoot root, final IChromosomeType type, final IAllele allele0, final IAllele allele1) { + public ControlAnalystChromosome(IWidget parent, int x, int y, ISpeciesRoot root, IChromosomeType type, IAllele allele0, IAllele allele1) { super(parent, x, y, 16, 22); - this.Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); - this.Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); - this.addAttribute(Attribute.MouseOver); + Homozygous = new StandardTexture(0, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); + Heterozygous = new StandardTexture(16, 0, 16, 22, BinnieCoreTexture.GUIAnalyst); + addAttribute(Attribute.MouseOver); this.root = root; - this.chromosomeType = type; + chromosomeType = type; this.allele0 = allele0; this.allele1 = allele1; } public boolean isHomozygous() { - return this.allele0.getUID().equals(this.allele1.getUID()); + return allele0.getUID().equals(allele1.getUID()); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - CraftGUI.render.texture(this.isHomozygous() ? this.Homozygous : this.Heterozygous, Point.ZERO); + CraftGUI.render.texture(isHomozygous() ? Homozygous : Heterozygous, Point.ZERO); } @Override - public void getTooltip(final Tooltip tooltip) { - final BreedingSystem system = Binnie.GENETICS.getSystem(this.root); - tooltip.add(system.getChromosomeName(this.chromosomeType)); - if (this.isHomozygous()) { - tooltip.add(system.getAlleleName(this.chromosomeType, this.allele0)); + public void getTooltip(Tooltip tooltip) { + BreedingSystem system = Binnie.GENETICS.getSystem(root); + tooltip.add(system.getChromosomeName(chromosomeType)); + if (isHomozygous()) { + tooltip.add(system.getAlleleName(chromosomeType, allele0)); } else { - tooltip.add("Active: " + system.getAlleleName(this.chromosomeType, this.allele0)); - tooltip.add("Inactive: " + system.getAlleleName(this.chromosomeType, this.allele1)); + tooltip.add("Active: " + system.getAlleleName(chromosomeType, allele0)); + tooltip.add("Inactive: " + system.getAlleleName(chromosomeType, allele1)); } } } diff --git a/src/main/java/binnie/genetics/gui/ControlAnalystPage.java b/src/main/java/binnie/genetics/gui/ControlAnalystPage.java index 41e233b1..a32b6dbf 100644 --- a/src/main/java/binnie/genetics/gui/ControlAnalystPage.java +++ b/src/main/java/binnie/genetics/gui/ControlAnalystPage.java @@ -7,9 +7,9 @@ import binnie.core.craftgui.controls.core.Control; import binnie.core.craftgui.geometry.Area; public abstract class ControlAnalystPage extends Control { - public ControlAnalystPage(final IWidget parent, final Area area) { + public ControlAnalystPage(IWidget parent, Area area) { super(parent, area); - this.hide(); + hide(); } @Override @@ -18,11 +18,11 @@ public abstract class ControlAnalystPage extends Control { public abstract String getTitle(); - protected String getTimeString(final int time) { - final int seconds = time / 20; - final int minutes = seconds / 60; - final int hours = minutes / 60; - final DecimalFormat df = new DecimalFormat("#.0"); + protected String getTimeString(int time) { + int seconds = time / 20; + int minutes = seconds / 60; + int hours = minutes / 60; + DecimalFormat df = new DecimalFormat("#.0"); if (hours > 1) { return df.format(hours) + " hours"; } diff --git a/src/main/java/binnie/genetics/gui/ControlBiome.java b/src/main/java/binnie/genetics/gui/ControlBiome.java index a9978a2a..1d48472e 100644 --- a/src/main/java/binnie/genetics/gui/ControlBiome.java +++ b/src/main/java/binnie/genetics/gui/ControlBiome.java @@ -21,54 +21,54 @@ public class ControlBiome extends Control implements ITooltip { private final Biome biome; private String iconCategory; - public ControlBiome(final IWidget parent, final int x, final int y, final int w, final int h, final Biome biome) { + public ControlBiome(IWidget parent, int x, int y, int w, int h, Biome biome) { super(parent, x, y, w, h); - this.iconCategory = "plains"; + iconCategory = "plains"; this.biome = biome; } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.MOUNTAIN) || BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.HILLS)) { - this.iconCategory = "hills"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.MOUNTAIN) || BiomeDictionary.hasType(biome, BiomeDictionary.Type.HILLS)) { + iconCategory = "hills"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.SANDY)) { - this.iconCategory = "desert"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SANDY)) { + iconCategory = "desert"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.SNOWY)) { - this.iconCategory = "snow"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SNOWY)) { + iconCategory = "snow"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.FOREST)) { - this.iconCategory = "forest"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST)) { + iconCategory = "forest"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.SWAMP)) { - this.iconCategory = "swamp"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.SWAMP)) { + iconCategory = "swamp"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.JUNGLE)) { - this.iconCategory = "jungle"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.JUNGLE)) { + iconCategory = "jungle"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.COLD) && BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.FOREST)) { - this.iconCategory = "taiga"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.COLD) && BiomeDictionary.hasType(biome, BiomeDictionary.Type.FOREST)) { + iconCategory = "taiga"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.MUSHROOM)) { - this.iconCategory = "mushroom"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.MUSHROOM)) { + iconCategory = "mushroom"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.OCEAN)) { - this.iconCategory = "ocean"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.OCEAN)) { + iconCategory = "ocean"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.NETHER)) { - this.iconCategory = "nether"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.NETHER)) { + iconCategory = "nether"; } - if (BiomeDictionary.hasType(this.biome, BiomeDictionary.Type.END)) { - this.iconCategory = "end"; + if (BiomeDictionary.hasType(biome, BiomeDictionary.Type.END)) { + iconCategory = "end"; } - TextureAtlasSprite sprite = ForestryAPI.textureManager.getDefault("habitats/" + this.iconCategory); + TextureAtlasSprite sprite = ForestryAPI.textureManager.getDefault("habitats/" + iconCategory); RenderUtil.drawGuiSprite(Point.ZERO, sprite); } @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(this.biome.getBiomeName().replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2")); + public void getTooltip(Tooltip tooltip) { + tooltip.add(biome.getBiomeName().replaceAll("(\\p{Ll})(\\p{Lu})", "$1 $2")); } } diff --git a/src/main/java/binnie/genetics/gui/ControlChromoPicker.java b/src/main/java/binnie/genetics/gui/ControlChromoPicker.java index 23c4d9fb..a5a45729 100644 --- a/src/main/java/binnie/genetics/gui/ControlChromoPicker.java +++ b/src/main/java/binnie/genetics/gui/ControlChromoPicker.java @@ -24,23 +24,23 @@ public class ControlChromoPicker extends Control implements ITooltip { IChromosomeType type; ControlChromosome parent; - public ControlChromoPicker(final ControlChromosome parent, final int x, final int y, final IChromosomeType chromo) { + public ControlChromoPicker(ControlChromosome parent, int x, int y, IChromosomeType chromo) { super(parent, x, y, 16, 16); - this.Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett); - this.Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett); - this.type = chromo; - this.addAttribute(Attribute.MouseOver); + Selected = new StandardTexture(160, 18, 16, 16, ExtraBeeTexture.GUIPunnett); + Texture = new StandardTexture(160, 34, 16, 16, ExtraBeeTexture.GUIPunnett); + type = chromo; + addAttribute(Attribute.MouseOver); this.parent = parent; - this.addSelfEventHandler(new EventWidget.StartMouseOver.Handler() { + addSelfEventHandler(new EventWidget.StartMouseOver.Handler() { @Override - public void onEvent(final EventWidget.StartMouseOver event) { - ControlChromoPicker.this.callEvent(new EventValueChanged(ControlChromoPicker.this.getWidget(), ControlChromoPicker.this.type)); + public void onEvent(EventWidget.StartMouseOver event) { + callEvent(new EventValueChanged(getWidget(), type)); } }); - this.addSelfEventHandler(new EventWidget.EndMouseOver.Handler() { + addSelfEventHandler(new EventWidget.EndMouseOver.Handler() { @Override - public void onEvent(final EventWidget.EndMouseOver event) { - ControlChromoPicker.this.callEvent(new EventValueChanged<>(ControlChromoPicker.this.getWidget(), null)); + public void onEvent(EventWidget.EndMouseOver event) { + callEvent(new EventValueChanged<>(getWidget(), null)); } }); } @@ -49,13 +49,13 @@ public class ControlChromoPicker extends Control implements ITooltip { @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - final boolean selected = this.isMouseOver(); - final Texture text = selected ? this.Selected : this.Texture; + boolean selected = isMouseOver(); + Texture text = selected ? Selected : Texture; CraftGUI.render.texture(text, Point.ZERO); } @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(Binnie.GENETICS.getSystem(this.parent.getRoot()).getChromosomeName(this.type)); + public void getTooltip(Tooltip tooltip) { + tooltip.add(Binnie.GENETICS.getSystem(parent.getRoot()).getChromosomeName(type)); } } diff --git a/src/main/java/binnie/genetics/gui/ControlChromosome.java b/src/main/java/binnie/genetics/gui/ControlChromosome.java index 7dd36c50..397a16eb 100644 --- a/src/main/java/binnie/genetics/gui/ControlChromosome.java +++ b/src/main/java/binnie/genetics/gui/ControlChromosome.java @@ -34,25 +34,25 @@ public class ControlChromosome extends Control implements IControlValue { - public ControlGenesisOption(final ControlList parent, final Gene gene, final int y) { + public ControlGenesisOption(ControlList parent, Gene gene, int y) { super(parent, gene, y); } String getAlleleName() { - return this.getValue().getAlleleName(); + return getValue().getAlleleName(); } String getChromosomeName() { - return this.getValue().getShortChromosomeName(); + return getValue().getShortChromosomeName(); } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { super.onRenderBackground(guiWidth, guiHeight); - RenderUtil.drawText(new Area(0, 0, 70, 22), TextJustification.MIDDLE_CENTER, this.getChromosomeName(), this.getColour()); - RenderUtil.drawText(new Area(75, 0, 80, 22), TextJustification.MIDDLE_CENTER, this.getAlleleName(), this.getColour()); - RenderUtil.drawSolidRect(new Area(70, 2, 1, 16), -16777216 + this.getColour()); + RenderUtil.drawText(new Area(0, 0, 70, 22), TextJustification.MIDDLE_CENTER, getChromosomeName(), getColor()); + RenderUtil.drawText(new Area(75, 0, 80, 22), TextJustification.MIDDLE_CENTER, getAlleleName(), getColor()); + RenderUtil.drawSolidRect(new Area(70, 2, 1, 16), -16777216 + getColor()); } } diff --git a/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java b/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java index 94a30fb3..9e92a75b 100644 --- a/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java +++ b/src/main/java/binnie/genetics/gui/ControlIndividualDisplay.java @@ -13,24 +13,24 @@ import binnie.core.craftgui.minecraft.control.ControlItemDisplay; import binnie.core.genetics.BreedingSystem; public class ControlIndividualDisplay extends ControlItemDisplay implements ITooltip { - public ControlIndividualDisplay(final IWidget parent, final int x, final int y, final IIndividual ind) { + public ControlIndividualDisplay(IWidget parent, int x, int y, IIndividual ind) { this(parent, x, y, 16, ind); } - public ControlIndividualDisplay(final IWidget parent, final int x, final int y, final int size, final IIndividual ind) { + public ControlIndividualDisplay(IWidget parent, int x, int y, int size, IIndividual ind) { super(parent, x, y, size); - final BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); - this.setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType())); - this.setTooltip(); + BreedingSystem system = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); + setItemStack(system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType())); + setTooltip(); } @Override - public void getTooltip(final Tooltip tooltip) { - final ItemStack stack = this.getItemStack(); + public void getTooltip(Tooltip tooltip) { + ItemStack stack = getItemStack(); if (stack.isEmpty()) { return; } - final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); + IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); if (ind == null) { return; } diff --git a/src/main/java/binnie/genetics/gui/ControlToleranceBar.java b/src/main/java/binnie/genetics/gui/ControlToleranceBar.java index 934f2c56..3cfbd843 100644 --- a/src/main/java/binnie/genetics/gui/ControlToleranceBar.java +++ b/src/main/java/binnie/genetics/gui/ControlToleranceBar.java @@ -25,57 +25,57 @@ public abstract class ControlToleranceBar> extends Control imp EnumSet fullSet; private Class enumClass; - public ControlToleranceBar(final IWidget parent, final int x, final int y, final int width, final int height, final Class clss) { + public ControlToleranceBar(IWidget parent, int x, int y, int width, int height, Class clss) { super(parent, x, y, width, height); - this.addAttribute(Attribute.MouseOver); - this.enumClass = clss; - this.tolerated = EnumSet.noneOf(this.enumClass); - this.fullSet = EnumSet.allOf(this.enumClass); - if (this.enumClass == EnumTemperature.class) { - this.fullSet.remove(this.enumClass.cast(EnumTemperature.NONE)); + addAttribute(Attribute.MouseOver); + enumClass = clss; + tolerated = EnumSet.noneOf(enumClass); + fullSet = EnumSet.allOf(enumClass); + if (enumClass == EnumTemperature.class) { + fullSet.remove(enumClass.cast(EnumTemperature.NONE)); } } @Override - public void getTooltip(final Tooltip list) { - final int types = this.fullSet.size(); - final int type = this.getRelativeMousePosition().x() / (this.getSize().x() / types); - for (final T tol : this.fullSet) { - if (tol.ordinal() - ((this.enumClass == EnumTemperature.class) ? 1 : 0) == type) { - list.add((this.tolerated.contains(tol) ? "" : TextFormatting.DARK_GRAY) + this.getName(tol)); + public void getTooltip(Tooltip list) { + int types = fullSet.size(); + int type = getRelativeMousePosition().x() / (getSize().x() / types); + for (T tol : fullSet) { + if (tol.ordinal() - ((enumClass == EnumTemperature.class) ? 1 : 0) == type) { + list.add((tolerated.contains(tol) ? "" : TextFormatting.DARK_GRAY) + getName(tol)); } } } - protected abstract String getName(final T p0); + protected abstract String getName(T p0); - protected abstract int getColour(final T p0); + protected abstract int getColour(T p0); @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawGradientRect(this.getArea(), -1431655766, -1431655766); - final int w = this.getArea().width() / this.fullSet.size(); + RenderUtil.drawGradientRect(getArea(), -1431655766, -1431655766); + int w = getArea().width() / fullSet.size(); int t = 0; - for (final T value : this.fullSet) { - final int col = (this.tolerated.contains(value) ? -16777216 : 855638016) + this.getColour(value); - final Border inset = new Border(this.tolerated.contains(value) ? 1 : 3); - RenderUtil.drawGradientRect(new Area(w * t, 0, w, this.height()).inset(inset), col, col); + for (T value : fullSet) { + int col = (tolerated.contains(value) ? -16777216 : 855638016) + getColour(value); + Border inset = new Border(tolerated.contains(value) ? 1 : 3); + RenderUtil.drawGradientRect(new Area(w * t, 0, w, height()).inset(inset), col, col); ++t; } } - public void setValues(final T value, final EnumTolerance enumTol) { - this.tolerated.clear(); - final Tolerance tol = Tolerance.get(enumTol); - for (final T full : this.fullSet) { + public void setValues(T value, EnumTolerance enumTol) { + tolerated.clear(); + Tolerance tol = Tolerance.get(enumTol); + for (T full : fullSet) { if (full.ordinal() > value.ordinal() + tol.getBounds()[1]) { continue; } if (full.ordinal() < value.ordinal() + tol.getBounds()[0]) { continue; } - this.tolerated.add(full); + tolerated.add(full); } } } diff --git a/src/main/java/binnie/genetics/gui/ControlTooltip.java b/src/main/java/binnie/genetics/gui/ControlTooltip.java index 87099cd0..1be24c7f 100644 --- a/src/main/java/binnie/genetics/gui/ControlTooltip.java +++ b/src/main/java/binnie/genetics/gui/ControlTooltip.java @@ -6,11 +6,11 @@ import binnie.core.craftgui.Tooltip; import binnie.core.craftgui.controls.core.Control; public class ControlTooltip extends Control implements ITooltip { - public ControlTooltip(final IWidget parent, final int x, final int y, final int w, final int h) { + public ControlTooltip(IWidget parent, int x, int y, int w, int h) { super(parent, x, y, w, h); } @Override - public void getTooltip(final Tooltip tooltip) { + public void getTooltip(Tooltip tooltip) { } } diff --git a/src/main/java/binnie/genetics/gui/WindowAnalyst.java b/src/main/java/binnie/genetics/gui/WindowAnalyst.java index f3e91825..b121fc32 100644 --- a/src/main/java/binnie/genetics/gui/WindowAnalyst.java +++ b/src/main/java/binnie/genetics/gui/WindowAnalyst.java @@ -83,23 +83,23 @@ public class WindowAnalyst extends Window { private Control analystNone; private ControlSlide slideUpInv; - public WindowAnalyst(final EntityPlayer player, @Nullable final IInventory inventory, final Side side, final boolean database, final boolean master) { + public WindowAnalyst(EntityPlayer player, @Nullable IInventory inventory, Side side, boolean database, boolean master) { super(312, 230, player, inventory, side); - this.baseWidget = null; - this.tabBar = null; - this.analystPages = new ArrayList<>(); - this.analystPageSize = null; - this.isDatabase = false; - this.isMaster = false; - this.lockedSearch = false; - this.current = null; - this.currentSystem = null; - this.isDatabase = database; - this.isMaster = master; - this.lockedSearch = this.isDatabase; + baseWidget = null; + tabBar = null; + analystPages = new ArrayList<>(); + analystPageSize = null; + isDatabase = false; + isMaster = false; + lockedSearch = false; + current = null; + currentSystem = null; + isDatabase = database; + isMaster = master; + lockedSearch = isDatabase; } - public static GeneticsGUI.WindowFactory create(final boolean database, final boolean master) { + public static GeneticsGUI.WindowFactory create(boolean database, boolean master) { return (player, inventory, side) -> new WindowAnalyst(player, inventory, side, database, master); } @@ -114,59 +114,59 @@ public class WindowAnalyst extends Window { } private void setupValidators() { - if (!this.isDatabase) { - this.getWindowInventory().setValidator(0, new SlotValidator.Individual() { + if (!isDatabase) { + getWindowInventory().setValidator(0, new SlotValidator.Individual() { @Override - public boolean isValid(final ItemStack itemStack) { - return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && !WindowAnalyst.this.getWindowInventory().getStackInSlot(1).isEmpty()); + public boolean isValid(ItemStack itemStack) { + return Analyser.isAnalysed(itemStack) || (Analyser.isAnalysable(itemStack) && !getWindowInventory().getStackInSlot(1).isEmpty()); } }); - this.getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.spriteDye)); + getWindowInventory().setValidator(1, new SlotValidator.Item(GeneticsItems.DNADye.get(1), ModuleMachine.spriteDye)); } } @Override public void initialiseServer() { - for (final BreedingSystem system : Binnie.GENETICS.getActiveSystems()) { + for (BreedingSystem system : Binnie.GENETICS.getActiveSystems()) { ISpeciesRoot root = system.getSpeciesRoot(); if (root != null) { - final IBreedingTracker tracker = root.getBreedingTracker(this.getWorld(), this.getUsername()); + IBreedingTracker tracker = root.getBreedingTracker(getWorld(), getUsername()); if (tracker != null) { - tracker.synchToPlayer(this.getPlayer()); + tracker.synchToPlayer(getPlayer()); } } } - this.setupValidators(); + setupValidators(); } @Override @SideOnly(Side.CLIENT) public void initialiseClient() { - this.setTitle(this.isDatabase ? (this.isMaster ? "Master Registry" : "Registry") : "Analyst"); - final BreedingSystem system = Binnie.GENETICS.beeBreedingSystem; - final IIndividual ind = system.getDefaultIndividual(); - final ItemStack stack = system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()); - this.getWindowInventory().createSlot(0); - this.baseWidget = new Widget(this); + setTitle(isDatabase ? (isMaster ? "Master Registry" : "Registry") : "Analyst"); + BreedingSystem system = Binnie.GENETICS.beeBreedingSystem; + IIndividual ind = system.getDefaultIndividual(); + ItemStack stack = system.getSpeciesRoot().getMemberStack(ind, system.getDefaultType()); + getWindowInventory().createSlot(0); + baseWidget = new Widget(this); int x = 16; - final int y = 28; - if (this.isDatabase) { - for (final BreedingSystem syst : Binnie.GENETICS.getActiveSystems()) { + int y = 28; + if (isDatabase) { + for (BreedingSystem syst : Binnie.GENETICS.getActiveSystems()) { new Control(this, x, y, 20, 20) { @Override public void initialise() { - this.addAttribute(Attribute.MouseOver); - this.addSelfEventHandler(new EventMouse.Down.Handler() { + addAttribute(Attribute.MouseOver); + addSelfEventHandler(new EventMouse.Down.Handler() { @Override @SideOnly(Side.CLIENT) - public void onEvent(final EventMouse.Down event) { - WindowAnalyst.this.setSystem(syst); + public void onEvent(EventMouse.Down event) { + setSystem(syst); } }); } @Override - public void getTooltip(final Tooltip tooltip) { + public void getTooltip(Tooltip tooltip) { tooltip.add(syst.getName()); } @@ -174,11 +174,11 @@ public class WindowAnalyst extends Window { @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { RenderUtil.setColour(syst.getColour()); - final int outset = (WindowAnalyst.this.getSystem() == syst) ? 1 : 0; - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().outset(outset)); - if (WindowAnalyst.this.getSystem() == syst) { + int outset = (getSystem() == syst) ? 1 : 0; + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().outset(outset)); + if (getSystem() == syst) { RenderUtil.setColour(1140850688 + syst.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().outset(outset)); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().outset(outset)); } RenderUtil.drawItem(new Point(2, 2), syst.getItemStackRepresentitive()); } @@ -190,177 +190,177 @@ public class WindowAnalyst extends Window { x += 22; new ControlSlot.Builder(this, x, y + 1).assign(InventoryType.Window, 1); x += 26; - this.setupValidators(); + setupValidators(); } - this.tabBar = new Control(this, x, 28, this.width() - 16 - x, 20); - this.analystPanel = new Panel(this, 16, 54, 280, 164, MinecraftGUI.PanelType.Outline) { + tabBar = new Control(this, x, 28, width() - 16 - x, 20); + analystPanel = new Panel(this, 16, 54, 280, 164, MinecraftGUI.PanelType.Outline) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - RenderUtil.drawGradientRect(this.getArea(), 1157627903, 1728053247); + RenderUtil.drawGradientRect(getArea(), 1157627903, 1728053247); super.onRenderBackground(guiWidth, guiHeight); } @Override public void initialise() { - this.setColour(4473924); - final int sectionWidth = (this.width() - 8 - 4) / 2; - WindowAnalyst.this.leftPage = new ControlScrollableContent(this, 3, 3, sectionWidth + 2, this.height() - 8 + 2, 0) { + setColor(4473924); + int sectionWidth = (width() - 8 - 4) / 2; + leftPage = new ControlScrollableContent(this, 3, 3, sectionWidth + 2, height() - 8 + 2, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (this.getContent() == null) { + if (getContent() == null) { return; } - RenderUtil.setColour(this.getContent().getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea()); + RenderUtil.setColour(getContent().getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea()); } }; - new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, this.height() - 8 + 2 - 6, WindowAnalyst.this.leftPage) { + new ControlScrollBar(this, sectionWidth + 2 - 3, 6, 3, height() - 8 + 2 - 6, leftPage) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (!this.isEnabled()) { + if (!isEnabled()) { return; } - if (WindowAnalyst.this.leftPage.getContent() == null) { + if (leftPage.getContent() == null) { return; } - RenderUtil.drawGradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.leftPage.getContent().getColour()); - RenderUtil.drawSolidRect(this.getRenderArea(), WindowAnalyst.this.leftPage.getContent().getColour()); + RenderUtil.drawGradientRect(getArea(), 1140850688 + leftPage.getContent().getColor(), 1140850688 + leftPage.getContent().getColor()); + RenderUtil.drawSolidRect(getRenderArea(), leftPage.getContent().getColor()); } }; - WindowAnalyst.this.rightPage = new ControlScrollableContent(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, this.height() - 8 + 2, 0) { + rightPage = new ControlScrollableContent(this, 3 + sectionWidth + 4, 3, sectionWidth + 2, height() - 8 + 2, 0) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (this.getContent() == null) { + if (getContent() == null) { return; } - RenderUtil.setColour(this.getContent().getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea()); + RenderUtil.setColour(getContent().getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea()); } }; - new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, this.height() - 8 + 2 - 6, WindowAnalyst.this.rightPage) { + new ControlScrollBar(this, sectionWidth + 2 - 3 + sectionWidth + 4, 6, 3, height() - 8 + 2 - 6, rightPage) { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - if (!this.isEnabled()) { + if (!isEnabled()) { return; } - if (WindowAnalyst.this.rightPage.getContent() == null) { + if (rightPage.getContent() == null) { return; } - RenderUtil.drawGradientRect(this.getArea(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour(), 1140850688 + WindowAnalyst.this.rightPage.getContent().getColour()); - RenderUtil.drawSolidRect(this.getRenderArea(), WindowAnalyst.this.rightPage.getContent().getColour()); + RenderUtil.drawGradientRect(getArea(), 1140850688 + rightPage.getContent().getColor(), 1140850688 + rightPage.getContent().getColor()); + RenderUtil.drawSolidRect(getRenderArea(), rightPage.getContent().getColor()); } }; - WindowAnalyst.this.analystPageSize = new Area(1, 1, sectionWidth, this.height() - 8); + analystPageSize = new Area(1, 1, sectionWidth, height() - 8); } }; - if (!this.isDatabase) { - this.slideUpInv = new ControlSlide(this, (this.getSize().x() - 244) / 2, this.getSize().y() - 80 + 1, 244, 80, Position.BOTTOM); - new ControlPlayerInventory(this.slideUpInv, true); - this.slideUpInv.setSlide(false); + if (!isDatabase) { + slideUpInv = new ControlSlide(this, (getSize().x() - 244) / 2, getSize().y() - 80 + 1, 244, 80, Position.BOTTOM); + new ControlPlayerInventory(slideUpInv, true); + slideUpInv.setSlide(false); } - this.addEventHandler(new EventKey.Down.Handler() { + addEventHandler(new EventKey.Down.Handler() { @Override - public void onEvent(final EventKey.Down event) { + public void onEvent(EventKey.Down event) { if (event.getKey() == 205) { - WindowAnalyst.this.shiftPages(true); + shiftPages(true); } if (event.getKey() == 203) { - WindowAnalyst.this.shiftPages(false); + shiftPages(false); } } }); - if (!this.isDatabase) { - this.analystNone = new Control(this.analystPanel, 0, 0, this.analystPanel.width(), this.analystPanel.height()) { + if (!isDatabase) { + analystNone = new Control(analystPanel, 0, 0, analystPanel.width(), analystPanel.height()) { @Override public void initialise() { - new ControlTextCentered(this, 20, "Add a bee, tree, flower or butterfly to the top left slot. DNA Dye is required if it has not been analysed yet. This dye can also convert vanilla items to breedable individuals.").setColour(4473924); + new ControlTextCentered(this, 20, "Add a bee, tree, flower or butterfly to the top left slot. DNA Dye is required if it has not been analysed yet. This dye can also convert vanilla items to breedable individuals.").setColor(4473924); new ControlPlayerInventory(this); } }; } - this.setIndividual(null); - this.setSystem(Binnie.GENETICS.beeBreedingSystem); + setIndividual(null); + setSystem(Binnie.GENETICS.beeBreedingSystem); } @SideOnly(Side.CLIENT) - public void updatePages(final boolean systemChange) { + public void updatePages(boolean systemChange) { int oldLeft = -1; int oldRight = -1; if (!systemChange) { - oldLeft = this.analystPages.indexOf(this.leftPage.getContent()); - oldRight = this.analystPages.indexOf(this.rightPage.getContent()); + oldLeft = analystPages.indexOf(leftPage.getContent()); + oldRight = analystPages.indexOf(rightPage.getContent()); } ControlAnalystPage databasePage = null; - if (this.isDatabase && !systemChange) { - databasePage = ((this.analystPages.size() > 0) ? this.analystPages.get(0) : null); + if (isDatabase && !systemChange) { + databasePage = ((analystPages.size() > 0) ? analystPages.get(0) : null); } - this.analystPages.clear(); - this.setPage(this.leftPage, null); - this.setPage(this.rightPage, null); - if (this.isDatabase) { - this.analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(this.analystPanel, this.analystPageSize, this.currentSystem, this.isMaster)); + analystPages.clear(); + setPage(leftPage, null); + setPage(rightPage, null); + if (isDatabase) { + analystPages.add((databasePage != null) ? databasePage : new AnalystPageDatabase(analystPanel, analystPageSize, currentSystem, isMaster)); } - if (this.current != null) { - this.analystPages.add(new AnalystPageDescription(this.analystPanel, this.analystPageSize, this.current)); - this.analystPages.add(new AnalystPageGenome(this.analystPanel, this.analystPageSize, true, this.current)); - if (!this.isDatabase) { - this.analystPages.add(new AnalystPageGenome(this.analystPanel, this.analystPageSize, false, this.current)); - this.analystPages.add(new AnalystPageKaryogram(this.analystPanel, this.analystPageSize, this.current)); + if (current != null) { + analystPages.add(new AnalystPageDescription(analystPanel, analystPageSize, current)); + analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, true, current)); + if (!isDatabase) { + analystPages.add(new AnalystPageGenome(analystPanel, analystPageSize, false, current)); + analystPages.add(new AnalystPageKaryogram(analystPanel, analystPageSize, current)); } - if (!(this.current instanceof ITree)) { - this.analystPages.add(new AnalystPageClimate(this.analystPanel, this.analystPageSize, this.current)); + if (!(current instanceof ITree)) { + analystPages.add(new AnalystPageClimate(analystPanel, analystPageSize, current)); } - if (this.current instanceof IBee) { - this.analystPages.add(new AnalystPageProducts(this.analystPanel, this.analystPageSize, (IBee) this.current)); - } else if (this.current instanceof ITree) { - this.analystPages.add(new AnalystPageFruit(this.analystPanel, this.analystPageSize, (ITree) this.current)); - this.analystPages.add(new AnalystPageWood(this.analystPanel, this.analystPageSize, (ITree) this.current)); - } else if (this.current instanceof IFlower) { - this.analystPages.add(new AnalystPageSoil(this.analystPanel, this.analystPageSize, (IFlower) this.current)); - } else if (this.current instanceof IButterfly) { - this.analystPages.add(new AnalystPageSpecimen(this.analystPanel, this.analystPageSize, (IButterfly) this.current)); + if (current instanceof IBee) { + analystPages.add(new AnalystPageProducts(analystPanel, analystPageSize, (IBee) current)); + } else if (current instanceof ITree) { + analystPages.add(new AnalystPageFruit(analystPanel, analystPageSize, (ITree) current)); + analystPages.add(new AnalystPageWood(analystPanel, analystPageSize, (ITree) current)); + } else if (current instanceof IFlower) { + analystPages.add(new AnalystPageSoil(analystPanel, analystPageSize, (IFlower) current)); + } else if (current instanceof IButterfly) { + analystPages.add(new AnalystPageSpecimen(analystPanel, analystPageSize, (IButterfly) current)); } - this.analystPages.add(new AnalystPageBiology(this.analystPanel, this.analystPageSize, this.current)); - if (this.current instanceof IBee || this.current instanceof IButterfly) { - this.analystPages.add(new AnalystPageBehaviour(this.analystPanel, this.analystPageSize, this.current)); - } else if (this.current instanceof ITree) { - this.analystPages.add(new AnalystPageGrowth(this.analystPanel, this.analystPageSize, this.current)); - } else if (this.current instanceof IFlower) { - this.analystPages.add(new AnalystPageAppearance(this.analystPanel, this.analystPageSize, (IFlower) this.current)); + analystPages.add(new AnalystPageBiology(analystPanel, analystPageSize, current)); + if (current instanceof IBee || current instanceof IButterfly) { + analystPages.add(new AnalystPageBehaviour(analystPanel, analystPageSize, current)); + } else if (current instanceof ITree) { + analystPages.add(new AnalystPageGrowth(analystPanel, analystPageSize, current)); + } else if (current instanceof IFlower) { + analystPages.add(new AnalystPageAppearance(analystPanel, analystPageSize, (IFlower) current)); } - this.analystPages.add(new AnalystPageMutations(this.analystPanel, this.analystPageSize, this.current, this.isMaster)); + analystPages.add(new AnalystPageMutations(analystPanel, analystPageSize, current, isMaster)); } - this.tabBar.deleteAllChildren(); - if (this.analystPages.size() > 0) { - final int width = this.tabBar.width() / this.analystPages.size(); + tabBar.deleteAllChildren(); + if (analystPages.size() > 0) { + int width = tabBar.width() / analystPages.size(); int x = 0; - for (final ControlAnalystPage page : this.analystPages) { - new ControlTooltip(this.tabBar, x, 0, width, this.tabBar.height()) { + for (ControlAnalystPage page : analystPages) { + new ControlTooltip(tabBar, x, 0, width, tabBar.height()) { ControlAnalystPage value; @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(this.value.getTitle()); + public void getTooltip(Tooltip tooltip) { + tooltip.add(value.getTitle()); } @Override protected void initialise() { super.initialise(); - this.addAttribute(Attribute.MouseOver); - this.value = page; - this.addSelfEventHandler(new EventMouse.Down.Handler() { + addAttribute(Attribute.MouseOver); + value = page; + addSelfEventHandler(new EventMouse.Down.Handler() { @Override - public void onEvent(final EventMouse.Down event) { - final int currentIndex = WindowAnalyst.this.analystPages.indexOf(WindowAnalyst.this.rightPage.getContent()); - int clickedIndex = WindowAnalyst.this.analystPages.indexOf(value); - if (WindowAnalyst.this.isDatabase) { + public void onEvent(EventMouse.Down event) { + int currentIndex = analystPages.indexOf(rightPage.getContent()); + int clickedIndex = analystPages.indexOf(value); + if (isDatabase) { if (clickedIndex != 0 && clickedIndex != currentIndex) { - WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, value); + setPage(rightPage, value); } } else { if (clickedIndex < 0) { @@ -369,10 +369,10 @@ public class WindowAnalyst extends Window { if (clickedIndex < currentIndex) { ++clickedIndex; } - WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, null); - WindowAnalyst.this.setPage(WindowAnalyst.this.leftPage, null); - WindowAnalyst.this.setPage(WindowAnalyst.this.rightPage, WindowAnalyst.this.analystPages.get(clickedIndex)); - WindowAnalyst.this.setPage(WindowAnalyst.this.leftPage, WindowAnalyst.this.analystPages.get(clickedIndex - 1)); + setPage(rightPage, null); + setPage(leftPage, null); + setPage(rightPage, analystPages.get(clickedIndex)); + setPage(leftPage, analystPages.get(clickedIndex - 1)); } } }); @@ -381,63 +381,63 @@ public class WindowAnalyst extends Window { @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - final boolean active = this.value == WindowAnalyst.this.leftPage.getContent() || this.value == WindowAnalyst.this.rightPage.getContent(); - RenderUtil.setColour((active ? -16777216 : 1140850688) + this.value.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabSolid, this.getArea().inset(1)); - RenderUtil.setColour(this.value.getColour()); - CraftGUI.render.texture(CraftGUITexture.TabOutline, this.getArea().inset(1)); + boolean active = value == leftPage.getContent() || value == rightPage.getContent(); + RenderUtil.setColour((active ? -16777216 : 1140850688) + value.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabSolid, getArea().inset(1)); + RenderUtil.setColour(value.getColor()); + CraftGUI.render.texture(CraftGUITexture.TabOutline, getArea().inset(1)); super.onRenderBackground(guiWidth, guiHeight); } }; x += width; } - this.setPage(this.leftPage, this.analystPages.get((oldLeft >= 0) ? oldLeft : 0)); - if (this.analystPages.size() > 1) { - this.setPage(this.rightPage, this.analystPages.get((oldRight >= 0) ? oldRight : 1)); + setPage(leftPage, analystPages.get((oldLeft >= 0) ? oldLeft : 0)); + if (analystPages.size() > 1) { + setPage(rightPage, analystPages.get((oldRight >= 0) ? oldRight : 1)); } } } - public void shiftPages(final boolean right) { - if (this.analystPages.size() < 2) { + public void shiftPages(boolean right) { + if (analystPages.size() < 2) { return; } - final int leftIndex = this.analystPages.indexOf(this.leftPage.getContent()); - final int rightIndex = this.analystPages.indexOf(this.rightPage.getContent()); - if (right && rightIndex + 1 >= this.analystPages.size()) { + int leftIndex = analystPages.indexOf(leftPage.getContent()); + int rightIndex = analystPages.indexOf(rightPage.getContent()); + if (right && rightIndex + 1 >= analystPages.size()) { return; } - if (!this.lockedSearch && !right && leftIndex <= 0) { + if (!lockedSearch && !right && leftIndex <= 0) { return; } - if (!this.lockedSearch && !right && rightIndex <= 1) { + if (!lockedSearch && !right && rightIndex <= 1) { return; } - final int newRightIndex = rightIndex + (right ? 1 : -1); - final int newLeftIndex = this.lockedSearch ? 0 : (newRightIndex - 1); + int newRightIndex = rightIndex + (right ? 1 : -1); + int newLeftIndex = lockedSearch ? 0 : (newRightIndex - 1); float oldRightPercent = 0; float oldLeftPercent = 0; if (newLeftIndex == rightIndex) { - oldRightPercent = this.rightPage.getPercentageIndex(); + oldRightPercent = rightPage.getPercentageIndex(); } if (newRightIndex == leftIndex) { - oldLeftPercent = this.leftPage.getPercentageIndex(); + oldLeftPercent = leftPage.getPercentageIndex(); } - this.setPage(this.leftPage, null); - this.setPage(this.rightPage, null); - this.setPage(this.leftPage, this.analystPages.get(newLeftIndex)); - this.setPage(this.rightPage, this.analystPages.get(newRightIndex)); - this.analystPages.get(newLeftIndex).show(); + setPage(leftPage, null); + setPage(rightPage, null); + setPage(leftPage, analystPages.get(newLeftIndex)); + setPage(rightPage, analystPages.get(newRightIndex)); + analystPages.get(newLeftIndex).show(); if (oldRightPercent != 0) { - this.leftPage.setPercentageIndex(oldRightPercent); + leftPage.setPercentageIndex(oldRightPercent); } if (oldLeftPercent != 0) { - this.rightPage.setPercentageIndex(oldLeftPercent); + rightPage.setPercentageIndex(oldLeftPercent); } } - public void setPage(final ControlScrollableContent side, @Nullable final ControlAnalystPage page) { - final ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent(); + public void setPage(ControlScrollableContent side, @Nullable ControlAnalystPage page) { + ControlAnalystPage existingPage = (ControlAnalystPage) side.getContent(); if (existingPage != null) { existingPage.hide(); side.setScrollableContent(null); @@ -456,58 +456,58 @@ public class WindowAnalyst extends Window { WindowInventory inv = getWindowInventory(); ItemStack stack = inv.getStackInSlot(0); if (!stack.isEmpty() && !Analyser.isAnalysed(stack)) { - inv.setInventorySlotContents(0, Analyser.analyse(stack, this.getWorld(), this.getUsername())); + inv.setInventorySlotContents(0, Analyser.analyse(stack, getWorld(), getUsername())); inv.decrStackSize(1, 1); } - if (this.isClient()) { + if (isClient()) { //noinspection MethodCallSideOnly - this.setStack(stack); + setStack(stack); } } @SideOnly(Side.CLIENT) - public void setStack(final ItemStack stack) { - final IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); - this.setIndividual(ind); + public void setStack(ItemStack stack) { + IIndividual ind = AlleleManager.alleleRegistry.getIndividual(stack); + setIndividual(ind); } public IIndividual getIndividual() { - return this.current; + return current; } @SideOnly(Side.CLIENT) - public void setIndividual(final IIndividual ind) { - if (!this.isDatabase) { + public void setIndividual(IIndividual ind) { + if (!isDatabase) { if (ind == null) { - this.analystNone.show(); - this.slideUpInv.hide(); + analystNone.show(); + slideUpInv.hide(); } else { - this.analystNone.hide(); - this.slideUpInv.show(); + analystNone.hide(); + slideUpInv.show(); } } - if (ind == this.current || (ind != null && this.current != null && ind.isGeneticEqual(this.current))) { + if (ind == current || (ind != null && current != null && ind.isGeneticEqual(current))) { return; } - final boolean systemChange = (this.current = ind) != null && ind.getGenome().getSpeciesRoot() != this.getSystem().getSpeciesRoot(); + boolean systemChange = (current = ind) != null && ind.getGenome().getSpeciesRoot() != getSystem().getSpeciesRoot(); if (systemChange) { - this.currentSystem = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); + currentSystem = Binnie.GENETICS.getSystem(ind.getGenome().getSpeciesRoot()); } - this.updatePages(systemChange); + updatePages(systemChange); } public BreedingSystem getSystem() { - return this.currentSystem; + return currentSystem; } @SideOnly(Side.CLIENT) - public void setSystem(final BreedingSystem system) { - if (system == this.currentSystem) { + public void setSystem(BreedingSystem system) { + if (system == currentSystem) { return; } - this.currentSystem = system; - this.current = null; - this.updatePages(true); + currentSystem = system; + current = null; + updatePages(true); } } diff --git a/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java b/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java index 9a495cab..3b0d9ce3 100644 --- a/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java +++ b/src/main/java/binnie/genetics/gui/bee/AnalystPageProducts.java @@ -39,64 +39,73 @@ import binnie.extratrees.kitchen.craftgui.ControlFluidDisplay; import binnie.genetics.gui.AnalystPageProduce; public class AnalystPageProducts extends AnalystPageProduce { - public AnalystPageProducts(final IWidget parent, final Area area, final IBee ind) { + public AnalystPageProducts(IWidget parent, Area area, IBee ind) { super(parent, area); - this.setColour(13382400); - final IBeeGenome genome = ind.getGenome(); - final float speed = genome.getSpeed(); - final float modeSpeed = Binnie.GENETICS.getBeeRoot().getBeekeepingMode(BinnieCore.getBinnieProxy().getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f); + setColor(0xcc3300); + IBeeGenome genome = ind.getGenome(); + float speed = genome.getSpeed(); + float modeSpeed = Binnie.GENETICS.getBeeRoot().getBeekeepingMode(BinnieCore.getBinnieProxy().getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f); + int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); + y += 12; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produces.rate") + ": " + Binnie.GENETICS.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.produces.rate") + ": " + Binnie.GENETICS.beeBreedingSystem.getAlleleName(EnumBeeChromosome.SPEED, ind.getGenome().getActiveAllele(EnumBeeChromosome.SPEED))).setColor(getColor()); + y += 20; - final Collection refinedProducts = new UniqueItemStackSet(); - final Collection productList = new UniqueItemStackSet(); - final Collection specialtyList = new UniqueItemStackSet(); + Collection refinedProducts = new UniqueItemStackSet(); + Collection productList = new UniqueItemStackSet(); + Collection specialtyList = new UniqueItemStackSet(); Map products = new HashMap<>(); products.putAll(genome.getPrimary().getProductChances()); products.putAll(genome.getSecondary().getProductChances()); + if (!products.isEmpty()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.natural")).setColor(getColor()); y += 12; - for (final Map.Entry entry : products.entrySet()) { + for (Map.Entry entry : products.entrySet()) { if (!productList.add(entry.getKey())) { continue; } - refinedProducts.addAll(this.getAllProducts(entry.getKey())); - this.createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); + refinedProducts.addAll(getAllProducts(entry.getKey())); + createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); y += 18; } y += 12; } + products = genome.getPrimary().getSpecialtyChances(); if (!products.isEmpty()) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.specialty")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.specialty")).setColor(getColor()); y += 12; - for (final Map.Entry entry : products.entrySet()) { - refinedProducts.addAll(this.getAllProducts(entry.getKey())); - this.createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); + for (Map.Entry entry : products.entrySet()) { + refinedProducts.addAll(getAllProducts(entry.getKey())); + createProductEntry(entry.getKey(), entry.getValue(), y, speed * modeSpeed); y += 18; } y += 12; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.refined")).setColour(this.getColour()); + + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.products.refined")).setColor(getColor()); + y += 12; Collection level2Products = new UniqueItemStackSet(); - for (final ItemStack stack : refinedProducts) { - level2Products.addAll(this.getAllProducts(stack)); + for (ItemStack stack : refinedProducts) { + level2Products.addAll(getAllProducts(stack)); } + refinedProducts.addAll(level2Products); level2Products = new UniqueItemStackSet(); - for (final ItemStack stack : refinedProducts) { - level2Products.addAll(this.getAllProducts(stack)); + for (ItemStack stack : refinedProducts) { + level2Products.addAll(getAllProducts(stack)); } + refinedProducts.addAll(level2Products); - final Collection allFluids = new ArrayList<>(); - for (final ItemStack stack2 : refinedProducts) { - for (final FluidStack addition : this.getAllFluids(stack2)) { + Collection allFluids = new ArrayList<>(); + for (ItemStack stack2 : refinedProducts) { + for (FluidStack addition : getAllFluids(stack2)) { boolean alreadyIn = false; - for (final FluidStack existing : allFluids) { + for (FluidStack existing : allFluids) { if (existing.isFluidEqual(addition)) { alreadyIn = true; } @@ -106,42 +115,44 @@ public class AnalystPageProducts extends AnalystPageProduce { } } } - final int maxBiomePerLine = (int) ((this.width() + 2.0f - 16.0f) / 18.0f); - final int biomeListX = (this.width() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2; + + int maxBiomePerLine = (int) ((width() + 2.0f - 16.0f) / 18.0f); + int biomeListX = (width() - (Math.min(maxBiomePerLine, allFluids.size() + refinedProducts.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final ItemStack soilStack : refinedProducts) { + for (ItemStack soilStack : refinedProducts) { if (dx >= 18 * maxBiomePerLine) { dx = 0; dy += 18; } - final ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy); + ControlItemDisplay display = new ControlItemDisplay(this, biomeListX + dx, y + dy); display.setItemStack(soilStack); display.setTooltip(); dx += 18; } - for (final FluidStack soilStack2 : allFluids) { + + for (FluidStack soilStack2 : allFluids) { if (dx >= 18 * maxBiomePerLine) { dx = 0; dy += 18; } ItemStack container = getContainer(soilStack2); if (container == null) { - final ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy); + ControlFluidDisplay display2 = new ControlFluidDisplay(this, biomeListX + dx, y + dy); display2.setFluidStack(soilStack2); display2.setTooltip(); } else { - final ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy); + ControlItemDisplay display3 = new ControlItemDisplay(this, biomeListX + dx, y + dy); display3.setItemStack(container); display3.setTooltip(); } dx += 18; } - this.setSize(new Point(this.width(), y + dy + 18 + 8)); + setSize(new Point(width(), y + dy + 18 + 8)); } @Nullable - public static ItemStack getContainer(final FluidStack fluidStack) { + public static ItemStack getContainer(FluidStack fluidStack) { ItemStack[] containers = { new ItemStack(Items.GLASS_BOTTLE), new ItemStack(Items.BUCKET) @@ -153,43 +164,43 @@ public class AnalystPageProducts extends AnalystPageProduce { return fluidHandler.getContainer(); } } - return null; } - private void createProductEntry(final ItemStack key, final Float value, final int y, final float speed) { - final ControlItemDisplay item = new ControlItemDisplay(this, 16, y) { + private void createProductEntry(ItemStack key, Float value, int y, float speed) { + ControlItemDisplay item = new ControlItemDisplay(this, 16, y) { @Override @SideOnly(Side.CLIENT) - public void getTooltip(final Tooltip tooltip) { + public void getTooltip(Tooltip tooltip) { super.getTooltip(tooltip); - final Collection products = AnalystPageProducts.this.getCentrifuge(key); + Collection products = getCentrifuge(key); if (!products.isEmpty()) { tooltip.add(I18N.localise("genetics.gui.analyst.products.centrifuges") + ": "); - for (final ItemStack prod : products) { - final NBTTagCompound nbt = new NBTTagCompound(); + for (ItemStack prod : products) { + NBTTagCompound nbt = new NBTTagCompound(); prod.writeToNBT(nbt); tooltip.add(prod, prod.getDisplayName()); } } - final Collection liquids = AnalystPageProducts.this.getSqueezer(key); + Collection liquids = getSqueezer(key); if (!liquids.isEmpty()) { tooltip.add(I18N.localise("genetics.gui.analyst.products.squeezes") + ": "); - for (final ItemStack prod2 : liquids) { - final NBTTagCompound nbt2 = new NBTTagCompound(); + for (ItemStack prod2 : liquids) { + NBTTagCompound nbt2 = new NBTTagCompound(); prod2.writeToNBT(nbt2); tooltip.add(prod2, prod2.getDisplayName()); } } } }; + item.setTooltip(); - final ControlText textWidget = new ControlTextCentered(this, y + 4, ""); - textWidget.setColour(this.getColour()); + ControlText textWidget = new ControlTextCentered(this, y + 4, ""); + textWidget.setColor(getColor()); CraftGUIUtil.moveWidget(textWidget, new Point(12, 0)); item.setItemStack(key); - final int time = (int) (PluginApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value)); - textWidget.setValue(I18N.localise("genetics.gui.analyst.products.every") + " " + this.getTimeString(time)); + int time = (int) (PluginApiculture.ticksPerBeeWorkCycle * 100.0 / (speed * value)); + textWidget.setValue(I18N.localise("genetics.gui.analyst.products.every") + " " + getTimeString(time)); } @Override diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java b/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java index ee956bea..265e678e 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlBiomes.java @@ -25,49 +25,48 @@ import binnie.core.craftgui.resource.minecraft.CraftGUITexture; public class ControlBiomes extends Control implements ITooltip { List tolerated; - public ControlBiomes(final IWidget parent, final int x, final int y, final int width, final int height) { + public ControlBiomes(IWidget parent, int x, int y, int width, int height) { super(parent, x, y, width * 16, height * 16); - this.tolerated = new ArrayList<>(); - this.addAttribute(Attribute.MouseOver); + tolerated = new ArrayList<>(); + addAttribute(Attribute.MouseOver); } @Override - public void getTooltip(final Tooltip list) { - if (this.tolerated.isEmpty()) { + public void getTooltip(Tooltip list) { + if (tolerated.isEmpty()) { return; } - final int x = (int) (this.getRelativeMousePosition().x() / 16.0f); - final int y = (int) (this.getRelativeMousePosition().y() / 16.0f); - final int i = x + y * 8; - if (i < this.tolerated.size()) { - Biome biome = Biome.getBiome(this.tolerated.get(i)); - if (biome != null) { - list.add(biome.getBiomeName()); - } + + int x = (int) (getRelativeMousePosition().x() / 16.0f); + int y = (int) (getRelativeMousePosition().y() / 16.0f); + int i = x + y * 8; + if (i >= tolerated.size()) { + return; + } + + Biome biome = Biome.getBiome(tolerated.get(i)); + if (biome != null) { + list.add(biome.getBiomeName()); } } @Override @SideOnly(Side.CLIENT) public void onRenderForeground(int guiWidth, int guiHeight) { - for (int i = 0; i < this.tolerated.size(); ++i) { - final int x = i % 8 * 16; - final int y = i / 8 * 16; + for (int i = 0; i < tolerated.size(); ++i) { + int x = i % 8 * 16; + int y = i / 8 * 16; if (Biome.getBiome(i) != null) { //TODO FIND COLOR //CraftGUI.Render.colour(Biome.getBiome(i).color); - } CraftGUI.render.texture(CraftGUITexture.Button, new Area(x, y, 16, 16)); } } - public void setSpecies(final IAlleleBeeSpecies species) { - this.tolerated.clear(); - if (species == null) { - return; - } - final IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(Binnie.GENETICS.getBeeRoot().getTemplate(species)); - final IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); + public void setSpecies(IAlleleBeeSpecies species) { + tolerated.clear(); + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(Binnie.GENETICS.getBeeRoot().getTemplate(species)); + IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java b/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java index 3a6eddaf..bdc38517 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlClimateBar.java @@ -25,131 +25,135 @@ import binnie.core.craftgui.renderer.RenderUtil; import binnie.core.craftgui.resource.minecraft.CraftGUITexture; public class ControlClimateBar extends Control implements ITooltip { + private final int[] TEMP_COLORS = new int[]{ + 0x00fffb, + 0x78bbff, + 0x4fff30, + 0xffff00, + 0xffa200, + 0xff0000 + }; + private final int[] HUMID_COLORS = new int[]{ + 0xffe7a3, + 0x1aff00, + 0x307cff + }; + boolean isHumidity; List tolerated; - int[] tempColours; - int[] humidColours; - public ControlClimateBar(final IWidget parent, final int x, final int y, final int width, final int height) { - super(parent, x, y, width, height); - this.isHumidity = false; - this.tolerated = new ArrayList<>(); - this.tempColours = new int[]{65531, 7912447, 5242672, 16776960, 16753152, 16711680}; - this.humidColours = new int[]{16770979, 1769216, 3177727}; - this.addAttribute(Attribute.MouseOver); + public ControlClimateBar(IWidget parent, int x, int y, int width, int height) { + this(parent, x, y, width, height, false); } - public ControlClimateBar(final IWidget parent, final int x, final int y, final int width, final int height, final boolean humidity) { + public ControlClimateBar(IWidget parent, int x, int y, int width, int height, boolean humidity) { super(parent, x, y, width, height); - this.isHumidity = false; - this.tolerated = new ArrayList<>(); - this.tempColours = new int[]{65531, 7912447, 5242672, 16776960, 16753152, 16711680}; - this.humidColours = new int[]{16770979, 1769216, 3177727}; - this.addAttribute(Attribute.MouseOver); - this.isHumidity = true; + isHumidity = false; + tolerated = new ArrayList<>(); + addAttribute(Attribute.MouseOver); + isHumidity = humidity; } @Override - public void getTooltip(final Tooltip list) { - if (this.tolerated.isEmpty()) { + public void getTooltip(Tooltip list) { + if (tolerated.isEmpty()) { return; } - final int types = this.isHumidity ? 3 : 6; - final int type = (int) ((int) (this.getRelativeMousePosition().x() - 1.0f) / ((this.getSize().x() - 2.0f) / types)); - if (!this.tolerated.contains(type)) { + + int types = isHumidity ? 3 : 6; + int type = (int) ((int) (getRelativeMousePosition().x() - 1.0f) / ((getSize().x() - 2.0f) / types)); + if (!tolerated.contains(type) || type >= types) { return; } - if (type < types) { - if (this.isHumidity) { - list.add(EnumHumidity.values()[type].name); - } else { - list.add(EnumTemperature.values()[type + 1].name); - } + + if (isHumidity) { + list.add(EnumHumidity.values()[type].name); + } else { + list.add(EnumTemperature.values()[type + 1].name); } } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, this.getArea()); - final int types = this.isHumidity ? 3 : 6; - final int w = (int) ((this.getSize().x() - 2.0f) / types); + CraftGUI.render.texture(CraftGUITexture.EnergyBarBack, getArea()); + int types = isHumidity ? 3 : 6; + int w = (int) ((getSize().x() - 2.0f) / types); for (int i = 0; i < types; ++i) { - final int x = i * w; - if (this.tolerated.contains(i)) { - int colour = 0; - if (this.isHumidity) { - colour = this.humidColours[i]; + int x = i * w; + if (tolerated.contains(i)) { + int color; + if (isHumidity) { + color = HUMID_COLORS[i]; } else { - colour = this.tempColours[i]; + color = TEMP_COLORS[i]; } - RenderUtil.drawSolidRect(new Area(x + 1, 1, w, this.getSize().y() - 2), colour); + RenderUtil.drawSolidRect(new Area(x + 1, 1, w, getSize().y() - 2), color); } } - CraftGUI.render.texture(CraftGUITexture.EnergyBarGlass, this.getArea()); + CraftGUI.render.texture(CraftGUITexture.EnergyBarGlass, getArea()); } - public void setSpecies(final IAlleleBeeSpecies species) { - this.tolerated.clear(); - if (species == null) { - return; - } + public void setSpecies(IAlleleBeeSpecies species) { + tolerated.clear(); int main; EnumTolerance tolerance; - final IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species); - final IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); + IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species); + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); - if (!this.isHumidity) { + if (!isHumidity) { main = species.getTemperature().ordinal() - 1; tolerance = genome.getToleranceTemp(); } else { main = species.getHumidity().ordinal(); tolerance = genome.getToleranceHumid(); } - this.tolerated.add(main); + + tolerated.add(main); switch (tolerance) { case BOTH_5: case UP_5: { - this.tolerated.add(main + 5); + tolerated.add(main + 5); } case BOTH_4: case UP_4: { - this.tolerated.add(main + 4); + tolerated.add(main + 4); } case BOTH_3: case UP_3: { - this.tolerated.add(main + 3); + tolerated.add(main + 3); } case BOTH_2: case UP_2: { - this.tolerated.add(main + 2); + tolerated.add(main + 2); } case BOTH_1: case UP_1: { - this.tolerated.add(main + 1); + tolerated.add(main + 1); break; } } + switch (tolerance) { case BOTH_5: case DOWN_5: { - this.tolerated.add(main - 5); + tolerated.add(main - 5); } case BOTH_4: case DOWN_4: { - this.tolerated.add(main - 4); + tolerated.add(main - 4); } case BOTH_3: case DOWN_3: { - this.tolerated.add(main - 3); + tolerated.add(main - 3); } case BOTH_2: case DOWN_2: { - this.tolerated.add(main - 2); + tolerated.add(main - 2); } case BOTH_1: case DOWN_1: { - this.tolerated.add(main - 1); + tolerated.add(main - 1); break; } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java index 3b413549..7b23684c 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsBox.java @@ -20,50 +20,54 @@ public class ControlProductsBox extends ControlListBox strings = new ArrayList<>(); - if (this.type == Type.Products) { - for (final Map.Entry entry : species.getProductChances().entrySet()) { - strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); - } - } else { - for (final Map.Entry entry : species.getSpecialtyChances().entrySet()) { - strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); - } - } - this.setOptions(strings); + public void setSpecies(IAlleleBeeSpecies species) { + if (species == this.species || (this.species = species) == null) { + return; } + + IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species.getUID()); + if (template == null) { + return; + } + + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); + float speed = genome.getSpeed(); + float modeSpeed = Binnie.GENETICS.getBeeRoot().getBeekeepingMode(BinnieCore.getBinnieProxy().getWorld()).getBeeModifier().getProductionModifier(genome, 1.0f); + List strings = new ArrayList<>(); + + if (type == Type.PRODUCTS) { + for (Map.Entry entry : species.getProductChances().entrySet()) { + strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); + } + } else { + for (Map.Entry entry : species.getSpecialtyChances().entrySet()) { + strings.add(new Product(entry.getKey(), speed * modeSpeed * entry.getValue())); + } + } + setOptions(strings); } enum Type { - Products, - Specialties + PRODUCTS, + SPECIALTIES } class Product { ItemStack item; float chance; - public Product(final ItemStack item, final float chance) { + public Product(ItemStack item, float chance) { this.item = item; this.chance = chance; } diff --git a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java index ba4c678d..132b82e3 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java +++ b/src/main/java/binnie/genetics/gui/bee/database/ControlProductsItem.java @@ -11,27 +11,26 @@ import binnie.core.craftgui.geometry.Point; import binnie.core.craftgui.minecraft.control.ControlItemDisplay; public class ControlProductsItem extends ControlOption { - ControlItemDisplay item; + private ControlItemDisplay item; - public ControlProductsItem(final ControlList controlList, final ControlProductsBox.Product value, final int y) { + public ControlProductsItem(ControlList controlList, ControlProductsBox.Product value, int y) { super(controlList, value, y); - (this.item = new ControlItemDisplay(this, 4, 4)).setTooltip(); - final ControlText textWidget = new ControlTextCentered(this, 2, ""); + (item = new ControlItemDisplay(this, 4, 4)).setTooltip(); + ControlText textWidget = new ControlTextCentered(this, 2, ""); CraftGUIUtil.moveWidget(textWidget, new Point(12, 0)); - if (value != null) { - this.item.setItemStack(value.item); - final int time = (int) (55000.0 / value.chance); - final int seconds = time / 20; - final int minutes = seconds / 60; - final int hours = minutes / 60; - final DecimalFormat df = new DecimalFormat("#.0"); - if (hours > 1) { - textWidget.setValue("Every " + df.format(hours) + " hours"); - } else if (minutes > 1) { - textWidget.setValue("Every " + df.format(minutes) + " min."); - } else { - textWidget.setValue("Every " + df.format(seconds) + " sec."); - } + item.setItemStack(value.item); + int time = (int) (55000.0 / value.chance); + int seconds = time / 20; + int minutes = seconds / 60; + int hours = minutes / 60; + DecimalFormat df = new DecimalFormat("#.0"); + + if (hours > 1) { + textWidget.setValue("Every " + df.format(hours) + " hours"); + } else if (minutes > 1) { + textWidget.setValue("Every " + df.format(minutes) + " min."); + } else { + textWidget.setValue("Every " + df.format(seconds) + " sec."); } } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java index d9b6541f..1bc62c6a 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java +++ b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesClimate.java @@ -13,19 +13,19 @@ public class PageSpeciesClimate extends PageSpecies { ControlClimateBar humidBar; ControlBiomes biomes; - public PageSpeciesClimate(final IWidget parent, final DatabaseTab tab) { + public PageSpeciesClimate(IWidget parent, DatabaseTab tab) { super(parent, tab); new ControlTextCentered(this, 8, "Climate"); - this.tempBar = new ControlClimateBar(this, 8, 24, 128, 12); - this.humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true); + tempBar = new ControlClimateBar(this, 8, 24, 128, 12); + humidBar = new ControlClimateBar(this, 8, 42, 128, 12, true); new ControlTextCentered(this, 70, "Biomes"); - this.biomes = new ControlBiomes(this, 8, 90, 8, 4); + biomes = new ControlBiomes(this, 8, 90, 8, 4); } @Override - public void onValueChanged(final IAlleleSpecies species) { - this.tempBar.setSpecies((IAlleleBeeSpecies) species); - this.humidBar.setSpecies((IAlleleBeeSpecies) species); - this.biomes.setSpecies((IAlleleBeeSpecies) species); + public void onValueChanged(IAlleleSpecies species) { + tempBar.setSpecies((IAlleleBeeSpecies) species); + humidBar.setSpecies((IAlleleBeeSpecies) species); + biomes.setSpecies((IAlleleBeeSpecies) species); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java index 03a49f66..f92e3e4b 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java +++ b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesGenome.java @@ -33,7 +33,7 @@ public class PageSpeciesGenome extends PageSpecies { ControlText flowerText; ControlText effectText; - public PageSpeciesGenome(final IWidget parent, final DatabaseTab tab) { + public PageSpeciesGenome(IWidget parent, DatabaseTab tab) { super(parent, tab); title = new ControlTextCentered(this, 8, I18N.localise("extrabees.gui.database.tab.species.genome")); new ControlText(this, new Area(0, 32, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.speed"), TextJustification.TOP_RIGHT); @@ -46,20 +46,20 @@ public class PageSpeciesGenome extends PageSpecies { new ControlText(this, new Area(0, 121, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.rain"), TextJustification.TOP_RIGHT); new ControlText(this, new Area(0, 138, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.flower"), TextJustification.TOP_RIGHT); new ControlText(this, new Area(0, 155, 68, 30), I18N.localise("extrabees.gui.database.tab.species.genome.effect"), TextJustification.TOP_RIGHT); - final int x = 72; - this.speedText = new ControlText(this, new Area(x, 32, 72, 30), "", TextJustification.TOP_LEFT); - this.lifespanText = new ControlText(this, new Area(x, 44, 72, 30), "", TextJustification.TOP_LEFT); - this.fertilityText = new ControlText(this, new Area(x, 56, 72, 30), "", TextJustification.TOP_LEFT); - this.floweringText = new ControlText(this, new Area(x, 68, 72, 30), "", TextJustification.TOP_LEFT); - this.territoryText = new ControlText(this, new Area(x, 80, 72, 30), "", TextJustification.TOP_LEFT); - this.nocturnalText = new ControlText(this, new Area(x, 97, 72, 30), "", TextJustification.TOP_LEFT); - this.caveDwellingText = new ControlText(this, new Area(x, 109, 72, 30), "", TextJustification.TOP_LEFT); - this.tolerantFlyerText = new ControlText(this, new Area(x, 121, 72, 30), "", TextJustification.TOP_LEFT); - this.flowerText = new ControlText(this, new Area(x, 138, 72, 30), "", TextJustification.TOP_LEFT); - this.effectText = new ControlText(this, new Area(x, 155, 72, 30), "", TextJustification.TOP_LEFT); + int x = 72; + speedText = new ControlText(this, new Area(x, 32, 72, 30), "", TextJustification.TOP_LEFT); + lifespanText = new ControlText(this, new Area(x, 44, 72, 30), "", TextJustification.TOP_LEFT); + fertilityText = new ControlText(this, new Area(x, 56, 72, 30), "", TextJustification.TOP_LEFT); + floweringText = new ControlText(this, new Area(x, 68, 72, 30), "", TextJustification.TOP_LEFT); + territoryText = new ControlText(this, new Area(x, 80, 72, 30), "", TextJustification.TOP_LEFT); + nocturnalText = new ControlText(this, new Area(x, 97, 72, 30), "", TextJustification.TOP_LEFT); + caveDwellingText = new ControlText(this, new Area(x, 109, 72, 30), "", TextJustification.TOP_LEFT); + tolerantFlyerText = new ControlText(this, new Area(x, 121, 72, 30), "", TextJustification.TOP_LEFT); + flowerText = new ControlText(this, new Area(x, 138, 72, 30), "", TextJustification.TOP_LEFT); + effectText = new ControlText(this, new Area(x, 155, 72, 30), "", TextJustification.TOP_LEFT); } - public static String rateFlowering(final int flowering) { + public static String rateFlowering(int flowering) { if (flowering >= 99) { return AlleleHelper.toDisplay(EnumAllele.Flowering.MAXIMUM); } @@ -84,7 +84,7 @@ public class PageSpeciesGenome extends PageSpecies { return AlleleHelper.toDisplay(EnumAllele.Flowering.SLOWEST); } - public static String rateSpeed(final float speed) { + public static String rateSpeed(float speed) { if (speed >= 1.7f) { return AlleleHelper.toDisplay(EnumAllele.Speed.FASTEST); } @@ -106,7 +106,7 @@ public class PageSpeciesGenome extends PageSpecies { return AlleleHelper.toDisplay(EnumAllele.Speed.SLOWEST); } - public static String rateLifespan(final int life) { + public static String rateLifespan(int life) { if (life >= 70) { return AlleleHelper.toDisplay(EnumAllele.Lifespan.LONGEST); } @@ -134,7 +134,7 @@ public class PageSpeciesGenome extends PageSpecies { return AlleleHelper.toDisplay(EnumAllele.Lifespan.SHORTEST); } - public static String tolerated(final boolean t) { + public static String tolerated(boolean t) { if (t) { return I18N.localise("extrabees.gui.database.tab.species.genome.tolerated"); } @@ -142,37 +142,41 @@ public class PageSpeciesGenome extends PageSpecies { } @Override - public void onValueChanged(final IAlleleSpecies species) { - final IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species.getUID()); - if (template != null) { - final IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); - final IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); - this.speedText.setValue(rateSpeed(genome.getSpeed())); - this.lifespanText.setValue(rateLifespan(genome.getLifespan())); - this.fertilityText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.children", genome.getFertility())); - this.floweringText.setValue(rateFlowering(genome.getFlowering())); - final Vec3i area = genome.getTerritory(); - this.territoryText.setValue(area.getX() + "x" + area.getY() + "x" + area.getZ()); - String behavior = I18N.localise("extrabees.gui.database.tab.species.genome.daytime"); - if (genome.getPrimary().isNocturnal()) { - behavior = I18N.localise("extrabees.gui.database.tab.species.genome.nighttime"); - } - if (genome.getNeverSleeps()) { - behavior = I18N.localise("extrabees.gui.database.tab.species.genome.allDay"); - } - this.nocturnalText.setValue(behavior); - if (genome.getCaveDwelling()) { - this.caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.notNeeded")); - } else { - this.caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.required")); - } - this.tolerantFlyerText.setValue(tolerated(genome.getToleratesRain())); - if (genome.getFlowerProvider() != null) { - this.flowerText.setValue(genome.getFlowerProvider().getDescription()); - } else { - this.flowerText.setValue(AlleleHelper.toDisplay(EnumTolerance.NONE)); - } - this.effectText.setValue(genome.getEffect().getName()); + public void onValueChanged(IAlleleSpecies species) { + IAllele[] template = Binnie.GENETICS.getBeeRoot().getTemplate(species.getUID()); + if (template == null) { + return; } + + IBeeGenome genome = Binnie.GENETICS.getBeeRoot().templateAsGenome(template); + IBee bee = Binnie.GENETICS.getBeeRoot().getBee(genome); + speedText.setValue(rateSpeed(genome.getSpeed())); + lifespanText.setValue(rateLifespan(genome.getLifespan())); + fertilityText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.children", genome.getFertility())); + floweringText.setValue(rateFlowering(genome.getFlowering())); + Vec3i area = genome.getTerritory(); + territoryText.setValue(area.getX() + "x" + area.getY() + "x" + area.getZ()); + String behavior = I18N.localise("extrabees.gui.database.tab.species.genome.daytime"); + if (genome.getPrimary().isNocturnal()) { + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.nighttime"); + } + if (genome.getNeverSleeps()) { + behavior = I18N.localise("extrabees.gui.database.tab.species.genome.allDay"); + } + + nocturnalText.setValue(behavior); + if (genome.getCaveDwelling()) { + caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.notNeeded")); + } else { + caveDwellingText.setValue(I18N.localise("extrabees.gui.database.tab.species.genome.required")); + } + + tolerantFlyerText.setValue(tolerated(genome.getToleratesRain())); + if (genome.getFlowerProvider() != null) { + flowerText.setValue(genome.getFlowerProvider().getDescription()); + } else { + flowerText.setValue(AlleleHelper.toDisplay(EnumTolerance.NONE)); + } + effectText.setValue(genome.getEffect().getName()); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java index f2170539..7366195b 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java +++ b/src/main/java/binnie/genetics/gui/bee/database/PageSpeciesProducts.java @@ -10,22 +10,22 @@ import binnie.core.craftgui.database.DatabaseTab; import binnie.core.craftgui.database.PageSpecies; public class PageSpeciesProducts extends PageSpecies { - ControlText pageSpeciesProducts_Title; - ControlProductsBox pageSpeciesProducts_Products; - ControlText pageSpeciesProducts_Title2; - ControlProductsBox pageSpeciesProducts_Specialties; + ControlText title; + ControlProductsBox productsBox; + ControlText title2; + ControlProductsBox specialitiesBox; - public PageSpeciesProducts(final IWidget parent, final DatabaseTab tab) { + public PageSpeciesProducts(IWidget parent, DatabaseTab tab) { super(parent, tab); - this.pageSpeciesProducts_Title = new ControlTextCentered(this, 8, "Products"); - this.pageSpeciesProducts_Products = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.Products); - this.pageSpeciesProducts_Title2 = new ControlTextCentered(this, 68, "Specialties"); - this.pageSpeciesProducts_Specialties = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.Specialties); + title = new ControlTextCentered(this, 8, "Products"); + productsBox = new ControlProductsBox(this, 4, 20, 136, 48, ControlProductsBox.Type.PRODUCTS); + title2 = new ControlTextCentered(this, 68, "Specialties"); + specialitiesBox = new ControlProductsBox(this, 4, 80, 136, 48, ControlProductsBox.Type.SPECIALTIES); } @Override - public void onValueChanged(final IAlleleSpecies species) { - this.pageSpeciesProducts_Products.setSpecies((IAlleleBeeSpecies) species); - this.pageSpeciesProducts_Specialties.setSpecies((IAlleleBeeSpecies) species); + public void onValueChanged(IAlleleSpecies species) { + productsBox.setSpecies((IAlleleBeeSpecies) species); + specialitiesBox.setSpecies((IAlleleBeeSpecies) species); } } diff --git a/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java b/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java index d7a18e88..9f19bbe7 100644 --- a/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java +++ b/src/main/java/binnie/genetics/gui/bee/database/WindowApiaristDatabase.java @@ -20,27 +20,27 @@ import binnie.core.craftgui.minecraft.Window; import binnie.genetics.Genetics; public class WindowApiaristDatabase extends WindowAbstractDatabase { - public WindowApiaristDatabase(final EntityPlayer player, final Side side, final boolean nei) { + public WindowApiaristDatabase(EntityPlayer player, Side side, boolean nei) { super(player, side, nei, Binnie.GENETICS.beeBreedingSystem, 110); } - public static Window create(final EntityPlayer player, final Side side, final boolean nei) { + public static Window create(EntityPlayer player, Side side, boolean nei) { return new WindowApiaristDatabase(player, side, nei); } @Override @SideOnly(Side.CLIENT) protected void addTabs() { - new PageSpeciesOverview(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.overview", 0)); - new PageSpeciesClassification(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.classification", 0)); - new PageSpeciesGenome(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.genome", 0)); - new PageSpeciesProducts(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.products", 0)); - new PageSpeciesClimate(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.climate", 0)); - new PageSpeciesResultant(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.resultant", 0)); - new PageSpeciesMutations(this.getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.further", 0)); - new PageBranchOverview(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.overview", 0)); - new PageBranchSpecies(this.getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.species", 0)); - new PageBreeder(this.getInfoPages(Mode.BREEDER), this.getUsername(), new DatabaseTab(Genetics.instance, "breeder", 0)); + new PageSpeciesOverview(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.overview", 0)); + new PageSpeciesClassification(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.classification", 0)); + new PageSpeciesGenome(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.genome", 0)); + new PageSpeciesProducts(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.products", 0)); + new PageSpeciesClimate(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.climate", 0)); + new PageSpeciesResultant(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.resultant", 0)); + new PageSpeciesMutations(getInfoPages(Mode.SPECIES), new DatabaseTab(Genetics.instance, "species.further", 0)); + new PageBranchOverview(getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.overview", 0)); + new PageBranchSpecies(getInfoPages(Mode.BRANCHES), new DatabaseTab(Genetics.instance, "branches.species", 0)); + new PageBreeder(getInfoPages(Mode.BREEDER), getUsername(), new DatabaseTab(Genetics.instance, "breeder", 0)); } @Override @@ -54,28 +54,28 @@ public class WindowApiaristDatabase extends WindowAbstractDatabase { } enum SpeciesTab { - Overview(255), - Genome(16776960), - Productivity(65535), - Climate(16711680), - ResultantMutations(16711935), - FurtherMutations(65280); + Overview(0x00ff), + Genome(0xffff00), + Productivity(0x00ffff), + Climate(0xff0000), + ResultantMutations(0xff00ff), + FurtherMutations(0xff00); - public int colour; + public int color; - SpeciesTab(final int colour) { - this.colour = colour; + SpeciesTab(int color) { + this.color = color; } } enum BranchesTab { - Overview(255), - Species(16711680); + Overview(0x0000ff), + Species(0xff0000); - public int colour; + public int color; - BranchesTab(final int colour) { - this.colour = colour; + BranchesTab(int color) { + this.color = color; } } } diff --git a/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java b/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java index 0eba33db..85012856 100644 --- a/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java +++ b/src/main/java/binnie/genetics/gui/butterfly/AnalystPageSpecimen.java @@ -12,14 +12,14 @@ import binnie.genetics.gui.ControlAnalystPage; import binnie.genetics.gui.ControlIndividualDisplay; public class AnalystPageSpecimen extends ControlAnalystPage { - public AnalystPageSpecimen(final IWidget parent, final Area area, final IButterfly ind) { + public AnalystPageSpecimen(IWidget parent, Area area, IButterfly ind) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - final int w = Math.round((this.width() - 16) * ind.getSize()); - new ControlIndividualDisplay(this, (this.width() - w) / 2, y + (this.width() - w) / 2, w, ind); + int w = Math.round((width() - 16) * ind.getSize()); + new ControlIndividualDisplay(this, (width() - w) / 2, y + (width() - w) / 2, w, ind); } @Override diff --git a/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java b/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java index 598a1af9..7a3dc9c5 100644 --- a/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java +++ b/src/main/java/binnie/genetics/gui/flower/AnalystPageAppearance.java @@ -23,30 +23,30 @@ import binnie.core.util.I18N; import binnie.genetics.gui.ControlAnalystPage; public class AnalystPageAppearance extends ControlAnalystPage { - public AnalystPageAppearance(final IWidget parent, final Area area, final IFlower flower) { + public AnalystPageAppearance(IWidget parent, Area area, IFlower flower) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; IFlowerGenome genome = flower.getGenome(); - final IAlleleSpecies species = genome.getPrimary(); - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + IAlleleSpecies species = genome.getPrimary(); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - final ControlColorDisplay a = new ControlColorDisplay(this, this.width() / 2 - 28, y, genome.getPrimaryColor()); + ControlColorDisplay a = new ControlColorDisplay(this, width() / 2 - 28, y, genome.getPrimaryColor()); a.addTooltip(I18N.localise("genetics.gui.analyst.appearance.primary")); - final ControlColorDisplay b = new ControlColorDisplay(this, this.width() / 2 - 8, y, genome.getSecondaryColor()); + ControlColorDisplay b = new ControlColorDisplay(this, width() / 2 - 8, y, genome.getSecondaryColor()); b.addTooltip(I18N.localise("genetics.gui.analyst.appearance.secondary")); - final ControlColorDisplay c = new ControlColorDisplay(this, this.width() / 2 + 12, y, genome.getStemColor()); + ControlColorDisplay c = new ControlColorDisplay(this, width() / 2 + 12, y, genome.getStemColor()); c.addTooltip(I18N.localise("genetics.gui.analyst.appearance.stem")); y += 26; IFlowerType type = genome.getType(); - final int sections = type.getSections(); - final int width = (sections > 1) ? 50 : 100; - new ControlIconDisplay(this, (this.width() - width) / 2, y - ((sections == 1) ? 0 : 0)) { + int sections = type.getSections(); + int width = (sections > 1) ? 50 : 100; + new ControlIconDisplay(this, (width() - width) / 2, y - ((sections == 1) ? 0 : 0)) { @Override @SideOnly(Side.CLIENT) public void onRenderForeground(int guiWidth, int guiHeight) { GlStateManager.pushMatrix(); - final float scale = width / 16.0f; + float scale = width / 16.0f; int dy = (sections > 1) ? 16 : 0; GlStateManager.scale(scale, scale, 1.0f); RenderUtil.setColour(flower.getGenome().getStemColor().getColor(false)); diff --git a/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java b/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java index 1661cb22..24c942b4 100644 --- a/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java +++ b/src/main/java/binnie/genetics/gui/flower/AnalystPageSoil.java @@ -26,30 +26,30 @@ import binnie.genetics.gui.ControlAnalystPage; import binnie.genetics.gui.ControlToleranceBar; public class AnalystPageSoil extends ControlAnalystPage { - public AnalystPageSoil(final IWidget parent, final Area area, final IFlower flower) { + public AnalystPageSoil(IWidget parent, Area area, IFlower flower) { super(parent, area); - this.setColour(6697728); - final EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture(); - final EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture(); - final EnumAcidity pH = flower.getGenome().getPrimary().getPH(); - final EnumTolerance pHTol = flower.getGenome().getTolerancePH(); + setColor(6697728); + EnumMoisture moisture = flower.getGenome().getPrimary().getMoisture(); + EnumTolerance moistureTol = flower.getGenome().getToleranceMoisture(); + EnumAcidity pH = flower.getGenome().getPrimary().getPH(); + EnumTolerance pHTol = flower.getGenome().getTolerancePH(); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.moisture"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createMoisture(this, (this.width() - 100) / 2, y, 100, 10, moisture, moistureTol); + createMoisture(this, (width() - 100) / 2, y, 100, 10, moisture, moistureTol); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.ph"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.tolerance.ph"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createAcidity(this, (this.width() - 100) / 2, y, 100, 10, pH, pHTol); + createAcidity(this, (width() - 100) / 2, y, 100, 10, pH, pHTol); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.recommended"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.recommended"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; EnumMoisture recomMoisture = EnumMoisture.NORMAL; - final boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); - final boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.DAMP, moistureTol); - final boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.DRY, moistureTol); + boolean canTolNormal = Tolerance.canTolerate(moisture, EnumMoisture.NORMAL, moistureTol); + boolean canTolDamp = Tolerance.canTolerate(moisture, EnumMoisture.DAMP, moistureTol); + boolean canTolDry = Tolerance.canTolerate(moisture, EnumMoisture.DRY, moistureTol); if (canTolNormal) { if (canTolDamp && !canTolDry) { recomMoisture = EnumMoisture.DAMP; @@ -65,9 +65,9 @@ public class AnalystPageSoil extends ControlAnalystPage { } } EnumAcidity recomPH = EnumAcidity.NEUTRAL; - final boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.NEUTRAL, pHTol); - final boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.ACID, pHTol); - final boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.ALKALINE, pHTol); + boolean canTolNeutral = Tolerance.canTolerate(pH, EnumAcidity.NEUTRAL, pHTol); + boolean canTolAcid = Tolerance.canTolerate(pH, EnumAcidity.ACID, pHTol); + boolean canTolAlkaline = Tolerance.canTolerate(pH, EnumAcidity.ALKALINE, pHTol); if (canTolNeutral) { if (canTolAcid && !canTolAlkaline) { recomPH = EnumAcidity.ACID; @@ -82,54 +82,54 @@ public class AnalystPageSoil extends ControlAnalystPage { recomPH = EnumAcidity.ALKALINE; } } - final ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture)); - final ControlItemDisplay recomSoil = new ControlItemDisplay(this, (this.width() - 24) / 2, y, 24); + ItemStack stack = new ItemStack(Botany.soil, 1, BlockSoil.getMeta(recomPH, recomMoisture)); + ControlItemDisplay recomSoil = new ControlItemDisplay(this, (width() - 24) / 2, y, 24); recomSoil.setItemStack(stack); recomSoil.setTooltip(); y += 32; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.other"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.soil.other"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - final List stacks = new ArrayList<>(); - for (final EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { - for (final EnumMoisture b : EnumSet.range(EnumMoisture.DRY, EnumMoisture.DAMP)) { + List stacks = new ArrayList<>(); + for (EnumAcidity a : EnumSet.range(EnumAcidity.ACID, EnumAcidity.ALKALINE)) { + for (EnumMoisture b : EnumSet.range(EnumMoisture.DRY, EnumMoisture.DAMP)) { if (Tolerance.canTolerate(pH, a, pHTol) && Tolerance.canTolerate(moisture, b, moistureTol) && (a != recomPH || b != recomMoisture)) { stacks.add(new ItemStack(Botany.soil, 1, BlockSoil.getMeta(a, b))); } } } - final int soilListWidth = 17 * stacks.size() - 1; - final int soilListX = (this.width() - soilListWidth) / 2; + int soilListWidth = 17 * stacks.size() - 1; + int soilListX = (width() - soilListWidth) / 2; int t = 0; - for (final ItemStack soilStack : stacks) { - final ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y); + for (ItemStack soilStack : stacks) { + ControlItemDisplay display = new ControlItemDisplay(this, soilListX + 17 * t++, y); display.setItemStack(soilStack); display.setTooltip(); } } - protected void createMoisture(final IWidget parent, final int x, final int y, final int w, final int h, final EnumMoisture value, final EnumTolerance tol) { + protected void createMoisture(IWidget parent, int x, int y, int w, int h, EnumMoisture value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumMoisture.class) { @Override - protected String getName(final EnumMoisture value) { + protected String getName(EnumMoisture value) { return value.getLocalisedName(false); } @Override - protected int getColour(final EnumMoisture value) { + protected int getColour(EnumMoisture value) { return (new int[]{13434828, 6737151, 3368703})[value.ordinal()]; } }.setValues(value, tol); } - protected void createAcidity(final IWidget parent, final int x, final int y, final int w, final int h, final EnumAcidity value, final EnumTolerance tol) { + protected void createAcidity(IWidget parent, int x, int y, int w, int h, EnumAcidity value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumAcidity.class) { @Override - protected String getName(final EnumAcidity value) { + protected String getName(EnumAcidity value) { return value.getLocalisedName(false); } @Override - protected int getColour(final EnumAcidity value) { + protected int getColour(EnumAcidity value) { return (new int[]{16711782, 65280, 26367})[value.ordinal()]; } }.setValues(value, tol); diff --git a/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java b/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java index 6569c38e..909a517c 100644 --- a/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java +++ b/src/main/java/binnie/genetics/gui/punnett/ControlChromosome.java @@ -17,32 +17,32 @@ import binnie.core.craftgui.renderer.RenderUtil; public class ControlChromosome extends Control implements IControlValue, ITooltip { private IChromosomeType value; - protected ControlChromosome(final IWidget parent, final int x, final int y, final IChromosomeType type) { + protected ControlChromosome(IWidget parent, int x, int y, IChromosomeType type) { super(parent, x, y, 16, 16); - this.value = type; - this.addAttribute(Attribute.MouseOver); + value = type; + addAttribute(Attribute.MouseOver); } @Override public IChromosomeType getValue() { - return this.value; + return value; } @Override - public void setValue(final IChromosomeType value) { + public void setValue(IChromosomeType value) { this.value = value; } @Override @SideOnly(Side.CLIENT) public void onRenderBackground(int guiWidth, int guiHeight) { - CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome, this.getArea()); + CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome, getArea()); RenderUtil.setColour(16711680); - CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome2, this.getArea()); + CraftGUI.render.texture(ExtraBeeGUITexture.Chromosome2, getArea()); } @Override - public void getTooltip(final Tooltip tooltip) { - tooltip.add(this.value.getName()); + public void getTooltip(Tooltip tooltip) { + tooltip.add(value.getName()); } } diff --git a/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java b/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java index 27e0da36..a0919b7a 100644 --- a/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java +++ b/src/main/java/binnie/genetics/gui/punnett/ControlPunnett.java @@ -22,7 +22,7 @@ public class ControlPunnett extends Control { static int boxWidth = 80; static int boxHeight = 28; - protected ControlPunnett(final IWidget parent, final int x, final int y) { + protected ControlPunnett(IWidget parent, int x, int y) { super(parent, x, y, ControlPunnett.boxWidth * 3, ControlPunnett.boxWidth * 3); } @@ -35,21 +35,21 @@ public class ControlPunnett extends Control { RenderUtil.drawSolidRect(new Area(ControlPunnett.boxWidth * 2, ControlPunnett.boxHeight / 2, 1, Math.round(ControlPunnett.boxHeight * 2.5f)), 11184810); } - public void setup(final IChromosomeType chromosome, final IIndividual ind1, final IIndividual ind2, final ISpeciesRoot root) { - this.deleteAllChildren(); + public void setup(IChromosomeType chromosome, IIndividual ind1, IIndividual ind2, ISpeciesRoot root) { + deleteAllChildren(); if (chromosome == null || ind1 == null || ind2 == null || root == null) { return; } - final IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome); - final IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome); - final IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome); - final IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome); + IAllele primary1 = ind1.getGenome().getActiveAllele(chromosome); + IAllele primary2 = ind2.getGenome().getActiveAllele(chromosome); + IAllele secondary1 = ind1.getGenome().getInactiveAllele(chromosome); + IAllele secondary2 = ind2.getGenome().getInactiveAllele(chromosome); int x = 1; int y = 1; - for (final IAllele allele1 : new IAllele[]{primary1, secondary1}) { + for (IAllele allele1 : new IAllele[]{primary1, secondary1}) { y = 1; - for (final IAllele allele2 : new IAllele[]{primary2, secondary2}) { - final List alleles = new LinkedList<>(); + for (IAllele allele2 : new IAllele[]{primary2, secondary2}) { + List alleles = new LinkedList<>(); if (allele1.isDominant() && !allele2.isDominant()) { alleles.add(allele1); } else if (allele2.isDominant() && !allele1.isDominant()) { @@ -61,17 +61,17 @@ public class ControlPunnett extends Control { } } StringBuilder text = new StringBuilder(); - for (final IAllele allele3 : alleles) { + for (IAllele allele3 : alleles) { text.append(allele3.getName()).append(": ").append(25.0f / alleles.size()).append("%\n"); } - new ControlText(this, new Area(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text.toString(), TextJustification.TOP_CENTER).setColour(11184810); + new ControlText(this, new Area(x * ControlPunnett.boxWidth, ControlPunnett.boxHeight * y, ControlPunnett.boxWidth, ControlPunnett.boxHeight), text.toString(), TextJustification.TOP_CENTER).setColor(11184810); ++y; } ++x; } - new ControlText(this, new Area(ControlPunnett.boxWidth, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TOP_CENTER).setColour(11184810); - new ControlText(this, new Area(ControlPunnett.boxWidth * 2, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TOP_CENTER).setColour(11184810); - new ControlText(this, new Area(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColour(11184810); - new ControlText(this, new Area(0, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColour(11184810); + new ControlText(this, new Area(ControlPunnett.boxWidth, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + primary1.getName(), TextJustification.TOP_CENTER).setColor(11184810); + new ControlText(this, new Area(ControlPunnett.boxWidth * 2, 0, ControlPunnett.boxWidth, ControlPunnett.boxHeight), "\n" + secondary1.getName(), TextJustification.TOP_CENTER).setColor(11184810); + new ControlText(this, new Area(0, ControlPunnett.boxHeight, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColor(11184810); + new ControlText(this, new Area(0, ControlPunnett.boxHeight * 2, ControlPunnett.boxWidth, ControlPunnett.boxHeight), primary2.getName(), TextJustification.TOP_CENTER).setColor(11184810); } } diff --git a/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java b/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java index de242bde..8e0f69a7 100644 --- a/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java +++ b/src/main/java/binnie/genetics/gui/punnett/WindowPunnettSquare.java @@ -33,12 +33,12 @@ public class WindowPunnettSquare extends Window { @Nullable ISpeciesRoot root; - public WindowPunnettSquare(final EntityPlayer player, final IInventory inventory, final Side side) { + public WindowPunnettSquare(EntityPlayer player, IInventory inventory, Side side) { super(245, 205, player, inventory, side); - this.root = null; + root = null; } - public static Window create(final EntityPlayer player, final IInventory inventory, final Side side) { + public static Window create(EntityPlayer player, IInventory inventory, Side side) { return new WindowPunnettSquare(player, inventory, side); } @@ -55,16 +55,16 @@ public class WindowPunnettSquare extends Window { @Override @SideOnly(Side.CLIENT) public void initialiseClient() { - this.setTitle("Punnett Square"); + setTitle("Punnett Square"); CraftGUI.render.setStyleSheet(new StyleSheetPunnett()); } static class StyleSheetPunnett extends StyleSheet { public StyleSheetPunnett() { - this.textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, texture, 32, 32, 32, 32)); - this.textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, texture)); - this.textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, texture)); - this.textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, texture)); + textures.put(CraftGUITexture.Window, new PaddedTexture(0, 0, 160, 160, 0, texture, 32, 32, 32, 32)); + textures.put(CraftGUITexture.Slot, new StandardTexture(160, 0, 18, 18, 0, texture)); + textures.put(ExtraBeeGUITexture.Chromosome, new StandardTexture(160, 36, 16, 16, 0, texture)); + textures.put(ExtraBeeGUITexture.Chromosome2, new StandardTexture(160, 52, 16, 16, 0, texture)); } } diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java index 0ad818ce..20abd1d0 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageClimate.java @@ -32,12 +32,12 @@ import binnie.genetics.gui.ControlBiome; import binnie.genetics.gui.ControlToleranceBar; public class AnalystPageClimate extends ControlAnalystPage { - public AnalystPageClimate(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageClimate(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(26163); - final EnumTemperature temp = ind.getGenome().getPrimary().getTemperature(); + setColor(26163); + EnumTemperature temp = ind.getGenome().getPrimary().getTemperature(); EnumTolerance tempTol = EnumTolerance.NONE; - final EnumHumidity humid = ind.getGenome().getPrimary().getHumidity(); + EnumHumidity humid = ind.getGenome().getPrimary().getHumidity(); EnumTolerance humidTol = EnumTolerance.NONE; if (ind instanceof IBee) { tempTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumBeeChromosome.TEMPERATURE_TOLERANCE)).getValue(); @@ -52,28 +52,28 @@ public class AnalystPageClimate extends ControlAnalystPage { humidTol = ((IAlleleTolerance) ind.getGenome().getActiveAllele(EnumButterflyChromosome.HUMIDITY_TOLERANCE)).getValue(); } int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 16; - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.temp"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.temp"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createTemperatureBar(this, (this.width() - 100) / 2, y, 100, 10, temp, tempTol); + createTemperatureBar(this, (width() - 100) / 2, y, 100, 10, temp, tempTol); y += 16; if (!(ind instanceof IFlower)) { - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.hum"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.hum"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - this.createHumidity(this, (this.width() - 100) / 2, y, 100, 10, humid, humidTol); + createHumidity(this, (width() - 100) / 2, y, 100, 10, humid, humidTol); y += 16; } - new ControlText(this, new Area(4, y, this.width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER).setColour(this.getColour()); + new ControlText(this, new Area(4, y, width() - 8, 14), I18N.localise("genetics.gui.analyst.climate.biomes"), TextJustification.MIDDLE_CENTER).setColor(getColor()); y += 12; - final List biomes = new ArrayList<>(); - for (final Biome biome : Biome.EXPLORATION_BIOMES_LIST) { //TODO check + List biomes = new ArrayList<>(); + for (Biome biome : Biome.EXPLORATION_BIOMES_LIST) { //TODO check if (biome != null && biome != Biomes.FROZEN_OCEAN && Tolerance.canTolerate(temp, EnumTemperature.getFromBiome(biome), tempTol) && Tolerance.canTolerate(humid, EnumHumidity.getFromValue(biome.getRainfall()), humidTol)) { boolean match = false; - for (final Biome eBiome : biomes) { + for (Biome eBiome : biomes) { if (biome.getBiomeName().contains(eBiome.getBiomeName()) && EnumHumidity.getFromValue(eBiome.getRainfall()) == EnumHumidity.getFromValue(biome.getRainfall()) && EnumTemperature.getFromBiome(eBiome) == EnumTemperature.getFromBiome(biome)) { match = true; } @@ -83,11 +83,11 @@ public class AnalystPageClimate extends ControlAnalystPage { } } } - final int maxBiomePerLine = (this.width() + 2 - 16) / 18; - final int biomeListX = (this.width() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2; + int maxBiomePerLine = (width() + 2 - 16) / 18; + int biomeListX = (width() - (Math.min(maxBiomePerLine, biomes.size()) * 18 - 2)) / 2; int dx = 0; int dy = 0; - for (final Biome biome2 : biomes) { + for (Biome biome2 : biomes) { new ControlBiome(this, biomeListX + dx, y + dy, 16, 16, biome2); dx += 18; if (dx >= 18 * maxBiomePerLine) { @@ -95,32 +95,32 @@ public class AnalystPageClimate extends ControlAnalystPage { dy += 18; } } - this.setSize(new Point(this.width(), y + dy + 18 + 8)); + setSize(new Point(width(), y + dy + 18 + 8)); } - protected void createTemperatureBar(final IWidget parent, final int x, final int y, final int w, final int h, final EnumTemperature value, final EnumTolerance tol) { + protected void createTemperatureBar(IWidget parent, int x, int y, int w, int h, EnumTemperature value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumTemperature.class) { @Override - protected String getName(final EnumTemperature value) { + protected String getName(EnumTemperature value) { return value.name; } @Override - protected int getColour(final EnumTemperature value) { + protected int getColour(EnumTemperature value) { return (new int[]{65531, 7912447, 5242672, 16776960, 16753152, 16711680})[value.ordinal() - 1]; } }.setValues(value, tol); } - protected void createHumidity(final IWidget parent, final int x, final int y, final int w, final int h, final EnumHumidity value, final EnumTolerance tol) { + protected void createHumidity(IWidget parent, int x, int y, int w, int h, EnumHumidity value, EnumTolerance tol) { new ControlToleranceBar(parent, x, y, w, h, EnumHumidity.class) { @Override - protected String getName(final EnumHumidity value) { + protected String getName(EnumHumidity value) { return value.name; } @Override - protected int getColour(final EnumHumidity value) { + protected int getColour(EnumHumidity value) { return (new int[]{16770979, 1769216, 3177727})[value.ordinal()]; } }.setValues(value, tol); diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java index 13516a1e..0755c7c5 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageFruit.java @@ -30,24 +30,24 @@ import binnie.core.util.UniqueItemStackSet; import binnie.genetics.gui.AnalystPageProduce; public class AnalystPageFruit extends AnalystPageProduce { - public AnalystPageFruit(final IWidget parent, final Area area, final ITree ind) { + public AnalystPageFruit(IWidget parent, Area area, ITree ind) { super(parent, area); - this.setColour(13382400); - final ITreeGenome genome = ind.getGenome(); + setColor(13382400); + ITreeGenome genome = ind.getGenome(); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.fruit.yield") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.YIELD, ind.getGenome().getActiveAllele(EnumTreeChromosome.YIELD))).setColor(getColor()); y += 20; - final Collection products = new UniqueItemStackSet(); - final Collection specialties = new UniqueItemStackSet(); - final Collection wiid = new UniqueItemStackSet(); + Collection products = new UniqueItemStackSet(); + Collection specialties = new UniqueItemStackSet(); + Collection wiid = new UniqueItemStackSet(); products.addAll(ind.getProducts().keySet()); specialties.addAll(ind.getSpecialties().keySet()); try { if (ind.getGenome().getFruitProvider() instanceof FruitProviderPod) { - final FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider(); - final Field f = FruitProviderPod.class.getDeclaredField("drops"); + FruitProviderPod pod = (FruitProviderPod) ind.getGenome().getFruitProvider(); + Field f = FruitProviderPod.class.getDeclaredField("drops"); f.setAccessible(true); Collections.addAll(products, ((Map) f.get(pod)).keySet().toArray(new ItemStack[0])); } @@ -55,48 +55,48 @@ public class AnalystPageFruit extends AnalystPageProduce { throw Throwables.propagate(e); } if (products.size() > 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.natural")).setColor(getColor()); y += 10; - final int w = products.size() * 18 - 2; - final int i = 0; - for (final ItemStack stack : products) { - final ControlItemDisplay d = new ControlItemDisplay(this, (this.width() - w) / 2 + 18 * i, y); + int w = products.size() * 18 - 2; + int i = 0; + for (ItemStack stack : products) { + ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } y += 26; } if (specialties.size() > 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.specialty")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.specialty")).setColor(getColor()); y += 10; - final int w = products.size() * 18 - 2; - final int i = 0; - for (final ItemStack stack : specialties) { - final ControlItemDisplay d = new ControlItemDisplay(this, (this.width() - w) / 2 + 18 * i, y); + int w = products.size() * 18 - 2; + int i = 0; + for (ItemStack stack : specialties) { + ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } y += 26; } - final Collection allProducts = new UniqueItemStackSet(); + Collection allProducts = new UniqueItemStackSet(); allProducts.addAll(products); allProducts.addAll(specialties); - final Collection refinedProducts = new UniqueItemStackSet(); - refinedProducts.addAll(this.getAllProductsAndFluids(allProducts)); + Collection refinedProducts = new UniqueItemStackSet(); + refinedProducts.addAll(getAllProductsAndFluids(allProducts)); if (refinedProducts.size() > 0) { - y = this.getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts); + y = getRefined(I18N.localise("genetics.gui.analyst.fruit.refined"), y, refinedProducts); y += 8; } if (products.size() == 0 && specialties.size() == 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.noFruits")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.noFruits")).setColor(getColor()); y += 28; } - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.fruit.possible")).setColor(getColor()); y += 12; - final Collection fruitAlleles = Binnie.GENETICS.getChromosomeMap(Binnie.GENETICS.getTreeRoot()).get(EnumTreeChromosome.FRUITS); - for (final IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) { - final Collection stacks = new UniqueItemStackSet(); - for (final IAllele a : fruitAlleles) { + Collection fruitAlleles = Binnie.GENETICS.getChromosomeMap(Binnie.GENETICS.getTreeRoot()).get(EnumTreeChromosome.FRUITS); + for (IFruitFamily fam : ind.getGenome().getPrimary().getSuitableFruit()) { + Collection stacks = new UniqueItemStackSet(); + for (IAllele a : fruitAlleles) { if (((IAlleleFruit) a).getProvider().getFamily() == fam) { stacks.addAll(((IAlleleFruit) a).getProvider().getProducts().keySet()); stacks.addAll(((IAlleleFruit) a).getProvider().getSpecialty().keySet()); @@ -107,8 +107,8 @@ public class AnalystPageFruit extends AnalystPageProduce { if (!(((IAlleleFruit) a).getProvider() instanceof FruitProviderPod)) { continue; } - final FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider(); - final Field field = FruitProviderPod.class.getDeclaredField("drops"); + FruitProviderPod pod2 = (FruitProviderPod) ((IAlleleFruit) a).getProvider(); + Field field = FruitProviderPod.class.getDeclaredField("drops"); field.setAccessible(true); Collections.addAll(stacks, ((Map) field.get(pod2)).keySet().toArray(new ItemStack[0])); } @@ -117,10 +117,10 @@ public class AnalystPageFruit extends AnalystPageProduce { } } } - y = this.getRefined(TextFormatting.ITALIC + fam.getName(), y, stacks); + y = getRefined(TextFormatting.ITALIC + fam.getName(), y, stacks); y += 2; } - this.setSize(new Point(this.width(), y + 8)); + setSize(new Point(width(), y + 8)); } @Override diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java index 4094667e..04cd9277 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageGrowth.java @@ -15,23 +15,23 @@ import binnie.core.util.I18N; import binnie.genetics.gui.ControlAnalystPage; public class AnalystPageGrowth extends ControlAnalystPage { - public AnalystPageGrowth(final IWidget parent, final Area area, final IIndividual ind) { + public AnalystPageGrowth(IWidget parent, Area area, IIndividual ind) { super(parent, area); - this.setColour(3355443); + setColor(3355443); int y = 4; - final IAlleleSpecies species = ind.getGenome().getPrimary(); - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + IAlleleSpecies species = ind.getGenome().getPrimary(); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; if (ind instanceof ITree) { - final ITree tree = (ITree) ind; - final int mat = tree.getGenome().getMaturationTime(); - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature")).setColour(this.getColour()); + ITree tree = (ITree) ind; + int mat = tree.getGenome().getMaturationTime(); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.growth.mature")).setColor(getColor()); y += 12; - new ControlTextCentered(this, y, TextFormatting.BOLD + this.getTimeString(Math.round(1373.3999f * mat))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.BOLD + getTimeString(Math.round(1373.3999f * mat))).setColor(getColor()); y += 22; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.height") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.HEIGHT, ind.getGenome().getActiveAllele(EnumTreeChromosome.HEIGHT))).setColor(getColor()); y += 12; - new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.ITALIC + I18N.localise("genetics.gui.analyst.growth.girth") + ": " + Binnie.GENETICS.treeBreedingSystem.getAlleleName(EnumTreeChromosome.GIRTH, ind.getGenome().getActiveAllele(EnumTreeChromosome.GIRTH))).setColor(getColor()); } } diff --git a/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java b/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java index 06e87f5c..c7eb6830 100644 --- a/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java +++ b/src/main/java/binnie/genetics/gui/tree/AnalystPageWood.java @@ -27,12 +27,12 @@ import binnie.genetics.item.ModuleItems; @SideOnly(Side.CLIENT) public class AnalystPageWood extends AnalystPageProduce { - public AnalystPageWood(final IWidget parent, final Area area, final ITree ind) { + public AnalystPageWood(IWidget parent, Area area, ITree ind) { super(parent, area); - this.setColour(6697728); - final ITreeGenome genome = ind.getGenome(); + setColor(6697728); + ITreeGenome genome = ind.getGenome(); int y = 4; - new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColour(this.getColour()); + new ControlTextCentered(this, y, TextFormatting.UNDERLINE + getTitle()).setColor(getColor()); y += 12; if (((IAlleleBoolean) ind.getGenome().getActiveAllele(EnumTreeChromosome.FIREPROOF)).getValue()) { new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconNoFire).addTooltip(I18N.localise("genetics.gui.analyst.wood.fireproof")); @@ -40,39 +40,39 @@ public class AnalystPageWood extends AnalystPageProduce { new ControlIconDisplay(this, (width() - 16) / 2, y, ModuleItems.iconFire).addTooltip(I18N.localise("genetics.gui.analyst.wood.flammable")); } y += 30; - final Collection products = new UniqueItemStackSet(); + Collection products = new UniqueItemStackSet(); - final IAlleleTreeSpecies treeSpecies = genome.getPrimary(); - final ItemStack stackWood = treeSpecies.getWoodProvider().getWoodStack(); + IAlleleTreeSpecies treeSpecies = genome.getPrimary(); + ItemStack stackWood = treeSpecies.getWoodProvider().getWoodStack(); if (!stackWood.isEmpty()) { products.add(stackWood); } products.addAll(ind.getGenome().getFruitProvider().getProducts().keySet()); if (products.size() > 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.logs")).setColor(getColor()); y += 10; - final int w = products.size() * 18 - 2; - final int i = 0; - for (final ItemStack stack : products) { - final ControlItemDisplay d = new ControlItemDisplay(this, (this.width() - w) / 2 + 18 * i, y); + int w = products.size() * 18 - 2; + int i = 0; + for (ItemStack stack : products) { + ControlItemDisplay d = new ControlItemDisplay(this, (width() - w) / 2 + 18 * i, y); d.setTooltip(); d.setItemStack(stack); } y += 26; } - final Collection allProducts = new UniqueItemStackSet(); + Collection allProducts = new UniqueItemStackSet(); allProducts.addAll(products); - final Collection refinedProducts = new UniqueItemStackSet(); - refinedProducts.addAll(this.getAllProductsAndFluids(allProducts)); + Collection refinedProducts = new UniqueItemStackSet(); + refinedProducts.addAll(getAllProductsAndFluids(allProducts)); if (refinedProducts.size() > 0) { - y = this.getRefined(I18N.localise("genetics.gui.analyst.wood.refined"), y, refinedProducts); + y = getRefined(I18N.localise("genetics.gui.analyst.wood.refined"), y, refinedProducts); y += 8; } if (products.size() == 0) { - new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")).setColour(this.getColour()); + new ControlTextCentered(this, y, I18N.localise("genetics.gui.analyst.wood.noFruits")).setColor(getColor()); y += 28; } - this.setSize(new Point(this.width(), y + 8)); + setSize(new Point(width(), y + 8)); } @Override diff --git a/src/main/java/binnie/genetics/item/ItemAnalyst.java b/src/main/java/binnie/genetics/item/ItemAnalyst.java index e2014e7b..9477bcf4 100644 --- a/src/main/java/binnie/genetics/item/ItemAnalyst.java +++ b/src/main/java/binnie/genetics/item/ItemAnalyst.java @@ -27,7 +27,7 @@ public class ItemAnalyst extends ItemCore { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - Genetics.proxy.openGui(GeneticsGUI.Analyst, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.ANALYST, playerIn, playerIn.getPosition()); return super.onItemRightClick(worldIn, playerIn, handIn); } diff --git a/src/main/java/binnie/genetics/item/ItemBeeDictionary.java b/src/main/java/binnie/genetics/item/ItemBeeDictionary.java index 19a04fb0..3aa61658 100644 --- a/src/main/java/binnie/genetics/item/ItemBeeDictionary.java +++ b/src/main/java/binnie/genetics/item/ItemBeeDictionary.java @@ -56,9 +56,9 @@ public class ItemBeeDictionary extends Item implements IItemModelRegister { final ItemStack itemStack = playerIn.getHeldItem(handIn); final GeneticsGUI id; if (itemStack.getItemDamage() == 0) { - id = GeneticsGUI.BeeDatabase; + id = GeneticsGUI.BEE_DATABASE; } else { - id = GeneticsGUI.BeeDatabaseNEI; + id = GeneticsGUI.BEE_DATABASE_NEI; } Genetics.proxy.openGui(id, playerIn, playerIn.getPosition()); diff --git a/src/main/java/binnie/genetics/item/ItemDatabase.java b/src/main/java/binnie/genetics/item/ItemDatabase.java index 387b2042..3faae161 100644 --- a/src/main/java/binnie/genetics/item/ItemDatabase.java +++ b/src/main/java/binnie/genetics/item/ItemDatabase.java @@ -48,9 +48,9 @@ public class ItemDatabase extends ItemCore { ItemStack itemStack = player.getHeldItem(hand); final GeneticsGUI id; if (isMaster(itemStack)) { - id = GeneticsGUI.DatabaseNEI; + id = GeneticsGUI.DATABASE_NEI; } else { - id = GeneticsGUI.Database; + id = GeneticsGUI.DATABASE; } Genetics.proxy.openGui(id, player, player.getPosition()); diff --git a/src/main/java/binnie/genetics/item/ItemGene.java b/src/main/java/binnie/genetics/item/ItemGene.java index f1886ef6..6d10c2f3 100644 --- a/src/main/java/binnie/genetics/item/ItemGene.java +++ b/src/main/java/binnie/genetics/item/ItemGene.java @@ -65,7 +65,7 @@ public abstract class ItemGene extends ItemCore implements IColoredItem { public int getColorFromItemstack(ItemStack stack, int tintIndex) { IGeneItem gene = this.getGeneItem(stack); if (gene != null) { - return gene.getColour(tintIndex); + return gene.getColor(tintIndex); } return 16777215; } diff --git a/src/main/java/binnie/genetics/item/ItemMasterRegistry.java b/src/main/java/binnie/genetics/item/ItemMasterRegistry.java index fbb7767b..dcb6cf41 100644 --- a/src/main/java/binnie/genetics/item/ItemMasterRegistry.java +++ b/src/main/java/binnie/genetics/item/ItemMasterRegistry.java @@ -27,7 +27,7 @@ public class ItemMasterRegistry extends ItemCore { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - Genetics.proxy.openGui(GeneticsGUI.MasterRegistry, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.MASTER_REGISTRY, playerIn, playerIn.getPosition()); return super.onItemRightClick(worldIn, playerIn, handIn); } diff --git a/src/main/java/binnie/genetics/item/ItemPunnettSquare.java b/src/main/java/binnie/genetics/item/ItemPunnettSquare.java index 0f091a1e..296413b0 100644 --- a/src/main/java/binnie/genetics/item/ItemPunnettSquare.java +++ b/src/main/java/binnie/genetics/item/ItemPunnettSquare.java @@ -28,7 +28,7 @@ public class ItemPunnettSquare extends Item { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (handIn == EnumHand.MAIN_HAND) { - Genetics.proxy.openGui(GeneticsGUI.PunnettSquare, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.PUNNETT_SQUARE, playerIn, playerIn.getPosition()); } ItemStack itemStack = playerIn.getHeldItem(handIn); return new ActionResult<>(EnumActionResult.PASS, itemStack); diff --git a/src/main/java/binnie/genetics/item/ItemRegistry.java b/src/main/java/binnie/genetics/item/ItemRegistry.java index b19c26c9..8c763924 100644 --- a/src/main/java/binnie/genetics/item/ItemRegistry.java +++ b/src/main/java/binnie/genetics/item/ItemRegistry.java @@ -27,7 +27,7 @@ public class ItemRegistry extends ItemCore { @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - Genetics.proxy.openGui(GeneticsGUI.Registry, playerIn, playerIn.getPosition()); + Genetics.proxy.openGui(GeneticsGUI.REGISTRY, playerIn, playerIn.getPosition()); return super.onItemRightClick(worldIn, playerIn, handIn); } diff --git a/src/main/java/binnie/genetics/item/ItemSequence.java b/src/main/java/binnie/genetics/item/ItemSequence.java index 8dd49ede..fb85aac7 100644 --- a/src/main/java/binnie/genetics/item/ItemSequence.java +++ b/src/main/java/binnie/genetics/item/ItemSequence.java @@ -111,18 +111,18 @@ public class ItemSequence extends ItemCore implements IItemAnalysable, IItemChar } @Override - public int getCharges(final ItemStack itemStack) { - return itemStack.getMaxDamage() - itemStack.getItemDamage(); + public int getCharges(final ItemStack stack) { + return stack.getMaxDamage() - stack.getItemDamage(); } @Override - public int getMaxCharges(ItemStack itemStack) { - return itemStack.getMaxDamage(); + public int getMaxCharges(ItemStack stack) { + return stack.getMaxDamage(); } @Override - public ISpeciesRoot getSpeciesRoot(ItemStack itemStack) { - final SequencerItem seq = SequencerItem.create(itemStack); + public ISpeciesRoot getSpeciesRoot(ItemStack stack) { + final SequencerItem seq = SequencerItem.create(stack); Preconditions.checkNotNull(seq, "Cannot getSpeciesRoot from itemstack that is not a valid item sequence"); return seq.getSpeciesRoot(); } diff --git a/src/main/java/binnie/genetics/item/ItemSerum.java b/src/main/java/binnie/genetics/item/ItemSerum.java index a5d188b3..c3d58925 100644 --- a/src/main/java/binnie/genetics/item/ItemSerum.java +++ b/src/main/java/binnie/genetics/item/ItemSerum.java @@ -44,13 +44,13 @@ public class ItemSerum extends ItemGene implements IItemSerum { } @Override - public int getCharges(ItemStack itemStack) { - return itemStack.getMaxDamage() - itemStack.getItemDamage(); + public int getCharges(ItemStack stack) { + return stack.getMaxDamage() - stack.getItemDamage(); } @Override - public int getMaxCharges(ItemStack itemStack) { - return itemStack.getMaxDamage(); + public int getMaxCharges(ItemStack stack) { + return stack.getMaxDamage(); } @SideOnly(Side.CLIENT) @@ -72,15 +72,15 @@ public class ItemSerum extends ItemGene implements IItemSerum { } @Override - public IGene[] getGenes(ItemStack itemStack) { - GeneItem geneItem = this.getGeneItem(itemStack); + public IGene[] getGenes(ItemStack stack) { + GeneItem geneItem = this.getGeneItem(stack); Preconditions.checkNotNull(geneItem, "Cannot get genes from itemStack that is not a valid serum."); return new IGene[]{geneItem.getGene()}; } @Override - public ISpeciesRoot getSpeciesRoot(ItemStack itemStack) { - GeneItem geneItem = this.getGeneItem(itemStack); + public ISpeciesRoot getSpeciesRoot(ItemStack stack) { + GeneItem geneItem = this.getGeneItem(stack); Preconditions.checkNotNull(geneItem, "Cannot get species root from itemStack that is not a valid serum."); return geneItem.getSpeciesRoot(); } diff --git a/src/main/java/binnie/genetics/item/ItemSerumArray.java b/src/main/java/binnie/genetics/item/ItemSerumArray.java index fa155e34..eb9cf26e 100644 --- a/src/main/java/binnie/genetics/item/ItemSerumArray.java +++ b/src/main/java/binnie/genetics/item/ItemSerumArray.java @@ -44,13 +44,13 @@ public class ItemSerumArray extends ItemGene implements IItemSerum { } @Override - public int getCharges(final ItemStack itemStack) { - return itemStack.getMaxDamage() - itemStack.getItemDamage(); + public int getCharges(final ItemStack stack) { + return stack.getMaxDamage() - stack.getItemDamage(); } @Override - public int getMaxCharges(ItemStack itemStack) { - return itemStack.getMaxDamage(); + public int getMaxCharges(ItemStack stack) { + return stack.getMaxDamage(); } @Override diff --git a/src/main/java/binnie/genetics/machine/LaboratoryMachine.java b/src/main/java/binnie/genetics/machine/LaboratoryMachine.java index f2f569fd..1ad48c6e 100644 --- a/src/main/java/binnie/genetics/machine/LaboratoryMachine.java +++ b/src/main/java/binnie/genetics/machine/LaboratoryMachine.java @@ -53,7 +53,7 @@ public enum LaboratoryMachine implements IMachineType { public static class PackageLabMachine extends GeneticMachine.PackageGeneticBase { public PackageLabMachine() { - super("lab_machine", GeneticsTexture.LabMachine, 16777215, false); + super("lab_machine", GeneticsTexture.LAB_MACHINE, 16777215, false); } @Override diff --git a/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java b/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java index 09782015..653fc726 100644 --- a/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java +++ b/src/main/java/binnie/genetics/machine/acclimatiser/PackageAcclimatiser.java @@ -18,12 +18,12 @@ import binnie.genetics.machine.GeneticMachine; public class PackageAcclimatiser extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageAcclimatiser() { - super("acclimatiser", GeneticsTexture.Acclimatiser, 9857609, true); + super("acclimatiser", GeneticsTexture.ACCLIMATISER, 9857609, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Acclimatiser); + new ComponentGeneticGUI(machine, GeneticsGUI.ACCLIMATISER); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotTarget = inventory.addSlot(Acclimatiser.SLOT_TARGET, "process"); slotTarget.setValidator(new SlotValidator.Individual()); diff --git a/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java b/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java index 9596e72e..ba2efab6 100644 --- a/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java +++ b/src/main/java/binnie/genetics/machine/acclimatiser/WindowAcclimatiser.java @@ -22,8 +22,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowAcclimatiser extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(0, 64, 64, 64, GeneticsTexture.GUI_PROCESS_3); public WindowAcclimatiser(final EntityPlayer player, final IInventory inventory, final Side side) { super(280, 198, player, inventory, side); diff --git a/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java b/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java index 7520b461..72540238 100644 --- a/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java +++ b/src/main/java/binnie/genetics/machine/analyser/PackageAnalyser.java @@ -21,12 +21,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageAnalyser extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageAnalyser() { - super("analyser", GeneticsTexture.Analyser, 9961727, true); + super("analyser", GeneticsTexture.ANALYSER, 9961727, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Analyser); + new ComponentGeneticGUI(machine, GeneticsGUI.ANALYSER); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); for (InventorySlot slot : inventory.addSlotArray(Analyser.SLOT_RESERVE, "input")) { slot.setValidator(new SlotValidatorUnanalysed()); diff --git a/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java b/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java index 6915ec91..efbefdd9 100644 --- a/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java +++ b/src/main/java/binnie/genetics/machine/analyser/WindowAnalyser.java @@ -27,8 +27,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowAnalyser extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUI_PROCESS_3); public WindowAnalyser(final EntityPlayer player, final IInventory inventory, final Side side) { super(220, 210, player, inventory, side); @@ -38,14 +38,14 @@ public class WindowAnalyser extends WindowMachine { @SideOnly(Side.CLIENT) public void initialiseClient() { super.initialiseClient(); - WindowAnalyser.ProgressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUIProcess); - WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUIProcess); + WindowAnalyser.ProgressBase = new StandardTexture(0, 51, 66, 40, GeneticsTexture.GUI_PROCESS); + WindowAnalyser.Progress = new StandardTexture(66, 51, 66, 40, GeneticsTexture.GUI_PROCESS); int x = 16; final int y = 32; new ControlSlotArray.Builder(this, x, y, 2, 3).create(Analyser.SLOT_RESERVE); x += 28; new ControlSlot.Builder(this, x, y + 54 + 8).assign(13); - new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColour(10040319); + new ControlSlotCharge(this, x + 20, y + 54 + 8, 13).setColor(10040319); new ControlEnergyBar(this, x + 24 + 16, y + 54 + 8 + 1, 60, 16, Position.LEFT); new ControlErrorState(this, x + 24 + 16 + 60 + 16, y + 54 + 8 + 1); x -= 28; diff --git a/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java b/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java index ed0148d5..51e5fe13 100644 --- a/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java +++ b/src/main/java/binnie/genetics/machine/genepool/PackageGenepool.java @@ -28,12 +28,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageGenepool extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageGenepool() { - super("genepool", GeneticsTexture.Genepool, 12661942, true); + super("genepool", GeneticsTexture.GENEPOOL, 12661942, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Genepool); + new ComponentGeneticGUI(machine, GeneticsGUI.GENEPOOL); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotEnzyme = inventory.addSlot(Genepool.SLOT_ENZYME, "enzyme"); slotEnzyme.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.spriteEnzyme)); diff --git a/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java b/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java index 7aa9dce8..ee645600 100644 --- a/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java +++ b/src/main/java/binnie/genetics/machine/genepool/WindowGenepool.java @@ -26,8 +26,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowGenepool extends WindowMachine { - static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(64, 21, 130, 21, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(64, 0, 130, 21, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(64, 21, 130, 21, GeneticsTexture.GUI_PROCESS_3); public WindowGenepool(final EntityPlayer player, final IInventory inventory, final Side side) { super(280, 198, player, inventory, side); @@ -52,7 +52,7 @@ public class WindowGenepool extends WindowMachine { new ControlLiquidTank(this, x, y).setTankID(0); new ControlEnergyBar(this, 21, 115, 16, 60, Position.BOTTOM); new ControlSlot.Builder(this, 121, 82).assign(7); - new ControlSlotCharge(this, 143, 82, 7).setColour(15722671); + new ControlSlotCharge(this, 143, 82, 7).setColor(15722671); new ControlErrorState(this, 181, 83); new ControlPlayerInventory(this); } diff --git a/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java b/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java index 81d9de83..8af3ffc5 100644 --- a/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java +++ b/src/main/java/binnie/genetics/machine/incubator/PackageIncubator.java @@ -16,12 +16,12 @@ import binnie.genetics.machine.GeneticMachine; public class PackageIncubator extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageIncubator() { - super("incubator", GeneticsTexture.Incubator, 16767313, true); + super("incubator", GeneticsTexture.INCUBATOR, 16767313, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Incubator); + new ComponentGeneticGUI(machine, GeneticsGUI.INCUBATOR); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); for (InventorySlot slot : inventory.addSlotArray(Incubator.SLOT_QUEUE, "input")) { slot.forbidExtraction(); diff --git a/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java b/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java index dbcdbf12..58dc2cb5 100644 --- a/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java +++ b/src/main/java/binnie/genetics/machine/incubator/WindowIncubator.java @@ -25,8 +25,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowIncubator extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUIProcess); - static Texture Progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUIProcess); + static Texture ProgressBase = new StandardTexture(0, 91, 38, 32, GeneticsTexture.GUI_PROCESS); + static Texture Progress = new StandardTexture(38, 91, 38, 32, GeneticsTexture.GUI_PROCESS); public WindowIncubator(final EntityPlayer player, final IInventory inventory, final Side side) { super(228, 196, player, inventory, side); diff --git a/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java b/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java index 273af27c..95c0e948 100644 --- a/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java +++ b/src/main/java/binnie/genetics/machine/inoculator/PackageInoculator.java @@ -28,12 +28,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageInoculator extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageInoculator() { - super("inoculator", GeneticsTexture.Inoculator, 14819893, true); + super("inoculator", GeneticsTexture.INOCULATOR, 14819893, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Inoculator); + new ComponentGeneticGUI(machine, GeneticsGUI.INOCULATOR); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotSerumVial = inventory.addSlot(Inoculator.SLOT_SERUM_VIAL, "serum.active"); slotSerumVial.forbidInteraction(); diff --git a/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java b/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java index f27fbe3f..bfb9a1d8 100644 --- a/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java +++ b/src/main/java/binnie/genetics/machine/inoculator/WindowInoculator.java @@ -27,8 +27,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowInoculator extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2); - static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2); + static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUI_PROCESS_2); + static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUI_PROCESS_2); public WindowInoculator(final EntityPlayer player, final IInventory inventory, final Side side) { super(266, 240, player, inventory, side); diff --git a/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java b/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java index e5e1750f..bcd3b73e 100644 --- a/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java +++ b/src/main/java/binnie/genetics/machine/isolator/PackageIsolator.java @@ -29,12 +29,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageIsolator extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageIsolator() { - super("isolator", GeneticsTexture.Isolator, 16740111, true); + super("isolator", GeneticsTexture.ISOLATOR, 16740111, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Isolator); + new ComponentGeneticGUI(machine, GeneticsGUI.ISOLATOR); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotEnzyme = inventory.addSlot(Isolator.SLOT_ENZYME, "enzyme"); slotEnzyme.setValidator(new SlotValidator.Item(GeneticsItems.Enzyme.get(1), ModuleMachine.spriteEnzyme)); diff --git a/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java b/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java index 527b17ff..7dc329e7 100644 --- a/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java +++ b/src/main/java/binnie/genetics/machine/isolator/WindowIsolator.java @@ -26,8 +26,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowIsolator extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(0, 218, 142, 17, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(0, 201, 142, 17, GeneticsTexture.GUI_PROCESS_3); public WindowIsolator(final EntityPlayer player, final IInventory inventory, final Side side) { super(330, 208, player, inventory, side); @@ -47,7 +47,7 @@ public class WindowIsolator extends WindowMachine { x += 18; new ControlSlot.Builder(this, x, y + 3).assign(5); new ControlSlot.Builder(this, x, y + 36 + 3).assign(0); - new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColour(15722671); + new ControlSlotCharge(this, x + 18 + 2, y + 36 + 3, 0).setColor(15722671); x += 18; new ControlProgress(this, x, y + 3, WindowIsolator.ProgressBase, WindowIsolator.Progress, Position.LEFT); x += 142; diff --git a/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java b/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java index ab84487e..9583e12b 100644 --- a/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java +++ b/src/main/java/binnie/genetics/machine/polymeriser/PackagePolymeriser.java @@ -27,12 +27,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackagePolymeriser extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackagePolymeriser() { - super("polymeriser", GeneticsTexture.Polymeriser, 58819, true); + super("polymeriser", GeneticsTexture.POLYMERISER, 58819, true); } @Override public void createMachine(Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Replicator); + new ComponentGeneticGUI(machine, GeneticsGUI.POLYMERISER); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); //Slot Gold InventorySlot slotGold = inventory.addSlot(Polymeriser.SLOT_GOLD, "catalyst"); diff --git a/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java b/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java index 61568bf3..89dc3f49 100644 --- a/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java +++ b/src/main/java/binnie/genetics/machine/polymeriser/WindowPolymeriser.java @@ -26,8 +26,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowPolymeriser extends WindowMachine { - static Texture ProgressBase = new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUIProcess); - static Texture Progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUIProcess); + static Texture ProgressBase = new StandardTexture(76, 170, 160, 79, GeneticsTexture.GUI_PROCESS); + static Texture Progress = new StandardTexture(76, 91, 160, 79, GeneticsTexture.GUI_PROCESS); public WindowPolymeriser(final EntityPlayer player, final IInventory inventory, final Side side) { super(278, 212, player, inventory, side); @@ -49,7 +49,7 @@ public class WindowPolymeriser extends WindowMachine { new ControlEnergyBar(this, x + 120, 96, 64, 16, Position.LEFT); x += 40; new ControlSlot.Builder(this, x + 30, y + 18 + 8).assign(1); - new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColour(16766976); + new ControlSlotCharge(this, x + 30 + 20, y + 18 + 8, 1).setColor(16766976); x += 138; new ControlSlotArray.Builder(this, x, y + 9, 2, 2).create(Polymeriser.SLOT_SERUM_FINISHED); final ControlErrorState errorState = new ControlErrorState(this, 244, 97); diff --git a/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java b/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java index df9f601d..b6223884 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java +++ b/src/main/java/binnie/genetics/machine/sequencer/PackageSequencer.java @@ -22,7 +22,7 @@ import binnie.genetics.machine.ModuleMachine; public class PackageSequencer extends GeneticMachine.PackageGeneticBase implements IMachineInformation { public PackageSequencer() { - super("sequencer", GeneticsTexture.Sequencer, 12058418, true); + super("sequencer", GeneticsTexture.SEQUENCER, 12058418, true); Sequencer.fxSeqA = Binnie.RESOURCE.getBlockSprite(Genetics.instance, "fx/sequencer.a"); Sequencer.fxSeqG = Binnie.RESOURCE.getBlockSprite(Genetics.instance, "fx/sequencer.g"); Sequencer.fxSeqT = Binnie.RESOURCE.getBlockSprite(Genetics.instance, "fx/sequencer.t"); @@ -31,7 +31,7 @@ public class PackageSequencer extends GeneticMachine.PackageGeneticBase implemen @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Sequencer); + new ComponentGeneticGUI(machine, GeneticsGUI.SEQUENCER); ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotDye = inventory.addSlot(Sequencer.SLOT_DYE, "dye"); slotDye.setValidator(new SlotValidator.Item(GeneticsItems.FluorescentDye.get(1), ModuleMachine.spriteDye)); diff --git a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java index 214d6e19..531fa03e 100644 --- a/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java +++ b/src/main/java/binnie/genetics/machine/sequencer/WindowSequencer.java @@ -30,8 +30,8 @@ import binnie.genetics.core.GeneticsTexture; import binnie.genetics.machine.craftgui.WindowMachine; public class WindowSequencer extends WindowMachine { - static Texture ProgressBase = new StandardTexture(64, 114, 98, 9, GeneticsTexture.GUIProcess3); - static Texture Progress = new StandardTexture(64, 123, 98, 9, GeneticsTexture.GUIProcess3); + static Texture ProgressBase = new StandardTexture(64, 114, 98, 9, GeneticsTexture.GUI_PROCESS_3); + static Texture Progress = new StandardTexture(64, 123, 98, 9, GeneticsTexture.GUI_PROCESS_3); ControlText slotText; public WindowSequencer(final EntityPlayer player, final IInventory inventory, final Side side) { @@ -67,7 +67,7 @@ public class WindowSequencer extends WindowMachine { y += 20; final ControlSlot slotDye = new ControlSlot.Builder(this, x, y).assign(0); x += 20; - new ControlSlotCharge(this, x, y, 0).setColour(16750848); + new ControlSlotCharge(this, x, y, 0).setColor(16750848); x += 32; new ControlEnergyBar(this, x, y, 60, 16, Position.LEFT); x += 92; diff --git a/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java b/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java index 2c27ffc8..22fd2287 100644 --- a/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/PackageSplicer.java @@ -24,12 +24,12 @@ import binnie.genetics.machine.ModuleMachine; public class PackageSplicer extends AdvGeneticMachine.PackageAdvGeneticBase implements IMachineInformation { public PackageSplicer() { - super("splicer", GeneticsTexture.Splicer, 14819893, true); + super("splicer", GeneticsTexture.SPLICER, 14819893, true); } @Override public void createMachine(final Machine machine) { - new ComponentGeneticGUI(machine, GeneticsGUI.Splicer); + new ComponentGeneticGUI(machine, GeneticsGUI.SPLICER); final ComponentInventorySlots inventory = new ComponentInventorySlots(machine); InventorySlot slotSerumVial = inventory.addSlot(Splicer.SLOT_SERUM_VIAL, "serum.active"); slotSerumVial.forbidInteraction(); diff --git a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java index 91702b58..75a3d94f 100644 --- a/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java +++ b/src/main/java/binnie/genetics/machine/splicer/WindowSplicer.java @@ -26,8 +26,8 @@ import binnie.genetics.machine.craftgui.WindowMachine; import binnie.genetics.machine.inoculator.Inoculator; public class WindowSplicer extends WindowMachine { - static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUIProcess2); - static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUIProcess2); + static Texture ProgressBase = new StandardTexture(0, 72, 142, 72, GeneticsTexture.GUI_PROCESS_2); + static Texture Progress = new StandardTexture(0, 0, 142, 72, GeneticsTexture.GUI_PROCESS_2); public WindowSplicer(final EntityPlayer player, final IInventory inventory, final Side side) { super(280, 240, player, inventory, side); diff --git a/src/main/resources/assets/genetics/lang/en_US.lang b/src/main/resources/assets/genetics/lang/en_US.lang index a2d70b09..50246550 100644 --- a/src/main/resources/assets/genetics/lang/en_US.lang +++ b/src/main/resources/assets/genetics/lang/en_US.lang @@ -53,6 +53,7 @@ genetics.errors.genepool.insufficient.ethanol.desc=Insufficient Ethanol genetics.errors.genepool.insufficient.enzyme.desc=Insufficient Enzyme genetics.machine.lab_machine.lab_machine=Lab Stand +genetics.machine.lab_machine.lab_machine.info= genetics.machine.lab_machine.analyser=Analyser genetics.machine.lab_machine.analyser.info=The Analyser takes breedable individuals and DNA sequencers and analyses them to determine the genes present. This requires DNA Dye, created from purple dye and glowstone