aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-28 18:39:10 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-28 18:39:10 -0800
commitb846f1dc3a502d157ecf871e2a4a1ff49915f871 (patch)
tree4a86feaaddd8d00d32f7cc093736d02be92bf358 /src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity
parent3194d4cbab82e336ecb82b5a2dc80153ed9b1b81 (diff)
downloadGT5-Unofficial-b846f1dc3a502d157ecf871e2a4a1ff49915f871.tar.gz
GT5-Unofficial-b846f1dc3a502d157ecf871e2a4a1ff49915f871.tar.bz2
GT5-Unofficial-b846f1dc3a502d157ecf871e2a4a1ff49915f871.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity')
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/DieselGenerator.java159
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronAccelerator.java9
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronSensor.java85
-rw-r--r--src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java186
4 files changed, 185 insertions, 254 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/DieselGenerator.java b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/DieselGenerator.java
index 9105685742..9f2661b486 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/DieselGenerator.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/DieselGenerator.java
@@ -3,6 +3,8 @@ package goodgenerator.blocks.tileEntity.GTMetaTileEntity;
import static gregtech.api.enums.Textures.BlockIcons.*;
import static gregtech.api.enums.Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE_GLOW;
+import net.minecraft.item.ItemStack;
+
import cpw.mods.fml.common.registry.GameRegistry;
import gregtech.GT_Mod;
import gregtech.api.enums.ItemList;
@@ -15,18 +17,20 @@ import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
-import net.minecraft.item.ItemStack;
public class DieselGenerator extends GT_MetaTileEntity_BasicGenerator {
public int mEfficiency;
public DieselGenerator(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, new String[] {
- "Requires liquid Fuel",
- "Causes " + (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond * (1.1 - aTier * 0.1))
- + " Pollution per second"
- });
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ new String[] { "Requires liquid Fuel", "Causes "
+ + (int) (GT_Mod.gregtechproxy.mPollutionBaseDieselGeneratorPerSecond * (1.1 - aTier * 0.1))
+ + " Pollution per second" });
mEfficiency = 100 - aTier * 10;
}
@@ -77,8 +81,13 @@ public class DieselGenerator extends GT_MetaTileEntity_BasicGenerator {
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aTick % 100 == 0 && mFluid != null && mFluid.amount > this.getCapacity()) {
GT_Log.err.println(
- "Dupe Abuse: " + aBaseMetaTileEntity.getOwnerName() + " Coords: " + aBaseMetaTileEntity.getXCoord()
- + " " + aBaseMetaTileEntity.getYCoord() + " " + aBaseMetaTileEntity.getZCoord());
+ "Dupe Abuse: " + aBaseMetaTileEntity.getOwnerName()
+ + " Coords: "
+ + aBaseMetaTileEntity.getXCoord()
+ + " "
+ + aBaseMetaTileEntity.getYCoord()
+ + " "
+ + aBaseMetaTileEntity.getZCoord());
aBaseMetaTileEntity.setToFire();
}
super.onPostTick(aBaseMetaTileEntity, aTick);
@@ -86,134 +95,84 @@ public class DieselGenerator extends GT_MetaTileEntity_BasicGenerator {
@Override
public ITexture[] getFront(byte aColor) {
- return new ITexture[] {
- super.getFront(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_FRONT),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_FRONT_GLOW)
- .glow()
- .build()),
- OVERLAYS_ENERGY_OUT[this.mTier]
- };
+ return new ITexture[] { super.getFront(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_FRONT),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_FRONT_GLOW).glow().build()),
+ OVERLAYS_ENERGY_OUT[this.mTier] };
}
@Override
public ITexture[] getBack(byte aColor) {
- return new ITexture[] {
- super.getBack(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_BACK),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_BACK_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getBack(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_BACK),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_BACK_GLOW).glow().build()) };
}
@Override
public ITexture[] getBottom(byte aColor) {
- return new ITexture[] {
- super.getBottom(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_BOTTOM),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_BOTTOM_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getBottom(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_BOTTOM),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_BOTTOM_GLOW).glow().build()) };
}
@Override
public ITexture[] getTop(byte aColor) {
- return new ITexture[] {
- super.getTop(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_TOP),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_TOP_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getTop(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_TOP),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_TOP_GLOW).glow().build()) };
}
@Override
public ITexture[] getSides(byte aColor) {
- return new ITexture[] {
- super.getSides(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_SIDE),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_SIDE_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getSides(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_SIDE),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_SIDE_GLOW).glow().build()) };
}
@Override
public ITexture[] getFrontActive(byte aColor) {
- return new ITexture[] {
- super.getFrontActive(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_FRONT_ACTIVE),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_FRONT_ACTIVE_GLOW)
- .glow()
- .build()),
- OVERLAYS_ENERGY_OUT[this.mTier]
- };
+ return new ITexture[] { super.getFrontActive(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_FRONT_ACTIVE),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_FRONT_ACTIVE_GLOW).glow().build()),
+ OVERLAYS_ENERGY_OUT[this.mTier] };
}
@Override
public ITexture[] getBackActive(byte aColor) {
- return new ITexture[] {
- super.getBackActive(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_BACK_ACTIVE),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_BACK_ACTIVE_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getBackActive(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_BACK_ACTIVE),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_BACK_ACTIVE_GLOW).glow().build()) };
}
@Override
public ITexture[] getBottomActive(byte aColor) {
- return new ITexture[] {
- super.getBottomActive(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_BOTTOM_ACTIVE),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_BOTTOM_ACTIVE_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getBottomActive(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_BOTTOM_ACTIVE),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_BOTTOM_ACTIVE_GLOW).glow().build()) };
}
@Override
public ITexture[] getTopActive(byte aColor) {
- return new ITexture[] {
- super.getTopActive(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_TOP_ACTIVE),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_TOP_ACTIVE_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getTopActive(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_TOP_ACTIVE),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_TOP_ACTIVE_GLOW).glow().build()) };
}
@Override
public ITexture[] getSidesActive(byte aColor) {
- return new ITexture[] {
- super.getSidesActive(aColor)[0],
- TextureFactory.of(
- TextureFactory.of(DIESEL_GENERATOR_SIDE_ACTIVE),
- TextureFactory.builder()
- .addIcon(DIESEL_GENERATOR_SIDE_ACTIVE_GLOW)
- .glow()
- .build())
- };
+ return new ITexture[] { super.getSidesActive(aColor)[0],
+ TextureFactory.of(
+ TextureFactory.of(DIESEL_GENERATOR_SIDE_ACTIVE),
+ TextureFactory.builder().addIcon(DIESEL_GENERATOR_SIDE_ACTIVE_GLOW).glow().build()) };
}
@Override
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronAccelerator.java b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronAccelerator.java
index dc049e69c7..2a110b3b67 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronAccelerator.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronAccelerator.java
@@ -28,12 +28,9 @@ public class NeutronAccelerator extends GT_MetaTileEntity_Hatch_Energy {
@Override
public String[] getDescription() {
- return new String[] {
- "Input EU to Accelerate the Neutron!",
- "Max EU input: " + this.maxEUInput(),
- "Max EU consumption: " + this.getMaxEUConsume(),
- "Every EU can be transformed into 10~20 eV Neutron Kinetic Energy."
- };
+ return new String[] { "Input EU to Accelerate the Neutron!", "Max EU input: " + this.maxEUInput(),
+ "Max EU consumption: " + this.getMaxEUConsume(),
+ "Every EU can be transformed into 10~20 eV Neutron Kinetic Energy." };
}
@Override
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronSensor.java b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronSensor.java
index e176e103b7..c10c6d962d 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronSensor.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/NeutronSensor.java
@@ -1,5 +1,10 @@
package goodgenerator.blocks.tileEntity.GTMetaTileEntity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+
import com.gtnewhorizons.modularui.api.drawable.Text;
import com.gtnewhorizons.modularui.api.math.Alignment;
import com.gtnewhorizons.modularui.api.math.Color;
@@ -7,6 +12,7 @@ import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.TextWidget;
import com.gtnewhorizons.modularui.common.widget.textfield.TextFieldWidget;
+
import goodgenerator.blocks.tileEntity.NeutronActivator;
import goodgenerator.util.CharExchanger;
import gregtech.api.enums.Textures;
@@ -18,16 +24,12 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.render.TextureFactory;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.StatCollector;
public class NeutronSensor extends GT_MetaTileEntity_Hatch {
private static final IIconContainer textureFont = new Textures.BlockIcons.CustomIcon("icons/NeutronSensorFont");
- private static final IIconContainer textureFont_Glow =
- new Textures.BlockIcons.CustomIcon("icons/NeutronSensorFont_GLOW");
+ private static final IIconContainer textureFont_Glow = new Textures.BlockIcons.CustomIcon(
+ "icons/NeutronSensorFont_GLOW");
protected String texts = "";
boolean isOn = false;
@@ -42,11 +44,9 @@ public class NeutronSensor extends GT_MetaTileEntity_Hatch {
@Override
public String[] getDescription() {
- return new String[] {
- "Can be installed in Neutron Activator.",
- "Output Redstone Signal according to the Neutron Kinetic Energy.",
- "Right click to open the GUI and setting."
- };
+ return new String[] { "Can be installed in Neutron Activator.",
+ "Output Redstone Signal according to the Neutron Kinetic Energy.",
+ "Right click to open the GUI and setting." };
}
@Override
@@ -87,8 +87,8 @@ public class NeutronSensor extends GT_MetaTileEntity_Hatch {
}
@Override
- public boolean onRightclick(
- IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX,
+ float aY, float aZ) {
GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
return true;
}
@@ -111,16 +111,13 @@ public class NeutronSensor extends GT_MetaTileEntity_Hatch {
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {
- aBaseTexture,
- TextureFactory.of(textureFont),
- TextureFactory.builder().addIcon(textureFont_Glow).glow().build()
- };
+ return new ITexture[] { aBaseTexture, TextureFactory.of(textureFont),
+ TextureFactory.builder().addIcon(textureFont_Glow).glow().build() };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {aBaseTexture, TextureFactory.of(textureFont)};
+ return new ITexture[] { aBaseTexture, TextureFactory.of(textureFont) };
}
@Override
@@ -161,33 +158,30 @@ public class NeutronSensor extends GT_MetaTileEntity_Hatch {
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
TextFieldWidget textField = new TextFieldWidget();
- builder.widget(textField
- .setGetter(this::getText)
- .setSetter(this::setText)
- .setValidator(str -> isValidExpression(str)
- ? str
- : textField.getLastText().size() > 0
- ? textField.getLastText().get(0)
- : "")
- .setFocusOnGuiOpen(true)
- .setTextColor(Color.WHITE.dark(1))
+ builder.widget(
+ textField.setGetter(this::getText).setSetter(this::setText)
+ .setValidator(
+ str -> isValidExpression(str) ? str
+ : textField.getLastText().size() > 0 ? textField.getLastText().get(0) : "")
+ .setFocusOnGuiOpen(true).setTextColor(Color.WHITE.dark(1))
.setTextAlignment(Alignment.CenterLeft)
- .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD.withOffset(-1, -1, 2, 2))
- .setPos(8, 48)
+ .setBackground(GT_UITextures.BACKGROUND_TEXT_FIELD.withOffset(-1, -1, 2, 2)).setPos(8, 48)
.setSize(100, 18))
- .widget(new TextWidget(StatCollector.translateToLocal("gui.NeutronSensor.0"))
- .setDefaultColor(COLOR_TEXT_GRAY.get())
- .setTextAlignment(Alignment.CenterLeft)
- .setPos(8, 8))
- .widget(new TextWidget(StatCollector.translateToLocal("gui.NeutronSensor.1"))
- .setDefaultColor(COLOR_TEXT_GRAY.get())
- .setPos(8, 32))
- .widget(TextWidget.dynamicText(() -> isValidExpression(textField.getText())
- ? new Text(StatCollector.translateToLocal("gui.NeutronSensor.2")).color(0x077d02)
- : new Text(StatCollector.translateToLocal("gui.NeutronSensor.3"))
- .color(COLOR_TEXT_RED.get()))
- .setSynced(false)
- .setPos(120, 53));
+ .widget(
+ new TextWidget(StatCollector.translateToLocal("gui.NeutronSensor.0"))
+ .setDefaultColor(COLOR_TEXT_GRAY.get()).setTextAlignment(Alignment.CenterLeft)
+ .setPos(8, 8))
+ .widget(
+ new TextWidget(StatCollector.translateToLocal("gui.NeutronSensor.1"))
+ .setDefaultColor(COLOR_TEXT_GRAY.get()).setPos(8, 32))
+ .widget(
+ TextWidget.dynamicText(
+ () -> isValidExpression(textField.getText())
+ ? new Text(StatCollector.translateToLocal("gui.NeutronSensor.2"))
+ .color(0x077d02)
+ : new Text(StatCollector.translateToLocal("gui.NeutronSensor.3"))
+ .color(COLOR_TEXT_RED.get()))
+ .setSynced(false).setPos(120, 53));
}
private boolean isValidExpression(String exp) {
@@ -204,8 +198,7 @@ public class NeutronSensor extends GT_MetaTileEntity_Hatch {
if (exp.charAt(index) != 'E' && exp.charAt(index) != 'e') return false;
index = exp.length() - 3;
if (index < 0) return false;
- return exp.charAt(index) == 'M'
- || exp.charAt(index) == 'm'
+ return exp.charAt(index) == 'M' || exp.charAt(index) == 'm'
|| exp.charAt(index) == 'K'
|| exp.charAt(index) == 'k'
|| Character.isDigit(exp.charAt(index));
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java
index 6ac023a559..a8019611ce 100644
--- a/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java
+++ b/src/main/java/goodgenerator/blocks/tileEntity/GTMetaTileEntity/YOTTAHatch.java
@@ -1,5 +1,17 @@
package goodgenerator.blocks.tileEntity.GTMetaTileEntity;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.common.util.ForgeDirection;
+import net.minecraftforge.fluids.FluidRegistry;
+import net.minecraftforge.fluids.FluidStack;
+import net.minecraftforge.fluids.FluidTankInfo;
+
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.networking.GridFlags;
@@ -32,46 +44,31 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Utility;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.nbt.NBTTagCompound;
-import net.minecraft.util.StatCollector;
-import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidRegistry;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.FluidTankInfo;
@Optional.InterfaceList(
value = {
- @Optional.Interface(
- iface = "appeng.api.networking.security.IActionHost",
- modid = "appliedenergistics2",
- striprefs = true),
- @Optional.Interface(
- iface = "appeng.me.helpers.IGridProxyable",
- modid = "appliedenergistics2",
- striprefs = true),
- @Optional.Interface(
- iface = "appeng.api.storage.IMEInventory",
- modid = "appliedenergistics2",
- striprefs = true),
- @Optional.Interface(
- iface = "appeng.api.storage.IMEInventoryHandler",
- modid = "appliedenergistics2",
- striprefs = true),
- @Optional.Interface(
- iface = "appeng.api.storage.ICellContainer",
- modid = "appliedenergistics2",
- striprefs = true),
- })
-public class YOTTAHatch extends GT_MetaTileEntity_Hatch
- implements IGridProxyable,
- IActionHost,
- ICellContainer,
- IMEInventory<IAEFluidStack>,
- IMEInventoryHandler<IAEFluidStack> {
+ @Optional.Interface(
+ iface = "appeng.api.networking.security.IActionHost",
+ modid = "appliedenergistics2",
+ striprefs = true),
+ @Optional.Interface(
+ iface = "appeng.me.helpers.IGridProxyable",
+ modid = "appliedenergistics2",
+ striprefs = true),
+ @Optional.Interface(
+ iface = "appeng.api.storage.IMEInventory",
+ modid = "appliedenergistics2",
+ striprefs = true),
+ @Optional.Interface(
+ iface = "appeng.api.storage.IMEInventoryHandler",
+ modid = "appliedenergistics2",
+ striprefs = true),
+ @Optional.Interface(
+ iface = "appeng.api.storage.ICellContainer",
+ modid = "appliedenergistics2",
+ striprefs = true), })
+public class YOTTAHatch extends GT_MetaTileEntity_Hatch implements IGridProxyable, IActionHost, ICellContainer,
+ IMEInventory<IAEFluidStack>, IMEInventoryHandler<IAEFluidStack> {
private static final IIconContainer textureFont = new Textures.BlockIcons.CustomIcon("icons/YOTTAHatch");
@@ -82,17 +79,18 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
private String lastFluid = "";
private BigInteger lastAmt = BigInteger.ZERO;
private AccessRestriction readMode = AccessRestriction.READ_WRITE;
- private final AccessRestriction[] AEModes = new AccessRestriction[] {
- AccessRestriction.NO_ACCESS, AccessRestriction.READ, AccessRestriction.WRITE, AccessRestriction.READ_WRITE
- };
+ private final AccessRestriction[] AEModes = new AccessRestriction[] { AccessRestriction.NO_ACCESS,
+ AccessRestriction.READ, AccessRestriction.WRITE, AccessRestriction.READ_WRITE };
public YOTTAHatch(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 0, new String[] {
- "Special I/O port for EC2.",
- "Directly connected YOTTank with AE fluid storage system.",
- "Use screwdriver to set storage priority",
- "Use soldering iron to set read/write mode"
- });
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 0,
+ new String[] { "Special I/O port for EC2.", "Directly connected YOTTank with AE fluid storage system.",
+ "Use screwdriver to set storage priority", "Use soldering iron to set read/write mode" });
}
public YOTTAHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
@@ -132,15 +130,17 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
if (aPlayer.isSneaking()) this.priority -= 10;
else this.priority += 10;
GT_Utility.sendChatToPlayer(
- aPlayer, String.format(StatCollector.translateToLocal("yothatch.chat.0"), this.priority));
+ aPlayer,
+ String.format(StatCollector.translateToLocal("yothatch.chat.0"), this.priority));
}
@Override
- public boolean onSolderingToolRightClick(
- byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) {
+ public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
this.readMode = AEModes[(readMode.ordinal() + 1) % 4];
GT_Utility.sendChatToPlayer(
- aPlayer, String.format(StatCollector.translateToLocal("yothatch.chat.1"), this.readMode));
+ aPlayer,
+ String.format(StatCollector.translateToLocal("yothatch.chat.1"), this.readMode));
return true;
}
@@ -180,12 +180,11 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
@Override
@Optional.Method(modid = "appliedenergistics2")
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return out;
- if (host.mFluidName == null
- || host.mFluidName.equals("")
- || host.mStorageCurrent.compareTo(BigInteger.ZERO) <= 0) return out;
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive())
+ return out;
+ if (host.mFluidName == null || host.mFluidName.equals("")
+ || host.mStorageCurrent.compareTo(BigInteger.ZERO) <= 0)
+ return out;
long ready;
if (host.mStorageCurrent.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) {
ready = Long.MAX_VALUE;
@@ -240,9 +239,8 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
if (storageGrid == null) {
node.getGrid().postEvent(new MENetworkStorageEvent(null, StorageChannel.FLUIDS));
} else {
- node.getGrid()
- .postEvent(new MENetworkStorageEvent(
- storageGrid.getFluidInventory(), StorageChannel.FLUIDS));
+ node.getGrid().postEvent(
+ new MENetworkStorageEvent(storageGrid.getFluidInventory(), StorageChannel.FLUIDS));
}
node.getGrid().postEvent(new MENetworkCellArrayUpdate());
}
@@ -258,9 +256,7 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
@Override
public int getCapacity() {
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return 0;
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive()) return 0;
if (host.mStorage.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) >= 0) {
return Integer.MAX_VALUE;
} else return host.mStorage.intValue();
@@ -268,14 +264,11 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return 0;
- if (host.mLockedFluidName != null
- && !host.mLockedFluidName.equals("")
- && !host.mLockedFluidName.equals(resource.getFluid().getName())) return 0;
- if (host.mFluidName == null
- || host.mFluidName.equals("")
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive()) return 0;
+ if (host.mLockedFluidName != null && !host.mLockedFluidName.equals("")
+ && !host.mLockedFluidName.equals(resource.getFluid().getName()))
+ return 0;
+ if (host.mFluidName == null || host.mFluidName.equals("")
|| host.mFluidName.equals(resource.getFluid().getName())) {
host.mFluidName = resource.getFluid().getName();
if (host.mStorage.subtract(host.mStorageCurrent).compareTo(BigInteger.valueOf(resource.amount)) >= 0) {
@@ -291,14 +284,11 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
}
public long fill(ForgeDirection from, IAEFluidStack resource, boolean doFill) {
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return 0;
- if (host.mLockedFluidName != null
- && !host.mLockedFluidName.equals("")
- && !host.mLockedFluidName.equals(resource.getFluid().getName())) return 0;
- if (host.mFluidName == null
- || host.mFluidName.equals("")
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive()) return 0;
+ if (host.mLockedFluidName != null && !host.mLockedFluidName.equals("")
+ && !host.mLockedFluidName.equals(resource.getFluid().getName()))
+ return 0;
+ if (host.mFluidName == null || host.mFluidName.equals("")
|| host.mFluidName.equals(resource.getFluid().getName())) {
host.mFluidName = resource.getFluid().getName();
if (host.mStorage.subtract(host.mStorageCurrent).compareTo(BigInteger.valueOf(resource.getStackSize()))
@@ -316,12 +306,11 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
@Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return null;
- if (host.mFluidName == null
- || host.mFluidName.equals("")
- || !host.mFluidName.equals(resource.getFluid().getName())) return null;
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive())
+ return null;
+ if (host.mFluidName == null || host.mFluidName.equals("")
+ || !host.mFluidName.equals(resource.getFluid().getName()))
+ return null;
int ready;
if (host.mStorageCurrent.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) > 0) {
ready = Integer.MAX_VALUE;
@@ -334,12 +323,11 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
}
public IAEFluidStack drain(ForgeDirection from, IAEFluidStack resource, boolean doDrain) {
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return null;
- if (host.mFluidName == null
- || host.mFluidName.equals("")
- || !host.mFluidName.equals(resource.getFluid().getName())) return null;
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive())
+ return null;
+ if (host.mFluidName == null || host.mFluidName.equals("")
+ || !host.mFluidName.equals(resource.getFluid().getName()))
+ return null;
long ready;
if (host.mStorageCurrent.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) {
ready = Long.MAX_VALUE;
@@ -355,9 +343,8 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
@Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return null;
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive())
+ return null;
if (host.mFluidName == null || host.mFluidName.equals("")) return null;
return this.drain(from, FluidRegistry.getFluidStack(host.mFluidName, maxDrain), doDrain);
}
@@ -366,9 +353,8 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
FluidTankInfo[] tankInfo = new FluidTankInfo[1];
tankInfo[0] = new FluidTankInfo(null, 0);
- if (host == null
- || host.getBaseMetaTileEntity() == null
- || !host.getBaseMetaTileEntity().isActive()) return tankInfo;
+ if (host == null || host.getBaseMetaTileEntity() == null || !host.getBaseMetaTileEntity().isActive())
+ return tankInfo;
FluidStack fluid = null;
if (host.mFluidName != null && !host.mFluidName.equals("")) {
int camt;
@@ -393,16 +379,12 @@ public class YOTTAHatch extends GT_MetaTileEntity_Hatch
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
- return new ITexture[] {
- aBaseTexture, TextureFactory.of(textureFont),
- };
+ return new ITexture[] { aBaseTexture, TextureFactory.of(textureFont), };
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
- return new ITexture[] {
- aBaseTexture, TextureFactory.of(textureFont),
- };
+ return new ITexture[] { aBaseTexture, TextureFactory.of(textureFont), };
}
@Override