mirror of
https://github.com/GTNewHorizons/WirelessCraftingTerminal.git
synced 2026-11-12 16:37:29 +00:00
cleanup
This commit is contained in:
4 files changed
+26
-47
No files matched your search
@@ -22,7 +22,7 @@ public class GuiMagnet extends GuiContainer {
|
||||
public boolean ignoreNBT = false;
|
||||
public boolean ignoreMeta = false;
|
||||
public boolean useOreDict = false;
|
||||
private ItemStack magnetItem;
|
||||
private final ItemStack magnetItem;
|
||||
private WCTGuiCheckBox ignoreNBTBox;
|
||||
private WCTGuiCheckBox ignoreMetaBox;
|
||||
private WCTGuiCheckBox useOreDictBox;
|
||||
|
||||
+3
-5
@@ -50,7 +50,6 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
|
||||
|
||||
private int currentMouseX = 0;
|
||||
private int currentMouseY = 0;
|
||||
private final int lowerTextureOffset = 0;
|
||||
|
||||
public GuiWirelessCraftingTerminal(final InventoryPlayer inventoryPlayer, ICraftingTerminal host) {
|
||||
super(inventoryPlayer, host, new ContainerWirelessCraftingTerminal(inventoryPlayer, host));
|
||||
@@ -185,11 +184,11 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
|
||||
// draw player inv
|
||||
this.drawTexturedModalRect(
|
||||
offsetX,
|
||||
offsetY + 16 + this.rows * 18 + this.lowerTextureOffset,
|
||||
offsetY + 16 + this.rows * 18,
|
||||
0,
|
||||
106 - 18 - 18,
|
||||
x_width,
|
||||
99 + this.getReservedSpace() - this.lowerTextureOffset);
|
||||
99 + this.getReservedSpace());
|
||||
|
||||
// draw view cells background
|
||||
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 32, 104);
|
||||
@@ -263,8 +262,7 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
|
||||
@Override
|
||||
@Optional.Method(modid = "MouseTweaks")
|
||||
public Object getModSelectedSlot(Object modContainer, int slotCount) {
|
||||
Slot s = getSlot(currentMouseX, currentMouseY);
|
||||
return s;
|
||||
return getSlot(currentMouseX, currentMouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-3
@@ -3,7 +3,6 @@ package net.p455w0rd.wirelesscraftingterminal.implementation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.IWCTInteractionHelper;
|
||||
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
|
||||
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
|
||||
@@ -19,8 +18,7 @@ public class WCTInteractionHelper implements IWCTInteractionHelper {
|
||||
|
||||
@Override
|
||||
public void openWirelessCraftingTerminalGui(final EntityPlayer player) {
|
||||
if ((player == null) || (player instanceof FakePlayer)
|
||||
|| (player instanceof EntityPlayerMP)
|
||||
if (player == null || player instanceof EntityPlayerMP
|
||||
|| FMLCommonHandler.instance().getSide() == Side.SERVER) {
|
||||
return;
|
||||
}
|
||||
|
||||
+21
-38
@@ -25,7 +25,6 @@ import org.lwjgl.input.Keyboard;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
@@ -48,14 +47,13 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||
implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBaubleExpanded {
|
||||
|
||||
public static final String LINK_KEY_STRING = "key";
|
||||
public static double GLOBAL_POWER_MULTIPLIER = PowerMultiplier.CONFIG.multiplier;
|
||||
private static final String POWER_NBT_KEY = "internalCurrentPower";
|
||||
private static final String BOOSTER_SLOT_NBT = "BoosterSlot";
|
||||
private static final String MAGNET_SLOT_NBT = "MagnetSlot";
|
||||
private EntityPlayer entityPlayer;
|
||||
|
||||
public ItemWirelessCraftingTerminal() {
|
||||
super(Reference.WCT_MAX_POWER, Optional.<String>absent());
|
||||
super(Reference.WCT_MAX_POWER, Optional.absent());
|
||||
setUnlocalizedName("wirelessCraftingTerminal");
|
||||
setTextureName(Reference.MODID + ":wirelessCraftingTerminal");
|
||||
setMaxStackSize(1);
|
||||
@@ -148,16 +146,16 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||
|
||||
@Override
|
||||
public void onUpdate(final ItemStack is, final World w, final Entity e, int i, boolean f) {
|
||||
if (!(e instanceof EntityPlayer)) {
|
||||
if (!(e instanceof EntityPlayer p)) {
|
||||
return;
|
||||
}
|
||||
EntityPlayer p = (EntityPlayer) e;
|
||||
|
||||
if (entityPlayer == null) {
|
||||
entityPlayer = p;
|
||||
}
|
||||
ItemStack wirelessTerminal = null;
|
||||
|
||||
InventoryPlayer inv = p.inventory;
|
||||
wirelessTerminal = RandomUtils.getWirelessTerm(inv);
|
||||
ItemStack wirelessTerminal = RandomUtils.getWirelessTerm(inv);
|
||||
if (wirelessTerminal == null || !(wirelessTerminal.getItem() instanceof IWirelessCraftingTerminalItem)) {
|
||||
return;
|
||||
}
|
||||
@@ -221,11 +219,6 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||
return getAECurrentPower(is) >= amt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasInfinityPower(ItemStack is) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasInfinityRange(ItemStack is) {
|
||||
return this.checkForBooster(is);
|
||||
@@ -236,9 +229,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||
final ConfigManager out = new ConfigManager(new IConfigManagerHost() {
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager,
|
||||
@SuppressWarnings("rawtypes") final Enum settingName,
|
||||
@SuppressWarnings("rawtypes") final Enum newValue) {
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||
final NBTTagCompound data = Platform.openNbtData(target);
|
||||
manager.writeToNBT(data);
|
||||
}
|
||||
@@ -252,44 +243,39 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||
return out;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@Override
|
||||
public void getCheckedSubItems(Item item, CreativeTabs creativeTab, List itemList) {
|
||||
List itemList2 = itemList;
|
||||
itemList2.add(new ItemStack(item));
|
||||
itemList.add(new ItemStack(item));
|
||||
ItemStack is = new ItemStack(item);
|
||||
injectAEPower(is, Reference.WCT_MAX_POWER);
|
||||
itemList2.add(is);
|
||||
itemList.add(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showDurabilityBar(ItemStack is) {
|
||||
double aeCurrPower = getAECurrentPower(is);
|
||||
double aeMaxPower = getAEMaxPower(is);
|
||||
if ((int) aeCurrPower >= (int) aeMaxPower) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return (int) aeCurrPower < (int) aeMaxPower;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void addCheckedInformation(ItemStack is, EntityPlayer player, List list, boolean displayMore) {
|
||||
String shift = LocaleHandler.PressShift.getLocal().replace(
|
||||
"Shift",
|
||||
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
|
||||
String shift = LocaleHandler.PressShift.getLocal()
|
||||
.replace("Shift", color("yellow") + color("bold") + color("italics") + "Shift" + color("gray"));
|
||||
final NBTTagCompound tag = ensureTagCompound(is);
|
||||
|
||||
String encKey = tag.getString("key");
|
||||
String pctTxtColor = color("white") + "";
|
||||
String pctTxtColor = color("white");
|
||||
double aeCurrPower = getAECurrentPower(is);
|
||||
double aeCurrPowerPct = (int) Math.floor(aeCurrPower / Reference.WCT_MAX_POWER * 1e4) / 1e2;
|
||||
if ((int) aeCurrPowerPct >= 75) {
|
||||
pctTxtColor = color("green") + "";
|
||||
pctTxtColor = color("green");
|
||||
}
|
||||
if ((int) aeCurrPowerPct <= 5) {
|
||||
pctTxtColor = color("red") + "";
|
||||
pctTxtColor = color("red");
|
||||
}
|
||||
list.add(color("aqua") + "==============================");
|
||||
list.add(
|
||||
@@ -305,10 +291,10 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||
linked = color("blue") + StatCollector.translateToLocal("gui.appliedenergistics2.Linked");
|
||||
}
|
||||
list.add(LocaleHandler.LinkStatus.getLocal() + ": " + linked);
|
||||
String boosterStatus = (checkForBooster(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
|
||||
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
|
||||
String magnetStatus = (isMagnetInstalled(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
|
||||
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
|
||||
String boosterStatus = (checkForBooster(is) ? color("green") + LocaleHandler.Installed.getLocal()
|
||||
: color("red") + LocaleHandler.NotInstalled.getLocal());
|
||||
String magnetStatus = (isMagnetInstalled(is) ? color("green") + LocaleHandler.Installed.getLocal()
|
||||
: color("red") + LocaleHandler.NotInstalled.getLocal());
|
||||
if (Reference.WCT_BOOSTER_ENABLED) {
|
||||
list.add(getItemName("infinityBoosterCard") + ": " + boosterStatus);
|
||||
}
|
||||
@@ -370,10 +356,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
|
||||
}
|
||||
|
||||
private NBTTagCompound ensureTagCompound(ItemStack is) {
|
||||
if (!is.hasTagCompound()) {
|
||||
is.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
return is.getTagCompound();
|
||||
return RandomUtils.getTag(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user