mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-28 16:06:04 +00:00
Some reformat code for 1.11.2 source (#84)
* Optimized imports * Some code reformat * Some refactoring and code reformat * Some code reformat
This commit is contained in:
1 parent
886c36a308
commit
c3809fbc27
508 files changed
+6677
-6238
No files matched your search
@@ -10,24 +10,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public abstract class AbstractAlvearyContainer extends Container {
|
||||
|
||||
public AbstractAlvearyContainer(EntityPlayer player, IItemHandlerModifiable inv, EnumAlvearyLogicType type, Dimension dimension){
|
||||
this.player = player;
|
||||
this.inv = inv;
|
||||
this.dimension = dimension;
|
||||
String base = "extrabees.machine.alveay."+type.getName();
|
||||
title = ExtraBees.proxy.localise(base+".name");
|
||||
tooltip = ExtraBees.proxy.localise(base+".info");
|
||||
background = new ExtraBeesResourceLocation("textures/gui/gui"+ type.getName()+".png");
|
||||
setupContainer();
|
||||
}
|
||||
|
||||
protected static final Dimension DEFAULT_DIMENSION = new Dimension(176, 144);
|
||||
public final Dimension dimension;
|
||||
protected final EntityPlayer player;
|
||||
@@ -36,9 +22,20 @@ public abstract class AbstractAlvearyContainer extends Container {
|
||||
protected int offset = 0;
|
||||
protected String tooltip, title;
|
||||
|
||||
public AbstractAlvearyContainer(EntityPlayer player, IItemHandlerModifiable inv, EnumAlvearyLogicType type, Dimension dimension) {
|
||||
this.player = player;
|
||||
this.inv = inv;
|
||||
this.dimension = dimension;
|
||||
String base = "extrabees.machine.alveay." + type.getName();
|
||||
title = ExtraBees.proxy.localise(base + ".name");
|
||||
tooltip = ExtraBees.proxy.localise(base + ".info");
|
||||
background = new ExtraBeesResourceLocation("textures/gui/gui" + type.getName() + ".png");
|
||||
setupContainer();
|
||||
}
|
||||
|
||||
protected abstract void setupContainer();
|
||||
|
||||
protected final void addPlayerInventory(){
|
||||
protected final void addPlayerInventory() {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, (84 + this.offset) + i * 18));
|
||||
@@ -54,5 +51,4 @@ public abstract class AbstractAlvearyContainer extends Container {
|
||||
public boolean canInteractWith(@Nonnull EntityPlayer playerIn) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,9 +5,6 @@ import binnie.extrabees.alveary.EnumAlvearyLogicType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerFrameHousing extends AbstractAlvearyContainer {
|
||||
|
||||
public ContainerFrameHousing(EntityPlayer player, AlvearyLogicFrameHousing logic) {
|
||||
@@ -20,5 +17,4 @@ public class ContainerFrameHousing extends AbstractAlvearyContainer {
|
||||
addPlayerInventory();
|
||||
addSlotToContainer(new SlotItemHandler(inv, 0, 80, 37));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,9 +5,6 @@ import binnie.extrabees.alveary.EnumAlvearyLogicType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerHatchery extends AbstractAlvearyContainer {
|
||||
|
||||
public ContainerHatchery(EntityPlayer player, AlvearyLogicHatchery logic) {
|
||||
@@ -22,5 +19,4 @@ public class ContainerHatchery extends AbstractAlvearyContainer {
|
||||
addSlotToContainer(new SlotItemHandler(inv, i, 44 + i * 18, 37));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,11 +5,8 @@ import binnie.extrabees.alveary.EnumAlvearyLogicType;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Dimension;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerMutator extends AbstractAlvearyContainer {
|
||||
|
||||
public ContainerMutator(EntityPlayer player, AlvearyLogicMutator logic) {
|
||||
@@ -21,5 +18,4 @@ public class ContainerMutator extends AbstractAlvearyContainer {
|
||||
addPlayerInventory();
|
||||
addSlotToContainer(new SlotItemHandler(inv, 0, 81, 29));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,25 +7,22 @@ import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraftforge.energy.IEnergyStorage;
|
||||
import net.minecraftforge.items.SlotItemHandler;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class ContainerStimulator extends AbstractAlvearyContainer {
|
||||
|
||||
private final AlvearyLogicStimulator logic;
|
||||
private final IEnergyStorage storage;
|
||||
protected int power, maxPower;
|
||||
|
||||
public ContainerStimulator(EntityPlayer player, AlvearyLogicStimulator logic) {
|
||||
super(player, logic.getInventory(), EnumAlvearyLogicType.STIMULATOR, DEFAULT_DIMENSION);
|
||||
this.storage = logic.getEnergyStorage();
|
||||
this.logic = logic;
|
||||
this.maxPower = storage.getMaxEnergyStored();
|
||||
if (!player.world.isRemote){
|
||||
if (!player.world.isRemote) {
|
||||
logic.onContainerOpened(this);
|
||||
}
|
||||
}
|
||||
|
||||
private final AlvearyLogicStimulator logic;
|
||||
private final IEnergyStorage storage;
|
||||
protected int power, maxPower;
|
||||
|
||||
@Override
|
||||
protected void setupContainer() {
|
||||
offset = -21;
|
||||
@@ -34,9 +31,9 @@ public class ContainerStimulator extends AbstractAlvearyContainer {
|
||||
addSlotToContainer(new SlotItemHandler(inv, 0, 44, 37));
|
||||
}
|
||||
|
||||
public void checkPower(){
|
||||
if (power != storage.getEnergyStored()){
|
||||
for (IContainerListener listener : listeners){
|
||||
public void checkPower() {
|
||||
if (power != storage.getEnergyStored()) {
|
||||
for (IContainerListener listener : listeners) {
|
||||
listener.sendProgressBarUpdate(this, 9, power = storage.getEnergyStored());
|
||||
}
|
||||
}
|
||||
@@ -50,9 +47,8 @@ public class ContainerStimulator extends AbstractAlvearyContainer {
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int id, int data) {
|
||||
if (id == 9){
|
||||
if (id == 9) {
|
||||
power = data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,40 +8,35 @@ import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiContainerAlvearyPart extends GuiContainer {
|
||||
|
||||
@SuppressWarnings("all")
|
||||
protected FontRenderer font;
|
||||
protected AbstractAlvearyContainer container;
|
||||
private int titleS = -1;
|
||||
|
||||
public GuiContainerAlvearyPart(AbstractAlvearyContainer container) {
|
||||
super(container);
|
||||
this.container = container;
|
||||
font = Minecraft.getMinecraft().fontRendererObj;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
protected FontRenderer font;
|
||||
protected AbstractAlvearyContainer container;
|
||||
private int titleS = -1;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(container.background);
|
||||
if (titleS == -1){
|
||||
if (titleS == -1) {
|
||||
titleS = (i + (xSize / 2)) - (font.getStringWidth(container.title) / 2);
|
||||
}
|
||||
|
||||
drawTexturedModalRect(i, j, 0, 0, container.dimension.width, container.dimension.height);
|
||||
font.drawString(container.title, titleS, j + 8, Color.DARK_GRAY.getRGB());
|
||||
if (mouseX > i + 6 && mouseX < i + 23 && mouseY > j + 5 && mouseY < j + 22){
|
||||
if (mouseX > i + 6 && mouseX < i + 23 && mouseY > j + 5 && mouseY < j + 22) {
|
||||
GuiUtils.drawHoveringText(Lists.newArrayList(container.tooltip), mouseX, mouseY, width, height, 150, font);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,28 +5,25 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class GuiContainerMutator extends GuiContainerAlvearyPart {
|
||||
|
||||
private String mutagens;
|
||||
private int titleS = -1;
|
||||
|
||||
public GuiContainerMutator(AbstractAlvearyContainer container) {
|
||||
super(container);
|
||||
mutagens = "Possible Mutagens:";
|
||||
}
|
||||
|
||||
private String mutagens;
|
||||
private int titleS = -1;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
|
||||
int i = (this.width - this.xSize) / 2;
|
||||
int j = (this.height - this.ySize) / 2;
|
||||
int mid = i + (xSize / 2);
|
||||
if (titleS == -1){
|
||||
if (titleS == -1) {
|
||||
titleS = mid - (font.getStringWidth(mutagens) / 2);
|
||||
}
|
||||
font.drawString(mutagens, titleS, j + 50, Color.DARK_GRAY.getRGB());
|
||||
@@ -39,5 +36,4 @@ public class GuiContainerMutator extends GuiContainerAlvearyPart {
|
||||
q++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,18 +3,15 @@ package binnie.extrabees.client.gui;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
/**
|
||||
* Created by Elec332 on 13-5-2017.
|
||||
*/
|
||||
public class GuiContainerStimulator extends GuiContainerAlvearyPart {
|
||||
|
||||
private ContainerStimulator container;
|
||||
|
||||
public GuiContainerStimulator(ContainerStimulator container) {
|
||||
super(container);
|
||||
this.container = container;
|
||||
}
|
||||
|
||||
private ContainerStimulator container;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
||||
super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
|
||||
@@ -27,5 +24,4 @@ public class GuiContainerStimulator extends GuiContainerAlvearyPart {
|
||||
drawTexturedModalRect(i + 71, j + 38, 0, 185, (int) bar, 14);
|
||||
drawTexturedModalRect(i + 71, j + 38, 0, 165, 70, 14);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user