aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorBass <tudurap.com@gmail.com>2019-08-21 12:30:22 +0100
committerBass <tudurap.com@gmail.com>2019-08-21 12:30:22 +0100
commit32222a152686e1fb8ce65c9436b25640845080a8 (patch)
treed4431c25e0a69e24acf4b28a66a8bc87cb104540 /src/main/java/com
parent8d4962c7bfdb37bf1d7fe5d7ce83be0afb30d3b7 (diff)
downloadGT5-Unofficial-32222a152686e1fb8ce65c9436b25640845080a8.tar.gz
GT5-Unofficial-32222a152686e1fb8ce65c9436b25640845080a8.tar.bz2
GT5-Unofficial-32222a152686e1fb8ce65c9436b25640845080a8.zip
Tesla Cover Item Refactor
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java7
-rw-r--r--src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/CustomItemList.java2
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java40
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java8
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java53
-rw-r--r--src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCoverUltimate.java35
7 files changed, 81 insertions, 72 deletions
diff --git a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java
index e87ac69f2a..d7e9a21a67 100644
--- a/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/thing/CoverLoader.java
@@ -4,7 +4,6 @@ import com.github.technus.tectech.TecTech;
import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil;
import com.github.technus.tectech.thing.cover.GT_Cover_TM_TeslaCoil_Ultimate;
import com.github.technus.tectech.thing.item.TeslaCoilCover;
-import com.github.technus.tectech.thing.item.TeslaCoilCoverUltimate;
import gregtech.api.GregTech_API;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IIconContainer;
@@ -14,12 +13,12 @@ import net.minecraft.item.ItemStack;
public class CoverLoader implements Runnable {
- public void run(){
+ public void run() {
final IIconContainer TESLA_OVERLAY = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY");
final IIconContainer TESLA_OVERLAY_ULTIMATE = new Textures.BlockIcons.CustomIcon("iconsets/TESLA_OVERLAY_ULTIMATE");
- GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1), new GT_RenderedTexture(TESLA_OVERLAY), new GT_Cover_TM_TeslaCoil());
- GregTech_API.registerCover(new ItemStack(TeslaCoilCoverUltimate.INSTANCE, 1), new GT_RenderedTexture(TESLA_OVERLAY_ULTIMATE), new GT_Cover_TM_TeslaCoil_Ultimate());
+ GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 0), new GT_RenderedTexture(TESLA_OVERLAY), new GT_Cover_TM_TeslaCoil());
+ GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1, 1), new GT_RenderedTexture(TESLA_OVERLAY_ULTIMATE), new GT_Cover_TM_TeslaCoil_Ultimate());
TecTech.LOGGER.info("Cover functionality registered");
}
}
diff --git a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java
index 13d8861d31..6a12c640f3 100644
--- a/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java
+++ b/src/main/java/com/github/technus/tectech/loader/thing/ThingsLoader.java
@@ -52,19 +52,13 @@ public class ThingsLoader implements Runnable {
ReactorSimBlock.run();
TecTech.LOGGER.info("Reactor Simulator registered");
- TeslaCoilCover.run();
- TeslaCoilCoverUltimate.run();
- TecTech.LOGGER.info("Covers Items registered");
-
ConstructableTriggerItem.run();
FrontRotationTriggerItem.run();
ParametrizerMemoryCard.run();
ElementalDefinitionScanStorage_EM.run();
EuMeterGT.run();
-
-
+ TeslaCoilCover.run();
TeslaCoilCapacitor.run();
-
TecTech.LOGGER.info("Useful Items registered");
ElementalDefinitionContainer_EM.run();
diff --git a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
index fdbda7ecd5..8bbb8fd4ce 100644
--- a/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
+++ b/src/main/java/com/github/technus/tectech/thing/CustomItemList.java
@@ -92,7 +92,7 @@ public enum CustomItemList implements IItemContainer {
Machine_Multi_BHG,
hint_0,hint_1,hint_2,hint_3,hint_4,hint_5,hint_6,hint_7,hint_8,hint_9,hint_10,hint_11, hint_general,hint_air,hint_noAir,hint_error,
- scanContainer,parametrizerMemory,
+ scanContainer,parametrizerMemory,teslaCapacitor,teslaCoilCover,
Machine_TeslaCoil_LV_1A, Machine_TeslaCoil_MV_1A, Machine_TeslaCoil_HV_1A, Machine_TeslaCoil_EV_1A, Machine_TeslaCoil_IV_1A,
Machine_TeslaCoil_LV_4A, Machine_TeslaCoil_MV_4A, Machine_TeslaCoil_HV_4A, Machine_TeslaCoil_EV_4A, Machine_TeslaCoil_IV_4A,
diff --git a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java
index dafc425163..611fba6376 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/ParametrizerMemoryCard.java
@@ -31,11 +31,10 @@ import static com.github.technus.tectech.thing.CustomItemList.parametrizerMemory
*/
public final class ParametrizerMemoryCard extends Item {
public static ParametrizerMemoryCard INSTANCE;
- public static IIcon locked,unlocked;
+ private static IIcon locked, unlocked;
private ParametrizerMemoryCard() {
setMaxStackSize(1);
- setHasSubtypes(true);
setUnlocalizedName("em.parametrizerMemoryCard");
setTextureName(MODID + ":itemParametrizerMemoryCardUnlocked");
}
@@ -66,13 +65,13 @@ public final class ParametrizerMemoryCard extends Item {
tNBT.setDouble("value1D", parametrizer.value1D);
}
return true;
- }else if(metaTE instanceof GT_MetaTileEntity_MultiblockBase_EM){
+ } else if (metaTE instanceof GT_MetaTileEntity_MultiblockBase_EM) {
GT_MetaTileEntity_MultiblockBase_EM base = (GT_MetaTileEntity_MultiblockBase_EM) metaTE;
if (aStack.getTagCompound() == null) {
aStack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tNBT = aStack.getTagCompound();
- if(aStack.getItemDamage()== 1){
+ if (aStack.getItemDamage() == 1) {
base.parametrization.trySetParameters(
tNBT.getInteger("param"),
tNBT.getDouble("value0D"),
@@ -90,9 +89,9 @@ public final class ParametrizerMemoryCard extends Item {
public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) {
if (aPlayer instanceof EntityPlayerMP && aPlayer.isSneaking()) {
aStack.stackSize = 1;
- if(aStack.getItemDamage()==1) {
+ if (aStack.getItemDamage() == 1) {
aStack.setItemDamage(0);
- }else{
+ } else {
aStack.setItemDamage(1);
}
return aStack;
@@ -106,23 +105,23 @@ public final class ParametrizerMemoryCard extends Item {
aList.add(CommonValues.BASS_MARK);
aList.add("Stores Parameters");
- if(aStack.getItemDamage()==1) {
+ if (aStack.getItemDamage() == 1) {
aList.add(EnumChatFormatting.BLUE + "Use on Parametrizer/Controller to configure it");
- }else{
+ } else {
aList.add(EnumChatFormatting.BLUE + "Use on Parametrizer to store parameters");
}
aList.add(EnumChatFormatting.BLUE + "Sneak right click to lock/unlock");
long temp;
- if(tNBT!=null && tNBT.hasKey("param")) {
- aList.add("Hatch ID: "+EnumChatFormatting.AQUA + tNBT.getInteger("param"));
- temp=tNBT.getInteger("value0D");
- aList.add("Value 0D: "+EnumChatFormatting.AQUA + temp);
- aList.add("Value 0B: "+EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp)));
- temp=tNBT.getInteger("value1D");
- aList.add("Value 1D: "+EnumChatFormatting.AQUA + temp);
- aList.add("Value 1B: "+EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp)));
- aList.add("Uses Floats: "+(tNBT.getBoolean("usesFloats")?EnumChatFormatting.GREEN+"TRUE":EnumChatFormatting.RED+"FALSE"));
+ if (tNBT != null && tNBT.hasKey("param")) {
+ aList.add("Hatch ID: " + EnumChatFormatting.AQUA + tNBT.getInteger("param"));
+ temp = tNBT.getInteger("value0D");
+ aList.add("Value 0D: " + EnumChatFormatting.AQUA + temp);
+ aList.add("Value 0B: " + EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp)));
+ temp = tNBT.getInteger("value1D");
+ aList.add("Value 1D: " + EnumChatFormatting.AQUA + temp);
+ aList.add("Value 1B: " + EnumChatFormatting.AQUA + Util.longBitsToShortString(Double.doubleToLongBits(temp)));
+ aList.add("Uses Floats: " + (tNBT.getBoolean("usesFloats") ? EnumChatFormatting.GREEN + "TRUE" : EnumChatFormatting.RED + "FALSE"));
}
}
@@ -136,17 +135,16 @@ public final class ParametrizerMemoryCard extends Item {
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
- locked =iconRegister.registerIcon(MODID + ":itemParametrizerMemoryCardLocked");
+ locked = iconRegister.registerIcon(MODID + ":itemParametrizerMemoryCardLocked");
unlocked = itemIcon = iconRegister.registerIcon(getIconString());
}
@Override
public IIcon getIconFromDamage(int damage) {
- if(damage==1) {
+ if (damage == 1) {
return locked;
- }else{
- return unlocked;
}
+ return unlocked;
}
@Override
diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java
index 22c6fe335b..13b7f311d2 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCapacitor.java
@@ -17,6 +17,7 @@ import java.util.List;
import static com.github.technus.tectech.CommonValues.V;
import static com.github.technus.tectech.Reference.MODID;
+import static com.github.technus.tectech.thing.CustomItemList.teslaCapacitor;
public final class TeslaCoilCapacitor extends Item {
@@ -24,6 +25,7 @@ public final class TeslaCoilCapacitor extends Item {
private static IIcon LVicon, MVicon, HVicon, EVicon, IVicon;
private TeslaCoilCapacitor() {
+ setHasSubtypes(true);
setUnlocalizedName("tm.teslaCoilCapacitor");
setTextureName(MODID + ":itemCapacitorLV");
@@ -37,8 +39,8 @@ public final class TeslaCoilCapacitor extends Item {
@Override
public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) {
aList.add(CommonValues.BASS_MARK);
- if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 4){
- aList.add("Stores " + V[aStack.getItemDamage()+1]*512 + " EU in a tesla tower at " + V[aStack.getItemDamage()+1] +" EU/t");
+ if (aStack.getItemDamage() >= 0 && aStack.getItemDamage() <= 4) {
+ aList.add("Stores " + V[aStack.getItemDamage() + 1] * 512 + " EU in a tesla tower at " + V[aStack.getItemDamage() + 1] + " EU/t");
} else {
aList.add("Yeet this broken item into some spicy water!");
}
@@ -54,6 +56,7 @@ public final class TeslaCoilCapacitor extends Item {
public static void run() {
INSTANCE = new TeslaCoilCapacitor();
GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName());
+ teslaCapacitor.set(INSTANCE);
}
@Override
@@ -82,6 +85,7 @@ public final class TeslaCoilCapacitor extends Item {
}
}
+ @Override
public void getSubItems(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
for (int i = 0; i <= 4; i++) {
aList.add(new ItemStack(aItem, 1, i));
diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java
index 64ba2de78e..82f71ec9c6 100644
--- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java
+++ b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCover.java
@@ -2,34 +2,83 @@ package com.github.technus.tectech.thing.item;
import com.github.technus.tectech.CommonValues;
import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.util.GT_LanguageManager;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.IIcon;
import java.util.List;
import static com.github.technus.tectech.Reference.MODID;
+import static com.github.technus.tectech.thing.CustomItemList.teslaCoilCover;
public final class TeslaCoilCover extends Item {
public static TeslaCoilCover INSTANCE;
+ private static IIcon ultItemIcon;
- public TeslaCoilCover() {
+ private TeslaCoilCover() {
+ setHasSubtypes(true);
setUnlocalizedName("tm.teslaCoilCover");
setTextureName(MODID + ":itemTeslaCover");
+
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Tesla Coil Cover");
+ GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Tesla Coil Cover Rich Edition");
}
@Override
public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) {
aList.add(CommonValues.BASS_MARK);
- aList.add("Tesla-Enables Machines!");
+ switch (aStack.getItemDamage()) {
+ case 0:
+ aList.add("Tesla-Enables Machines!");
+ break;
+ case 1:
+ aList.add("Tesla-Enables Machines! (BUT LOUDER!!)");
+ break;
+ default:
+ aList.add("Yeet this broken item into some spicy water!");
+ break;
+ }
aList.add(EnumChatFormatting.BLUE + "Use on top of a machine to enable Tesla capabilities");
aList.add(EnumChatFormatting.BLUE + "Who the hell uses cables anyway?");
}
+ @Override
+ public String getUnlocalizedName(ItemStack aStack) {
+ return getUnlocalizedName() + "." + getDamage(aStack);
+ }
+
public static void run() {
INSTANCE = new TeslaCoilCover();
GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName());
+ teslaCoilCover.set(INSTANCE);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister iconRegister) {
+ itemIcon = iconRegister.registerIcon(getIconString());
+ ultItemIcon = iconRegister.registerIcon(MODID + ":itemTeslaCoverUltimate");
+ }
+
+ @Override
+ public IIcon getIconFromDamage(int damage) {
+ if (damage == 1) {
+ return ultItemIcon;
+ }
+ return itemIcon;
+ }
+
+ @Override
+ public void getSubItems(Item aItem, CreativeTabs par2CreativeTabs, List aList) {
+ aList.add(new ItemStack(aItem, 1, 0));
+ aList.add(new ItemStack(aItem, 1, 1));
}
}
diff --git a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCoverUltimate.java b/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCoverUltimate.java
deleted file mode 100644
index 71ef0bd0c8..0000000000
--- a/src/main/java/com/github/technus/tectech/thing/item/TeslaCoilCoverUltimate.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.github.technus.tectech.thing.item;
-
-import com.github.technus.tectech.CommonValues;
-import cpw.mods.fml.common.registry.GameRegistry;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.Item;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.EnumChatFormatting;
-
-import java.util.List;
-
-import static com.github.technus.tectech.Reference.MODID;
-
-
-public final class TeslaCoilCoverUltimate extends Item {
- public static TeslaCoilCoverUltimate INSTANCE;
-
- public TeslaCoilCoverUltimate() {
- setUnlocalizedName("tm.teslaCoilCoverUltimate");
- setTextureName(MODID + ":itemTeslaCoverUltimate");
- }
-
- @Override
- public void addInformation(ItemStack aStack, EntityPlayer ep, List aList, boolean boo) {
- aList.add(CommonValues.BASS_MARK);
- aList.add("Tesla-Enables Machines! (BUT LOUDER!!)");
- aList.add(EnumChatFormatting.BLUE + "Use on top of a machine to enable Tesla capabilities");
- aList.add(EnumChatFormatting.BLUE + "Who the hell uses cables anyway?");
- }
-
- public static void run() {
- INSTANCE = new TeslaCoilCoverUltimate();
- GameRegistry.registerItem(INSTANCE, INSTANCE.getUnlocalizedName());
- }
-}