From 5f14653c028191c89a62a3c6a7f18f898752a8d2 Mon Sep 17 00:00:00 2001 From: Bass Date: Wed, 24 Jul 2019 02:54:34 +0100 Subject: Proper Texture implementation --- .../technus/tectech/loader/thing/CoverLoader.java | 14 +++++++---- .../tectech/thing/metaTileEntity/Textures.java | 8 ++---- .../single/GT_MetaTileEntity_TeslaCoil.java | 29 +++++++++++++++++++--- 3 files changed, 37 insertions(+), 14 deletions(-) (limited to 'src/main/java') 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 067cb0f4a0..e87ac69f2a 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 @@ -6,16 +6,20 @@ 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; +import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.item.ItemStack; -import static com.github.technus.tectech.thing.metaTileEntity.Textures.TESLA_COVER_TEXTURES; + public class CoverLoader implements Runnable { public void run(){ - //GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1), new GT_RenderedTexture(Textures.BlockIcons.VENT_NORMAL), new GT_Cover_TM_TeslaCoil()); - //GregTech_API.registerCover(new ItemStack(TeslaCoilCoverUltimate.INSTANCE, 1), new GT_RenderedTexture(Textures.BlockIcons.VENT_ADVANCED), new GT_Cover_TM_TeslaCoil_Ultimate()); - GregTech_API.registerCover(new ItemStack(TeslaCoilCover.INSTANCE, 1), TESLA_COVER_TEXTURES[0], new GT_Cover_TM_TeslaCoil()); - GregTech_API.registerCover(new ItemStack(TeslaCoilCoverUltimate.INSTANCE, 1), TESLA_COVER_TEXTURES[1], new GT_Cover_TM_TeslaCoil_Ultimate()); + 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()); TecTech.LOGGER.info("Cover functionality registered"); } } diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java index be94940990..69ff06e9e7 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/Textures.java @@ -33,8 +33,7 @@ public class Textures { private static final IIconContainer MACHINE_OPV_BOTTOM = new CustomIcon("iconsets/MACHINE_OPV_BOTTOM"); private static final IIconContainer MACHINE_MAXV_BOTTOM = new CustomIcon("iconsets/MACHINE_MAXV_BOTTOM"); - private static final IIconContainer TESLA_COVER_ICON = new CustomIcon("iconsets/TESLA_COVER"); - private static final IIconContainer TESLA_COVER_ULTIMATE_ICON = new CustomIcon("iconsets/TESLA_COVER_ULTIMATE"); + private static final IIconContainer TESLA_TRANSCEIVER_TOP = new CustomIcon("iconsets/TESLA_TRANSCEIVER_TOP"); public static IIconContainer[] MACHINECASINGS_SIDE_TT = new IIconContainer[]{ MACHINE_8V_SIDE, MACHINE_LV_SIDE, MACHINE_MV_SIDE, MACHINE_HV_SIDE, @@ -192,10 +191,7 @@ public class Textures { public static ITexture[][] MACHINE_CASINGS_TT = new ITexture[16][17]; - public static ITexture[] TESLA_COVER_TEXTURES = new ITexture[]{ - new GT_RenderedTexture(TESLA_COVER_ICON), - new GT_RenderedTexture(TESLA_COVER_ULTIMATE_ICON) - }; + public static ITexture TESLA_TRANSCEIVER_TOP_BA = new GT_RenderedTexture(TESLA_TRANSCEIVER_TOP); public Textures(){ for (byte i = 0; i < MACHINE_CASINGS_TT.length; i++) { diff --git a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java index d0073acb48..81418f0c4f 100644 --- a/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java +++ b/src/main/java/com/github/technus/tectech/thing/metaTileEntity/single/GT_MetaTileEntity_TeslaCoil.java @@ -5,6 +5,7 @@ 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.metaTileEntity.multi.GT_MetaTileEntity_TM_teslaCoil; import eu.usrv.yamcore.auxiliary.PlayerChatHelper; +import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -12,16 +13,17 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicBatteryBuffer; import net.minecraft.entity.player.EntityPlayer; - -import java.util.*; +import java.util.HashMap; +import java.util.Map; import static com.github.technus.tectech.CommonValues.V; import static com.github.technus.tectech.Util.entriesSortedByValues; +import static com.github.technus.tectech.thing.metaTileEntity.Textures.TESLA_TRANSCEIVER_TOP_BA; import static java.lang.Math.round; public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryBuffer { - private int maxTier = 3; //Max tier of transceiver + private int maxTier = 4; //Max tier of transceiver private int minTier = 0; //Min tier of transceiver public Map eTeslaMap = new HashMap();//Tesla Map to map them tesla bois! @@ -142,6 +144,27 @@ public class GT_MetaTileEntity_TeslaCoil extends GT_MetaTileEntity_BasicBatteryB return powerPassToggle ? "Sending power!" : "Receiving power!"; } + @Override + public boolean isFacingValid(byte aSide) {return aSide != 1;}//Prevents output at the top side + + @Override + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[3][17][]; + + for(byte i = -1; i < 16; ++i) { + rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1]}; + rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], TESLA_TRANSCEIVER_TOP_BA}; + rTextures[2][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[this.mTier][i + 1], this.mInventory.length == 16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[this.mTier] : (this.mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[this.mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier])}; + } + + return rTextures; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return this.mTextures[aSide == aFacing ? 2 : aSide == 1 ? 1 : 0][aColorIndex + 1]; + } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_TeslaCoil(mName, mTier, mDescription, mTextures, mInventory.length); -- cgit