diff options
Diffstat (limited to 'src/main/java/gregtech')
146 files changed, 6096 insertions, 3355 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java index 080dc13fc8..525da2dd08 100644 --- a/src/main/java/gregtech/GT_Mod.java +++ b/src/main/java/gregtech/GT_Mod.java @@ -325,6 +325,7 @@ public class GT_Mod implements IGT_Mod { } ); gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile.get("render", "TileAmbientOcclusion", true); + gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true); gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig.get(aTextGeneral, "MaxEqualEntitiesAtOneSpot", 3).getInt(3); gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get(aTextGeneral, "SkeletonsShootGTArrows", 16).getInt(16); diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index b2afa4216e..8cb3547768 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -3,9 +3,7 @@ package gregtech.api.enums; import gregtech.api.GregTech_API; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.GT_SidedTexture; -import gregtech.api.objects.GT_StdRenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.util.IIcon; @@ -45,16 +43,20 @@ public class Textures { MACHINE_MAXV_BOTTOM, OVERLAY_SCHEST, + OVERLAY_SCHEST_GLOW, OVERLAY_STANK, - + OVERLAY_STANK_GLOW, + OVERLAY_PIPELINE_FLUID_BACK, OVERLAY_PIPELINE_FLUID_FRONT, - OVERLAY_PIPELINE_FLUID_SIDE, - + OVERLAY_PIPELINE_FLUID_SIDE, + OVERLAY_PIPELINE_FLUID_SIDE_GLOW, + OVERLAY_PIPELINE_ITEM_BACK, OVERLAY_PIPELINE_ITEM_FRONT, OVERLAY_PIPELINE_ITEM_SIDE, - + OVERLAY_PIPELINE_ITEM_SIDE_GLOW, + LONG_DISTANCE_PIPE_FLUID, LONG_DISTANCE_PIPE_ITEM, @@ -88,8 +90,9 @@ public class Textures { OVERLAY_ENERGY_IN_POWER, OVERLAY_ENERGY_OUT_POWER, OVERLAY_AUTOMAINTENANCE, + OVERLAY_AUTOMAINTENANCE_GLOW, OVERLAY_AUTOMAINTENANCE_IDLE, - OVERLAY_TELEPORTER_SIDES, + OVERLAY_AUTOMAINTENANCE_IDLE_GLOW, // VOID // The Empty Texture @@ -124,16 +127,26 @@ public class Textures { VENT_ADVANCED, COVER_WOOD_PLATE, ARROW_UP, + ARROW_UP_GLOW, ARROW_DOWN, + ARROW_DOWN_GLOW, ARROW_LEFT, + ARROW_LEFT_GLOW, ARROW_RIGHT, + ARROW_RIGHT_GLOW, AUTOMATION_FILTER, + AUTOMATION_FILTER_GLOW, AUTOMATION_TYPEFILTER, + AUTOMATION_TYPEFILTER_GLOW, AUTOMATION_CHESTBUFFER, + AUTOMATION_CHESTBUFFER_GLOW, AUTOMATION_SUPERBUFFER, + AUTOMATION_SUPERBUFFER_GLOW, AUTOMATION_REGULATOR, + AUTOMATION_REGULATOR_GLOW, AUTOMATION_ITEMDISTRIBUTOR, + AUTOMATION_ITEMDISTRIBUTOR_GLOW, CONCRETE_LIGHT_STONE, CONCRETE_LIGHT_COBBLE, CONCRETE_LIGHT_COBBLE_MOSSY, @@ -224,6 +237,7 @@ public class Textures { MACHINE_BRONZEBLASTFURNACE, MACHINE_BRONZEBLASTFURNACE_ACTIVE, + MACHINE_BRONZEBLASTFURNACE_ACTIVE_GLOW, MACHINE_CASING_ROBUST_TUNGSTENSTEEL, MACHINE_CASING_CLEAN_STAINLESSSTEEL, MACHINE_CASING_STABLE_TITANIUM, @@ -236,13 +250,19 @@ public class Textures { MACHINE_CASING_FUSION, MACHINE_CASING_FUSION_GLASS, MACHINE_CASING_FUSION_GLASS_YELLOW, + MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW, MACHINE_CASING_FUSION_2, MACHINE_CASING_MAGIC, + MACHINE_CASING_MAGIC_GLOW, MACHINE_CASING_MAGIC_ACTIVE, + MACHINE_CASING_MAGIC_ACTIVE_GLOW, MACHINE_CASING_MAGIC_FRONT, + MACHINE_CASING_MAGIC_FRONT_GLOW, MACHINE_CASING_MAGIC_FRONT_ACTIVE, + MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW, MACHINE_CASING_DRAGONEGG, + MACHINE_CASING_DRAGONEGG_GLOW, MACHINE_CASING_SOLID_STEEL, MACHINE_CASING_FROST_PROOF, @@ -288,6 +308,7 @@ public class Textures { MACHINE_CASING_DENSEBRICKS, MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE, + MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE_GLOW, MACHINE_CASING_BRICKEDBLASTFURNACE_INACTIVE, MACHINE_COIL_KANTHAL, @@ -304,20 +325,27 @@ public class Textures { BOILER_FRONT, BOILER_FRONT_ACTIVE, + BOILER_FRONT_ACTIVE_GLOW, BOILER_LAVA_FRONT, BOILER_LAVA_FRONT_ACTIVE, + BOILER_LAVA_FRONT_ACTIVE_GLOW, NAQUADAH_REACTOR_SOLID_BACK, NAQUADAH_REACTOR_SOLID_FRONT, NAQUADAH_REACTOR_SOLID_SIDE, NAQUADAH_REACTOR_SOLID_BOTTOM, - NAQUADAH_REACTOR_SOLID_TOP, + NAQUADAH_REACTOR_SOLID_BACK_ACTIVE, + NAQUADAH_REACTOR_SOLID_BACK_ACTIVE_GLOW, NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE, + NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE_GLOW, NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE, + NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE_GLOW, NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE, - + NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE_GLOW, NAQUADAH_REACTOR_SOLID_TOP_ACTIVE, + NAQUADAH_REACTOR_SOLID_TOP_ACTIVE_GLOW, + NAQUADAH_REACTOR_FLUID_BACK, NAQUADAH_REACTOR_FLUID_FRONT, NAQUADAH_REACTOR_FLUID_SIDE, @@ -325,10 +353,15 @@ public class Textures { NAQUADAH_REACTOR_FLUID_TOP, NAQUADAH_REACTOR_FLUID_BACK_ACTIVE, + NAQUADAH_REACTOR_FLUID_BACK_ACTIVE_GLOW, NAQUADAH_REACTOR_FLUID_FRONT_ACTIVE, + NAQUADAH_REACTOR_FLUID_FRONT_ACTIVE_GLOW, NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE, + NAQUADAH_REACTOR_FLUID_SIDE_ACTIVE_GLOW, NAQUADAH_REACTOR_FLUID_BOTTOM_ACTIVE, + NAQUADAH_REACTOR_FLUID_BOTTOM_ACTIVE_GLOW, NAQUADAH_REACTOR_FLUID_TOP_ACTIVE, + NAQUADAH_REACTOR_FLUID_TOP_ACTIVE_GLOW, DIESEL_GENERATOR_BACK, DIESEL_GENERATOR_FRONT, @@ -397,16 +430,23 @@ public class Textures { OVERLAY_MUFFLER, OVERLAY_CONTROLLER, OVERLAY_ACTIVITYDETECTOR, + OVERLAY_ACTIVITYDETECTOR_GLOW, OVERLAY_ENERGYDETECTOR, OVERLAY_FLUIDDETECTOR, OVERLAY_ITEMDETECTOR, OVERLAY_FUSION1, + OVERLAY_FUSION1_GLOW, OVERLAY_FUSION2, + OVERLAY_FUSION2_GLOW, OVERLAY_FUSION3, + OVERLAY_FUSION3_GLOW, OVERLAY_SCREEN, + OVERLAY_SCREEN_GLOW, OVERLAY_QTANK, + OVERLAY_QTANK_GLOW, OVERLAY_QCHEST, + OVERLAY_QCHEST_GLOW, OVERLAY_SHUTTER, OVERLAY_CLOSET, @@ -425,17 +465,27 @@ public class Textures { OVERLAY_ENERGY_IN_MULTI, OVERLAY_ENERGY_OUT_MULTI, OVERLAY_FRONT_LARGE_BOILER, + OVERLAY_FRONT_LARGE_BOILER_GLOW, OVERLAY_FRONT_LARGE_BOILER_ACTIVE, + OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW, OVERLAY_FRONT_VACUUM_FREEZER, + OVERLAY_FRONT_VACUUM_FREEZER_GLOW, OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE, + OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW, OVERLAY_FRONT_MULTI_SMELTER, + OVERLAY_FRONT_MULTI_SMELTER_GLOW, OVERLAY_FRONT_MULTI_SMELTER_ACTIVE, + OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW, OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE, + OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW, OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE, + OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW, OVERLAY_FRONT_IMPLOSION_COMPRESSOR, - + OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW, OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE, + OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW, + OVERLAY_TOP_POTIONBREWER, OVERLAY_TOP_REPLICATOR, OVERLAY_TOP_MASSFAB, @@ -455,17 +505,25 @@ public class Textures { OVERLAY_FRONT_REPLICATOR, OVERLAY_FRONT_MASSFAB, OVERLAY_FRONT_STEAM_HAMMER, + OVERLAY_FRONT_STEAM_HAMMER_ACTIVE, + OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW, OVERLAY_FRONT_STEAM_FURNACE, OVERLAY_FRONT_STEAM_ALLOY_SMELTER, OVERLAY_FRONT_STEAM_MACERATOR, + OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE, + OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW, OVERLAY_FRONT_STEAM_COMPRESSOR, OVERLAY_FRONT_STEAM_EXTRACTOR, OVERLAY_FRONT_DISASSEMBLER, + OVERLAY_FRONT_DISASSEMBLER_GLOW, + OVERLAY_FRONT_DISASSEMBLER_ACTIVE, + OVERLAY_FRONT_DISASSEMBLER_ACTIVE_GLOW, OVERLAY_FRONT_BOXINATOR, OVERLAY_FRONT_ROCK_BREAKER, OVERLAY_FRONT_SCANNER, + OVERLAY_FRONT_SCANNER_GLOW, OVERLAY_BOTTOM_POTIONBREWER, OVERLAY_BOTTOM_REPLICATOR, OVERLAY_BOTTOM_MASSFAB, @@ -504,29 +562,38 @@ public class Textures { OVERLAY_TOP_STEAM_FURNACE_ACTIVE, OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE, OVERLAY_TOP_STEAM_MACERATOR_ACTIVE, + OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW, OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE, OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE, OVERLAY_TOP_DISASSEMBLER_ACTIVE, + OVERLAY_TOP_DISASSEMBLER_ACTIVE_GLOW, OVERLAY_TOP_BOXINATOR_ACTIVE, OVERLAY_TOP_ROCK_BREAKER_ACTIVE, OVERLAY_TOP_SCANNER_ACTIVE, OVERLAY_FRONT_POTIONBREWER_ACTIVE, + OVERLAY_FRONT_POTIONBREWER_ACTIVE_GLOW, OVERLAY_FRONT_REPLICATOR_ACTIVE, + OVERLAY_FRONT_REPLICATOR_ACTIVE_GLOW, OVERLAY_FRONT_MASSFAB_ACTIVE, - OVERLAY_FRONT_STEAM_HAMMER_ACTIVE, + OVERLAY_FRONT_MASSFAB_ACTIVE_GLOW, OVERLAY_FRONT_STEAM_FURNACE_ACTIVE, + OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW, OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE, + OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW, - OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE, OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE, + OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW, OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE, - OVERLAY_FRONT_DISASSEMBLER_ACTIVE, + OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW, OVERLAY_FRONT_BOXINATOR_ACTIVE, + OVERLAY_FRONT_BOXINATOR_ACTIVE_GLOW, OVERLAY_FRONT_ROCK_BREAKER_ACTIVE, + OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW, OVERLAY_FRONT_SCANNER_ACTIVE, + OVERLAY_FRONT_SCANNER_ACTIVE_GLOW, OVERLAY_BOTTOM_POTIONBREWER_ACTIVE, OVERLAY_BOTTOM_REPLICATOR_ACTIVE, OVERLAY_BOTTOM_MASSFAB_ACTIVE, @@ -560,7 +627,11 @@ public class Textures { OVERLAY_SIDE_SCANNER_ACTIVE, OVERLAY_ADV_PUMP, OVERLAY_TELEPORTER, + OVERLAY_TELEPORTER_GLOW, OVERLAY_TELEPORTER_ACTIVE, + OVERLAY_TELEPORTER_ACTIVE_GLOW, + OVERLAY_TELEPORTER_SIDES, + OVERLAY_TELEPORTER_SIDES_GLOW, FUSIONI_1, FUSIONI_2, FUSIONI_3, @@ -865,33 +936,55 @@ public class Textures { BASALT_BRICKS_CHISELED, BASALT_SMOOTH, OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE, + OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW, OVERLAY_FRONT_HEAT_EXCHANGER, + OVERLAY_FRONT_HEAT_EXCHANGER_GLOW, OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE, + OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW, OVERLAY_FRONT_PROCESSING_ARRAY, + OVERLAY_FRONT_PROCESSING_ARRAY_GLOW, OVERLAY_FRONT_OIL_DRILL_ACTIVE, + OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW, OVERLAY_FRONT_OIL_DRILL, + OVERLAY_FRONT_OIL_DRILL_GLOW, OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE, + OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW, OVERLAY_FRONT_DIESEL_ENGINE, + OVERLAY_FRONT_DIESEL_ENGINE_GLOW, OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE, + OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW, OVERLAY_FRONT_EXTREME_DIESEL_ENGINE, + OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW, OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE, + OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW, OVERLAY_FRONT_PYROLYSE_OVEN, + OVERLAY_FRONT_PYROLYSE_OVEN_GLOW, OVERLAY_FRONT_OIL_CRACKER_ACTIVE, + OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW, OVERLAY_FRONT_OIL_CRACKER, + OVERLAY_FRONT_OIL_CRACKER_GLOW, OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE, + OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW, OVERLAY_FRONT_DISTILLATION_TOWER, + OVERLAY_FRONT_DISTILLATION_TOWER_GLOW, OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, + OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW, OVERLAY_FRONT_ASSEMBLY_LINE, + OVERLAY_FRONT_ASSEMBLY_LINE_GLOW, OVERLAY_FRONT_ORE_DRILL_ACTIVE, + OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW, OVERLAY_FRONT_ORE_DRILL, + OVERLAY_FRONT_ORE_DRILL_GLOW, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR, + OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE, + OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW, PIPE_RESTRICTOR_UP, PIPE_RESTRICTOR_DOWN, @@ -914,37 +1007,37 @@ public class Textures { /** * Icon for Fresh CFoam */ - public static final ITexture[] FRESHFOAM = new ITexture[]{new GT_RenderedTexture(CFOAM_FRESH)}; + public static final ITexture[] FRESHFOAM = {TextureFactory.of(CFOAM_FRESH)}; /** * Icons for Hardened CFoam * 0 = No Color * 1 - 16 = Colors */ - public static final ITexture[][] HARDENEDFOAMS = new ITexture[][]{ - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.CONSTRUCTION_FOAM.mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[0].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[1].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[2].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[3].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[4].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[5].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[6].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[7].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[8].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[9].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[10].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[11].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[12].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[13].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[14].mRGBa)}, - new ITexture[]{new GT_RenderedTexture(CFOAM_HARDENED, Dyes.VALUES[15].mRGBa)} + public static final ITexture[][] HARDENEDFOAMS = { + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.CONSTRUCTION_FOAM.mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[0].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[1].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[2].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[3].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[4].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[5].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[6].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[7].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[8].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[9].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[10].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[11].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[12].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[13].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[14].mRGBa)}, + new ITexture[]{TextureFactory.of(CFOAM_HARDENED, Dyes.VALUES[15].mRGBa)} }; /** * Machine Casings by Tier * 0 = 8V, 1 = LV, 2 = MV, 3 = HV, 4 = EV, 5 = IV, 6 = IV, 7 = IV, 8 = IV, 9 = IV */ public static final IIconContainer[] - MACHINECASINGS_SIDE = new IIconContainer[]{ + MACHINECASINGS_SIDE = { MACHINE_8V_SIDE, MACHINE_LV_SIDE, MACHINE_MV_SIDE, @@ -962,7 +1055,7 @@ public class Textures { MACHINE_OPV_SIDE, MACHINE_MAXV_SIDE, }, - MACHINECASINGS_TOP = new IIconContainer[]{ + MACHINECASINGS_TOP = { MACHINE_8V_TOP, MACHINE_LV_TOP, MACHINE_MV_TOP, @@ -980,7 +1073,7 @@ public class Textures { MACHINE_OPV_TOP, MACHINE_MAXV_TOP, }, - MACHINECASINGS_BOTTOM = new IIconContainer[]{ + MACHINECASINGS_BOTTOM = { MACHINE_8V_BOTTOM, MACHINE_LV_BOTTOM, MACHINE_MV_BOTTOM, @@ -998,7 +1091,7 @@ public class Textures { MACHINE_OPV_BOTTOM, MACHINE_MAXV_BOTTOM, }, - GRANITES = new IIconContainer[]{ + GRANITES = { GRANITE_BLACK_STONE, GRANITE_BLACK_COBBLE, GRANITE_BLACK_COBBLE_MOSSY, @@ -1016,7 +1109,7 @@ public class Textures { GRANITE_RED_BRICKS_CHISELED, GRANITE_RED_SMOOTH, }, - CONCRETES = new IIconContainer[]{ + CONCRETES = { CONCRETE_DARK_STONE, CONCRETE_DARK_COBBLE, CONCRETE_DARK_COBBLE_MOSSY, @@ -1034,7 +1127,7 @@ public class Textures { CONCRETE_LIGHT_BRICKS_CHISELED, CONCRETE_LIGHT_SMOOTH, }, - STONES = new IIconContainer[]{ + STONES = { MARBLE_STONE, MARBLE_COBBLE, MARBLE_COBBLE_MOSSY, @@ -1052,7 +1145,7 @@ public class Textures { BASALT_BRICKS_CHISELED, BASALT_SMOOTH, }, - TURBINE = new IIconContainer[]{ + TURBINE = { LARGETURBINE_ST1, LARGETURBINE_ST2, LARGETURBINE_ST3, @@ -1063,7 +1156,7 @@ public class Textures { LARGETURBINE_ST8, LARGETURBINE_ST9 }, - TURBINE_ACTIVE = new IIconContainer[]{ + TURBINE_ACTIVE = { LARGETURBINE_ST_ACTIVE1, LARGETURBINE_ST_ACTIVE2, LARGETURBINE_ST_ACTIVE3, @@ -1074,7 +1167,7 @@ public class Textures { LARGETURBINE_ST_ACTIVE8, LARGETURBINE_ST_ACTIVE9 }, - TURBINE1 = new IIconContainer[]{ + TURBINE1 = { LARGETURBINE_SS1, LARGETURBINE_SS2, LARGETURBINE_SS3, @@ -1085,7 +1178,7 @@ public class Textures { LARGETURBINE_SS8, LARGETURBINE_SS9 }, - TURBINE_ACTIVE1 = new IIconContainer[]{ + TURBINE_ACTIVE1 = { LARGETURBINE_SS_ACTIVE1, LARGETURBINE_SS_ACTIVE2, LARGETURBINE_SS_ACTIVE3, @@ -1096,7 +1189,7 @@ public class Textures { LARGETURBINE_SS_ACTIVE8, LARGETURBINE_SS_ACTIVE9 }, - TURBINE2 = new IIconContainer[]{ + TURBINE2 = { LARGETURBINE_TI1, LARGETURBINE_TI2, LARGETURBINE_TI3, @@ -1107,7 +1200,7 @@ public class Textures { LARGETURBINE_TI8, LARGETURBINE_TI9 }, - TURBINE_ACTIVE2 = new IIconContainer[]{ + TURBINE_ACTIVE2 = { LARGETURBINE_TI_ACTIVE1, LARGETURBINE_TI_ACTIVE2, LARGETURBINE_TI_ACTIVE3, @@ -1118,7 +1211,7 @@ public class Textures { LARGETURBINE_TI_ACTIVE8, LARGETURBINE_TI_ACTIVE9 }, - TURBINE3 = new IIconContainer[]{ + TURBINE3 = { LARGETURBINE_TU1, LARGETURBINE_TU2, LARGETURBINE_TU3, @@ -1129,7 +1222,7 @@ public class Textures { LARGETURBINE_TU8, LARGETURBINE_TU9 }, - TURBINE_ACTIVE3 = new IIconContainer[]{ + TURBINE_ACTIVE3 = { LARGETURBINE_TU_ACTIVE1, LARGETURBINE_TU_ACTIVE2, LARGETURBINE_TU_ACTIVE3, @@ -1140,7 +1233,7 @@ public class Textures { LARGETURBINE_TU_ACTIVE8, LARGETURBINE_TU_ACTIVE9 }, - CONNECTED_HULLS = new IIconContainer[]{ + CONNECTED_HULLS = { CONCRETE_DARK_STONE, FUSIONI_1, FUSIONI_2, @@ -1167,7 +1260,7 @@ public class Textures { FUSIONII_11, FUSIONII_12, }, - STORAGE_BLOCKS1 = new IIconContainer[]{ + STORAGE_BLOCKS1 = { BLOCK_ADAMANTIUM, BLOCK_ALUMINIUM, BLOCK_AMERICIUM, @@ -1185,7 +1278,7 @@ public class Textures { BLOCK_BLUESTEEL, BLOCK_BRASS }, - STORAGE_BLOCKS2 = new IIconContainer[]{ + STORAGE_BLOCKS2 = { BLOCK_BRONZE, BLOCK_CAESIUM, BLOCK_CERIUM, @@ -1203,7 +1296,7 @@ public class Textures { BLOCK_DYSPROSIUM, BLOCK_ELECTRUM }, - STORAGE_BLOCKS3 = new IIconContainer[]{ + STORAGE_BLOCKS3 = { BLOCK_ELECTRUMFLUX, BLOCK_ENDERIUM, BLOCK_ERBIUM, @@ -1221,7 +1314,7 @@ public class Textures { BLOCK_IRONWOOD, BLOCK_KANTHAL }, - STORAGE_BLOCKS4 = new IIconContainer[]{ + STORAGE_BLOCKS4 = { BLOCK_KNIGHTMETAL, BLOCK_LANTHANUM, BLOCK_LEAD, @@ -1239,7 +1332,7 @@ public class Textures { BLOCK_NAQUADAHENRICHED, BLOCK_NAQUADRIA }, - STORAGE_BLOCKS5 = new IIconContainer[]{ + STORAGE_BLOCKS5 = { BLOCK_NEODYMIUM, BLOCK_NEODYMIUMMAGNETIC, BLOCK_NEUTRONIUM, @@ -1257,7 +1350,7 @@ public class Textures { BLOCK_PLUTONIUM241, BLOCK_PRASEODYMIUM }, - STORAGE_BLOCKS6 = new IIconContainer[]{ + STORAGE_BLOCKS6 = { BLOCK_PROMETHIUM, BLOCK_REDALLOY, BLOCK_REDSTEEL, @@ -1275,7 +1368,7 @@ public class Textures { BLOCK_STEELMAGNETIC, BLOCK_STERLINGSILVER }, - STORAGE_BLOCKS7 = new IIconContainer[]{ + STORAGE_BLOCKS7 = { BLOCK_SUNNARIUM, BLOCK_TANTALUM, BLOCK_TELLURIUM, @@ -1293,7 +1386,7 @@ public class Textures { BLOCK_URANIUM, BLOCK_URANIUM235 }, - STORAGE_BLOCKS8 = new IIconContainer[]{ + STORAGE_BLOCKS8 = { BLOCK_VANADIUM, BLOCK_VANADIUMGALLIUM, BLOCK_WROUGHTIRON, @@ -1311,7 +1404,7 @@ public class Textures { BLOCK_FIRESTONE, BLOCK_SHADOW }, - STORAGE_BLOCKS9 = new IIconContainer[]{ + STORAGE_BLOCKS9 = { BLOCK_AERCRYSTAL, BLOCK_AMBER, BLOCK_AMETHYST, @@ -1329,7 +1422,7 @@ public class Textures { BLOCK_IGNISCRYSTAL, BLOCK_JASPER }, - STORAGE_BLOCKS10 = new IIconContainer[]{ + STORAGE_BLOCKS10 = { BLOCK_LAZURITE, BLOCK_LIGNITE, BLOCK_MONAZITE, @@ -1347,7 +1440,7 @@ public class Textures { BLOCK_TANZANITE, BLOCK_TERRACRYSTAL }, - STORAGE_BLOCKS11 = new IIconContainer[]{ + STORAGE_BLOCKS11 = { BLOCK_TOPAZ, BLOCK_VINTEUM, BLOCK_YELLOWGARNET, @@ -1355,136 +1448,136 @@ public class Textures { BLOCK_CHARCOAL, BLOCK_BLAZE }; - public static ITexture[] HIDDEN_TEXTURE = new ITexture[]{ - new GT_StdRenderedTexture(BlockIcons.HIDDEN_FACE) + public static ITexture[] HIDDEN_TEXTURE = { + TextureFactory.builder().addIcon(HIDDEN_FACE).stdOrient().build() }; public static ITexture[] - ERROR_RENDERING = new ITexture[]{ - new GT_RenderedTexture(RENDERING_ERROR) + ERROR_RENDERING = { + TextureFactory.of(RENDERING_ERROR) }; - public static ITexture[] OVERLAYS_ENERGY_IN = new ITexture[]{ - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{180, 180, 180, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{220, 220, 220, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{255, 100, 0, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{255, 255, 30, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{128, 128, 128, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{240, 240, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{220, 220, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{200, 200, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{180, 180, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{160, 160, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{140, 140, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{120, 120, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{100, 100, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{80, 80, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{60, 60, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN, new short[]{40, 40, 245, 0}), + public static ITexture[] OVERLAYS_ENERGY_IN = { + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN, new short[]{40, 40, 245, 0}), }; - public static ITexture[] OVERLAYS_ENERGY_OUT = new ITexture[]{ - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{180, 180, 180, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{220, 220, 220, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{255, 100, 0, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{255, 255, 30, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{128, 128, 128, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{240, 240, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{220, 220, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{200, 200, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{180, 180, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{160, 160, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{140, 140, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{120, 120, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{100, 100, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{80, 80, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{60, 60, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT, new short[]{40, 40, 245, 0}), + public static ITexture[] OVERLAYS_ENERGY_OUT = { + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT, new short[]{40, 40, 245, 0}), }; - public static ITexture[] OVERLAYS_ENERGY_IN_MULTI = new ITexture[]{ - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{180, 180, 180, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{220, 220, 220, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{255, 100, 0, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{255, 255, 30, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{128, 128, 128, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{240, 240, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{220, 220, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{200, 200, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{180, 180, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{160, 160, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{140, 140, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{120, 120, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{100, 100, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{80, 80, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{60, 60, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_MULTI, new short[]{40, 40, 245, 0}), + public static ITexture[] OVERLAYS_ENERGY_IN_MULTI = { + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_MULTI, new short[]{40, 40, 245, 0}), }; - public static ITexture[] OVERLAYS_ENERGY_OUT_MULTI = new ITexture[]{ - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{180, 180, 180, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{220, 220, 220, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{255, 100, 0, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{255, 255, 30, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{128, 128, 128, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{240, 240, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{220, 220, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{200, 200, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{180, 180, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{160, 160, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{140, 140, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{120, 120, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{100, 100, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{80, 80, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{60, 60, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_MULTI, new short[]{40, 40, 245, 0}), + public static ITexture[] OVERLAYS_ENERGY_OUT_MULTI = { + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_MULTI, new short[]{40, 40, 245, 0}), }; - public static ITexture[] OVERLAYS_ENERGY_IN_POWER = new ITexture[]{ - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{180, 180, 180, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{220, 220, 220, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{255, 100, 0, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{255, 255, 30, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{128, 128, 128, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{240, 240, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{220, 220, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{200, 200, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{180, 180, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{160, 160, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{140, 140, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{120, 120, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{100, 100, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{80, 80, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{60, 60, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_IN_POWER, new short[]{40, 40, 245, 0}), + public static ITexture[] OVERLAYS_ENERGY_IN_POWER = { + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_IN_POWER, new short[]{40, 40, 245, 0}), }; - public static ITexture[] OVERLAYS_ENERGY_OUT_POWER = new ITexture[]{ - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{180, 180, 180, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{220, 220, 220, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{255, 100, 0, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{255, 255, 30, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{128, 128, 128, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{240, 240, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{220, 220, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{200, 200, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{180, 180, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{160, 160, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{140, 140, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{120, 120, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{100, 100, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{80, 80, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{60, 60, 245, 0}), - new GT_RenderedTexture(OVERLAY_ENERGY_OUT_POWER, new short[]{40, 40, 245, 0}), + public static ITexture[] OVERLAYS_ENERGY_OUT_POWER = { + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{180, 180, 180, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{220, 220, 220, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{255, 100, 0, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{255, 255, 30, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{128, 128, 128, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{240, 240, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{220, 220, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{200, 200, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{180, 180, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{160, 160, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{140, 140, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{120, 120, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{100, 100, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{80, 80, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{60, 60, 245, 0}), + TextureFactory.of(OVERLAY_ENERGY_OUT_POWER, new short[]{40, 40, 245, 0}), }; - public static ITexture[] LOCKERS = new ITexture[]{ - new GT_RenderedTexture(OVERLAY_LOCKER_000), - new GT_RenderedTexture(OVERLAY_LOCKER_001), - new GT_RenderedTexture(OVERLAY_LOCKER_002), - new GT_RenderedTexture(OVERLAY_LOCKER_003), - new GT_RenderedTexture(OVERLAY_LOCKER_004), - new GT_RenderedTexture(OVERLAY_LOCKER_005), - new GT_RenderedTexture(OVERLAY_LOCKER_006), - new GT_RenderedTexture(OVERLAY_LOCKER_007), - new GT_RenderedTexture(OVERLAY_LOCKER_008), - new GT_RenderedTexture(OVERLAY_LOCKER_009), - new GT_RenderedTexture(OVERLAY_LOCKER_010), - new GT_RenderedTexture(OVERLAY_LOCKER_011), - new GT_RenderedTexture(OVERLAY_LOCKER_012), - new GT_RenderedTexture(OVERLAY_LOCKER_013), + public static ITexture[] LOCKERS = { + TextureFactory.of(OVERLAY_LOCKER_000), + TextureFactory.of(OVERLAY_LOCKER_001), + TextureFactory.of(OVERLAY_LOCKER_002), + TextureFactory.of(OVERLAY_LOCKER_003), + TextureFactory.of(OVERLAY_LOCKER_004), + TextureFactory.of(OVERLAY_LOCKER_005), + TextureFactory.of(OVERLAY_LOCKER_006), + TextureFactory.of(OVERLAY_LOCKER_007), + TextureFactory.of(OVERLAY_LOCKER_008), + TextureFactory.of(OVERLAY_LOCKER_009), + TextureFactory.of(OVERLAY_LOCKER_010), + TextureFactory.of(OVERLAY_LOCKER_011), + TextureFactory.of(OVERLAY_LOCKER_012), + TextureFactory.of(OVERLAY_LOCKER_013), }; /** * USE casingTexturePages[page] instead of CASING_BLOCKS since it is casingTexturePages[0] @@ -1497,24 +1590,17 @@ public class Textures { */ public static ITexture[][] casingTexturePages = new ITexture[128][];//page holder so we don't make an short long array - public static ITexture getCasingTextureForId(int id){ - return casingTexturePages[(id>>7)&0x7f][id&0x7f]; - } - public static void setCasingTextureForId(int id,ITexture iTexture){ - casingTexturePages[(id>>7)&0x7f][id&0x7f]=iTexture; - } - public static void setCasingTexture(byte page,byte index,ITexture iTexture){ - casingTexturePages[page][index]=iTexture; - } - static { for (byte i = 0; i < MACHINE_CASINGS.length; i++) for (byte j = 0; j < MACHINE_CASINGS[i].length; j++) - MACHINE_CASINGS[i][j] = new GT_SidedTexture(MACHINECASINGS_BOTTOM[i], MACHINECASINGS_TOP[i], MACHINECASINGS_SIDE[i], Dyes.getModulation(j - 1, Dyes.MACHINE_METAL.mRGBa)); - casingTexturePages[0] = CASING_BLOCKS; + MACHINE_CASINGS[i][j] = TextureFactory.of( + MACHINECASINGS_BOTTOM[i], + MACHINECASINGS_TOP[i], + MACHINECASINGS_SIDE[i], Dyes.getModulation(j - 1, Dyes.MACHINE_METAL.mRGBa)); + casingTexturePages[0] = new ITexture[128]; //adds some known pages, modders also can do it... - GT_Utility.addTexturePage((byte)1); - GT_Utility.addTexturePage((byte)8); + GT_Utility.addTexturePage((byte) 1); + GT_Utility.addTexturePage((byte) 8); } protected IIcon mIcon; @@ -1523,6 +1609,18 @@ public class Textures { GregTech_API.sGTBlockIconload.add(this); } + public static ITexture getCasingTextureForId(int id) { + return casingTexturePages[(id >> 7) & 0x7f][id & 0x7f]; + } + + public static void setCasingTextureForId(int id, ITexture iTexture) { + casingTexturePages[(id >> 7) & 0x7f][id & 0x7f] = iTexture; + } + + public static void setCasingTexture(byte page, byte index, ITexture iTexture) { + casingTexturePages[page][index] = iTexture; + } + @Override public IIcon getIcon() { return mIcon; @@ -1534,13 +1632,13 @@ public class Textures { } @Override - public void run() { - mIcon = GregTech_API.sBlockIcons.registerIcon(RES_PATH_BLOCK + "iconsets/" + this); + public ResourceLocation getTextureFile() { + return TextureMap.locationBlocksTexture; } @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; + public void run() { + mIcon = GregTech_API.sBlockIcons.registerIcon(RES_PATH_BLOCK + "iconsets/" + this); } public static class CustomIcon implements IIconContainer, Runnable { @@ -1563,13 +1661,13 @@ public class Textures { } @Override - public void run() { - mIcon = GregTech_API.sBlockIcons.registerIcon(RES_PATH_BLOCK + mIconName); + public ResourceLocation getTextureFile() { + return TextureMap.locationBlocksTexture; } @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationBlocksTexture; + public void run() { + mIcon = GregTech_API.sBlockIcons.registerIcon(RES_PATH_BLOCK + mIconName); } } } @@ -1623,7 +1721,7 @@ public class Textures { TURBINE_HUGE; public static final IIconContainer[] - DURABILITY_BAR = new IIconContainer[]{ + DURABILITY_BAR = { DURABILITY_BAR_0, DURABILITY_BAR_1, DURABILITY_BAR_2, @@ -1634,7 +1732,7 @@ public class Textures { DURABILITY_BAR_7, DURABILITY_BAR_8, }, - ENERGY_BAR = new IIconContainer[]{ + ENERGY_BAR = { ENERGY_BAR_0, ENERGY_BAR_1, ENERGY_BAR_2, @@ -1646,7 +1744,7 @@ public class Textures { ENERGY_BAR_8, }; - public static final ITexture[] ERROR_RENDERING = new ITexture[]{new GT_RenderedTexture(RENDERING_ERROR)}; + public static final ITexture[] ERROR_RENDERING = {TextureFactory.of(RENDERING_ERROR)}; protected IIcon mIcon, mOverlay; @@ -1695,14 +1793,14 @@ public class Textures { } @Override - public void run() { - mIcon = GregTech_API.sItemIcons.registerIcon(RES_PATH_ITEM + mIconName); - mOverlay = GregTech_API.sItemIcons.registerIcon(RES_PATH_ITEM + mIconName + "_OVERLAY"); + public ResourceLocation getTextureFile() { + return TextureMap.locationItemsTexture; } @Override - public ResourceLocation getTextureFile() { - return TextureMap.locationItemsTexture; + public void run() { + mIcon = GregTech_API.sItemIcons.registerIcon(RES_PATH_ITEM + mIconName); + mOverlay = GregTech_API.sItemIcons.registerIcon(RES_PATH_ITEM + mIconName + "_OVERLAY"); } } } diff --git a/src/main/java/gregtech/api/interfaces/IBlockContainer.java b/src/main/java/gregtech/api/interfaces/IBlockContainer.java new file mode 100644 index 0000000000..7949ae90ce --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/IBlockContainer.java @@ -0,0 +1,8 @@ +package gregtech.api.interfaces; + +import net.minecraft.block.Block; + +public interface IBlockContainer { + Block getBlock(); + byte getMeta(); +} diff --git a/src/main/java/gregtech/api/interfaces/ITexture.java b/src/main/java/gregtech/api/interfaces/ITexture.java index 4321cc523c..4c0b1984ca 100644 --- a/src/main/java/gregtech/api/interfaces/ITexture.java +++ b/src/main/java/gregtech/api/interfaces/ITexture.java @@ -2,6 +2,7 @@ package gregtech.api.interfaces; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; public interface ITexture { void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); @@ -17,4 +18,35 @@ public interface ITexture { void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); boolean isValidTexture(); + + /** + * @return {@code true} if this texture is from the old package + */ + default boolean isOldTexture() { + return getClass().toString().startsWith("gregtech.api.objects"); + } + + /** + * Will initialize the {@link Tessellator} if rendering off-world (Inventory) + * @param aRenderer The {@link RenderBlocks} Renderer + * @param aNormalX The X Normal for current Quad Face + * @param aNormalY The Y Normal for current Quad Face + * @param aNormalZ The Z Normal for current Quad Face + */ + default void startDrawingQuads(RenderBlocks aRenderer, float aNormalX, float aNormalY, float aNormalZ) { + if (aRenderer.useInventoryTint) { + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(aNormalX, aNormalY, aNormalZ); + } + } + + /** + * Will run the {@link Tessellator} to draw Quads if rendering off-world (Inventory) + * @param aRenderer The {@link RenderBlocks} Renderer + */ + default void draw(RenderBlocks aRenderer) { + if (aRenderer.useInventoryTint) { + Tessellator.instance.draw(); + } + } } diff --git a/src/main/java/gregtech/api/interfaces/ITextureBuilder.java b/src/main/java/gregtech/api/interfaces/ITextureBuilder.java new file mode 100644 index 0000000000..8a4d715ccb --- /dev/null +++ b/src/main/java/gregtech/api/interfaces/ITextureBuilder.java @@ -0,0 +1,72 @@ +package gregtech.api.interfaces; + +import gregtech.api.render.TextureFactory; +import net.minecraft.block.Block; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * <p>This Interface defines operations to configure and build instances of the {@link ITexture} implementations</p> + * <p>Use the {@link TextureFactory#builder()} method to get an instance of the {@link ITextureBuilder} implementation.</p> + */ +public interface ITextureBuilder { + /** + * Build the {@link ITexture} + * + * @return The built {@link ITexture} + */ + ITexture build(); + + /** + * @param block The {@link Block} + * @param meta The meta value for the Block + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder setFromBlock(final Block block, final int meta); + + /** + * @param side <p>The {@link ForgeDirection} side providing the texture</p> + * <p>Default is {@link ForgeDirection#UNKNOWN} to use same side as rendered</p> + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder setFromSide(final ForgeDirection side); + + /** + * @param iconContainers The {@link IIconContainer}s to add + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder addIcon(final IIconContainer... iconContainers); + + /** + * @param rgba The RGBA tint for this {@link ITexture} + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder setRGBA(final short[] rgba); + + /** + * @param iTextures The {@link ITexture} layers to add + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder addLayer(final ITexture... iTextures); + + /** + * Set alpha blending + * @param allowAlpha to set + * + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder setAllowAlpha(final boolean allowAlpha); + + /** + * Texture will render with same orientation as with vanilla blocks + * + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder stdOrient(); + + /** + * Texture always render with full brightness to glow in the dark + * + * @return {@link ITextureBuilder} for chaining + */ + ITextureBuilder glow(); +} diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java index 262eac674c..fd94349d31 100644 --- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java @@ -22,7 +22,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.net.GT_Packet_TileEntity; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_StdRenderedTexture; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java index b841528063..7ab494e551 100644 --- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java +++ b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java @@ -1,22 +1,30 @@ package gregtech.api.metatileentity.examples; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE_ACTIVE; + /** * This Example Implementation still works, however I use something completely different in my own Code. */ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_E_Furnace(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Not like using a Commodore 64", 1, 1, "E_Furnace.png", "smelting", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE)); + super(aID, aName, aNameRegional, aTier, 1, "Not like using a Commodore 64", 1, 1, "E_Furnace.png", "smelting", TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE), TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE), TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE), TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE), TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE), TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE), TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE)); } public GT_MetaTileEntity_E_Furnace(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index 19b6d26237..c6da3522bc 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -17,9 +17,9 @@ import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.GT_GC_Compat; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_CoverBehavior; +import gregtech.api.util.GT_GC_Compat; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Client; @@ -30,7 +30,6 @@ import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySource; import ic2.api.energy.tile.IEnergyTile; import ic2.api.reactor.IReactorChamber; - import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -46,8 +45,6 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import appeng.api.parts.IPartHost; - import static gregtech.api.enums.GT_Values.VN; public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTileEntityCable { @@ -99,24 +96,24 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { if (!mInsulated) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], Dyes.getModulation(aColorIndex, mMaterial.mRGBa) )}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], Dyes.getModulation(aColorIndex, mMaterial.mRGBa) )}; if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) - return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; if (tThickNess < 0.374F)//0.375 x1 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; if (tThickNess < 0.499F)//0.500 x2 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; if (tThickNess < 0.624F)//0.625 x4 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; if (tThickNess < 0.749F)//0.750 x8 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; if (tThickNess < 0.874F)//0.825 x12 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), TextureFactory.of(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } - return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; + return new ITexture[]{TextureFactory.of(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))}; } @Override @@ -147,7 +144,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile @Override public int getProgresstime() { - return (int) mTransferredAmperage * 64; + return mTransferredAmperage * 64; } @Override @@ -266,7 +263,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile } else if (rfReceiver.receiveEnergy(tDirection, rfOut, true) > 0) { if (mRestRF == 0) { - int RFtrans = rfReceiver.receiveEnergy(tDirection, (int) rfOut, false); + int RFtrans = rfReceiver.receiveEnergy(tDirection, rfOut, false); rUsedAmperes++; mRestRF = rfOut - RFtrans; } else { @@ -453,11 +450,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile return true; // RF Input Compat - if (GregTech_API.mInputRF && (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity)baseMetaTile, tDir))) - return true; - - - return false; + return GregTech_API.mInputRF && (tTileEntity instanceof IEnergyEmitter && ((IEnergyEmitter) tTileEntity).emitsEnergyTo((TileEntity) baseMetaTile, tDir)); } @Override @@ -518,14 +511,14 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile EnumChatFormatting.RED+ mOverheat +EnumChatFormatting.RESET+" / "+EnumChatFormatting.YELLOW+ mMaxOverheat + EnumChatFormatting.RESET, "Max Load (1t):", EnumChatFormatting.GREEN + Integer.toString(mTransferredAmperageOK) + EnumChatFormatting.RESET +" A / "+ - EnumChatFormatting.YELLOW + Long.toString(mAmperage) + EnumChatFormatting.RESET +" A", + EnumChatFormatting.YELLOW + mAmperage + EnumChatFormatting.RESET +" A", "Max EU/p (1t):", EnumChatFormatting.GREEN + Long.toString(mTransferredVoltageOK) + EnumChatFormatting.RESET +" EU / "+ - EnumChatFormatting.YELLOW + Long.toString(mVoltage) + EnumChatFormatting.RESET +" EU", + EnumChatFormatting.YELLOW + mVoltage + EnumChatFormatting.RESET +" EU", "Max Load (20t): "+ - EnumChatFormatting.GREEN + Integer.toString(mTransferredAmperageLast20OK) + EnumChatFormatting.RESET +" A", + EnumChatFormatting.GREEN + mTransferredAmperageLast20OK + EnumChatFormatting.RESET +" A", "Max EU/p (20t): "+ - EnumChatFormatting.GREEN + Long.toString(mTransferredVoltageLast20OK) + EnumChatFormatting.RESET +" EU" + EnumChatFormatting.GREEN + mTransferredVoltageLast20OK + EnumChatFormatting.RESET +" EU" }; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index 708bbf2ca8..59c1e91543 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -13,7 +13,7 @@ import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; @@ -59,7 +59,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { } public GT_MetaPipeEntity_Fluid(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, int aCapacity, int aHeatResistance, boolean aGasProof, int aFluidTypes) { - super(aID, aName, aNameRegional, 0, false); + super(aID, aName, aNameRegional, 0, false); mThickNess = aThickNess; mMaterial = aMaterial; mCapacity = aCapacity; @@ -98,16 +98,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - float tThickNess = getThickNess(); - if (mDisableInput == 0) return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + float tThickNess = getThickNess(); + if (mDisableInput == 0) + return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; byte tMask = 0; - byte[][] sRestrictionArray = new byte[][]{ - {2, 3, 5, 4}, - {2, 3, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 4, 5}, - {1, 0, 2, 3}, - {1, 0, 2, 3} + byte[][] sRestrictionArray = { + {2, 3, 5, 4}, + {2, 3, 4, 5}, + {1, 0, 4, 5}, + {1, 0, 4, 5}, + {1, 0, 2, 3}, + {1, 0, 2, 3} }; if (aSide >= 0 && aSide < 6) { for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i; @@ -116,44 +117,67 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tMask > 3 && tMask < 12) tMask = (byte) (tMask ^ 12); } - return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), getRestrictorTexture(tMask)}; - } - - protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) { - if (aPipeAmount >= 9) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aPipeAmount >= 4) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.124F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.374F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.499F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.749F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - if (aThickNess < 0.874F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); - return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), getRestrictorTexture(tMask)}; + } + + protected static ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) { + if (aPipeAmount >= 9) + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aPipeAmount >= 4) + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.124F) + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.374F) + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.499F) + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.749F) + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.874F) + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return TextureFactory.of(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); } protected static final ITexture getRestrictorTexture(byte aMask) { - switch (aMask) { - case 1: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UP); - case 2: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DOWN); - case 3: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UD); - case 4: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_LEFT); - case 5: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UL); - case 6: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DL); - case 7: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NR); - case 8: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_RIGHT); - case 9: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UR); - case 10: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DR); - case 11: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NL); - case 12: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_LR); - case 13: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_ND); - case 14: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NU); - case 15: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR); - default: return null; - } + switch (aMask) { + case 1: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UP); + case 2: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DOWN); + case 3: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UD); + case 4: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_LEFT); + case 5: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UL); + case 6: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DL); + case 7: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NR); + case 8: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_RIGHT); + case 9: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_UR); + case 10: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_DR); + case 11: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NL); + case 12: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_LR); + case 13: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_ND); + case 14: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR_NU); + case 15: + return TextureFactory.of(Textures.BlockIcons.PIPE_RESTRICTOR); + default: + return null; + } } @Override public void onValueUpdate(byte aValue) { - mDisableInput = aValue; + mDisableInput = aValue; } @Override @@ -193,40 +217,42 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public void saveNBTData(NBTTagCompound aNBT) { - for (int i = 0; i < mPipeAmount; i++) - if (mFluids[i] != null) - aNBT.setTag("mFluid"+(i==0?"":i), mFluids[i].writeToNBT(new NBTTagCompound())); + for (int i = 0; i < mPipeAmount; i++) + if (mFluids[i] != null) + aNBT.setTag("mFluid" + (i == 0 ? "" : i), mFluids[i].writeToNBT(new NBTTagCompound())); aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); if (GT_Mod.gregtechproxy.gt6Pipe) { - aNBT.setByte("mConnections", mConnections); - aNBT.setByte("mDisableInput", mDisableInput); + aNBT.setByte("mConnections", mConnections); + aNBT.setByte("mDisableInput", mDisableInput); } } @Override public void loadNBTData(NBTTagCompound aNBT) { - for (int i = 0; i < mPipeAmount; i++) - mFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid"+(i==0?"":i))); + for (int i = 0; i < mPipeAmount; i++) + mFluids[i] = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid" + (i == 0 ? "" : i))); mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom"); if (GT_Mod.gregtechproxy.gt6Pipe) { - mConnections = aNBT.getByte("mConnections"); - mDisableInput = aNBT.getByte("mDisableInput"); + mConnections = aNBT.getByte("mConnections"); + mDisableInput = aNBT.getByte("mDisableInput"); } } @Override public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { - if ((((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) { - for (FluidStack tFluid : mFluids) { - if (tFluid != null) { - int tTemperature = tFluid.getFluid().getTemperature(tFluid); + if ((((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) { + for (FluidStack tFluid : mFluids) { + if (tFluid != null) { + int tTemperature = tFluid.getFluid().getTemperature(tFluid); if (tTemperature > 320 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { - GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F); break; + GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, (tTemperature - 300) / 50.0F); + break; } else if (tTemperature < 260 && !isCoverOnSide((BaseMetaPipeEntity) getBaseMetaTileEntity(), (EntityLivingBase) aEntity)) { - GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); break; + GT_Utility.applyFrostDamage((EntityLivingBase) aEntity, (270 - tTemperature) / 25.0F); + break; } - } - } + } + } } } @@ -269,13 +295,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tTemperature > mHeatResistance) { if (aBaseMetaTileEntity.getRandomNumber(100) == 0) { // Poof - GT_Log.exp.println("Set Pipe to Fire due to to low heat resistance at "+aBaseMetaTileEntity.getXCoord()+ " | "+aBaseMetaTileEntity.getYCoord()+ " | "+aBaseMetaTileEntity.getZCoord()+ " DIMID: "+aBaseMetaTileEntity.getWorld().provider.dimensionId); + GT_Log.exp.println("Set Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() + " | " + aBaseMetaTileEntity.getYCoord() + " | " + aBaseMetaTileEntity.getZCoord() + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); aBaseMetaTileEntity.setToFire(); return true; } // Mmhmm, Fire aBaseMetaTileEntity.setOnFire(); - GT_Log.exp.println("Set Blocks around Pipe to Fire due to to low heat resistance at "+aBaseMetaTileEntity.getXCoord()+ " | "+aBaseMetaTileEntity.getYCoord()+ " | "+aBaseMetaTileEntity.getZCoord()+ " DIMID: "+aBaseMetaTileEntity.getWorld().provider.dimensionId); + GT_Log.exp.println("Set Blocks around Pipe to Fire due to to low heat resistance at " + aBaseMetaTileEntity.getXCoord() + " | " + aBaseMetaTileEntity.getYCoord() + " | " + aBaseMetaTileEntity.getZCoord() + " DIMID: " + aBaseMetaTileEntity.getWorld().provider.dimensionId); } if (!mGasProof && tFluid.getFluid().isGaseous(tFluid)) { @@ -319,9 +345,8 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { final IGregTechTileEntity gTank = tTank instanceof IGregTechTileEntity ? (IGregTechTileEntity) tTank : null; if (isConnectedAtSide(aSide) && tTank != null && (mLastReceivedFrom & (1 << aSide)) == 0 && - getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsFluidOut(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), tFluid.getFluid(), getBaseMetaTileEntity()) && - (gTank == null || gTank.getCoverBehaviorAtSide(tSide).letsFluidIn(tSide, gTank.getCoverIDAtSide(tSide), gTank.getCoverDataAtSide(tSide), tFluid.getFluid(), gTank))) - { + getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsFluidOut(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), tFluid.getFluid(), getBaseMetaTileEntity()) && + (gTank == null || gTank.getCoverBehaviorAtSide(tSide).letsFluidIn(tSide, gTank.getCoverIDAtSide(tSide), gTank.getCoverDataAtSide(tSide), tFluid.getFluid(), gTank))) { if (tTank.fill(ForgeDirection.getOrientation(tSide), tFluid, false) > 0) { tTanks.add(new MutableTriple<>(tTank, ForgeDirection.getOrientation(tSide), 0)); } @@ -335,15 +360,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { double availableCapacity = 0; // Calculate available capacity for distribution from all tanks - for (MutableTriple<IFluidHandler, ForgeDirection, Integer> tEntry: tTanks) { + for (MutableTriple<IFluidHandler, ForgeDirection, Integer> tEntry : tTanks) { tEntry.right = tEntry.left.fill(tEntry.middle, maxFluid, false); availableCapacity += tEntry.right; } // Now distribute - for (MutableTriple<IFluidHandler, ForgeDirection, Integer> tEntry: tTanks) { - if (availableCapacity > tAmount) tEntry.right = (int) Math.floor(tEntry.right * tAmount / availableCapacity); // Distribue fluids based on percentage available space at destination - if (tEntry.right == 0) tEntry.right = (int)Math.min(1, tAmount); // If the percent is not enough to give at least 1L, try to give 1L + for (MutableTriple<IFluidHandler, ForgeDirection, Integer> tEntry : tTanks) { + if (availableCapacity > tAmount) + tEntry.right = (int) Math.floor(tEntry.right * tAmount / availableCapacity); // Distribue fluids based on percentage available space at destination + if (tEntry.right == 0) + tEntry.right = (int) Math.min(1, tAmount); // If the percent is not enough to give at least 1L, try to give 1L if (tEntry.right <= 0) continue; int tFilledAmount = tEntry.left.fill(tEntry.middle, drainFromIndex(tEntry.right, false, index), false); @@ -355,31 +382,30 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Mod.gregtechproxy.gt6Pipe) { - byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); - byte tMask = (byte) (1 << tSide); - if (aPlayer.isSneaking()) { - if (isInputDisabledAtSide(tSide)) { - mDisableInput &= ~tMask; - GT_Utility.sendChatToPlayer(aPlayer, trans("212", "Input enabled")); - if (!isConnectedAtSide(tSide)) - connect(tSide); - } else { - mDisableInput |= tMask; - GT_Utility.sendChatToPlayer(aPlayer, trans("213", "Input disabled")); - } - } else { - if (!isConnectedAtSide(tSide)) { - if (connect(tSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); - } - else { - disconnect(tSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); - } - } - return true; - } + if (GT_Mod.gregtechproxy.gt6Pipe) { + byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); + byte tMask = (byte) (1 << tSide); + if (aPlayer.isSneaking()) { + if (isInputDisabledAtSide(tSide)) { + mDisableInput &= ~tMask; + GT_Utility.sendChatToPlayer(aPlayer, trans("212", "Input enabled")); + if (!isConnectedAtSide(tSide)) + connect(tSide); + } else { + mDisableInput |= tMask; + GT_Utility.sendChatToPlayer(aPlayer, trans("213", "Input disabled")); + } + } else { + if (!isConnectedAtSide(tSide)) { + if (connect(tSide) > 0) + GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); + } else { + disconnect(tSide); + GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); + } + } + return true; + } return false; } @@ -398,7 +424,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (tTileEntity == null) return false; - final byte tSide = (byte)ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); + final byte tSide = (byte) ForgeDirection.getOrientation(aSide).getOpposite().ordinal(); final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity(); if (baseMetaTile == null) return false; @@ -419,18 +445,18 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { || gTileEntity != null && gTileEntity.getCoverBehaviorAtSide(tSide) instanceof GT_Cover_FluidRegulator; } - } + } return false; } @Optional.Method(modid = "TConstruct") - private boolean isTConstructFaucet(TileEntity tTileEntity){ + private boolean isTConstructFaucet(TileEntity tTileEntity) { // Tinker Construct Faucets return a null tank info, so check the class return tTileEntity instanceof tconstruct.smeltery.logic.FaucetLogic; } @Optional.Method(modid = "Translocator") - private boolean isTranslocator(TileEntity tTileEntity){ + private boolean isTranslocator(TileEntity tTileEntity) { // Translocators return a TankInfo, but it's of 0 length - so check the class if we see this pattern return tTileEntity instanceof codechicken.translocator.TileLiquidTranslocator; } @@ -457,9 +483,9 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { ForgeDirection.getOrientation(i).offsetZ / 5.0 ) .setPosition( - aX - 0.5 + XSTR_INSTANCE.nextFloat(), - aY - 0.5 + XSTR_INSTANCE.nextFloat(), - aZ - 0.5 + XSTR_INSTANCE.nextFloat() + aX - 0.5 + XSTR_INSTANCE.nextFloat(), + aY - 0.5 + XSTR_INSTANCE.nextFloat(), + aZ - 0.5 + XSTR_INSTANCE.nextFloat() ).run() ); } @@ -467,16 +493,16 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public final int getCapacity() { - return mCapacity * 20 * mPipeAmount; + return mCapacity * 20 * mPipeAmount; } @Override public FluidTankInfo getInfo() { - for (FluidStack tFluid : mFluids) { - if (tFluid != null) - return new FluidTankInfo(tFluid, mCapacity * 20); - } - return new FluidTankInfo(null, mCapacity * 20); + for (FluidStack tFluid : mFluids) { + if (tFluid != null) + return new FluidTankInfo(tFluid, mCapacity * 20); + } + return new FluidTankInfo(null, mCapacity * 20); } @Override @@ -484,7 +510,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { if (getCapacity() <= 0 && !getBaseMetaTileEntity().hasSteamEngineUpgrade()) return new FluidTankInfo[]{}; ArrayList<FluidTankInfo> tList = new ArrayList<>(); for (FluidStack tFluid : mFluids) - tList.add(new FluidTankInfo(tFluid, mCapacity * 20)); + tList.add(new FluidTankInfo(tFluid, mCapacity * 20)); return tList.toArray(new FluidTankInfo[mPipeAmount]); } @@ -500,20 +526,20 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public final FluidStack getFluid() { - for (FluidStack tFluid : mFluids) { - if (tFluid != null) - return tFluid; - } + for (FluidStack tFluid : mFluids) { + if (tFluid != null) + return tFluid; + } return null; } @Override public final int getFluidAmount() { - int rAmount = 0; - for (FluidStack tFluid : mFluids) { - if (tFluid != null) - rAmount += tFluid.amount; - } + int rAmount = 0; + for (FluidStack tFluid : mFluids) { + if (tFluid != null) + rAmount += tFluid.amount; + } return rAmount; } @@ -523,20 +549,20 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { int index = -1; for (int i = 0; i < mPipeAmount; i++) { - if (mFluids[i] != null && mFluids[i].isFluidEqual(aFluid)) { - index = i; break; - } - else if ((mFluids[i] == null || mFluids[i].getFluid().getID() <= 0) && index < 0) { - index = i; - } - } - + if (mFluids[i] != null && mFluids[i].isFluidEqual(aFluid)) { + index = i; + break; + } else if ((mFluids[i] == null || mFluids[i].getFluid().getID() <= 0) && index < 0) { + index = i; + } + } + return fill_default_intoIndex(aSide, aFluid, doFill, index); } private final int fill_default_intoIndex(ForgeDirection aSide, FluidStack aFluid, boolean doFill, int index) { - if (index < 0 || index >= mPipeAmount) return 0; - if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0; + if (index < 0 || index >= mPipeAmount) return 0; + if (aFluid == null || aFluid.getFluid().getID() <= 0) return 0; if (mFluids[index] == null || mFluids[index].getFluid().getID() <= 0) { if (aFluid.amount * mPipeAmount <= getCapacity()) { @@ -573,17 +599,17 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public final FluidStack drain(int maxDrain, boolean doDrain) { - FluidStack drained = null; - for (int i = 0; i < mPipeAmount; i++) { - if ((drained = drainFromIndex(maxDrain, doDrain, i)) != null) - return drained; - } - return null; + FluidStack drained = null; + for (int i = 0; i < mPipeAmount; i++) { + if ((drained = drainFromIndex(maxDrain, doDrain, i)) != null) + return drained; + } + return null; } private final FluidStack drainFromIndex(int maxDrain, boolean doDrain, int index) { - if (index < 0 || index >= mPipeAmount) return null; - if (mFluids[index] == null) return null; + if (index < 0 || index >= mPipeAmount) return null; + if (mFluids[index] == null) return null; if (mFluids[index].amount <= 0) { mFluids[index] = null; return null; @@ -615,12 +641,12 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public String[] getDescription() { if (mPipeAmount == 1) { - return new String[]{ + return new String[]{ EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + (mCapacity * 20) + "%%% L/sec" + EnumChatFormatting.GRAY, EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY }; } else { - return new String[]{ + return new String[]{ EnumChatFormatting.BLUE + "Fluid Capacity: %%%" + (mCapacity * 20) + "%%% L/sec" + EnumChatFormatting.GRAY, EnumChatFormatting.RED + "Heat Limit: %%%" + mHeatResistance + "%%% K" + EnumChatFormatting.GRAY, EnumChatFormatting.AQUA + "Pipe Amount: %%%" + mPipeAmount + EnumChatFormatting.GRAY @@ -630,67 +656,86 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity { @Override public float getThickNess() { - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F; + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F; return mThickNess; } @Override public boolean isLiquidInput(byte aSide) { - return !isInputDisabledAtSide(aSide); + return !isInputDisabledAtSide(aSide); } @Override public boolean isLiquidOutput(byte aSide) { - return true; + return true; } public boolean isInputDisabledAtSide(int aSide) { - return (mDisableInput & (1 << aSide)) != 0; + return (mDisableInput & (1 << aSide)) != 0; } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) - return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - else - return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) + return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); + else + return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - float tSpace = (1f - mThickNess)/2; - float tSide0 = tSpace; - float tSide1 = 1f - tSpace; - float tSide2 = tSpace; - float tSide3 = 1f - tSpace; - float tSide4 = tSpace; - float tSide5 = 1f - tSpace; - - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0){tSide0=tSide2=tSide4=0;tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0){tSide2=tSide4=0;tSide1=tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0){tSide0=tSide4=0;tSide1=tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide3=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0){tSide0=tSide2=0;tSide1=tSide3=tSide5=1;} - - byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; - if((tConn & (1 << ForgeDirection.DOWN.ordinal()) ) != 0) tSide0 = 0f; - if((tConn & (1 << ForgeDirection.UP.ordinal()) ) != 0) tSide1 = 1f; - if((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; - if((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; - if((tConn & (1 << ForgeDirection.WEST.ordinal()) ) != 0) tSide4 = 0f; - if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f; - - return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + float tSpace = (1f - mThickNess) / 2; + float tSide0 = tSpace; + float tSide1 = 1f - tSpace; + float tSide2 = tSpace; + float tSide3 = 1f - tSpace; + float tSide4 = tSpace; + float tSide5 = 1f - tSpace; + + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0) { + tSide2 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0) { + tSide0 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide3 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0) { + tSide0 = tSide2 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + + byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; + if ((tConn & (1 << ForgeDirection.DOWN.ordinal())) != 0) tSide0 = 0f; + if ((tConn & (1 << ForgeDirection.UP.ordinal())) != 0) tSide1 = 1f; + if ((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; + if ((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; + if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; + if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; + + return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { - super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { - AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb); - } + super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { + AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb); + } } + @Override public FluidStack drain(ForgeDirection aSide, FluidStack aFluid, boolean doDrain) { if (aFluid == null) diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java index a1f0c1ed8f..e1677b1deb 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Frame.java @@ -1,11 +1,14 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.*; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_ModHandler.RecipeBits; @@ -47,7 +50,7 @@ public class GT_MetaPipeEntity_Frame extends MetaPipeEntity { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.frameGt.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index d56cd9d2fa..e24aebc064 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -1,7 +1,9 @@ package gregtech.api.metatileentity.implementations; import gregtech.GT_Mod; -import gregtech.api.enums.*; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.metatileentity.IMetaTileEntityItemPipe; @@ -9,7 +11,7 @@ import gregtech.api.interfaces.tileentity.ICoverable; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.MetaPipeEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_CoverBehavior; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Client; @@ -30,6 +32,8 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ConcurrentHashMap; +import static gregtech.api.enums.Textures.BlockIcons.PIPE_RESTRICTOR; + public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileEntityItemPipe { public final float mThickNess; public final Materials mMaterial; @@ -79,34 +83,34 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; if (tThickNess < 0.374F)//0.375 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; if (tThickNess < 0.499F)//0.500 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; if (tThickNess < 0.749F)//0.750 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; if (tThickNess < 0.874F)//0.825 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), TextureFactory.of(PIPE_RESTRICTOR)}; } if (aConnected) { float tThickNess = getThickNess(); if (tThickNess < 0.124F) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; if (tThickNess < 0.374F)//0.375 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; if (tThickNess < 0.499F)//0.500 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; if (tThickNess < 0.749F)//0.750 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; if (tThickNess < 0.874F)//0.825 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + return new ITexture[]{TextureFactory.of(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; } @Override @@ -143,14 +147,14 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE public void saveNBTData(NBTTagCompound aNBT) { aNBT.setByte("mLastReceivedFrom", mLastReceivedFrom); if (GT_Mod.gregtechproxy.gt6Pipe) - aNBT.setByte("mConnections", mConnections); + aNBT.setByte("mConnections", mConnections); } @Override public void loadNBTData(NBTTagCompound aNBT) { mLastReceivedFrom = aNBT.getByte("mLastReceivedFrom"); if (GT_Mod.gregtechproxy.gt6Pipe) { - mConnections = aNBT.getByte("mConnections"); + mConnections = aNBT.getByte("mConnections"); } } @@ -187,18 +191,17 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (GT_Mod.gregtechproxy.gt6Pipe) { - byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); - if (!isConnectedAtSide(tSide)) { - if (connect(tSide) > 0) - GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); - } - else { - disconnect(tSide); - GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); - } - return true; - } + if (GT_Mod.gregtechproxy.gt6Pipe) { + byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); + if (isConnectedAtSide(tSide)) { + disconnect(tSide); + GT_Utility.sendChatToPlayer(aPlayer, trans("215", "Disconnected")); + } else { + if (connect(tSide) > 0) + GT_Utility.sendChatToPlayer(aPlayer, trans("214", "Connected")); + } + return true; + } return false; } @@ -272,7 +275,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE TileEntity tInventory = getBaseMetaTileEntity().getTileEntityAtSide(aSide); if (tInventory != null && !(tInventory instanceof BaseMetaPipeEntity)) { if ((!(tInventory instanceof TileEntityHopper) && !(tInventory instanceof TileEntityDispenser)) || getBaseMetaTileEntity().getMetaIDAtSide(aSide) != GT_Utility.getOppositeSide(aSide)) { - return GT_Utility.moveMultipleItemStacks(aSender, tInventory, (byte) 6, GT_Utility.getOppositeSide(aSide), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1,1) > 0; + return GT_Utility.moveMultipleItemStacks(aSender, tInventory, (byte) 6, GT_Utility.getOppositeSide(aSide), null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1, 1) > 0; } } } @@ -306,7 +309,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) { - return isConnectedAtSide(aSide) && super.canInsertItem(aIndex, aStack, aSide); + return isConnectedAtSide(aSide) && super.canInsertItem(aIndex, aStack, aSide); } @Override @@ -334,7 +337,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - if (!isConnectedAtSide(aSide)) return false; + if (!isConnectedAtSide(aSide)) return false; if (isInventoryEmpty()) mLastReceivedFrom = aSide; return mLastReceivedFrom == aSide && mInventory[aIndex] == null; } @@ -356,51 +359,69 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE @Override public float getThickNess() { - if(GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F; + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x1) != 0) return 0.0625F; return mThickNess; } @Override public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) - return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); - else - return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) + return AxisAlignedBB.getBoundingBox(aX, aY, aZ, aX + 1, aY + 1, aZ + 1); + else + return getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); } private AxisAlignedBB getActualCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { - float tSpace = (1f - mThickNess)/2; - float tSide0 = tSpace; - float tSide1 = 1f - tSpace; - float tSide2 = tSpace; - float tSide3 = 1f - tSpace; - float tSide4 = tSpace; - float tSide5 = 1f - tSpace; - - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0){tSide0=tSide2=tSide4=0;tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0){tSide2=tSide4=0;tSide1=tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0){tSide0=tSide4=0;tSide1=tSide3=tSide5=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0){tSide0=tSide2=tSide4=0;tSide1=tSide3=1;} - if(getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0){tSide0=tSide2=0;tSide1=tSide3=tSide5=1;} - - byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; - if((tConn & (1 << ForgeDirection.DOWN.ordinal()) ) != 0) tSide0 = 0f; - if((tConn & (1 << ForgeDirection.UP.ordinal()) ) != 0) tSide1 = 1f; - if((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; - if((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; - if((tConn & (1 << ForgeDirection.WEST.ordinal()) ) != 0) tSide4 = 0f; - if((tConn & (1 << ForgeDirection.EAST.ordinal()) ) != 0) tSide5 = 1f; - - return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + float tSpace = (1f - mThickNess) / 2; + float tSide0 = tSpace; + float tSide1 = 1f - tSpace; + float tSide2 = tSpace; + float tSide3 = 1f - tSpace; + float tSide4 = tSpace; + float tSide5 = 1f - tSpace; + + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 0) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 1) != 0) { + tSide2 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 2) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 3) != 0) { + tSide0 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 4) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide3 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide((byte) 5) != 0) { + tSide0 = tSide2 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + + byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; + if ((tConn & (1 << ForgeDirection.DOWN.ordinal())) != 0) tSide0 = 0f; + if ((tConn & (1 << ForgeDirection.UP.ordinal())) != 0) tSide1 = 1f; + if ((tConn & (1 << ForgeDirection.NORTH.ordinal())) != 0) tSide2 = 0f; + if ((tConn & (1 << ForgeDirection.SOUTH.ordinal())) != 0) tSide3 = 1f; + if ((tConn & (1 << ForgeDirection.WEST.ordinal())) != 0) tSide4 = 0f; + if ((tConn & (1 << ForgeDirection.EAST.ordinal())) != 0) tSide5 = 1f; + + return AxisAlignedBB.getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); } @Override public void addCollisionBoxesToList(World aWorld, int aX, int aY, int aZ, AxisAlignedBB inputAABB, List<AxisAlignedBB> outputAABB, Entity collider) { - super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); - if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { - AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); - if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb); - } + super.addCollisionBoxesToList(aWorld, aX, aY, aZ, inputAABB, outputAABB, collider); + if (GT_Mod.instance.isClientSide() && (GT_Client.hideValue & 0x2) != 0) { + AxisAlignedBB aabb = getActualCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb); + } } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java index 7d79d2b93f..84bce3e7c6 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java @@ -3,14 +3,13 @@ package gregtech.api.metatileentity.implementations; import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_BasicMachine; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMachineCallback; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; @@ -33,6 +32,8 @@ import java.util.Arrays; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.debugCleanroom; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; /** @@ -157,7 +158,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B for (int i = 0; i < aTextures.length; i++) if (aTextures[i] != null) for (byte c = -1; c < 16; c++) { if (rTextures[i][c + 1] == null) - rTextures[i][c + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][c + 1], aTextures[i]}; + rTextures[i][c + 1] = new ITexture[]{MACHINE_CASINGS[mTier][c + 1], aTextures[i]}; } for (byte c = -1; c < 16; c++) { @@ -786,13 +787,13 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B EnumChatFormatting.BLUE + mNEIName + EnumChatFormatting.RESET, "Progress:", EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s", + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET +" s", "Stored Energy:", EnumChatFormatting.GREEN + Long.toString(getBaseMetaTileEntity().getStoredEU()) + EnumChatFormatting.RESET +" EU / "+ - EnumChatFormatting.YELLOW + Long.toString(getBaseMetaTileEntity().getEUCapacity()) + EnumChatFormatting.RESET +" EU", + EnumChatFormatting.YELLOW + getBaseMetaTileEntity().getEUCapacity() + EnumChatFormatting.RESET +" EU", "Probably uses: " + - EnumChatFormatting.RED + Integer.toString(mEUt) + EnumChatFormatting.RESET + " EU/t at " + - EnumChatFormatting.RED + Integer.toString(mEUt==0?0:mAmperage) + EnumChatFormatting.RESET +" A" + EnumChatFormatting.RED + mEUt + EnumChatFormatting.RESET + " EU/t at " + + EnumChatFormatting.RED + (mEUt == 0 ? 0 : mAmperage) + EnumChatFormatting.RESET +" A" }; } @@ -922,58 +923,58 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B } public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1]}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1]}; } public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{MACHINE_CASINGS[mTier][aColor + 1], TextureFactory.of(OVERLAY_PIPE_OUT)}; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java index 12ae6c6044..3cdb26c9e1 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Bronze.java @@ -2,10 +2,9 @@ package gregtech.api.metatileentity.implementations; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gregtech.api.util.WorldSpawnedEventBuilder; @@ -17,6 +16,13 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; import static gregtech.api.enums.GT_Values.D1; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZE_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZE_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZE_TOP; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; /** @@ -189,71 +195,71 @@ public abstract class GT_MetaTileEntity_BasicMachine_Bronze extends GT_MetaTileE @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_BOTTOM : MACHINE_BRONZE_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP : Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_TOP : MACHINE_BRONZE_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE : Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_BRONZEBRICKS_SIDE : MACHINE_BRONZE_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java index 00ce4051ec..281d0f6541 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java @@ -1,14 +1,18 @@ package gregtech.api.metatileentity.implementations; import cpw.mods.fml.common.Loader; -import gregtech.api.enums.*; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures.BlockIcons.CustomIcon; +import gregtech.api.enums.Tier; import gregtech.api.gui.GT_Container_BasicMachine; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -23,7 +27,10 @@ import net.minecraftforge.oredict.OreDictionary; import java.util.Locale; import java.util.Random; -import static gregtech.api.enums.GT_Values.*; +import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.enums.GT_Values.ticksBetweenSounds; /** * NEVER INCLUDE THIS FILE IN YOUR MOD!!! @@ -39,19 +46,36 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_ private final byte mGUIParameterA, mGUIParameterB; public GT_MetaTileEntity_BasicMachine_GT_Recipe( - int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, - int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, - boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe + int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, + int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, + boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe ) { - super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM"))); + super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE_GLOW"))).glow().build()), + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_GLOW"))).glow().build()), + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE_GLOW"))).glow().build()), + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_GLOW"))).glow().build()), + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE_GLOW"))).glow().build()), + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_GLOW"))).glow().build()), + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE_GLOW"))).glow().build()), + TextureFactory.of( + TextureFactory.of(new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM")), + TextureFactory.builder().addIcon((new CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_GLOW"))).glow().build()) + ); this.mSharedTank = aSharedTank; this.mTankCapacity = aTankCapacity; this.mSpecialEffect = aSpecialEffect; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java index 3badfae1ff..20a3758324 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_Steel.java @@ -1,9 +1,16 @@ package gregtech.api.metatileentity.implementations; import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; + +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_TOP; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEEL_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEEL_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEEL_TOP; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; /** @@ -25,12 +32,6 @@ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEn super(aName, aDescription, aTextures, aInputSlotCount, aOutputSlotCount, aBricked); } - /* - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BasicMachine_Steel(mTier, mDescription, mTextures); - } - */ @Override public float getSteamDamage() { return 12.0F; @@ -38,71 +39,71 @@ public abstract class GT_MetaTileEntity_BasicMachine_Steel extends GT_MetaTileEn @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE : Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE : Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE : Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE : Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_TOP : Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_TOP : Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa))}; } @Override public ITexture[] getBottomFacingPipeActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getBottomFacingPipeInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM : Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_BOTTOM : MACHINE_STEEL_BOTTOM, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTopFacingPipeActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_TOP : Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTopFacingPipeInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_TOP : Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_TOP : MACHINE_STEEL_TOP, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getSideFacingPipeActive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE : Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getSideFacingPipeInactive(byte aColor) { - return new ITexture[]{new GT_RenderedTexture(mTier == 1 ? Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE : Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{TextureFactory.of(mTier == 1 ? MACHINE_STEELBRICKS_SIDE : MACHINE_STEEL_SIDE, Dyes.getModulation(aColor, Dyes._NULL.mRGBa)), TextureFactory.of(OVERLAY_PIPE_OUT)}; } } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java index d73db20951..7f9e21ff65 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java @@ -1,9 +1,8 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -11,6 +10,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredMachineBlock { private static final int OUTPUT_INDEX = 0; @@ -45,18 +45,26 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[ForgeDirection.VALID_DIRECTIONS.length][17][]; ITexture tIcon = getOverlayIcon(); - ITexture tOut = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT); - ITexture tUp = new GT_RenderedTexture(Textures.BlockIcons.ARROW_UP); - ITexture tDown = new GT_RenderedTexture(Textures.BlockIcons.ARROW_DOWN); - ITexture tLeft = new GT_RenderedTexture(Textures.BlockIcons.ARROW_LEFT); - ITexture tRight = new GT_RenderedTexture(Textures.BlockIcons.ARROW_RIGHT); + ITexture tOut = TextureFactory.of(OVERLAY_PIPE_OUT); + ITexture tUp = TextureFactory.of( + TextureFactory.of(ARROW_UP), + TextureFactory.builder().addIcon(ARROW_UP_GLOW).glow().build()); + ITexture tDown = TextureFactory.of( + TextureFactory.of(ARROW_DOWN), + TextureFactory.builder().addIcon(ARROW_DOWN_GLOW).glow().build()); + ITexture tLeft = TextureFactory.of( + TextureFactory.of(ARROW_LEFT), + TextureFactory.builder().addIcon(ARROW_LEFT_GLOW).glow().build()); + ITexture tRight = TextureFactory.of( + TextureFactory.of(ARROW_RIGHT), + TextureFactory.builder().addIcon(ARROW_RIGHT_GLOW).glow().build()); for (int i = 0; i < rTextures[0].length; i++) { - rTextures[OUTPUT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tOut}; - rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tRight, tIcon}; - rTextures[ARROW_DOWN_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tDown, tIcon}; - rTextures[ARROW_LEFT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tLeft, tIcon}; - rTextures[ARROW_UP_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tUp, tIcon}; - rTextures[FRONT_INDEX][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], tIcon}; + rTextures[OUTPUT_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tOut}; + rTextures[ARROW_RIGHT_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tRight, tIcon}; + rTextures[ARROW_DOWN_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tDown, tIcon}; + rTextures[ARROW_LEFT_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tLeft, tIcon}; + rTextures[ARROW_UP_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tUp, tIcon}; + rTextures[FRONT_INDEX][i] = new ITexture[]{MACHINE_CASINGS[mTier][i], tIcon}; } return rTextures; } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java index 0683f020fa..2faf113e18 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_DataAccess.java @@ -1,6 +1,5 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_2by2; import gregtech.api.gui.GT_Container_4by4; import gregtech.api.gui.GT_GUIContainer_2by2; @@ -8,11 +7,13 @@ import gregtech.api.gui.GT_GUIContainer_4by4; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DATA_ACCESS; + public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch { private int timeout=4; @@ -32,12 +33,12 @@ public class GT_MetaTileEntity_Hatch_DataAccess extends GT_MetaTileEntity_Hatch @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_DATA_ACCESS)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_DATA_ACCESS)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_DATA_ACCESS)}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java index 466095fc21..e37d2160a2 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java @@ -1,16 +1,17 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; + public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { public GT_Recipe_Map mRecipeMap = null; @@ -28,12 +29,12 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_IN)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_IN)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java index f2f76dca4f..c8fe305de9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_InputBus.java @@ -1,11 +1,17 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; -import gregtech.api.gui.*; +import gregtech.api.gui.GT_Container_1by1; +import gregtech.api.gui.GT_Container_2by2; +import gregtech.api.gui.GT_Container_3by3; +import gregtech.api.gui.GT_Container_4by4; +import gregtech.api.gui.GT_GUIContainer_1by1; +import gregtech.api.gui.GT_GUIContainer_2by2; +import gregtech.api.gui.GT_GUIContainer_3by3; +import gregtech.api.gui.GT_GUIContainer_4by4; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; @@ -15,6 +21,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.StatCollector; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_IN; + public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { public GT_Recipe_Map mRecipeMap = null; public boolean disableSort; @@ -37,12 +45,12 @@ public class GT_MetaTileEntity_Hatch_InputBus extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_IN)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_IN)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_IN)}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java index 2742e99816..9067f5bb7b 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java @@ -5,7 +5,6 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_2by2; import gregtech.api.gui.GT_Container_MaintenanceHatch; import gregtech.api.gui.GT_GUIContainer_2by2; @@ -13,7 +12,7 @@ import gregtech.api.gui.GT_GUIContainer_MaintenanceHatch; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; @@ -24,6 +23,13 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DUCTTAPE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MAINTENANCE; + public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch { public boolean mWrench = false, mScrewdriver = false, mSoftHammer = false, mHardHammer = false, mSolderingTool = false, mCrowbar = false, mAuto; @@ -66,14 +72,25 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - if(mAuto)return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE)}; - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE)}; + if (mAuto) return new ITexture[]{ + aBaseTexture, + TextureFactory.of(OVERLAY_AUTOMAINTENANCE_IDLE), + TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_IDLE_GLOW).glow().build()}; + return new ITexture[]{ + aBaseTexture, + TextureFactory.of(OVERLAY_MAINTENANCE)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - if(mAuto)return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE)}; - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_DUCTTAPE)}; + if (mAuto) return new ITexture[]{ + aBaseTexture, + TextureFactory.of(OVERLAY_AUTOMAINTENANCE), + TextureFactory.builder().addIcon(OVERLAY_AUTOMAINTENANCE_GLOW).glow().build()}; + return new ITexture[]{ + aBaseTexture, + TextureFactory.of(OVERLAY_MAINTENANCE), + TextureFactory.of(OVERLAY_DUCTTAPE)}; } @Override @@ -146,7 +163,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch } public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess) { - ItemStack[] mInputs=new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}), + ItemStack[] mInputs= {ItemList.Duct_Tape.get(4), GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2), GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)}; @@ -188,12 +205,12 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch } } } - this.mCrowbar = true; - this.mHardHammer = true; - this.mScrewdriver = true; - this.mSoftHammer = true; - this.mSolderingTool = true; - this.mWrench = true; + mCrowbar = true; + mHardHammer = true; + mScrewdriver = true; + mSoftHammer = true; + mSolderingTool = true; + mWrench = true; updateSlots(); } return true; diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java index 49a28d28ff..9e59520edb 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java @@ -3,11 +3,10 @@ package gregtech.api.metatileentity.implementations; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.WorldSpawnedEventBuilder; import gregtech.common.GT_Pollution; @@ -18,6 +17,7 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.Arrays; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_MUFFLER; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; @SuppressWarnings("unused") // Unused API is expected within scope @@ -54,12 +54,12 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MUFFLER)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MUFFLER)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_MUFFLER)}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java index f57d0ed402..1cb80886a9 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java @@ -1,10 +1,9 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; @@ -13,7 +12,12 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.*; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; +import net.minecraftforge.fluids.IFluidHandler; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { private String lockedFluidName = null; @@ -39,12 +43,12 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java index 57cfc44ff6..7c8efb88e0 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java @@ -1,17 +1,24 @@ package gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; -import gregtech.api.gui.*; +import gregtech.api.gui.GT_Container_1by1; +import gregtech.api.gui.GT_Container_2by2; +import gregtech.api.gui.GT_Container_3by3; +import gregtech.api.gui.GT_Container_4by4; +import gregtech.api.gui.GT_GUIContainer_1by1; +import gregtech.api.gui.GT_GUIContainer_2by2; +import gregtech.api.gui.GT_GUIContainer_3by3; +import gregtech.api.gui.GT_GUIContainer_4by4; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; import static gregtech.api.util.GT_Utility.moveMultipleItemStacks; public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { @@ -42,12 +49,12 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; } @Override diff --git a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java index 184bd67556..61136c8f40 100644 --- a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java @@ -5,10 +5,13 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.util.LightingHelper; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; +/** + * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. + */ +@Deprecated public class GT_CopiedBlockTexture implements ITexture { private final Block mBlock; private final byte mSide, mMeta; diff --git a/src/main/java/gregtech/api/objects/GT_MultiTexture.java b/src/main/java/gregtech/api/objects/GT_MultiTexture.java index ec89a0dfa1..c7878374b4 100644 --- a/src/main/java/gregtech/api/objects/GT_MultiTexture.java +++ b/src/main/java/gregtech/api/objects/GT_MultiTexture.java @@ -1,14 +1,16 @@ package gregtech.api.objects; import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; /** - * Lets Multiple ITextures Render overlay over each other. - * <p/> - * I should have done this much earlier... + * <p>Lets Multiple ITextures Render overlay over each other.<</p> + * <p>I should have done this much earlier...</p> + * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ +@Deprecated public class GT_MultiTexture implements ITexture { private final ITexture[] mTextures; diff --git a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java index 9a0fbf344e..12d013303c 100644 --- a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java @@ -11,6 +11,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; +@Deprecated public class GT_RenderedTexture implements ITexture, IColorModulationContainer { final IIconContainer mIconContainer; final boolean mAllowAlpha; diff --git a/src/main/java/gregtech/api/objects/GT_SidedTexture.java b/src/main/java/gregtech/api/objects/GT_SidedTexture.java index 2242259e69..c6ed003be9 100644 --- a/src/main/java/gregtech/api/objects/GT_SidedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_SidedTexture.java @@ -7,6 +7,10 @@ import gregtech.api.interfaces.ITexture; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; +/** + * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. + */ +@Deprecated public class GT_SidedTexture implements ITexture, IColorModulationContainer { private final ITexture[] mTextures; /** diff --git a/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java b/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java index 041fed4164..0dd405c792 100644 --- a/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_StdRenderedTexture.java @@ -12,7 +12,9 @@ import net.minecraftforge.common.util.ForgeDirection; * to render with bottom side flipped as with dumb blocks rendering. * It is used in Ore blocks rendering so they better blends with dumb block ores * from vanilla or other mods, when seen from bottom. + * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ +@Deprecated public class GT_StdRenderedTexture extends GT_RenderedTexture{ @SuppressWarnings("unused") diff --git a/src/main/java/gregtech/api/render/TextureFactory.java b/src/main/java/gregtech/api/render/TextureFactory.java new file mode 100644 index 0000000000..8c67cd6740 --- /dev/null +++ b/src/main/java/gregtech/api/render/TextureFactory.java @@ -0,0 +1,126 @@ +package gregtech.api.render; + +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.ITextureBuilder; +import gregtech.common.render.GT_TextureBuilder; +import net.minecraft.block.Block; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * <p>This class contains a collection of static factory methods to access the New Texture API.</p> + * <p>The {@link #of} methods directly returns ready-to-use instances of {@link ITexture} implementations.</p> + * <p>To get more specific implementations of {@link ITexture} instances, use the {@link #builder()} method.</p> + * <p>Example of the {@link #builder()}:</p> + * <pre>{@code + * // Texture that glows in the dark + * TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).glow().build()); + * + * // Texture with same bottom flipped orientation as vanilla + * TextureFactory.builder().addIcon(GRANITE_RED_STONE).stdOrient().build(); + * }</pre> + * See: the {@link ITextureBuilder} interface + */ +@SuppressWarnings("unused") +public final class TextureFactory { + private TextureFactory() { + throw new AssertionError("Non-instantiable class"); + } + + /** + * Multi-layered {@link ITexture} factory + * + * @param textures The layers of {@link ITexture} from bottom to top + * @return The instance of an {@link ITexture} implementation + */ + public static ITexture of(final ITexture... textures) { + return builder().addLayer(textures).build(); + } + + /** + * All-Sided {@link ITexture} factory + * + * @param bottom The {@link IIconContainer} Icon for the Bottom Side. + * @param top The {@link IIconContainer} Icon for the Top Side. + * @param north The {@link IIconContainer} Icon for the North Side. + * @param south The {@link IIconContainer} Icon for the South Side. + * @param west The {@link IIconContainer} Icon for the West Side. + * @param east The {@link IIconContainer} Icon for the East Side. + * @param rgba The {@code short[]} RGBA tint for all sides. + * @return The instance of an {@link ITexture} implementation + */ + public static ITexture of(final IIconContainer bottom, final IIconContainer top, final IIconContainer north, + final IIconContainer south, final IIconContainer west, final IIconContainer east, + final short[] rgba) { + return builder().addIcon(bottom, top, north, south, west, east).setRGBA(rgba).setAllowAlpha(true).build(); + } + + /** + * Bottom-Top-Sides-Sided {@link ITexture} factory + * + * @param bottom The {@link IIconContainer} Icon for the Bottom Side. + * @param top The {@link IIconContainer} Icon for the Top Side. + * @param sides The {@link IIconContainer} Icon for the North, South, West and East Sides. + * @param rgba The {@code short[]} RGBA tint for all sides. + * @return The instance of an {@link ITexture} implementation + */ + public static ITexture of(final IIconContainer bottom, final IIconContainer top, final IIconContainer sides, + final short[] rgba) { + return builder().addIcon(bottom, top, sides, sides, sides, sides).setRGBA(rgba).setAllowAlpha(true).build(); + } + + /** + * Rendered {@link ITexture} factory + * + * @param iconContainer The {@link IIconContainer} to render + * @param rgba The {@code short[]} RGBA tint for the texture. + * @param allowAlpha Determine if texture will use alpha blending (Not yet implemented) + * @return The instance of an {@link ITexture} implementation + */ + public static ITexture of(final IIconContainer iconContainer, final short[] rgba, final boolean allowAlpha) { + return builder().addIcon(iconContainer).setRGBA(rgba).setAllowAlpha(allowAlpha).build(); + } + + public static ITexture of(final IIconContainer iconContainer, final short[] rgba) { + return builder().addIcon(iconContainer).setRGBA(rgba).build(); + } + + public static ITexture of(final IIconContainer iconContainer) { + return builder().addIcon(iconContainer).build(); + } + + /** + * Copied-Block {@link ITexture} factory + * that will render a texture copied from the side of a {@link Block}. + * + * @param block The {@link Block} that will provide the texture + * @param meta The meta value for the Block + * @param side The {@link ForgeDirection} side providing the texture + * @param rgba The RGBA tint to apply + * @return The instance of an {@link ITexture} implementation + */ + public static ITexture of(final Block block, final int meta, final ForgeDirection side, final short[] rgba) { + return builder().setFromBlock(block, meta).setFromSide(side).setRGBA(rgba).build(); + } + + public static ITexture of(final Block block, final int meta, final ForgeDirection side) { + return builder().setFromBlock(block, meta).setFromSide(side).build(); + } + + public static ITexture of(final Block block, final int meta) { + return builder().setFromBlock(block, meta).build(); + } + + public static ITexture of(final Block block) { + return of(block, 0); + } + + /** + * {@link ITextureBuilder} factory + * + * @return An instance of the {@link ITextureBuilder} implementation + */ + public static ITextureBuilder builder() { + return new GT_TextureBuilder(); + } +} diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java index 4fe57964d3..4acdf07c1f 100644 --- a/src/main/java/gregtech/api/util/GT_Utility.java +++ b/src/main/java/gregtech/api/util/GT_Utility.java @@ -16,6 +16,7 @@ import gregtech.api.enums.SubTag; import gregtech.api.enums.Textures; import gregtech.api.enums.ToolDictNames; import gregtech.api.events.BlockScanningEvent; +import gregtech.api.interfaces.IBlockContainer; import gregtech.api.interfaces.IDebugableBlock; import gregtech.api.interfaces.IProjectileItem; import gregtech.api.interfaces.ITexture; @@ -29,7 +30,6 @@ import gregtech.api.items.GT_EnergyArmor_Item; import gregtech.api.items.GT_Generic_Item; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.net.GT_Packet_Sound; -import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_ItemStack; import gregtech.api.objects.ItemData; import gregtech.api.threads.GT_Runnable_Sound; @@ -153,7 +153,7 @@ public class GT_Utility { } public static int safeInt(long number){ - return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number; + return number> V[V.length-1] ? safeInt(V[V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number; } public static Field getPublicField(Object aObject, String aField) { @@ -411,9 +411,7 @@ public class GT_Utility { if (TE_CHECK && aTileEntity instanceof IItemDuct) return true; if (BC_CHECK && aTileEntity instanceof buildcraft.api.transport.IPipeTile) return ((buildcraft.api.transport.IPipeTile) aTileEntity).isPipeConnected(ForgeDirection.getOrientation(aSide)); - if (GregTech_API.mTranslocator && aTileEntity instanceof codechicken.translocator.TileItemTranslocator) return true; - - return false; + return GregTech_API.mTranslocator && aTileEntity instanceof codechicken.translocator.TileItemTranslocator; } /** * Moves Stack from Inv-Slot to Inv-Slot, without checking if its even allowed. @@ -1028,7 +1026,7 @@ public class GT_Utility { if (aCheckIFluidContainerItems && aStack.getItem() instanceof IFluidContainerItem && ((IFluidContainerItem) aStack.getItem()).getCapacity(aStack) > 0) return aFluid.isFluidEqual(((IFluidContainerItem) aStack.getItem()).getFluid(aStack = copyAmount(1, aStack))); FluidContainerData tData = sFilledContainerToData.get(new GT_ItemStack(aStack)); - return tData == null ? false : tData.fluid.isFluidEqual(aFluid); + return tData != null && tData.fluid.isFluidEqual(aFluid); } public static FluidStack getFluidForFilledItem(ItemStack aStack, boolean aCheckIFluidContainerItems) { @@ -1140,7 +1138,7 @@ public class GT_Utility { } } ItemStack[] tStack = GT_OreDictUnificator.getStackArray(true, aOutput); - if(tStack==null||(tStack.length>0&>_Utility.areStacksEqual(aInput, tStack[0])))return false; + if(tStack==null||(tStack.length>0&& areStacksEqual(aInput, tStack[0])))return false; if (tOreName != null) { if(tOreName.toString().equals("dustAsh")&&tStack[0].getUnlocalizedName().equals("tile.volcanicAsh"))return false; aRecipeList.put(new RecipeInputOreDict(tOreName.toString(), aInput.stackSize), new RecipeOutput(aNBT, tStack)); @@ -1438,24 +1436,24 @@ public class GT_Utility { * Return texture id from item stack, unoptimized but readable? * @return casing texture 0 to 16383 */ - public static int getTextureId(Block blockFromBlock,byte metaFromBlock){ + public static int getTextureId(Block blockFromBlock, byte metaFromBlock) { for (int page = 0; page < Textures.BlockIcons.casingTexturePages.length; page++) { ITexture[] casingTexturePage = Textures.BlockIcons.casingTexturePages[page]; - if(casingTexturePage!=null){ + if (casingTexturePage != null) { for (int index = 0; index < casingTexturePage.length; index++) { ITexture iTexture = casingTexturePage[index]; - if(iTexture instanceof GT_CopiedBlockTexture){ - Block block = ((GT_CopiedBlockTexture) iTexture).getBlock(); - byte meta = ((GT_CopiedBlockTexture) iTexture).getMeta(); - if(meta==metaFromBlock && blockFromBlock==block){ - return (page<<7)+index; + if (iTexture instanceof IBlockContainer) { + Block block = ((IBlockContainer) iTexture).getBlock(); + byte meta = ((IBlockContainer) iTexture).getMeta(); + if (meta == metaFromBlock && blockFromBlock == block) { + return (page << 7) + index; } } } } } - throw new RuntimeException("Probably missing mapping or different texture class used for: "+ - blockFromBlock.getUnlocalizedName()+" meta:"+metaFromBlock); + throw new RuntimeException("Probably missing mapping or different texture class used for: " + + blockFromBlock.getUnlocalizedName() + " meta:" + metaFromBlock); } /** @@ -1938,7 +1936,7 @@ public class GT_Utility { rEUAmount += 500; FluidTankInfo[] tTanks = ((IFluidHandler) tTileEntity).getTankInfo(ForgeDirection.getOrientation(aSide)); if (tTanks != null) for (byte i = 0; i < tTanks.length; i++) { - tList.add(trans("167","Tank ") + i + ": " +EnumChatFormatting.GREEN+ GT_Utility.formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) +EnumChatFormatting.RESET+ " L / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(tTanks[i].capacity) +EnumChatFormatting.RESET+ " L " +EnumChatFormatting.GOLD+ getFluidName(tTanks[i].fluid, true)+EnumChatFormatting.RESET); + tList.add(trans("167","Tank ") + i + ": " +EnumChatFormatting.GREEN+ formatNumbers((tTanks[i].fluid == null ? 0 : tTanks[i].fluid.amount)) +EnumChatFormatting.RESET+ " L / " +EnumChatFormatting.YELLOW+ formatNumbers(tTanks[i].capacity) +EnumChatFormatting.RESET+ " L " +EnumChatFormatting.GOLD+ getFluidName(tTanks[i].fluid, true)+EnumChatFormatting.RESET); } } } catch (Throwable e) { @@ -2032,7 +2030,7 @@ public class GT_Utility { rEUAmount += 400; int tValue = 0; if (0 < (tValue = ((IMachineProgress) tTileEntity).getMaxProgress())) - tList.add(trans("178","Progress/Load: ") +EnumChatFormatting.GREEN+GT_Utility.formatNumbers(((IMachineProgress) tTileEntity).getProgress()) +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(tValue) +EnumChatFormatting.RESET); + tList.add(trans("178","Progress/Load: ") +EnumChatFormatting.GREEN+ formatNumbers(((IMachineProgress) tTileEntity).getProgress()) +EnumChatFormatting.RESET+ " / " +EnumChatFormatting.YELLOW+ formatNumbers(tValue) +EnumChatFormatting.RESET); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2048,9 +2046,9 @@ public class GT_Utility { } try { if (tTileEntity instanceof IBasicEnergyContainer && ((IBasicEnergyContainer) tTileEntity).getEUCapacity() > 0) { - tList.add(trans("179","Max IN: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(((IBasicEnergyContainer) tTileEntity).getInputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+((IBasicEnergyContainer)tTileEntity).getInputAmperage()+EnumChatFormatting.RESET+trans("183"," A")); - tList.add(trans("181","Max OUT: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " (" + GT_Values.VN[GT_Utility.getTier(((IBasicEnergyContainer) tTileEntity).getOutputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() +EnumChatFormatting.RESET+ trans("183"," A")); - tList.add(trans("184","Energy: ") +EnumChatFormatting.GREEN+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) +EnumChatFormatting.RESET+ " EU / " +EnumChatFormatting.YELLOW+ GT_Utility.formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) +EnumChatFormatting.RESET+ " EU"); + tList.add(trans("179","Max IN: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getInputVoltage() + " (" + GT_Values.VN[getTier(((IBasicEnergyContainer) tTileEntity).getInputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+((IBasicEnergyContainer)tTileEntity).getInputAmperage()+EnumChatFormatting.RESET+trans("183"," A")); + tList.add(trans("181","Max OUT: ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputVoltage() + " (" + GT_Values.VN[getTier(((IBasicEnergyContainer) tTileEntity).getOutputVoltage())] + ") " +EnumChatFormatting.RESET+ trans("182"," EU at ") +EnumChatFormatting.RED+ ((IBasicEnergyContainer) tTileEntity).getOutputAmperage() +EnumChatFormatting.RESET+ trans("183"," A")); + tList.add(trans("184","Energy: ") +EnumChatFormatting.GREEN+ formatNumbers(((IBasicEnergyContainer) tTileEntity).getStoredEU()) +EnumChatFormatting.RESET+ " EU / " +EnumChatFormatting.YELLOW+ formatNumbers(((IBasicEnergyContainer) tTileEntity).getEUCapacity()) +EnumChatFormatting.RESET+ " EU"); } } catch (Throwable e) { if (D1) e.printStackTrace(GT_Log.err); @@ -2412,7 +2410,7 @@ public class GT_Utility { setBookTitle(aStack, "Raw Prospection Data"); - NBTTagCompound tNBT = GT_Utility.ItemNBT.getNBT(aStack); + NBTTagCompound tNBT = getNBT(aStack); tNBT.setByte("prospection_tier", aTier); tNBT.setString("prospection_pos", "Dim: " + aDim + "\nX: " + aX + " Y: " + aY + " Z: " + aZ); diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index ecca0097fb..612c469926 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -245,6 +245,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { */ public boolean mRenderTileAmbientOcclusion = true; + /** + * This enables rendering of glowing textures + */ + public boolean mRenderGlowTextures = true; + public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15 public static Map<String, Integer> oreDictBurnTimes = new HashMap<>(); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java index 1fa508f25f..9669d84883 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings1.java @@ -2,7 +2,7 @@ package gregtech.common.blocks; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -27,8 +27,8 @@ public class GT_Block_Casings1 extends GT_Block_Casings_Abstract { public GT_Block_Casings1() { super(GT_Item_Casings1.class, "gt.blockcasings", GT_Material_Casings.INSTANCE); - for (int i = 0; i < 16; i = i+1) { - Textures.BlockIcons.casingTexturePages[0][i] = new GT_CopiedBlockTexture(this, 6, i); + for (int i = 0; i < 16; i++) { + Textures.BlockIcons.casingTexturePages[0][i] = TextureFactory.of(this, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "ULV Machine Casing"); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java index 56a838ecf7..b534d5dfc9 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings2.java @@ -3,7 +3,7 @@ package gregtech.common.blocks; import gregtech.api.enums.Dyes; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import net.minecraft.block.Block; import net.minecraft.entity.Entity; @@ -11,17 +11,18 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; public class GT_Block_Casings2 extends GT_Block_Casings_Abstract { public GT_Block_Casings2() { super(GT_Item_Casings2.class, "gt.blockcasings2", GT_Material_Casings.INSTANCE); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - if (i != 6){ - Textures.BlockIcons.casingTexturePages[0][(i + 16)] = new GT_CopiedBlockTexture(this, 6, i); - } - } + for (int i = 0; i < 16; i++) { + if (i != 6) { + Textures.BlockIcons.casingTexturePages[0][(i + 16)] = TextureFactory.of(this, i); + } + } //Special handler for Pyrolyse Oven Casing on hatches... - Textures.BlockIcons.casingTexturePages[0][22] = new GT_CopiedBlockTexture(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 6, 0,Dyes.MACHINE_METAL.mRGBa); + Textures.BlockIcons.casingTexturePages[0][22] = TextureFactory.of(Block.getBlockFromItem(ItemList.Casing_ULV.get(1).getItem()), 0, ForgeDirection.UNKNOWN, Dyes.MACHINE_METAL.mRGBa); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Solid Steel Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Frost Proof Machine Casing"); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java index 918d131d58..bd50a559d2 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings3.java @@ -2,7 +2,7 @@ package gregtech.common.blocks; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -11,7 +11,7 @@ public class GT_Block_Casings3 extends GT_Block_Casings_Abstract { public GT_Block_Casings3() { super(GT_Item_Casings3.class, "gt.blockcasings3", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - Textures.BlockIcons.casingTexturePages[0][(i + 32)] = new GT_CopiedBlockTexture(this, 6, i); + Textures.BlockIcons.casingTexturePages[0][(i + 32)] = TextureFactory.of(this, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Yellow Stripes Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Yellow Stripes Block"); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java index 66ca1341d4..ae327a0a7b 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings4.java @@ -6,7 +6,7 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeTurbine; import net.minecraft.item.ItemStack; @@ -20,7 +20,7 @@ public class GT_Block_Casings4 extends GT_Block_Casings_Abstract { public GT_Block_Casings4() { super(GT_Item_Casings4.class, "gt.blockcasings4", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - Textures.BlockIcons.casingTexturePages[0][(i + 48)] = new GT_CopiedBlockTexture(this, 6, i); + Textures.BlockIcons.casingTexturePages[0][(i + 48)] = TextureFactory.of(this, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Robust Tungstensteel Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Clean Stainless Steel Machine Casing"); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java index 23b34e68c9..296bf765b0 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings5.java @@ -6,7 +6,7 @@ import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IHeatingCoil; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -20,7 +20,7 @@ public class GT_Block_Casings5 extends GT_Block_Casings_Abstract implements IHea public GT_Block_Casings5() { super(GT_Item_Casings5.class, "gt.blockcasings5", GT_Material_Casings.INSTANCE); for (byte i = 0; i < 16; i = (byte) (i + 1)) { - Textures.BlockIcons.casingTexturePages[1][i] = new GT_CopiedBlockTexture(this, 6, i); + Textures.BlockIcons.casingTexturePages[1][i] = TextureFactory.of(this, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Cupronickel Coil Block"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "Kanthal Coil Block"); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java index 47c9952227..2f8304fab3 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings6.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -14,7 +14,7 @@ public class GT_Block_Casings6 extends GT_Block_Casings_Abstract { public GT_Block_Casings6() { super(GT_Item_Casings6.class, "gt.blockcasings6", GT_Material_Casings.INSTANCE); for (int i = 0; i < 16; i = (i + 1)) { - Textures.BlockIcons.casingTexturePages[8][i + 112] = new GT_CopiedBlockTexture(this, 6, i); + Textures.BlockIcons.casingTexturePages[8][i + 112] = TextureFactory.of(this, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Hermetic Casing"); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java index 376bc62db9..bb151afafa 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Casings8.java @@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; @@ -15,7 +15,7 @@ public class GT_Block_Casings8 extends GT_Block_Casings_Abstract { public GT_Block_Casings8() { super(GT_Item_Casings8.class, "gt.blockcasings8", GT_Material_Casings.INSTANCE); for (int i = 0; i < 5; i = (i + 1)) { - Textures.BlockIcons.casingTexturePages[1][i+48] = new GT_CopiedBlockTexture(this, 6, i); + Textures.BlockIcons.casingTexturePages[1][i+48] = TextureFactory.of(this, i); } GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".0.name", "Chemically Inert Machine Casing"); GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".1.name", "PTFE Pipe Casing"); diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java index 9750e8ae52..c3f53a7bc5 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores.java @@ -4,15 +4,19 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.objects.GT_StdRenderedTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; +import java.util.Arrays; + +import static gregtech.api.enums.Textures.BlockIcons.BASALT_STONE; +import static gregtech.api.enums.Textures.BlockIcons.GRANITE_BLACK_STONE; +import static gregtech.api.enums.Textures.BlockIcons.GRANITE_RED_STONE; +import static gregtech.api.enums.Textures.BlockIcons.MARBLE_STONE; + public class GT_Block_Ores extends GT_Block_Ores_Abstract { public GT_Block_Ores() { super("gt.blockores", 7, false, Material.rock); @@ -58,7 +62,15 @@ public class GT_Block_Ores extends GT_Block_Ores_Abstract { } @Override - public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.netherrack, 0, 0), new GT_CopiedBlockTexture(Blocks.end_stone, 0, 0), new GT_StdRenderedTexture(Textures.BlockIcons.GRANITE_BLACK_STONE), new GT_StdRenderedTexture(Textures.BlockIcons.GRANITE_RED_STONE), new GT_StdRenderedTexture(Textures.BlockIcons.MARBLE_STONE), new GT_StdRenderedTexture(Textures.BlockIcons.BASALT_STONE), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_CopiedBlockTexture(Blocks.stone, 0, 0)}; + public ITexture[] getTextureSet() { + final ITexture[] rTextures = new ITexture[16]; //Must have 16 entries. + Arrays.fill(rTextures, TextureFactory.of(Blocks.stone)); + rTextures[1] = TextureFactory.of(Blocks.netherrack); + rTextures[2] = TextureFactory.of(Blocks.end_stone); + rTextures[3] = TextureFactory.builder().addIcon(GRANITE_BLACK_STONE).stdOrient().build(); + rTextures[4] = TextureFactory.builder().addIcon(GRANITE_RED_STONE).stdOrient().build(); + rTextures[5] = TextureFactory.builder().addIcon(MARBLE_STONE).stdOrient().build(); + rTextures[6] = TextureFactory.builder().addIcon(BASALT_STONE).stdOrient().build(); + return rTextures; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java index 9b4a418d73..6749f8d136 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB1.java @@ -5,7 +5,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -50,6 +50,6 @@ public class GT_Block_Ores_UB1 extends GT_Block_Ores_Abstract { @Override public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)}; + return new ITexture[]{TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7), TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7)}; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java index d9744bad69..5d78ab0aa3 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB2.java @@ -5,7 +5,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -50,6 +50,6 @@ public class GT_Block_Ores_UB2 extends GT_Block_Ores_Abstract { @Override public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)}; + return new ITexture[]{TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7), TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7)}; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java index 8708e813db..e4111af1c5 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Ores_UB3.java @@ -5,7 +5,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.init.Blocks; @@ -50,6 +50,6 @@ public class GT_Block_Ores_UB3 extends GT_Block_Ores_Abstract { @Override public ITexture[] getTextureSet() { //Must have 16 entries. - return new ITexture[]{new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7), new GT_CopiedBlockTexture(aUBBlock, 0, 0), new GT_CopiedBlockTexture(aUBBlock, 0, 1), new GT_CopiedBlockTexture(aUBBlock, 0, 2), new GT_CopiedBlockTexture(aUBBlock, 0, 3), new GT_CopiedBlockTexture(aUBBlock, 0, 4), new GT_CopiedBlockTexture(aUBBlock, 0, 5), new GT_CopiedBlockTexture(aUBBlock, 0, 6), new GT_CopiedBlockTexture(aUBBlock, 0, 7)}; + return new ITexture[]{TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7), TextureFactory.of(aUBBlock, 0), TextureFactory.of(aUBBlock, 1), TextureFactory.of(aUBBlock, 2), TextureFactory.of(aUBBlock, 3), TextureFactory.of(aUBBlock, 4), TextureFactory.of(aUBBlock, 5), TextureFactory.of(aUBBlock, 6), TextureFactory.of(aUBBlock, 7)}; } } diff --git a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java index 9853d47b9e..fd4e5475e2 100644 --- a/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java +++ b/src/main/java/gregtech/common/blocks/GT_Block_Reinforced.java @@ -8,7 +8,7 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; import gregtech.api.items.GT_Generic_Block; -import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.WorldSpawnedEventBuilder; @@ -39,8 +39,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block { public GT_Block_Reinforced(String aName) { super(GT_Item_Storage.class, aName, new GT_Material_Reinforced()); - for (byte i = 0; i < 16; i = (byte) (i + 1)) { - Textures.BlockIcons.casingTexturePages[1][i + 80] = new GT_CopiedBlockTexture(this, 6, i); + for (int i = 0; i < 16; i++) { + Textures.BlockIcons.casingTexturePages[1][i + 80] = TextureFactory.of(this, i); } setStepSound(soundTypeStone); setCreativeTab(GregTech_API.TAB_GREGTECH); @@ -70,8 +70,8 @@ public class GT_Block_Reinforced extends GT_Generic_Block { ItemList.Block_NaquadahPlate.set(new ItemStack(this.setHardness(500.0f).setResistance(1000.0f), 1, 10)); ItemList.Block_NeutroniumPlate.set(new ItemStack(this.setHardness(750.0f).setResistance(2500.0f), 1, 11)); ItemList.Block_BedrockiumCompressed.set(new ItemStack(this.setHardness(1500.0f).setResistance(5000.0f), 1, 12)); - GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(Items.coal, 1, 1), new Object[]{ItemList.Block_BrittleCharcoal.get(1, new Object[0])}); - GT_ModHandler.addCraftingRecipe(ItemList.Block_Powderbarrel.get(1L, new Object[0]),GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WSW","GGG","WGW", 'W', OrePrefixes.plate.get(Materials.Wood), 'G', new ItemStack(Items.gunpowder,1),'S',new ItemStack(Items.string,1)}); + GT_ModHandler.addShapelessCraftingRecipe(new ItemStack(Items.coal, 1, 1), new Object[]{ItemList.Block_BrittleCharcoal.get(1)}); + GT_ModHandler.addCraftingRecipe(ItemList.Block_Powderbarrel.get(1L),GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"WSW","GGG","WGW", 'W', OrePrefixes.plate.get(Materials.Wood), 'G', new ItemStack(Items.gunpowder,1),'S',new ItemStack(Items.string,1)}); } diff --git a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java index 3bc59a7402..851857fca2 100644 --- a/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java +++ b/src/main/java/gregtech/common/blocks/GT_TileEntity_Ores.java @@ -7,9 +7,8 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; -import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.objects.GT_StdRenderedTexture; import gregtech.api.objects.XSTR; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -23,6 +22,8 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.Random; +import static gregtech.api.enums.TextureSet.SET_NONE; + public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntity { public short mMetaData = 0; public boolean mNatural = false; @@ -31,7 +32,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit public static byte getHarvestData(short aMetaData, int aBaseBlockHarvestLevel) { Materials aMaterial = GregTech_API.sGeneratedMaterials[(aMetaData % 1000)]; byte tByte = aMaterial == null ? 0 : (byte) Math.max(aBaseBlockHarvestLevel, Math.min(7, aMaterial.mToolQuality - (aMetaData < 16000 ? 0 : 1))); - if(GT_Mod.gregtechproxy.mChangeHarvestLevels ) { + if (GT_Mod.gregtechproxy.mChangeHarvestLevels) { tByte = aMaterial == null ? 0 : (byte) Math.max(aBaseBlockHarvestLevel, Math.min(GT_Mod.gregtechproxy.mMaxHarvestLevel, GT_Mod.gregtechproxy.mHarvestLevel[aMaterial.mMetaItemSubID] - (aMetaData < 16000 ? 0 : 1))); } return tByte; @@ -147,38 +148,38 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } public void overrideOreBlockMaterial(Block aOverridingStoneBlock, byte aOverridingStoneMeta) { - if(this.worldObj == null || blockType==null)return; - this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L)); - if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.netherrack)) { - this.mMetaData = ((short) (this.mMetaData + 1000)); - } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.end_stone)) { - this.mMetaData = ((short) (this.mMetaData + 2000)); - } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockGranites)) { - if (aOverridingStoneBlock == GregTech_API.sBlockGranites) { - if (aOverridingStoneMeta < 8) { - this.mMetaData = ((short) (this.mMetaData + 3000)); - } else { - this.mMetaData = ((short) (this.mMetaData + 4000)); - } - } else { + if (this.worldObj == null || blockType == null) return; + this.mMetaData = ((short) (int) (this.mMetaData % 1000L + this.mMetaData / 16000L * 16000L)); + if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.netherrack)) { + this.mMetaData = ((short) (this.mMetaData + 1000)); + } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, Blocks.end_stone)) { + this.mMetaData = ((short) (this.mMetaData + 2000)); + } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockGranites)) { + if (aOverridingStoneBlock == GregTech_API.sBlockGranites) { + if (aOverridingStoneMeta < 8) { this.mMetaData = ((short) (this.mMetaData + 3000)); - } - } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockStones)) { - if (aOverridingStoneBlock == GregTech_API.sBlockStones) { - if (aOverridingStoneMeta < 8) { - this.mMetaData = ((short) (this.mMetaData + 5000)); - } else { - this.mMetaData = ((short) (this.mMetaData + 6000)); - } } else { + this.mMetaData = ((short) (this.mMetaData + 4000)); + } + } else { + this.mMetaData = ((short) (this.mMetaData + 3000)); + } + } else if (aOverridingStoneBlock.isReplaceableOreGen(this.worldObj, this.xCoord, this.yCoord, this.zCoord, GregTech_API.sBlockStones)) { + if (aOverridingStoneBlock == GregTech_API.sBlockStones) { + if (aOverridingStoneMeta < 8) { this.mMetaData = ((short) (this.mMetaData + 5000)); + } else { + this.mMetaData = ((short) (this.mMetaData + 6000)); } + } else { + this.mMetaData = ((short) (this.mMetaData + 5000)); } - this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData, ((GT_Block_Ores_Abstract) blockType).getBaseBlockHarvestLevel(mMetaData % 16000 / 1000)), 0); + } + this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, getHarvestData(this.mMetaData, ((GT_Block_Ores_Abstract) blockType).getBaseBlockHarvestLevel(mMetaData % 16000 / 1000)), 0); } public void convertOreBlock(World aWorld, int aX, int aY, int aZ) { - short aMeta = ((short) (int) (this.mMetaData % 1000 + (this.mMetaData / 16000 * 16000))); + short aMeta = ((short) (this.mMetaData % 1000 + (this.mMetaData / 16000 * 16000))); aWorld.setBlock(aX, aY, aZ, GregTech_API.sBlockOres1); TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (tTileEntity instanceof GT_TileEntity_Ores) { @@ -196,7 +197,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } public ArrayList<ItemStack> getDrops(Block aDroppedOre, int aFortune) { - ArrayList<ItemStack> rList = new ArrayList(); + ArrayList<ItemStack> rList = new ArrayList<>(); if (this.mMetaData <= 0) { rList.add(new ItemStack(Blocks.cobblestone, 1, 0)); return rList; @@ -214,7 +215,7 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit } if (aMaterial != null) { Random tRandom = new XSTR(this.xCoord ^ this.yCoord ^ this.zCoord); - ArrayList<ItemStack> tSelector = new ArrayList(); + ArrayList<ItemStack> tSelector = new ArrayList<>(); ItemStack tStack = GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L), 1L); @@ -259,15 +260,16 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit tSelector.add(tStack); } } - if (tSelector.size() > 0) { + if (!tSelector.isEmpty()) { int i = 0; for (int j = Math.max(1, aMaterial.mOreMultiplier + (aFortune > 0 ? tRandom.nextInt(1 + aFortune * aMaterial.mOreMultiplier) : 0) / 2); i < j; i++) { - rList.add(GT_Utility.copyAmount(1L, new Object[]{tSelector.get(tRandom.nextInt(tSelector.size()))})); + rList.add(GT_Utility.copyAmount(1L, tSelector.get(tRandom.nextInt(tSelector.size())))); } } if (tRandom.nextInt(3 + aFortune) > 1) { Materials dustMat = ((GT_Block_Ores_Abstract) aDroppedOre).getDroppedDusts()[this.mMetaData / 1000 % 16]; - if (dustMat != null) rList.add(GT_OreDictUnificator.get(tRandom.nextInt(3) > 0 ? OrePrefixes.dustImpure : OrePrefixes.dust, dustMat, 1L)); + if (dustMat != null) + rList.add(GT_OreDictUnificator.get(tRandom.nextInt(3) > 0 ? OrePrefixes.dustImpure : OrePrefixes.dust, dustMat, 1L)); } } return rList; @@ -276,11 +278,21 @@ public class GT_TileEntity_Ores extends TileEntity implements ITexturedTileEntit public ITexture[] getTexture(Block aBlock, byte aSide) { Materials aMaterial = GregTech_API.sGeneratedMaterials[(this.mMetaData % 1000)]; if ((aMaterial != null) && (this.mMetaData < 32000)) { - GT_StdRenderedTexture aIconSet = new GT_StdRenderedTexture(aMaterial.mIconSet.mTextures[this.mMetaData / 16000 == 0 ? OrePrefixes.ore.mTextureIndex : OrePrefixes.oreSmall.mTextureIndex], aMaterial.mRGBa); + ITexture iTexture = TextureFactory.builder() + .addIcon(aMaterial.mIconSet.mTextures[this.mMetaData / 16000 == 0 ? + OrePrefixes.ore.mTextureIndex : + OrePrefixes.oreSmall.mTextureIndex]) + .setRGBA(aMaterial.mRGBa) + .stdOrient() + .build(); if (aBlock instanceof GT_Block_Ores_Abstract) { - return new ITexture[]{((GT_Block_Ores_Abstract) aBlock).getTextureSet()[((this.mMetaData / 1000) % 16)], aIconSet}; + return new ITexture[]{ + ((GT_Block_Ores_Abstract) aBlock).getTextureSet()[((this.mMetaData / 1000) % 16)], iTexture}; } } - return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_StdRenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex])}; + return new ITexture[]{ + TextureFactory.of(Blocks.stone, 0), + TextureFactory.builder().addIcon(SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex]).stdOrient().build() + }; } } diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java index 029aba7ab3..c12a49b73e 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_01.java @@ -10,14 +10,12 @@ import gregtech.api.enums.OreDictNames; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SubTag; import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.IItemBehaviour; import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.items.GT_MetaGenerated_Item_X32; -import gregtech.api.objects.GT_MultiTexture; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; import gregtech.api.objects.MaterialStack; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_FoodStat; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; @@ -72,11 +70,15 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static gregtech.api.enums.Textures.BlockIcons.*; + public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { public static GT_MetaGenerated_Item_01 INSTANCE; private final String mToolTipPurify = GT_LanguageManager.addStringLocalization("metaitem.01.tooltip.purify", "Throw into Cauldron to get clean Dust"); - private final static String aTextArrow = " A";private final static String aTextStick = " S ";private final static String aTextFeather = "F "; - private final static String aTextEmptyRow = " "; private final static String aTextShape = " P "; + private static final String aTextArrow = " A"; + private static final String aTextStick = " S "; + private static final String aTextFeather = "F "; + private static final String aTextEmptyRow = " "; private static final String aTextShape = " P "; public GT_MetaGenerated_Item_01() { super("metaitem.01", OrePrefixes.dustTiny, OrePrefixes.dustSmall, OrePrefixes.dust, OrePrefixes.dustImpure, OrePrefixes.dustPure, OrePrefixes.crushed, OrePrefixes.crushedPurified, OrePrefixes.crushedCentrifuged, OrePrefixes.gem, OrePrefixes.nugget, null, OrePrefixes.ingot, OrePrefixes.ingotHot, OrePrefixes.ingotDouble, OrePrefixes.ingotTriple, OrePrefixes.ingotQuadruple, OrePrefixes.ingotQuintuple, OrePrefixes.plate, OrePrefixes.plateDouble, OrePrefixes.plateTriple, OrePrefixes.plateQuadruple, OrePrefixes.plateQuintuple, OrePrefixes.plateDense, OrePrefixes.stick, OrePrefixes.lens, OrePrefixes.round, OrePrefixes.bolt, OrePrefixes.screw, OrePrefixes.ring, OrePrefixes.foil, OrePrefixes.cell, OrePrefixes.cellPlasma); @@ -87,7 +89,7 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { setBurnValue(17000 + Materials.Wood.mMetaItemSubID, 1600); GT_OreDictUnificator.addToBlacklist(new ItemStack(this, 1, 17000 + Materials.Wood.mMetaItemSubID)); GT_ModHandler.addCompressionRecipe(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Wood, 8L), new ItemStack(this, 1, 17000 + Materials.Wood.mMetaItemSubID)); - GregTech_API.registerCover(new ItemStack(this, 1, 17000 + Materials.Wood.mMetaItemSubID), new GT_RenderedTexture(Textures.BlockIcons.COVER_WOOD_PLATE), null); + GregTech_API.registerCover(new ItemStack(this, 1, 17000 + Materials.Wood.mMetaItemSubID), TextureFactory.of(COVER_WOOD_PLATE), null); ItemStack tStack = new ItemStack(this, 1, 17000 + Materials.Wood.mMetaItemSubID); tStack.setStackDisplayName("The holy Planks of Sengir"); @@ -539,16 +541,16 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { ItemList.Electric_Pump_UHV.set(addItem(618, "Electric Pump (UHV)", "20.971.520 L/sec (as Cover)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 256L))); ItemList.Electric_Pump_UEV.set(addItem(619, "Electric Pump (UEV)", "41.943.040 L/sec (as Cover)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 512L))); - GregTech_API.registerCover(ItemList.Electric_Pump_LV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(32)); - GregTech_API.registerCover(ItemList.Electric_Pump_MV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(128)); - GregTech_API.registerCover(ItemList.Electric_Pump_HV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(512)); - GregTech_API.registerCover(ItemList.Electric_Pump_EV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(2048)); - GregTech_API.registerCover(ItemList.Electric_Pump_IV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(8192)); - GregTech_API.registerCover(ItemList.Electric_Pump_LuV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(32768)); - GregTech_API.registerCover(ItemList.Electric_Pump_ZPM.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(131072)); - GregTech_API.registerCover(ItemList.Electric_Pump_UV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(524288)); - GregTech_API.registerCover(ItemList.Electric_Pump_UHV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[9][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(1048576)); - GregTech_API.registerCover(ItemList.Electric_Pump_UEV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[9][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_Pump(2097152)); + GregTech_API.registerCover(ItemList.Electric_Pump_LV.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(32)); + GregTech_API.registerCover(ItemList.Electric_Pump_MV.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(128)); + GregTech_API.registerCover(ItemList.Electric_Pump_HV.get(1L), TextureFactory.of(MACHINE_CASINGS[3][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(512)); + GregTech_API.registerCover(ItemList.Electric_Pump_EV.get(1L), TextureFactory.of(MACHINE_CASINGS[4][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(2048)); + GregTech_API.registerCover(ItemList.Electric_Pump_IV.get(1L), TextureFactory.of(MACHINE_CASINGS[5][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(8192)); + GregTech_API.registerCover(ItemList.Electric_Pump_LuV.get(1L), TextureFactory.of(MACHINE_CASINGS[6][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(32768)); + GregTech_API.registerCover(ItemList.Electric_Pump_ZPM.get(1L), TextureFactory.of(MACHINE_CASINGS[7][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(131072)); + GregTech_API.registerCover(ItemList.Electric_Pump_UV.get(1L), TextureFactory.of(MACHINE_CASINGS[8][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(524288)); + GregTech_API.registerCover(ItemList.Electric_Pump_UHV.get(1L), TextureFactory.of(MACHINE_CASINGS[9][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(1048576)); + GregTech_API.registerCover(ItemList.Electric_Pump_UEV.get(1L), TextureFactory.of(MACHINE_CASINGS[9][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_Pump(2097152)); ItemList.Steam_Valve_LV.set(addItem(620, "Steam Valve (LV)", "20.480 L/sec (as Cover)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 1L))); ItemList.Steam_Valve_MV.set(addItem(621, "Steam Valve (MV)", "40.960 L/sec (as Cover)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 2L))); @@ -556,11 +558,11 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { ItemList.Steam_Valve_EV.set(addItem(623, "Steam Valve (EV)", "163.840 L/sec (as Cover)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 8L))); ItemList.Steam_Valve_IV.set(addItem(624, "Steam Valve (IV)", "327.680 L/sec (as Cover)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.ITER, 16L), new TC_Aspects.TC_AspectStack(TC_Aspects.AQUA, 16L))); - GregTech_API.registerCover(ItemList.Steam_Valve_LV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_VALVE)), new GT_Cover_SteamValve(1024)); - GregTech_API.registerCover(ItemList.Steam_Valve_MV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_VALVE)), new GT_Cover_SteamValve(2048)); - GregTech_API.registerCover(ItemList.Steam_Valve_HV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_VALVE)), new GT_Cover_SteamValve(4096)); - GregTech_API.registerCover(ItemList.Steam_Valve_EV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_VALVE)), new GT_Cover_SteamValve(8192)); - GregTech_API.registerCover(ItemList.Steam_Valve_IV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_VALVE)), new GT_Cover_SteamValve(16384)); + GregTech_API.registerCover(ItemList.Steam_Valve_LV.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_VALVE)), new GT_Cover_SteamValve(1024)); + GregTech_API.registerCover(ItemList.Steam_Valve_MV.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_VALVE)), new GT_Cover_SteamValve(2048)); + GregTech_API.registerCover(ItemList.Steam_Valve_HV.get(1L), TextureFactory.of(MACHINE_CASINGS[3][0], TextureFactory.of(OVERLAY_VALVE)), new GT_Cover_SteamValve(4096)); + GregTech_API.registerCover(ItemList.Steam_Valve_EV.get(1L), TextureFactory.of(MACHINE_CASINGS[4][0], TextureFactory.of(OVERLAY_VALVE)), new GT_Cover_SteamValve(8192)); + GregTech_API.registerCover(ItemList.Steam_Valve_IV.get(1L), TextureFactory.of(MACHINE_CASINGS[5][0], TextureFactory.of(OVERLAY_VALVE)), new GT_Cover_SteamValve(16384)); ItemList.FluidRegulator_LV.set(addItem(tLastID = 660, "Fluid Regulator (LV)", "Configuable up to 640 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click")); ItemList.FluidRegulator_MV.set(addItem(tLastID = 661, "Fluid Regulator (MV)", "Configuable up to 2.560 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click")); @@ -571,19 +573,19 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { ItemList.FluidRegulator_ZPM.set(addItem(tLastID = 666, "Fluid Regulator (ZPM)", "Configuable up to 2.621.440 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click")); ItemList.FluidRegulator_UV.set(addItem(tLastID = 667, "Fluid Regulator (UV)", "Configuable up to 10.485.760 L/sec (as Cover)/n Rightclick/Screwdriver-rightclick/Shift-screwdriver-rightclick/n to adjust the pump speed by 1/16/256 L/sec per click")); - GregTech_API.registerCover(ItemList.FluidRegulator_LV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(32)); - GregTech_API.registerCover(ItemList.FluidRegulator_MV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(128)); - GregTech_API.registerCover(ItemList.FluidRegulator_HV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(512)); - GregTech_API.registerCover(ItemList.FluidRegulator_EV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(2048)); - GregTech_API.registerCover(ItemList.FluidRegulator_IV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(8192)); - GregTech_API.registerCover(ItemList.FluidRegulator_LuV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(32768)); - GregTech_API.registerCover(ItemList.FluidRegulator_ZPM.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(131072)); - GregTech_API.registerCover(ItemList.FluidRegulator_UV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PUMP)), new GT_Cover_FluidRegulator(524288)); + GregTech_API.registerCover(ItemList.FluidRegulator_LV.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(32)); + GregTech_API.registerCover(ItemList.FluidRegulator_MV.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(128)); + GregTech_API.registerCover(ItemList.FluidRegulator_HV.get(1L), TextureFactory.of(MACHINE_CASINGS[3][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(512)); + GregTech_API.registerCover(ItemList.FluidRegulator_EV.get(1L), TextureFactory.of(MACHINE_CASINGS[4][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(2048)); + GregTech_API.registerCover(ItemList.FluidRegulator_IV.get(1L), TextureFactory.of(MACHINE_CASINGS[5][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(8192)); + GregTech_API.registerCover(ItemList.FluidRegulator_LuV.get(1L), TextureFactory.of(MACHINE_CASINGS[6][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(32768)); + GregTech_API.registerCover(ItemList.FluidRegulator_ZPM.get(1L), TextureFactory.of(MACHINE_CASINGS[7][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(131072)); + GregTech_API.registerCover(ItemList.FluidRegulator_UV.get(1L), TextureFactory.of(MACHINE_CASINGS[8][0], TextureFactory.of(OVERLAY_PUMP)), new GT_Cover_FluidRegulator(524288)); ItemList.FluidFilter.set(addItem(669, "Fluid Filter Cover", "Set with Fluid Container to only accept one Fluid Type")); - GregTech_API.registerCover(ItemList.FluidFilter.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SHUTTER)), new GT_Cover_Fluidfilter()); + GregTech_API.registerCover(ItemList.FluidFilter.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_SHUTTER)), new GT_Cover_Fluidfilter()); - /**ItemList.Rotor_LV.set(addItem(tLastID = 620, "Tin Rotor", "", new Object[] { OrePrefixes.rotor.get(Materials.Tin), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 1L) })); + /*ItemList.Rotor_LV.set(addItem(tLastID = 620, "Tin Rotor", "", new Object[] { OrePrefixes.rotor.get(Materials.Tin), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 1L) })); ItemList.Rotor_MV.set(addItem(tLastID = 621, "Bronze Rotor", "", new Object[] { OrePrefixes.rotor.get(Materials.Bronze), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 2L) })); ItemList.Rotor_HV.set(addItem(tLastID = 622, "Steel Rotor", "", new Object[] { OrePrefixes.rotor.get(Materials.Steel), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 4L) })); ItemList.Rotor_EV.set(addItem(tLastID = 623, "Stainless Steel Rotor", "", new Object[] { OrePrefixes.rotor.get(Materials.StainlessSteel), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 8L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 8L) })); @@ -615,16 +617,16 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GT_ModHandler.addCraftingRecipe(ItemList.Conveyor_Module_EV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", 'M', ItemList.Electric_Motor_EV, 'C', OrePrefixes.cableGt01.get(Materials.Aluminium), 'R', OrePrefixes.plate.get(Materials.AnyRubber)}); GT_ModHandler.addCraftingRecipe(ItemList.Conveyor_Module_IV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"RRR", "MCM", "RRR", 'M', ItemList.Electric_Motor_IV, 'C', OrePrefixes.cableGt01.get(Materials.Tungsten), 'R', OrePrefixes.plate.get(Materials.AnySyntheticRubber)}); - GregTech_API.registerCover(ItemList.Conveyor_Module_LV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(400, 1)); - GregTech_API.registerCover(ItemList.Conveyor_Module_MV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(100, 1)); - GregTech_API.registerCover(ItemList.Conveyor_Module_HV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(20, 1)); - GregTech_API.registerCover(ItemList.Conveyor_Module_EV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(4, 1)); - GregTech_API.registerCover(ItemList.Conveyor_Module_IV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 1)); - GregTech_API.registerCover(ItemList.Conveyor_Module_LuV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 2)); - GregTech_API.registerCover(ItemList.Conveyor_Module_ZPM.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 4)); - GregTech_API.registerCover(ItemList.Conveyor_Module_UV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 8)); - GregTech_API.registerCover(ItemList.Conveyor_Module_UHV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[9][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 16)); - GregTech_API.registerCover(ItemList.Conveyor_Module_UEV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[10][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 32)); + GregTech_API.registerCover(ItemList.Conveyor_Module_LV.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(400, 1)); + GregTech_API.registerCover(ItemList.Conveyor_Module_MV.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(100, 1)); + GregTech_API.registerCover(ItemList.Conveyor_Module_HV.get(1L), TextureFactory.of(MACHINE_CASINGS[3][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(20, 1)); + GregTech_API.registerCover(ItemList.Conveyor_Module_EV.get(1L), TextureFactory.of(MACHINE_CASINGS[4][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(4, 1)); + GregTech_API.registerCover(ItemList.Conveyor_Module_IV.get(1L), TextureFactory.of(MACHINE_CASINGS[5][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 1)); + GregTech_API.registerCover(ItemList.Conveyor_Module_LuV.get(1L), TextureFactory.of(MACHINE_CASINGS[6][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 2)); + GregTech_API.registerCover(ItemList.Conveyor_Module_ZPM.get(1L), TextureFactory.of(MACHINE_CASINGS[7][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 4)); + GregTech_API.registerCover(ItemList.Conveyor_Module_UV.get(1L), TextureFactory.of(MACHINE_CASINGS[8][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 8)); + GregTech_API.registerCover(ItemList.Conveyor_Module_UHV.get(1L), TextureFactory.of(MACHINE_CASINGS[9][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 16)); + GregTech_API.registerCover(ItemList.Conveyor_Module_UEV.get(1L), TextureFactory.of(MACHINE_CASINGS[10][0], TextureFactory.of(OVERLAY_CONVEYOR)), new GT_Cover_Conveyor(1, 32)); ItemList.Electric_Piston_LV.set(addItem(640, "Electric Piston (LV)", "", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 1L))); ItemList.Electric_Piston_MV.set(addItem(641, "Electric Piston (MV)", "", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 4L), new TC_Aspects.TC_AspectStack(TC_Aspects.MOTUS, 2L))); @@ -660,16 +662,16 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GT_ModHandler.addCraftingRecipe(ItemList.Robot_Arm_EV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", 'S', OrePrefixes.stick.get(Materials.Titanium), 'M', ItemList.Electric_Motor_EV, 'P', ItemList.Electric_Piston_EV, 'E', OrePrefixes.circuit.get(Materials.Data), 'C', OrePrefixes.cableGt01.get(Materials.Aluminium)}); GT_ModHandler.addCraftingRecipe(ItemList.Robot_Arm_IV.get(1L), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"CCC", "MSM", "PES", 'S', OrePrefixes.stick.get(Materials.TungstenSteel), 'M', ItemList.Electric_Motor_IV, 'P', ItemList.Electric_Piston_IV, 'E', OrePrefixes.circuit.get(Materials.Elite), 'C', OrePrefixes.cableGt01.get(Materials.Tungsten)}); - GregTech_API.registerCover(ItemList.Robot_Arm_LV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(400)); - GregTech_API.registerCover(ItemList.Robot_Arm_MV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(100)); - GregTech_API.registerCover(ItemList.Robot_Arm_HV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[3][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(20)); - GregTech_API.registerCover(ItemList.Robot_Arm_EV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[4][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(4)); - GregTech_API.registerCover(ItemList.Robot_Arm_IV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[5][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(1)); - GregTech_API.registerCover(ItemList.Robot_Arm_LuV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[6][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(1)); - GregTech_API.registerCover(ItemList.Robot_Arm_ZPM.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[7][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(1)); - GregTech_API.registerCover(ItemList.Robot_Arm_UV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[8][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(1)); - GregTech_API.registerCover(ItemList.Robot_Arm_UHV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[9][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(1)); - GregTech_API.registerCover(ItemList.Robot_Arm_UEV.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[10][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ARM)), new GT_Cover_Arm(1)); + GregTech_API.registerCover(ItemList.Robot_Arm_LV.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(400)); + GregTech_API.registerCover(ItemList.Robot_Arm_MV.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(100)); + GregTech_API.registerCover(ItemList.Robot_Arm_HV.get(1L), TextureFactory.of(MACHINE_CASINGS[3][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(20)); + GregTech_API.registerCover(ItemList.Robot_Arm_EV.get(1L), TextureFactory.of(MACHINE_CASINGS[4][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(4)); + GregTech_API.registerCover(ItemList.Robot_Arm_IV.get(1L), TextureFactory.of(MACHINE_CASINGS[5][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(1)); + GregTech_API.registerCover(ItemList.Robot_Arm_LuV.get(1L), TextureFactory.of(MACHINE_CASINGS[6][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(1)); + GregTech_API.registerCover(ItemList.Robot_Arm_ZPM.get(1L), TextureFactory.of(MACHINE_CASINGS[7][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(1)); + GregTech_API.registerCover(ItemList.Robot_Arm_UV.get(1L), TextureFactory.of(MACHINE_CASINGS[8][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(1)); + GregTech_API.registerCover(ItemList.Robot_Arm_UHV.get(1L), TextureFactory.of(MACHINE_CASINGS[9][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(1)); + GregTech_API.registerCover(ItemList.Robot_Arm_UEV.get(1L), TextureFactory.of(MACHINE_CASINGS[10][0], TextureFactory.of(OVERLAY_ARM)), new GT_Cover_Arm(1)); ItemList.QuantumEye.set(addItem(tLastID = 724, "Quantum Eye", "Improved Ender Eye")); ItemList.QuantumStar.set(addItem(tLastID = 725, "Quantum Star", "Improved Nether Star")); @@ -778,12 +780,12 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { ItemList.Cover_PlayerDetector.set(addItem(tLastID = 735, "Player Detector Cover", "Gives out close Players as Redstone", new TC_Aspects.TC_AspectStack(TC_Aspects.SENSUS, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L))); GT_Values.RA.addAssemblerRecipe(ItemList.Sensor_EV.get(1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Titanium, 1L), ItemList.Cover_PlayerDetector.get(1L), 3200, 128); - GregTech_API.registerCover(ItemList.Cover_Controller.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CONTROLLER)), new GT_Cover_ControlsWork()); - GregTech_API.registerCover(ItemList.Cover_ActivityDetector.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ACTIVITYDETECTOR)), new GT_Cover_DoesWork()); - GregTech_API.registerCover(ItemList.Cover_FluidDetector.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FLUIDDETECTOR)), new GT_Cover_LiquidMeter()); - GregTech_API.registerCover(ItemList.Cover_ItemDetector.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ITEMDETECTOR)), new GT_Cover_ItemMeter()); - GregTech_API.registerCover(ItemList.Cover_EnergyDetector.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ENERGYDETECTOR)), new GT_Cover_EUMeter()); - GregTech_API.registerCover(ItemList.Cover_PlayerDetector.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ACTIVITYDETECTOR)), new GT_Cover_PlayerDetector()); + GregTech_API.registerCover(ItemList.Cover_Controller.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_CONTROLLER)), new GT_Cover_ControlsWork()); + GregTech_API.registerCover(ItemList.Cover_ActivityDetector.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(TextureFactory.of(OVERLAY_ACTIVITYDETECTOR), TextureFactory.builder().addIcon(OVERLAY_ACTIVITYDETECTOR_GLOW).glow().build())), new GT_Cover_DoesWork()); + GregTech_API.registerCover(ItemList.Cover_FluidDetector.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_FLUIDDETECTOR)), new GT_Cover_LiquidMeter()); + GregTech_API.registerCover(ItemList.Cover_ItemDetector.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_ITEMDETECTOR)), new GT_Cover_ItemMeter()); + GregTech_API.registerCover(ItemList.Cover_EnergyDetector.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_ENERGYDETECTOR)), new GT_Cover_EUMeter()); + GregTech_API.registerCover(ItemList.Cover_PlayerDetector.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(TextureFactory.of(OVERLAY_ACTIVITYDETECTOR), TextureFactory.builder().addIcon(OVERLAY_ACTIVITYDETECTOR_GLOW).glow().build())), new GT_Cover_PlayerDetector()); ItemList.Cover_Screen.set(addItem(tLastID = 740, "Computer Monitor Cover", "Displays Data and GUI", new TC_Aspects.TC_AspectStack(TC_Aspects.COGNITIO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUX, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.VITREUS, 1L))); ItemList.Cover_Crafting.set(addItem(tLastID = 744, "Crafting Table Cover", "Better than a wooden Workbench", new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 4L))); @@ -804,10 +806,10 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GT_Values.RA.addAssemblerRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, Materials.WroughtIron, 1L), new ItemStack(Blocks.crafting_table, 1), ItemList.Cover_Crafting.get(1L), 800, 16); GT_Values.RA.addAssemblerRecipe(ItemList.Cover_Shutter.get(1L), GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Basic, 2), ItemList.FluidFilter.get(1L), 800, 4); - GregTech_API.registerCover(ItemList.Cover_Screen.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SCREEN)), new GT_Cover_Screen()); - GregTech_API.registerCover(ItemList.Cover_Crafting.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_CRAFTING)), new GT_Cover_Crafting()); - GregTech_API.registerCover(ItemList.Cover_Drain.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[0][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_DRAIN)), new GT_Cover_Drain()); - GregTech_API.registerCover(ItemList.Cover_Shutter.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[1][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SHUTTER)), new GT_Cover_Shutter()); + GregTech_API.registerCover(ItemList.Cover_Screen.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(TextureFactory.of(OVERLAY_SCREEN), TextureFactory.builder().addIcon(OVERLAY_SCREEN_GLOW).glow().build())), new GT_Cover_Screen()); + GregTech_API.registerCover(ItemList.Cover_Crafting.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_CRAFTING)), new GT_Cover_Crafting()); + GregTech_API.registerCover(ItemList.Cover_Drain.get(1L), TextureFactory.of(MACHINE_CASINGS[0][0], TextureFactory.of(OVERLAY_DRAIN)), new GT_Cover_Drain()); + GregTech_API.registerCover(ItemList.Cover_Shutter.get(1L), TextureFactory.of(MACHINE_CASINGS[1][0], TextureFactory.of(OVERLAY_SHUTTER)), new GT_Cover_Shutter()); ItemList.Cover_SolarPanel.set(addItem(tLastID = 750, "Solar Panel", "May the Sun be with you (Needs cleaning with right click)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 1L))); ItemList.Cover_SolarPanel_8V.set(addItem(tLastID = 751, "Solar Panel (8V)", "8 Volt Solar Panel (Needs cleaning with right click)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 2L))); @@ -820,16 +822,16 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { ItemList.Cover_SolarPanel_ZPM.set(addItem(tLastID = 758, "Solar Panel (ZPM)", "ZPM Voltage Solar Panel (Needs cleaning with right click)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 64L))); ItemList.Cover_SolarPanel_UV.set(addItem(tLastID = 759, "Solar Panel (UV)", "Ultimate Solar Panel (Needs cleaning with right click)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 64L), new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 64L))); - GregTech_API.registerCover(ItemList.Cover_SolarPanel.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL), new GT_Cover_SolarPanel(1)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_8V.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_8V), new GT_Cover_SolarPanel(8)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_LV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LV), new GT_Cover_SolarPanel(32)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_MV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_MV), new GT_Cover_SolarPanel(128)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_HV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_HV), new GT_Cover_SolarPanel(512)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_EV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_EV), new GT_Cover_SolarPanel(2048)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_IV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_IV), new GT_Cover_SolarPanel(8192)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_LuV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_LuV), new GT_Cover_SolarPanel(32768)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_ZPM.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_ZPM), new GT_Cover_SolarPanel(131072)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_UV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_UV), new GT_Cover_SolarPanel(524288)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel.get(1L), TextureFactory.of(SOLARPANEL), new GT_Cover_SolarPanel(1)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_8V.get(1L), TextureFactory.of(SOLARPANEL_8V), new GT_Cover_SolarPanel(8)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_LV.get(1L), TextureFactory.of(SOLARPANEL_LV), new GT_Cover_SolarPanel(32)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_MV.get(1L), TextureFactory.of(SOLARPANEL_MV), new GT_Cover_SolarPanel(128)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_HV.get(1L), TextureFactory.of(SOLARPANEL_HV), new GT_Cover_SolarPanel(512)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_EV.get(1L), TextureFactory.of(SOLARPANEL_EV), new GT_Cover_SolarPanel(2048)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_IV.get(1L), TextureFactory.of(SOLARPANEL_IV), new GT_Cover_SolarPanel(8192)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_LuV.get(1L), TextureFactory.of(SOLARPANEL_LuV), new GT_Cover_SolarPanel(32768)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_ZPM.get(1L), TextureFactory.of(SOLARPANEL_ZPM), new GT_Cover_SolarPanel(131072)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_UV.get(1L), TextureFactory.of(SOLARPANEL_UV), new GT_Cover_SolarPanel(524288)); ItemList.Tool_Sonictron.set(addItem(tLastID = 760, "Sonictron", "Bring your Music with you", Behaviour_Sonictron.INSTANCE, new TC_Aspects.TC_AspectStack(TC_Aspects.SENSUS, 4L))); ItemList.Tool_Cheat.set(addItem(tLastID = 761, "Debug Scanner", "Also an Infinite Energy Source", Behaviour_Scanner.INSTANCE, new TC_Aspects.TC_AspectStack(TC_Aspects.NEBRISUM, 64L))); @@ -848,10 +850,10 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { ItemList.Cover_RedstoneReceiverExternal.set(addItem(tLastID = 746, "Redstone Receiver (Out)", "Transfers Redstonesignals wireless", new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L))); ItemList.Cover_RedstoneReceiverInternal.set(addItem(tLastID = 747, "Redstone Receiver (In)", "Transfers Redstonesignals wireless", new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L))); - GregTech_API.registerCover(ItemList.Cover_RedstoneTransmitterExternal.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ACTIVITYDETECTOR)), new GT_Cover_RedstoneTransmitterExternal()); - GregTech_API.registerCover(ItemList.Cover_RedstoneTransmitterInternal.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ACTIVITYDETECTOR)), new GT_Cover_RedstoneTransmitterInternal()); - GregTech_API.registerCover(ItemList.Cover_RedstoneReceiverExternal.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FLUIDDETECTOR)), new GT_Cover_RedstoneReceiverExternal()); - GregTech_API.registerCover(ItemList.Cover_RedstoneReceiverInternal.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FLUIDDETECTOR)), new GT_Cover_RedstoneReceiverInternal()); + GregTech_API.registerCover(ItemList.Cover_RedstoneTransmitterExternal.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(TextureFactory.of(OVERLAY_ACTIVITYDETECTOR), TextureFactory.builder().addIcon(OVERLAY_ACTIVITYDETECTOR_GLOW).glow().build())), new GT_Cover_RedstoneTransmitterExternal()); + GregTech_API.registerCover(ItemList.Cover_RedstoneTransmitterInternal.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(TextureFactory.of(OVERLAY_ACTIVITYDETECTOR), TextureFactory.builder().addIcon(OVERLAY_ACTIVITYDETECTOR_GLOW).glow().build())), new GT_Cover_RedstoneTransmitterInternal()); + GregTech_API.registerCover(ItemList.Cover_RedstoneReceiverExternal.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_FLUIDDETECTOR)), new GT_Cover_RedstoneReceiverExternal()); + GregTech_API.registerCover(ItemList.Cover_RedstoneReceiverInternal.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(OVERLAY_FLUIDDETECTOR)), new GT_Cover_RedstoneReceiverInternal()); GT_Values.RA.addAssemblerRecipe(ItemList.Emitter_EV.get(1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 1L), ItemList.Cover_RedstoneTransmitterExternal.get(1L), 3200, 128); GT_Values.RA.addAssemblerRecipe(ItemList.Sensor_EV.get(1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.StainlessSteel, 1L), ItemList.Cover_RedstoneReceiverExternal.get(1L), 3200, 128); @@ -861,7 +863,7 @@ public class GT_MetaGenerated_Item_01 extends GT_MetaGenerated_Item_X32 { GT_ModHandler.addShapelessCraftingRecipe(ItemList.Cover_RedstoneReceiverExternal.get(1L), new Object[]{ItemList.Cover_RedstoneReceiverInternal.get(1L)}); ItemList.Cover_NeedsMaintainance.set(addItem(tLastID = 748, "Needs Maintenance Cover", "Attach to Multiblock Controller. Emits Redstone Signal if needs Maintenance", new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L), new TC_Aspects.TC_AspectStack(TC_Aspects.MACHINA, 1L))); - GregTech_API.registerCover(ItemList.Cover_NeedsMaintainance.get(1L), new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ACTIVITYDETECTOR)), new GT_Cover_NeedMaintainance()); + GregTech_API.registerCover(ItemList.Cover_NeedsMaintainance.get(1L), TextureFactory.of(MACHINE_CASINGS[2][0], TextureFactory.of(TextureFactory.of(OVERLAY_ACTIVITYDETECTOR), TextureFactory.builder().addIcon(OVERLAY_ACTIVITYDETECTOR_GLOW).glow().build())), new GT_Cover_NeedMaintainance()); GT_Values.RA.addAssemblerRecipe(ItemList.Emitter_MV.get(1L), GT_OreDictUnificator.get(OrePrefixes.plate, Materials.Aluminium, 1L), ItemList.Cover_NeedsMaintainance.get(1L), 600, 24); } diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java index d1bc513328..7244905d9f 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_02.java @@ -1,11 +1,21 @@ package gregtech.common.items; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TC_Aspects; import gregtech.api.items.GT_MetaGenerated_Item_X32; -import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.ItemData; -import gregtech.api.util.*; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_FoodStat; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gregtech.common.items.behaviors.Behaviour_Arrow; import net.minecraft.dispenser.IBlockSource; import net.minecraft.enchantment.Enchantment; @@ -24,7 +34,7 @@ import net.minecraft.world.World; public class GT_MetaGenerated_Item_02 extends GT_MetaGenerated_Item_X32 { public static GT_MetaGenerated_Item_02 INSTANCE; - private final static String aTextCover = "Usable as Cover"; private final static String aTextForestry = "Forestry"; + private static final String aTextCover = "Usable as Cover"; private static final String aTextForestry = "Forestry"; public GT_MetaGenerated_Item_02() { super("metaitem.02", OrePrefixes.toolHeadSword, OrePrefixes.toolHeadPickaxe, OrePrefixes.toolHeadShovel, OrePrefixes.toolHeadAxe, OrePrefixes.toolHeadHoe, OrePrefixes.toolHeadHammer, OrePrefixes.toolHeadFile, OrePrefixes.toolHeadSaw, OrePrefixes.toolHeadDrill, OrePrefixes.toolHeadChainsaw, OrePrefixes.toolHeadWrench, OrePrefixes.toolHeadUniversalSpade, OrePrefixes.toolHeadSense, OrePrefixes.toolHeadPlow, OrePrefixes.toolHeadArrow, OrePrefixes.toolHeadBuzzSaw, OrePrefixes.turbineBlade, null, OrePrefixes.itemCasing, OrePrefixes.wireFine, OrePrefixes.gearGtSmall, OrePrefixes.rotor, OrePrefixes.stickLong, OrePrefixes.springSmall, OrePrefixes.spring, OrePrefixes.arrowGtWood, OrePrefixes.arrowGtPlastic, OrePrefixes.gemChipped, OrePrefixes.gemFlawed, OrePrefixes.gemFlawless, OrePrefixes.gemExquisite, OrePrefixes.gearGt); @@ -241,36 +251,36 @@ public class GT_MetaGenerated_Item_02 extends GT_MetaGenerated_Item_X32 { GT_ModHandler.addCraftingRecipe(ItemList.Plank_Maple.get(2L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"s ", " P", 'P', GT_ModHandler.getModItem(aTextForestry, "slabs3", 1L, 6)}); GT_ModHandler.addCraftingRecipe(ItemList.Plank_Citrus.get(2L), GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, new Object[]{"s ", " P", 'P', GT_ModHandler.getModItem(aTextForestry, "slabs3", 1L, 7)}); - GregTech_API.registerCover(ItemList.Plank_Oak.get(1L), new GT_CopiedBlockTexture(Blocks.planks, 0, 0), null); - GregTech_API.registerCover(ItemList.Plank_Spruce.get(1L), new GT_CopiedBlockTexture(Blocks.planks, 0, 1), null); - GregTech_API.registerCover(ItemList.Plank_Birch.get(1L), new GT_CopiedBlockTexture(Blocks.planks, 0, 2), null); - GregTech_API.registerCover(ItemList.Plank_Jungle.get(1L), new GT_CopiedBlockTexture(Blocks.planks, 0, 3), null); - GregTech_API.registerCover(ItemList.Plank_Acacia.get(1L), new GT_CopiedBlockTexture(Blocks.planks, 0, 4), null); - GregTech_API.registerCover(ItemList.Plank_DarkOak.get(1L), new GT_CopiedBlockTexture(Blocks.planks, 0, 5), null); - GregTech_API.registerCover(ItemList.Plank_Larch.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 0, new ItemStack(Blocks.planks, 1, 0))), 0, 0), null); - GregTech_API.registerCover(ItemList.Plank_Teak.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 1, new ItemStack(Blocks.planks, 1, 0))), 0, 1), null); - GregTech_API.registerCover(ItemList.Plank_Acacia_Green.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 2, new ItemStack(Blocks.planks, 1, 0))), 0, 2), null); - GregTech_API.registerCover(ItemList.Plank_Lime.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 3, new ItemStack(Blocks.planks, 1, 0))), 0, 3), null); - GregTech_API.registerCover(ItemList.Plank_Chestnut.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 4, new ItemStack(Blocks.planks, 1, 0))), 0, 4), null); - GregTech_API.registerCover(ItemList.Plank_Wenge.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 5, new ItemStack(Blocks.planks, 1, 0))), 0, 5), null); - GregTech_API.registerCover(ItemList.Plank_Baobab.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 6, new ItemStack(Blocks.planks, 1, 0))), 0, 6), null); - GregTech_API.registerCover(ItemList.Plank_Sequoia.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 7, new ItemStack(Blocks.planks, 1, 0))), 0, 7), null); - GregTech_API.registerCover(ItemList.Plank_Kapok.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 8, new ItemStack(Blocks.planks, 1, 0))), 0, 8), null); - GregTech_API.registerCover(ItemList.Plank_Ebony.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 9, new ItemStack(Blocks.planks, 1, 0))), 0, 9), null); - GregTech_API.registerCover(ItemList.Plank_Mahagony.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 10, new ItemStack(Blocks.planks, 1, 0))), 0, 10), null); - GregTech_API.registerCover(ItemList.Plank_Balsa.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 11, new ItemStack(Blocks.planks, 1, 0))), 0, 11), null); - GregTech_API.registerCover(ItemList.Plank_Willow.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 12, new ItemStack(Blocks.planks, 1, 0))), 0, 12), null); - GregTech_API.registerCover(ItemList.Plank_Walnut.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 13, new ItemStack(Blocks.planks, 1, 0))), 0, 13), null); - GregTech_API.registerCover(ItemList.Plank_Greenheart.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 14, new ItemStack(Blocks.planks, 1, 0))), 0, 14), null); - GregTech_API.registerCover(ItemList.Plank_Cherry.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 15, new ItemStack(Blocks.planks, 1, 0))), 0, 15), null); - GregTech_API.registerCover(ItemList.Plank_Mahoe.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 16, new ItemStack(Blocks.planks, 1, 0))), 0, 0), null); - GregTech_API.registerCover(ItemList.Plank_Poplar.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 17, new ItemStack(Blocks.planks, 1, 0))), 0, 1), null); - GregTech_API.registerCover(ItemList.Plank_Palm.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 18, new ItemStack(Blocks.planks, 1, 0))), 0, 2), null); - GregTech_API.registerCover(ItemList.Plank_Papaya.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 19, new ItemStack(Blocks.planks, 1, 0))), 0, 3), null); - GregTech_API.registerCover(ItemList.Plank_Pine.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 20, new ItemStack(Blocks.planks, 1, 0))), 0, 4), null); - GregTech_API.registerCover(ItemList.Plank_Plum.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 21, new ItemStack(Blocks.planks, 1, 0))), 0, 5), null); - GregTech_API.registerCover(ItemList.Plank_Maple.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 22, new ItemStack(Blocks.planks, 1, 0))), 0, 6), null); - GregTech_API.registerCover(ItemList.Plank_Citrus.get(1L), new GT_CopiedBlockTexture(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 23, new ItemStack(Blocks.planks, 1, 0))), 0, 7), null); + GregTech_API.registerCover(ItemList.Plank_Oak.get(1L), TextureFactory.of(Blocks.planks, 0), null); + GregTech_API.registerCover(ItemList.Plank_Spruce.get(1L), TextureFactory.of(Blocks.planks, 1), null); + GregTech_API.registerCover(ItemList.Plank_Birch.get(1L), TextureFactory.of(Blocks.planks, 2), null); + GregTech_API.registerCover(ItemList.Plank_Jungle.get(1L), TextureFactory.of(Blocks.planks, 3), null); + GregTech_API.registerCover(ItemList.Plank_Acacia.get(1L), TextureFactory.of(Blocks.planks, 4), null); + GregTech_API.registerCover(ItemList.Plank_DarkOak.get(1L), TextureFactory.of(Blocks.planks, 5), null); + GregTech_API.registerCover(ItemList.Plank_Larch.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 0, new ItemStack(Blocks.planks, 1, 0))), 0), null); + GregTech_API.registerCover(ItemList.Plank_Teak.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 1, new ItemStack(Blocks.planks, 1, 0))), 1), null); + GregTech_API.registerCover(ItemList.Plank_Acacia_Green.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 2, new ItemStack(Blocks.planks, 1, 0))), 2), null); + GregTech_API.registerCover(ItemList.Plank_Lime.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 3, new ItemStack(Blocks.planks, 1, 0))), 3), null); + GregTech_API.registerCover(ItemList.Plank_Chestnut.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 4, new ItemStack(Blocks.planks, 1, 0))), 4), null); + GregTech_API.registerCover(ItemList.Plank_Wenge.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 5, new ItemStack(Blocks.planks, 1, 0))), 5), null); + GregTech_API.registerCover(ItemList.Plank_Baobab.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 6, new ItemStack(Blocks.planks, 1, 0))), 6), null); + GregTech_API.registerCover(ItemList.Plank_Sequoia.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 7, new ItemStack(Blocks.planks, 1, 0))), 7), null); + GregTech_API.registerCover(ItemList.Plank_Kapok.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 8, new ItemStack(Blocks.planks, 1, 0))), 8), null); + GregTech_API.registerCover(ItemList.Plank_Ebony.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 9, new ItemStack(Blocks.planks, 1, 0))), 9), null); + GregTech_API.registerCover(ItemList.Plank_Mahagony.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 10, new ItemStack(Blocks.planks, 1, 0))), 10), null); + GregTech_API.registerCover(ItemList.Plank_Balsa.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 11, new ItemStack(Blocks.planks, 1, 0))), 11), null); + GregTech_API.registerCover(ItemList.Plank_Willow.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 12, new ItemStack(Blocks.planks, 1, 0))), 12), null); + GregTech_API.registerCover(ItemList.Plank_Walnut.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 13, new ItemStack(Blocks.planks, 1, 0))), 13), null); + GregTech_API.registerCover(ItemList.Plank_Greenheart.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 14, new ItemStack(Blocks.planks, 1, 0))), 14), null); + GregTech_API.registerCover(ItemList.Plank_Cherry.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 15, new ItemStack(Blocks.planks, 1, 0))), 15), null); + GregTech_API.registerCover(ItemList.Plank_Mahoe.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 16, new ItemStack(Blocks.planks, 1, 0))), 0), null); + GregTech_API.registerCover(ItemList.Plank_Poplar.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 17, new ItemStack(Blocks.planks, 1, 0))), 1), null); + GregTech_API.registerCover(ItemList.Plank_Palm.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 18, new ItemStack(Blocks.planks, 1, 0))), 2), null); + GregTech_API.registerCover(ItemList.Plank_Papaya.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 19, new ItemStack(Blocks.planks, 1, 0))), 3), null); + GregTech_API.registerCover(ItemList.Plank_Pine.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 20, new ItemStack(Blocks.planks, 1, 0))), 4), null); + GregTech_API.registerCover(ItemList.Plank_Plum.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 21, new ItemStack(Blocks.planks, 1, 0))), 5), null); + GregTech_API.registerCover(ItemList.Plank_Maple.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 22, new ItemStack(Blocks.planks, 1, 0))), 6), null); + GregTech_API.registerCover(ItemList.Plank_Citrus.get(1L), TextureFactory.of(GT_Utility.getBlockFromStack(GT_ModHandler.getModItem(aTextForestry, "planks", 1L, 23, new ItemStack(Blocks.planks, 1, 0))), 7), null); ItemList.Crop_Drop_Plumbilia.set(addItem(tLastID = 500, "Plumbilia Leaf", "Source of Lead", new TC_Aspects.TC_AspectStack(TC_Aspects.MESSIS, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 1L))); ItemList.Crop_Drop_Argentia.set(addItem(tLastID = 501, "Argentia Leaf", "Source of Silver", new TC_Aspects.TC_AspectStack(TC_Aspects.MESSIS, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.METALLUM, 1L), new TC_Aspects.TC_AspectStack(TC_Aspects.LUCRUM, 1L))); diff --git a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java index 24e4f27dc5..1c27439352 100644 --- a/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java +++ b/src/main/java/gregtech/common/items/GT_MetaGenerated_Item_03.java @@ -1,11 +1,19 @@ package gregtech.common.items; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.enums.TC_Aspects; import gregtech.api.items.GT_MetaGenerated_Item_X32; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.common.covers.GT_Cover_SolarPanel; +import static gregtech.api.enums.Textures.BlockIcons.SOLARPANEL_UEV; +import static gregtech.api.enums.Textures.BlockIcons.SOLARPANEL_UHV; +import static gregtech.api.enums.Textures.BlockIcons.SOLARPANEL_UIV; + public class GT_MetaGenerated_Item_03 extends GT_MetaGenerated_Item_X32 { public static GT_MetaGenerated_Item_03 INSTANCE; @@ -212,9 +220,9 @@ public class GT_MetaGenerated_Item_03 ItemList.Cover_SolarPanel_UEV.set(addItem(tLastID = 131, "Solar Panel (UEV)", "Ultimate Extreme Voltage Solar Panel (Needs cleaning with right click)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 256L), new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 256L))); ItemList.Cover_SolarPanel_UIV.set(addItem(tLastID = 132, "Solar Panel (UIV)", "Ultimate Insane Voltage Solar Panel (Needs cleaning with right click)", new TC_Aspects.TC_AspectStack(TC_Aspects.ELECTRUM, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.POTENTIA, 512L), new TC_Aspects.TC_AspectStack(TC_Aspects.TENEBRAE, 512L))); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_UHV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_UHV), new GT_Cover_SolarPanel(2097152)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_UEV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_UEV), new GT_Cover_SolarPanel(8388608)); - GregTech_API.registerCover(ItemList.Cover_SolarPanel_UIV.get(1L), new GT_RenderedTexture(Textures.BlockIcons.SOLARPANEL_UIV), new GT_Cover_SolarPanel(33554432)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_UHV.get(1L), TextureFactory.of(SOLARPANEL_UHV), new GT_Cover_SolarPanel(2097152)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_UEV.get(1L), TextureFactory.of(SOLARPANEL_UEV), new GT_Cover_SolarPanel(8388608)); + GregTech_API.registerCover(ItemList.Cover_SolarPanel_UIV.get(1L), TextureFactory.of(SOLARPANEL_UIV), new GT_Cover_SolarPanel(33554432)); ItemList.ULV_Coil.set(addItem(tLastID = 140, "Ultra Low Voltage Coil", "Primitive Coil", o)); ItemList.LV_Coil.set(addItem(tLastID = 141, "Low Voltage Coil", "Basic Coil", o)); diff --git a/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java new file mode 100644 index 0000000000..fdd20026ab --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java @@ -0,0 +1,123 @@ +package gregtech.common.render; + +import gregtech.api.interfaces.IBlockContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.util.LightingHelper; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; + +class GT_CopiedBlockTexture implements ITexture, IBlockContainer { + private final Block mBlock; + private final byte mSide, mMeta; + + GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean allowAlpha) { + if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedBlockTexture"); + mBlock = aBlock; + mSide = (byte) aSide; + mMeta = (byte) aMeta; + } + + private IIcon getIcon(int aSide) { + if (mSide == 6) return mBlock.getIcon(aSide, mMeta); + return mBlock.getIcon(mSide, mMeta); + } + + @Override + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + IIcon aIcon = getIcon(ForgeDirection.EAST.ordinal()); + aRenderer.field_152631_f = true; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); + new LightingHelper(aRenderer) + .setupLightingXPos(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); + aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.field_152631_f = false; + } + + @Override + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); + IIcon aIcon = getIcon(ForgeDirection.WEST.ordinal()); + new LightingHelper(aRenderer) + .setupLightingXNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); + aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); + IIcon aIcon = getIcon(ForgeDirection.UP.ordinal()); + new LightingHelper(aRenderer) + .setupLightingYPos(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.UP.ordinal(), 0xffffff); + aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + IIcon aIcon = getIcon(ForgeDirection.DOWN.ordinal()); + new LightingHelper(aRenderer) + .setupLightingYNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); + IIcon aIcon = getIcon(ForgeDirection.SOUTH.ordinal()); + new LightingHelper(aRenderer) + .setupLightingZPos(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); + aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); + IIcon aIcon = getIcon(ForgeDirection.NORTH.ordinal()); + aRenderer.field_152631_f = true; + new LightingHelper(aRenderer) + .setupLightingZNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); + aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.field_152631_f = false; + } + + @Override + public boolean isValidTexture() { + return mBlock != null; + } + + @Override + public Block getBlock() { + return mBlock; + } + + @Override + public byte getMeta() { + return mMeta; + } +} diff --git a/src/main/java/gregtech/common/render/GT_MultiTexture.java b/src/main/java/gregtech/common/render/GT_MultiTexture.java new file mode 100644 index 0000000000..eadcb39573 --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_MultiTexture.java @@ -0,0 +1,58 @@ +package gregtech.common.render; + +import gregtech.api.interfaces.ITexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; + +/** + * <p>Lets Multiple ITextures Render overlay over each other.<</p> + * <p>I should have done this much earlier...</p> + */ +class GT_MultiTexture implements ITexture { + protected final ITexture[] mTextures; + + GT_MultiTexture(ITexture... aTextures) { + mTextures = aTextures; + } + + @Override + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + for (ITexture tTexture : mTextures) + if (tTexture != null && tTexture.isValidTexture()) tTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ); + } + + @Override + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + for (ITexture tTexture : mTextures) + if (tTexture != null && tTexture.isValidTexture()) tTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ); + } + + @Override + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + for (ITexture tTexture : mTextures) + if (tTexture != null && tTexture.isValidTexture()) tTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ); + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + for (ITexture tTexture : mTextures) + if (tTexture != null && tTexture.isValidTexture()) tTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ); + } + + @Override + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + for (ITexture tTexture : mTextures) + if (tTexture != null && tTexture.isValidTexture()) tTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ); + } + + @Override + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + for (ITexture tTexture : mTextures) + if (tTexture != null && tTexture.isValidTexture()) tTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ); + } + + @Override + public boolean isValidTexture() { + return true; + } +} diff --git a/src/main/java/gregtech/common/render/GT_RenderedGlowTexture.java b/src/main/java/gregtech/common/render/GT_RenderedGlowTexture.java new file mode 100644 index 0000000000..899e4d7c5d --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_RenderedGlowTexture.java @@ -0,0 +1,213 @@ +package gregtech.common.render; + +import gregtech.GT_Mod; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.IColorModulationContainer; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.IIcon; + +import static gregtech.api.util.LightingHelper.MAX_BRIGHTNESS; + +/** + * This {@link ITexture} implementation renders texture with max brightness to glow in the dark. + */ + +class GT_RenderedGlowTexture implements ITexture, IColorModulationContainer { + protected final IIconContainer mIconContainer; + private final short[] mRGBa; + + GT_RenderedGlowTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha) { + if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture"); + mIconContainer = GT_Mod.gregtechproxy.mRenderGlowTextures ? aIcon : BlockIcons.VOID; + mRGBa = aRGBa; + } + + @Override + public short[] getRGBA() { + return mRGBa; + } + + @Override + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API + if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; + final boolean enableAO = aRenderer.enableAO; + aRenderer.enableAO = false; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); + Tessellator.instance.setBrightness(MAX_BRIGHTNESS); + Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]); + aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorOpaque(255, 255, 255); + aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.enableAO = enableAO; + } + + @Override + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API + if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; + aRenderer.field_152631_f = true; + final boolean enableAO = aRenderer.enableAO; + aRenderer.enableAO = false; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); + Tessellator.instance.setBrightness(MAX_BRIGHTNESS); + Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]); + aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorOpaque(255, 255, 255); + aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.field_152631_f = false; + aRenderer.enableAO = enableAO; + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API + if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; + final boolean enableAO = aRenderer.enableAO; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + final Tessellator tessellator = Tessellator.instance; + IIcon aIcon = mIconContainer.getIcon(); + + float minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); + float maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); + float minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + float maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + minU = 16.0F - aIcon.getMaxU(); + maxU = 16.0F - aIcon.getMinU(); + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + minV = aIcon.getMinV(); + maxV = aIcon.getMaxV(); + } + + double minX = aX + aRenderer.renderMinX; + double maxX = aX + aRenderer.renderMaxX; + double minY = aY + aRenderer.renderMinY; + double minZ = aZ + aRenderer.renderMinZ; + double maxZ = aZ + aRenderer.renderMaxZ; + + Tessellator.instance.setBrightness(MAX_BRIGHTNESS); + Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]); + + tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); + tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); + tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); + tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV); + + if (mIconContainer.getOverlayIcon() != null) { + minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); + maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); + minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + minU = 16.0F - aIcon.getMaxU(); + maxU = 16.0F - aIcon.getMinU(); + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + minV = aIcon.getMinV(); + maxV = aIcon.getMaxV(); + } + + minX = aX + (float) aRenderer.renderMinX; + maxX = aX + (float) aRenderer.renderMaxX; + minY = aY + (float) aRenderer.renderMinY; + minZ = aZ + (float) aRenderer.renderMinZ; + maxZ = aZ + (float) aRenderer.renderMaxZ; + + Tessellator.instance.setColorOpaque(255, 255, 255); + tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); + tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); + tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); + tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.enableAO = enableAO; + } + + @Override + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API + if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; + final boolean enableAO = aRenderer.enableAO; + aRenderer.enableAO = false; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); + Tessellator.instance.setBrightness(MAX_BRIGHTNESS); + Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]); + aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorOpaque(255, 255, 255); + aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.enableAO = enableAO; + } + + @Override + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API + if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; + final boolean enableAO = aRenderer.enableAO; + aRenderer.enableAO = false; + aRenderer.field_152631_f = true; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); + Tessellator.instance.setBrightness(MAX_BRIGHTNESS); + Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]); + aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + Tessellator.instance.setColorOpaque(255, 255, 255); + aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.field_152631_f = false; + aRenderer.enableAO = enableAO; + } + + @Override + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + if (aRenderer.useInventoryTint) return; // TODO: Remove this once all addons have migrated to the new Texture API + if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; + final boolean enableAO = aRenderer.enableAO; + aRenderer.enableAO = false; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); + Tessellator.instance.setBrightness(MAX_BRIGHTNESS); + Tessellator.instance.setColorOpaque(mRGBa[0], mRGBa[1], mRGBa[2]); + aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.enableAO = enableAO; + } + + @Override + public boolean isValidTexture() { + return mIconContainer != null; + } +} diff --git a/src/main/java/gregtech/common/render/GT_RenderedTexture.java b/src/main/java/gregtech/common/render/GT_RenderedTexture.java new file mode 100644 index 0000000000..9e76634385 --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_RenderedTexture.java @@ -0,0 +1,214 @@ +package gregtech.common.render; + +import gregtech.api.interfaces.IColorModulationContainer; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.util.LightingHelper; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; + +class GT_RenderedTexture implements ITexture, IColorModulationContainer { + protected final IIconContainer mIconContainer; + private final short[] mRGBa; + + GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha) { + if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture"); + mIconContainer = aIcon; + mRGBa = aRGBa; + } + + @Override + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + aRenderer.field_152631_f = true; + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingXPos(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.EAST.ordinal(), mRGBa); + aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + lighting.setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); + aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.field_152631_f = false; + } + + @Override + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingXNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.WEST.ordinal(), mRGBa); + aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + lighting.setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); + aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYPos(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.UP.ordinal(), mRGBa); + aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + lighting.setupColor(ForgeDirection.UP.ordinal(), 0xffffff); + aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + final Tessellator tessellator = Tessellator.instance; + IIcon aIcon = mIconContainer.getIcon(); + + float minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); + float maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); + float minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + float maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + minU = 16.0F - aIcon.getMaxU(); + maxU = 16.0F - aIcon.getMinU(); + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + minV = aIcon.getMinV(); + maxV = aIcon.getMaxV(); + } + + double minX = aX + aRenderer.renderMinX; + double maxX = aX + aRenderer.renderMaxX; + double minY = aY + aRenderer.renderMinY; + double minZ = aZ + aRenderer.renderMinZ; + double maxZ = aZ + aRenderer.renderMaxZ; + + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + } else { + tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); + tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); + tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); + } + tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV); + + if (mIconContainer.getOverlayIcon() != null) { + minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); + maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); + minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); + maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); + + if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { + minU = 16.0F - aIcon.getMaxU(); + maxU = 16.0F - aIcon.getMinU(); + } + + if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { + minV = aIcon.getMinV(); + maxV = aIcon.getMaxV(); + } + + minX = aX + (float)aRenderer.renderMinX; + maxX = aX + (float)aRenderer.renderMaxX; + minY = aY + (float)aRenderer.renderMinY; + minZ = aZ + (float)aRenderer.renderMinZ; + maxZ = aZ + (float)aRenderer.renderMaxZ; + + lighting.setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); + + if (aRenderer.enableAO) { + tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); + tessellator.setBrightness(aRenderer.brightnessTopLeft); + tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); + tessellator.setBrightness(aRenderer.brightnessBottomLeft); + tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); + tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); + tessellator.setBrightness(aRenderer.brightnessBottomRight); + tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); + tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); + tessellator.setBrightness(aRenderer.brightnessTopRight); + } else { + tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); + tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); + tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); + } + tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingZPos(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa); + aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + lighting.setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); + aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } + + @Override + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); + aRenderer.field_152631_f = true; + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingZNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.NORTH.ordinal(), mRGBa); + aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + lighting.setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); + aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + aRenderer.field_152631_f = false; + } + + @Override + public short[] getRGBA() { + return mRGBa; + } + + @Override + public boolean isValidTexture() { + return mIconContainer != null; + } +} diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java index 1055991cad..42e59dd2c7 100644 --- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java +++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java @@ -448,53 +448,47 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { return true; } + @Override public void renderInventoryBlock(Block aBlock, int aMeta, int aModelID, RenderBlocks aRenderer) { aRenderer.enableAO = false; aRenderer.useInventoryTint = true; + Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API + GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.5F, -0.5F, -0.5F); - Tessellator.instance.startDrawingQuads(); - - if ((aBlock instanceof GT_Block_Machines)) { - if ((aMeta > 0) - && (aMeta < GregTech_API.METATILEENTITIES.length) - && (GregTech_API.METATILEENTITIES[aMeta] != null) - && (!GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer))) { - renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer); - } - } else if ((aBlock instanceof GT_Block_Ores_Abstract)) { + if (aBlock instanceof GT_Block_Ores_Abstract) { GT_TileEntity_Ores tTileEntity = new GT_TileEntity_Ores(); tTileEntity.mMetaData = ((short) aMeta); aBlock.setBlockBoundsForItemRender(); aRenderer.setRenderBoundsFromBlock(aBlock); - - Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + Tessellator.instance.setNormal(0, -1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) DOWN.ordinal()), true); - - Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + Tessellator.instance.setNormal(0, 1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) UP.ordinal()), true); - - Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + Tessellator.instance.setNormal(0, 0, -1); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) NORTH.ordinal()), true); - - Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + Tessellator.instance.setNormal(0, 0, 1); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) SOUTH.ordinal()), true); - - Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + Tessellator.instance.setNormal(-1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) WEST.ordinal()), true); - - Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + Tessellator.instance.setNormal(1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) EAST.ordinal()), true); + } else if (aMeta > 0 + && (aMeta < GregTech_API.METATILEENTITIES.length) + && aBlock instanceof GT_Block_Machines + && (GregTech_API.METATILEENTITIES[aMeta] != null) + && (!GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer))) { + renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer); } - Tessellator.instance.draw(); aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); + Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API GL11.glTranslatef(0.5F, 0.5F, 0.5F); aRenderer.useInventoryTint = false; } @@ -519,41 +513,30 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, blockMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - - Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + Tessellator.instance.setNormal(0, -1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - - Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + Tessellator.instance.setNormal(0, 1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - - Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + Tessellator.instance.setNormal(0, 0, -1); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - - Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + Tessellator.instance.setNormal(0, 0, 1); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - - Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + Tessellator.instance.setNormal(-1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) WEST.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, true, false), true); - - Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + Tessellator.instance.setNormal(1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, true, false), true); } else { - Tessellator.instance.setNormal(0.0F, -1.0F, 0.0F); + Tessellator.instance.setNormal(0, -1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - - Tessellator.instance.setNormal(0.0F, 1.0F, 0.0F); + Tessellator.instance.setNormal(0, 1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - - Tessellator.instance.setNormal(0.0F, 0.0F, -1.0F); + Tessellator.instance.setNormal(0, 0, -1); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - - Tessellator.instance.setNormal(0.0F, 0.0F, 1.0F); + Tessellator.instance.setNormal(0, 0, 1); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - - Tessellator.instance.setNormal(-1.0F, 0.0F, 0.0F); + Tessellator.instance.setNormal(-1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) WEST.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - - Tessellator.instance.setNormal(1.0F, 0.0F, 0.0F); + Tessellator.instance.setNormal(1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); } } @@ -636,6 +619,7 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } } + @Override public boolean renderWorldBlock(IBlockAccess aWorld, int aX, int aY, int aZ, Block aBlock, int aModelID, RenderBlocks aRenderer) { aRenderer.enableAO = Minecraft.isAmbientOcclusionEnabled() && GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion; aRenderer.useInventoryTint = false; @@ -661,10 +645,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { return false; } + @Override public boolean shouldRender3DInInventory(int aModel) { return true; } + @Override public int getRenderId() { return this.mRenderID; } diff --git a/src/main/java/gregtech/common/render/GT_SidedTexture.java b/src/main/java/gregtech/common/render/GT_SidedTexture.java new file mode 100644 index 0000000000..9bdee73eb0 --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_SidedTexture.java @@ -0,0 +1,75 @@ +package gregtech.common.render; + +import gregtech.api.interfaces.IColorModulationContainer; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.render.TextureFactory; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; + +class GT_SidedTexture implements ITexture, IColorModulationContainer { + protected final ITexture[] mTextures; + /** + * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! + * <p/> + * Just set this variable to another different Array instead. + * Otherwise some colored things will get Problems. + */ + private final short[] mRGBa; + + GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5, short[] aRGBa, boolean aAllowAlpha) { + if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture"); + mTextures = new ITexture[]{ + TextureFactory.of(aIcon0, aRGBa, aAllowAlpha), + TextureFactory.of(aIcon1, aRGBa, aAllowAlpha), + TextureFactory.of(aIcon2, aRGBa, aAllowAlpha), + TextureFactory.of(aIcon3, aRGBa, aAllowAlpha), + TextureFactory.of(aIcon4, aRGBa, aAllowAlpha), + TextureFactory.of(aIcon5, aRGBa, aAllowAlpha) + }; + mRGBa = aRGBa; + } + + @Override + public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + mTextures[5].renderXPos(aRenderer, aBlock, aX ,aY, aZ); + } + + @Override + public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + mTextures[4].renderXNeg(aRenderer, aBlock, aX ,aY, aZ); + } + + @Override + public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + mTextures[1].renderYPos(aRenderer, aBlock, aX ,aY, aZ); + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + mTextures[0].renderYNeg(aRenderer, aBlock, aX ,aY, aZ); + } + + @Override + public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + mTextures[3].renderZPos(aRenderer, aBlock, aX ,aY, aZ); + } + + @Override + public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + mTextures[2].renderZNeg(aRenderer, aBlock, aX ,aY, aZ); + } + + @Override + public short[] getRGBA() { + return mRGBa; + } + + @Override + public boolean isValidTexture() { + for (ITexture renderedTexture : mTextures) { + if (!renderedTexture.isValidTexture()) return false; + } + return true; + } +} diff --git a/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java b/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java new file mode 100644 index 0000000000..ba0f9d3a91 --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java @@ -0,0 +1,36 @@ +package gregtech.common.render; + +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.util.LightingHelper; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * This ITexture implementation extends the GT_RenderedTexture class + * to render with bottom side flipped as with dumb blocks rendering. + * It is used in Ore blocks rendering so they better blends with dumb block ores + * from vanilla or other mods, when seen from bottom. + */ +class GT_StdRenderedTexture extends GT_RenderedTexture{ + + GT_StdRenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha) { + super(aIcon, aRGBa, allowAlpha); + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + // TODO: Uncomment this once all addons have migrated to the new Texture API + //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.DOWN.ordinal(), getRGBA()); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + lighting.setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + // TODO: Uncomment this once all addons have migrated to the new Texture API + //draw(aRenderer); + } +} diff --git a/src/main/java/gregtech/common/render/GT_TextureBuilder.java b/src/main/java/gregtech/common/render/GT_TextureBuilder.java new file mode 100644 index 0000000000..22446f99a5 --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_TextureBuilder.java @@ -0,0 +1,107 @@ +package gregtech.common.render; + +import gregtech.api.enums.Dyes; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.ITextureBuilder; +import net.minecraft.block.Block; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@SuppressWarnings("unused") +public class GT_TextureBuilder implements ITextureBuilder { + private final List<IIconContainer> iconContainerList; + private final List<ITexture> textureLayers; + private Block fromBlock; + private int fromMeta; + private ForgeDirection fromSide; + private short[] rgba; + private boolean allowAlpha; + private boolean stdOrient; + private boolean glow; + + public GT_TextureBuilder() { + textureLayers = new ArrayList<>(); + iconContainerList = new ArrayList<>(); + rgba = Dyes._NULL.mRGBa; + allowAlpha = true; + stdOrient = false; + glow = false; + } + + @Override + public ITextureBuilder setFromBlock(final Block block, final int meta) { + this.fromBlock = block; + this.fromMeta = meta; + this.fromSide = ForgeDirection.UNKNOWN; + return this; + } + + @Override + public ITextureBuilder setFromSide(final ForgeDirection side) { + this.fromSide = side; + return this; + } + + @Override + public ITextureBuilder addIcon(final IIconContainer... iconContainers) { + this.iconContainerList.addAll(Arrays.asList(iconContainers)); + return this; + } + + @Override + public ITextureBuilder setRGBA(final short[] rgba) { + this.rgba = rgba; + return this; + } + + @Override + public ITextureBuilder addLayer(final ITexture... iTextures) { + this.textureLayers.addAll(Arrays.asList(iTextures)); + return this; + } + + @Override + public ITextureBuilder setAllowAlpha(final boolean allowAlpha) { + this.allowAlpha = allowAlpha; + return this; + } + + @Override + public ITextureBuilder stdOrient() { + this.stdOrient = true; + return this; + } + + @Override + public ITextureBuilder glow() { + glow = true; + return this; + } + + @Override + public ITexture build() { + if (fromBlock != null) return new GT_CopiedBlockTexture(fromBlock, fromSide.ordinal(), fromMeta, rgba, allowAlpha); + if (!textureLayers.isEmpty()) return new GT_MultiTexture(textureLayers.toArray(new ITexture[0])); + switch (iconContainerList.size()) { + case 1: + if (stdOrient) return new GT_StdRenderedTexture(iconContainerList.get(0), rgba, allowAlpha); + if (glow) return new GT_RenderedGlowTexture(iconContainerList.get(0), rgba, allowAlpha); + return new GT_RenderedTexture(iconContainerList.get(0), rgba, allowAlpha); + case 6: + return new GT_SidedTexture( + iconContainerList.get(ForgeDirection.DOWN.ordinal()), + iconContainerList.get(ForgeDirection.UP.ordinal()), + iconContainerList.get(ForgeDirection.NORTH.ordinal()), + iconContainerList.get(ForgeDirection.SOUTH.ordinal()), + iconContainerList.get(ForgeDirection.WEST.ordinal()), + iconContainerList.get(ForgeDirection.EAST.ordinal()), + rgba, allowAlpha); + default: + throw new IllegalStateException("Invalid sideIconContainer count"); + } + } +} diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java index 6951f9bb44..3830cd3497 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ChestBuffer.java @@ -1,11 +1,10 @@ package gregtech.common.tileentities.automation; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_ChestBuffer; import gregtech.common.gui.GT_GUIContainer_ChestBuffer; @@ -17,6 +16,9 @@ import net.minecraft.item.ItemStack; import java.util.Arrays; import java.util.Comparator; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_CHESTBUFFER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_CHESTBUFFER_GLOW; + public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { private static final int[] tickRate = {400, 200, 100, 20, 4, 1, 1, 1, 1, 1, 1, 1, 1}; @@ -25,10 +27,10 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 28, new String[]{ - "Buffers up to 27 Item Stacks", - "Use Screwdriver to regulate output stack size", - "Does not consume energy to move Item", - getTickRateDesc(aTier)}); + "Buffers up to 27 Item Stacks", + "Use Screwdriver to regulate output stack size", + "Does not consume energy to move Item", + getTickRateDesc(aTier)}); } public GT_MetaTileEntity_ChestBuffer(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription) { @@ -47,18 +49,24 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_ChestBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_CHESTBUFFER); + return TextureFactory.of( + TextureFactory.of(AUTOMATION_CHESTBUFFER), + TextureFactory.builder().addIcon(AUTOMATION_CHESTBUFFER_GLOW).glow().build()); } + @Override public boolean isValidSlot(int aIndex) { return aIndex < this.mInventory.length - 1; } + @Override protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aTimer % tickRate[mTier] > 0) return; @@ -113,6 +121,7 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { }); } + @Override protected void fillStacksIntoFirstSlots() { sortStacks(); // Merge small stacks together @@ -131,10 +140,12 @@ public class GT_MetaTileEntity_ChestBuffer extends GT_MetaTileEntity_Buffer { } } + @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_ChestBuffer(aPlayerInventory, aBaseMetaTileEntity); } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java index 1f87b45ced..0c5b1dfda8 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Filter.java @@ -1,11 +1,10 @@ package gregtech.common.tileentities.automation; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Filter; import gregtech.common.gui.GT_GUIContainer_Filter; @@ -13,15 +12,18 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_FILTER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_FILTER_GLOW; + public class GT_MetaTileEntity_Filter extends GT_MetaTileEntity_Buffer { public boolean bIgnoreNBT = false; public boolean bInvertFilter = false; public GT_MetaTileEntity_Filter(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 19, new String[]{ - "Filters up to 9 different Items", - "Use Screwdriver to regulate output stack size", - "Consumes 1EU per moved Item"}); + "Filters up to 9 different Items", + "Use Screwdriver to regulate output stack size", + "Consumes 1EU per moved Item"}); } public GT_MetaTileEntity_Filter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { @@ -32,38 +34,48 @@ public class GT_MetaTileEntity_Filter extends GT_MetaTileEntity_Buffer { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Filter(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_FILTER); + return TextureFactory.of( + TextureFactory.of(AUTOMATION_FILTER), + TextureFactory.builder().addIcon(AUTOMATION_FILTER_GLOW).glow().build()); } + @Override public boolean isValidSlot(int aIndex) { return aIndex < 9; } + @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_Filter(aPlayerInventory, aBaseMetaTileEntity); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_Filter(aPlayerInventory, aBaseMetaTileEntity); } + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setBoolean("bInvertFilter", this.bInvertFilter); aNBT.setBoolean("bIgnoreNBT", this.bIgnoreNBT); } + @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.bInvertFilter = aNBT.getBoolean("bInvertFilter"); this.bIgnoreNBT = aNBT.getBoolean("bIgnoreNBT"); } + @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) { return false; diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java index 75c58a55da..c941b73e58 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_ItemDistributor.java @@ -5,7 +5,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_ItemDistributor; import gregtech.common.gui.GT_GUIContainer_ItemDistributor; @@ -15,6 +15,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR_GLOW; + public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer { private byte[] itemsPerSide = new byte[6]; private byte currentSide = 0, currentSideItemCount = 0; @@ -40,11 +43,13 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer super(aName, aTier, aInvSlotCount, aDescription, aTextures); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_ItemDistributor(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } + @Override protected void fillStacksIntoFirstSlots() { for (int i = 0; i < this.mInventory.length - 1; i++) { for (int j = i + 1; j < this.mInventory.length - 1; j++) { @@ -57,14 +62,19 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer } } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity); } + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_ITEMDISTRIBUTOR); + return TextureFactory.of( + TextureFactory.of(AUTOMATION_ITEMDISTRIBUTOR), + TextureFactory.builder().addIcon(AUTOMATION_ITEMDISTRIBUTOR_GLOW).glow().build()); } + @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_ItemDistributor(aPlayerInventory, aBaseMetaTileEntity); } @@ -86,7 +96,7 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] returnTextures = new ITexture[2][17][]; - ITexture baseIcon = getOverlayIcon(), pipeIcon = new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT); + ITexture baseIcon = getOverlayIcon(), pipeIcon = TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_OUT); for (int i = 0; i < 17; i++) { returnTextures[0][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], baseIcon}; returnTextures[1][i] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i], pipeIcon, baseIcon}; @@ -104,6 +114,7 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer return getBaseMetaTileEntity().getFrontFacing() != aSide && itemsPerSide[aSide] > 0; } + @Override public boolean isValidSlot(int aIndex) { return aIndex < this.mInventory.length - 1; } @@ -119,9 +130,10 @@ public class GT_MetaTileEntity_ItemDistributor extends GT_MetaTileEntity_Buffer currentSideItemCount = aNBT.getByte("mCurrentSideItemCount"); } + @Override protected void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { fillStacksIntoFirstSlots(); - int movedItems = 0; + int movedItems; TileEntity adjacentTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(currentSide); int inspectedSides = 0; while (itemsPerSide[currentSide] == 0) { diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java index 746e182066..3bc79f3348 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_Regulator.java @@ -1,11 +1,10 @@ package gregtech.common.tileentities.automation; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Regulator; import gregtech.common.gui.GT_GUIContainer_Regulator; @@ -14,7 +13,10 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import java.util.Arrays; +import java.util.Collections; + +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_REGULATOR; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_REGULATOR_GLOW; public class GT_MetaTileEntity_Regulator extends GT_MetaTileEntity_Buffer { @@ -23,10 +25,10 @@ public class GT_MetaTileEntity_Regulator public GT_MetaTileEntity_Regulator(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 20, new String[]{ - "Filters up to 9 different Items", - "Allows Item-specific output stack size", - "Allows Item-specific output slot", - "Consumes 1EU per moved Item"}); + "Filters up to 9 different Items", + "Allows Item-specific output stack size", + "Allows Item-specific output slot", + "Consumes 1EU per moved Item"}); } public GT_MetaTileEntity_Regulator(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { @@ -37,26 +39,34 @@ public class GT_MetaTileEntity_Regulator super(aName, aTier, aInvSlotCount, aDescription, aTextures); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Regulator(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_REGULATOR); + return TextureFactory.of( + TextureFactory.of(AUTOMATION_REGULATOR), + TextureFactory.builder().addIcon(AUTOMATION_REGULATOR_GLOW).glow().build()); } + @Override public boolean isValidSlot(int aIndex) { return aIndex < 9; } + @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_Regulator(aPlayerInventory, aBaseMetaTileEntity); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_Regulator(aPlayerInventory, aBaseMetaTileEntity); } + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("mTargetSlot1", this.mTargetSlots[0]); @@ -70,6 +80,7 @@ public class GT_MetaTileEntity_Regulator aNBT.setInteger("mTargetSlot9", this.mTargetSlots[8]); } + @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.mTargetSlots[0] = aNBT.getInteger("mTargetSlot1"); @@ -85,14 +96,14 @@ public class GT_MetaTileEntity_Regulator @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - //Regulation per Screwdriver is overridden by GUI regulation. + //Regulation per Screwdriver is overridden by GUI regulation. } + @Override public void moveItems(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - int i = 0; - for (int tCosts = 0; i < 9; i++) { + for (int i = 0, tCosts; i < 9; i++) { if (this.mInventory[(i + 9)] != null) { - tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Arrays.asList(new ItemStack[]{this.mInventory[(i + 9)]}), false, (byte) this.mInventory[(i + 9)].stackSize, (byte) this.mInventory[(i + 9)].stackSize, (byte) 64, (byte) 1) * 3; + tCosts = GT_Utility.moveOneItemStackIntoSlot(getBaseMetaTileEntity(), getBaseMetaTileEntity().getTileEntityAtSide(getBaseMetaTileEntity().getBackFacing()), getBaseMetaTileEntity().getBackFacing(), this.mTargetSlots[i], Collections.singletonList(this.mInventory[(i + 9)]), false, (byte) this.mInventory[(i + 9)].stackSize, (byte) this.mInventory[(i + 9)].stackSize, (byte) 64, (byte) 1) * 3; if (tCosts > 0) { this.mSuccess = 50; break; @@ -101,6 +112,7 @@ public class GT_MetaTileEntity_Regulator } } + @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { return (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) && (GT_Utility.areStacksEqual(aStack, this.mInventory[(aIndex + 9)])); } diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java index 84df068972..72e6516bc4 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_SuperBuffer.java @@ -1,21 +1,23 @@ package gregtech.common.tileentities.automation; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.common.gui.GT_Container_SuperBuffer; import gregtech.common.gui.GT_GUIContainer_SuperBuffer; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_SUPERBUFFER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_SUPERBUFFER_GLOW; + public class GT_MetaTileEntity_SuperBuffer extends GT_MetaTileEntity_ChestBuffer { public GT_MetaTileEntity_SuperBuffer(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 257, new String[]{ - "Buffers up to 256 Item Stacks", - "Use Screwdriver to regulate output stack size", - "Does not consume energy to move Item", - getTickRateDesc(aTier)}); + "Buffers up to 256 Item Stacks", + "Use Screwdriver to regulate output stack size", + "Does not consume energy to move Item", + getTickRateDesc(aTier)}); } public GT_MetaTileEntity_SuperBuffer(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { @@ -30,8 +32,11 @@ public class GT_MetaTileEntity_SuperBuffer extends GT_MetaTileEntity_ChestBuffer return new GT_MetaTileEntity_SuperBuffer(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_SUPERBUFFER); + return TextureFactory.of( + TextureFactory.of(AUTOMATION_SUPERBUFFER), + TextureFactory.builder().addIcon(AUTOMATION_SUPERBUFFER_GLOW).glow().build()); } public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { diff --git a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java index ec60dc00e9..4e5864c3e6 100644 --- a/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java +++ b/src/main/java/gregtech/common/tileentities/automation/GT_MetaTileEntity_TypeFilter.java @@ -1,13 +1,12 @@ package gregtech.common.tileentities.automation; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Buffer; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_TypeFilter; @@ -16,6 +15,10 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER; +import static gregtech.api.enums.Textures.BlockIcons.AUTOMATION_TYPEFILTER_GLOW; + public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer { public boolean bNBTAllowed = false; public boolean bInvertFilter = false; @@ -24,9 +27,9 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer { public GT_MetaTileEntity_TypeFilter(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 11, new String[]{ - "Filters 1 Item Type", - "Use Screwdriver to regulate output stack size", - "Consumes 1 EU per moved Item"}); + "Filters 1 Item Type", + "Use Screwdriver to regulate output stack size", + "Consumes 1 EU per moved Item"}); } public GT_MetaTileEntity_TypeFilter(String aName, int aTier, int aInvSlotCount, String aDescription, ITexture[][][] aTextures) { @@ -37,22 +40,29 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer { super(aName, aTier, aInvSlotCount, aDescription, aTextures); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_TypeFilter(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } + @Override public ITexture getOverlayIcon() { - return new GT_RenderedTexture(Textures.BlockIcons.AUTOMATION_TYPEFILTER); + return TextureFactory.of( + TextureFactory.of(AUTOMATION_TYPEFILTER), + TextureFactory.builder().addIcon(AUTOMATION_TYPEFILTER_GLOW).glow().build()); } + @Override public boolean isValidSlot(int aIndex) { return aIndex < 9; } + @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_Container_TypeFilter(aPlayerInventory, aBaseMetaTileEntity); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_TypeFilter(aPlayerInventory, aBaseMetaTileEntity); } @@ -86,21 +96,21 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer { } } + @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); - if ((getBaseMetaTileEntity().isServerSide()) && ((aTick % 8L == 0L) || mRotationIndex == -1)) { - if (this.mPrefix.mPrefixedItems.isEmpty()) { - this.mInventory[9] = null; - } else { - this.mInventory[9] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())); - if (this.mInventory[9].getItemDamage() == 32767) { - this.mInventory[9].setItemDamage(0); - } - this.mInventory[9].setStackDisplayName(this.mPrefix.toString()); - } + if ((!getBaseMetaTileEntity().isServerSide()) || ((aTick % 8L != 0L) && mRotationIndex != -1)) return; + if (this.mPrefix.mPrefixedItems.isEmpty()) { + this.mInventory[9] = null; + return; } + this.mInventory[9] = GT_Utility.copyAmount(1L, this.mPrefix.mPrefixedItems.get(this.mRotationIndex = (this.mRotationIndex + 1) % this.mPrefix.mPrefixedItems.size())); + if (this.mInventory[9] == null) return; + if (this.mInventory[9].getItemDamage() == W) this.mInventory[9].setItemDamage(0); + this.mInventory[9].setStackDisplayName(this.mPrefix.toString()); } + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setString("mPrefix", this.mPrefix.toString()); @@ -108,6 +118,7 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer { aNBT.setBoolean("bNBTAllowed", this.bNBTAllowed); } + @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); this.mPrefix = OrePrefixes.getPrefix(aNBT.getString("mPrefix"), this.mPrefix); @@ -115,6 +126,7 @@ public class GT_MetaTileEntity_TypeFilter extends GT_MetaTileEntity_Buffer { this.bNBTAllowed = aNBT.getBoolean("bNBTAllowed"); } + @Override public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { boolean tAllowPrefix = this.mPrefix.contains(aStack); if (this.mPrefix == OrePrefixes.ore) { diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java index d218266fa1..5d5c6f3505 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Bronze.java @@ -1,14 +1,12 @@ package gregtech.common.tileentities.boilers; -import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.XSTR; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.GT_Pollution; @@ -18,6 +16,14 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.tileentity.TileEntityFurnace; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; + public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { public GT_MetaTileEntity_Boiler_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, new String[]{ @@ -40,12 +46,21 @@ public class GT_MetaTileEntity_Boiler_Bronze extends GT_MetaTileEntity_Boiler { public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[5][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[1][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[2][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[3][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT)}; - rTextures[4][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE)}; + final ITexture[] + texBottom = {TextureFactory.of(MACHINE_BRONZEBRICKS_BOTTOM)}, + texTop = {TextureFactory.of(MACHINE_BRONZEBRICKS_TOP), TextureFactory.of(OVERLAY_PIPE)}, + texSide = {TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), TextureFactory.of(OVERLAY_PIPE)}, + texFront = {TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), TextureFactory.of(BOILER_FRONT)}, + texFrontActive = { + TextureFactory.of(MACHINE_BRONZEBRICKS_SIDE), + TextureFactory.of(BOILER_FRONT_ACTIVE), + TextureFactory.builder().addIcon(BOILER_FRONT_ACTIVE_GLOW).glow().build()}; + for (int i = 0; i < 17; i++) { + rTextures[0][i] = texBottom; + rTextures[1][i] = texTop; + rTextures[2][i] = texSide; + rTextures[3][i] = texFront; + rTextures[4][i] = texFrontActive; } return rTextures; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java index 14330f24e7..2c3034911c 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Lava.java @@ -1,13 +1,11 @@ package gregtech.common.tileentities.boilers; -import gregtech.api.enums.Dyes; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.common.gui.GT_Container_Boiler; @@ -15,6 +13,14 @@ import gregtech.common.gui.GT_GUIContainer_Boiler; import net.minecraft.entity.player.InventoryPlayer; import net.minecraftforge.fluids.FluidStack; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_TOP; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; + public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public GT_MetaTileEntity_Boiler_Lava(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, new String[]{ @@ -33,12 +39,23 @@ public class GT_MetaTileEntity_Boiler_Lava extends GT_MetaTileEntity_Boiler { public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[5][17][]; - for (byte i = -1; i < 16; i++) { - rTextures[0][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[1][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[2][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[3][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT)}; - rTextures[4][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE)}; + final ITexture[] + texBottom = {TextureFactory.of(MACHINE_STEELBRICKS_BOTTOM)}, + texTop = {TextureFactory.of(MACHINE_STEELBRICKS_TOP), TextureFactory.of(OVERLAY_PIPE)}, + texSide = {TextureFactory.of(MACHINE_STEELBRICKS_SIDE), TextureFactory.of(OVERLAY_PIPE)}, + texFront = { + TextureFactory.of(MACHINE_STEELBRICKS_SIDE), + TextureFactory.of(BOILER_LAVA_FRONT)}, + texFrontActive = { + TextureFactory.of(MACHINE_STEELBRICKS_SIDE), + TextureFactory.of(BOILER_LAVA_FRONT_ACTIVE), + TextureFactory.builder().addIcon(BOILER_LAVA_FRONT_ACTIVE_GLOW).glow().build()}; + for (byte i = 0; i < 17; i++) { + rTextures[0][i] = texBottom; + rTextures[1][i] = texTop; + rTextures[2][i] = texSide; + rTextures[3][i] = texFront; + rTextures[4][i] = texFrontActive; } return rTextures; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java index 3fd061eff5..d08df611f7 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar.java @@ -5,7 +5,7 @@ import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Boiler; @@ -99,15 +99,15 @@ public class GT_MetaTileEntity_Boiler_Solar extends GT_MetaTileEntity_Boiler { int i = color + 1; short[] colorModulation = Dyes.getModulation(color, Dyes._NULL.mRGBa); rTextures[0][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, colorModulation)}; + TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, colorModulation)}; rTextures[1][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_TOP, colorModulation), - new GT_RenderedTexture(BlockIcons.BOILER_SOLAR)}; + TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_TOP, colorModulation), + TextureFactory.of(BlockIcons.BOILER_SOLAR)}; rTextures[2][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation)}; + TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation)}; rTextures[3][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation), - new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE)}; + TextureFactory.of(BlockIcons.MACHINE_BRONZEBRICKS_SIDE, colorModulation), + TextureFactory.of(BlockIcons.OVERLAY_PIPE)}; } return rTextures; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java index feaaa7fa32..d7a003ac5d 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Solar_Steel.java @@ -5,7 +5,7 @@ import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.common.gui.GT_GUIContainer_Boiler; import net.minecraft.entity.player.InventoryPlayer; @@ -41,15 +41,15 @@ public class GT_MetaTileEntity_Boiler_Solar_Steel extends GT_MetaTileEntity_Boil int i = color + 1; short[] colorModulation = Dyes.getModulation(color, Dyes._NULL.mRGBa); rTextures[0][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_BOTTOM, colorModulation)}; + TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_BOTTOM, colorModulation)}; rTextures[1][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_TOP, colorModulation), - new GT_RenderedTexture(BlockIcons.BOILER_SOLAR)}; + TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_TOP, colorModulation), + TextureFactory.of(BlockIcons.BOILER_SOLAR)}; rTextures[2][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation)}; + TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation)}; rTextures[3][i] = new ITexture[]{ - new GT_RenderedTexture(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation), - new GT_RenderedTexture(BlockIcons.OVERLAY_PIPE)}; + TextureFactory.of(BlockIcons.MACHINE_STEELBRICKS_SIDE, colorModulation), + TextureFactory.of(BlockIcons.OVERLAY_PIPE)}; } return rTextures; } diff --git a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java index 0f5dee8eb2..c0e70e42d8 100644 --- a/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java +++ b/src/main/java/gregtech/common/tileentities/boilers/GT_MetaTileEntity_Boiler_Steel.java @@ -1,15 +1,21 @@ package gregtech.common.tileentities.boilers; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.common.gui.GT_Container_Boiler; import gregtech.common.gui.GT_GUIContainer_Boiler; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.BOILER_FRONT_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_STEELBRICKS_TOP; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE; + public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bronze { @@ -30,17 +36,21 @@ public class GT_MetaTileEntity_Boiler_Steel extends GT_MetaTileEntity_Boiler_Bro public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[5][17][]; - for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE)}; - rTextures[2][(i + 1)] = tmp2; - ITexture[] tmp4 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT)}; - rTextures[3][(i + 1)] = tmp4; - ITexture[] tmp5 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.BOILER_FRONT_ACTIVE)}; - rTextures[4][(i + 1)] = tmp5; + final ITexture[] + texBottom = {TextureFactory.of(MACHINE_STEELBRICKS_BOTTOM)}, + texTop = {TextureFactory.of(MACHINE_STEELBRICKS_TOP), TextureFactory.of(OVERLAY_PIPE)}, + texSide = {TextureFactory.of(MACHINE_STEELBRICKS_SIDE), TextureFactory.of(OVERLAY_PIPE)}, + texFront = {TextureFactory.of(MACHINE_STEELBRICKS_SIDE), TextureFactory.of(BOILER_FRONT)}, + texFrontActive = { + TextureFactory.of(MACHINE_STEELBRICKS_SIDE), + TextureFactory.of(BOILER_FRONT_ACTIVE), + TextureFactory.builder().addIcon(BOILER_FRONT_ACTIVE_GLOW).glow().build()}; + for (int i = 0; i < 17; i++) { + rTextures[0][i] = texBottom; + rTextures[1][i] = texTop; + rTextures[2][i] = texSide; + rTextures[3][i] = texFront; + rTextures[4][i] = texFrontActive; } return rTextures; } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java index debf441bcf..5733332eda 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_DieselGenerator.java @@ -4,18 +4,19 @@ import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; 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; +import static gregtech.api.enums.Textures.BlockIcons.*; + public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGenerator { public static final int BASE_POLLUTION = 2; @@ -67,65 +68,65 @@ public class GT_MetaTileEntity_DieselGenerator extends GT_MetaTileEntity_BasicGe if (GT_Utility.isStackInvalid(aStack) || getRecipes() == null) return 0; long rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { - rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); + rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3L); } - if(rValue> Integer.MAX_VALUE){ + if (rValue > Integer.MAX_VALUE) { throw new ArithmeticException("Integer LOOPBACK!"); } - return (int)rValue; + return (int) rValue; } @Override 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()); + 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()); aBaseMetaTileEntity.setToFire(); } super.onPostTick(aBaseMetaTileEntity, aTick); } public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_FRONT), OVERLAYS_ENERGY_OUT[this.mTier]}; } public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK)}; + return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_BACK)}; } public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM)}; + return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_BOTTOM)}; } public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP)}; + return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_TOP)}; } public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE)}; + return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_SIDE)}; } public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_FRONT_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[]{super.getFrontActive(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_FRONT_ACTIVE), OVERLAYS_ENERGY_OUT[this.mTier]}; } public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE)}; + return new ITexture[]{super.getBackActive(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_BACK_ACTIVE)}; } public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE)}; + return new ITexture[]{super.getBottomActive(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_BOTTOM_ACTIVE)}; } public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE)}; + return new ITexture[]{super.getTopActive(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_TOP_ACTIVE)}; } public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE)}; + return new ITexture[]{super.getSidesActive(aColor)[0], TextureFactory.of(DIESEL_GENERATOR_SIDE_ACTIVE)}; } @Override public int getPollution() { - return (int) (GT_MetaTileEntity_DieselGenerator.BASE_POLLUTION * Math.pow(2, mTier - 1)); + return (int) (BASE_POLLUTION * Math.pow(2, mTier - 1)); } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java index 8bbffcfc6a..730e6e4fdc 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_GasTurbine.java @@ -7,7 +7,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerator { @@ -58,47 +58,47 @@ public class GT_MetaTileEntity_GasTurbine extends GT_MetaTileEntity_BasicGenerat } public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_FRONT), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_FRONT), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_BACK)}; + return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_BACK)}; } public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_BOTTOM)}; + return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_BOTTOM)}; } public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_TOP)}; + return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_TOP)}; } public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_SIDE)}; + return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_SIDE)}; } public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_FRONT_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[]{super.getFrontActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_FRONT_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_BACK_ACTIVE)}; + return new ITexture[]{super.getBackActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_BACK_ACTIVE)}; } public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_BOTTOM_ACTIVE)}; + return new ITexture[]{super.getBottomActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_BOTTOM_ACTIVE)}; } public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_TOP_ACTIVE)}; + return new ITexture[]{super.getTopActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_TOP_ACTIVE)}; } public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.GAS_TURBINE_SIDE_ACTIVE)}; + return new ITexture[]{super.getSidesActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.GAS_TURBINE_SIDE_ACTIVE)}; } @Override public int getPollution() { - return (int) (GT_MetaTileEntity_GasTurbine.BASE_POLLUTION * Math.pow(2, mTier - 1)); + return (int) (BASE_POLLUTION * Math.pow(2, mTier - 1)); } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java index 0057e87670..11dd1e406e 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_LightningRod.java @@ -1,17 +1,18 @@ package gregtech.common.tileentities.generators; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; @@ -30,7 +31,20 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1],aSide==1?(aActive ? new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW) : new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS)):Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; + if (aSide != ForgeDirection.UP.ordinal()) { + return new ITexture[]{ + BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier]}; + } + if (!aActive) return new ITexture[]{ + BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS) + }; + return new ITexture[]{ + BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder().addIcon(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build() + }; } @Override @@ -46,13 +60,13 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { World aWorld = aBaseMetaTileEntity.getWorld(); if (!aWorld.isRemote) { - if(aBaseMetaTileEntity.getStoredEU()>0){ + if (aBaseMetaTileEntity.getStoredEU() > 0) { aBaseMetaTileEntity.setActive(true); - aBaseMetaTileEntity.decreaseStoredEnergyUnits(aBaseMetaTileEntity.getStoredEU()/100+1, false); - }else { + aBaseMetaTileEntity.decreaseStoredEnergyUnits(aBaseMetaTileEntity.getStoredEU() / 100 + 1, false); + } else { aBaseMetaTileEntity.setActive(false); } - + if (aTick % 256 == 0 && (aWorld.isThundering() || (aWorld.isRaining() && XSTR_INSTANCE.nextInt(10) == 0))) { int aRodValue = 0; boolean isRodValid = true; @@ -60,13 +74,13 @@ public class GT_MetaTileEntity_LightningRod extends GT_MetaTileEntity_TieredMach int aY = aBaseMetaTileEntity.getYCoord(); int aZ = aBaseMetaTileEntity.getZCoord(); - for (int i = aBaseMetaTileEntity.getYCoord() + 1; i < aWorld.getHeight()-1; i++) { + for (int i = aBaseMetaTileEntity.getYCoord() + 1; i < aWorld.getHeight() - 1; i++) { if (isRodValid && aBaseMetaTileEntity.getBlock(aX, i, aZ).getUnlocalizedName().equals("blockFenceIron")) { aRodValue++; } else { isRodValid = false; if (aBaseMetaTileEntity.getBlock(aX, i, aZ) != Blocks.air) { - aRodValue=0; + aRodValue = 0; break; } } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java index fc61996dcf..aceab00a02 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicEnergyConverter.java @@ -2,14 +2,23 @@ package gregtech.common.tileentities.generators; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_MAGIC_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; + public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_BasicGenerator { public int mEfficiency; @@ -28,18 +37,22 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba onConfigLoad(); } + @Override public boolean isOutputFacing(byte aSide) { return aSide == getBaseMetaTileEntity().getFrontFacing(); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_MagicEnergyConverter(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { return GT_Recipe.GT_Recipe_Map.sMagicFuels; } + @Override public int getCapacity() { return 16000; } @@ -49,48 +62,91 @@ public class GT_MetaTileEntity_MagicEnergyConverter extends GT_MetaTileEntity_Ba } + @Override public int getEfficiency() { return this.mEfficiency; } + @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[]{ + super.getFront(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build(), + OVERLAYS_ENERGY_OUT[mTier]}; } + @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT)}; + return new ITexture[]{ + super.getBack(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_FRONT), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW).glow().build()}; } + @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; + return new ITexture[]{ + super.getBottom(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; } + @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; + return new ITexture[]{ + super.getTop(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; } + @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; + return new ITexture[]{ + super.getSides(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; } + @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + return new ITexture[]{ + super.getFrontActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build(), + OVERLAYS_ENERGY_OUT[mTier]}; } + @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE)}; + return new ITexture[]{ + super.getBackActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_FRONT_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; + return new ITexture[]{ + super.getBottomActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; + return new ITexture[]{ + super.getTopActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; + return new ITexture[]{ + super.getSidesActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java index 6521cb7a5d..5516b355fd 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_MagicalEnergyAbsorber.java @@ -4,13 +4,16 @@ import com.google.common.base.Enums; import cpw.mods.fml.common.Loader; import gregtech.api.GregTech_API; import gregtech.api.enums.TC_Aspects; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; -import gregtech.api.util.*; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Log; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; import net.minecraft.block.BlockDragonEgg; import net.minecraft.enchantment.Enchantment; @@ -27,16 +30,31 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.util.ForgeDirection; -import thaumcraft.api.aspects.*; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.aspects.AspectSourceHelper; +import thaumcraft.api.aspects.IAspectContainer; import thaumcraft.api.visnet.VisNetHandler; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import static gregtech.api.enums.ConfigCategories.machineconfig; import static gregtech.api.enums.GT_Values.MOD_ID_TC; import static gregtech.api.enums.GT_Values.V; -import static net.minecraft.util.EnumChatFormatting.*; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static net.minecraft.util.EnumChatFormatting.GRAY; +import static net.minecraft.util.EnumChatFormatting.GREEN; +import static net.minecraft.util.EnumChatFormatting.LIGHT_PURPLE; +import static net.minecraft.util.EnumChatFormatting.RESET; +import static net.minecraft.util.EnumChatFormatting.UNDERLINE; +import static net.minecraft.util.EnumChatFormatting.YELLOW; interface MagicalEnergyBBListener { void onMagicalEnergyBBUpdate(); @@ -46,17 +64,17 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B private static final boolean THAUMCRAFT_LOADED = Loader.isModLoaded(MOD_ID_TC); private static final ConcurrentHashMap<UUID, GT_MetaTileEntity_MagicalEnergyAbsorber> sSubscribedCrystals = new ConcurrentHashMap<>(4); - private static List<Aspect> sPrimalAspects = (THAUMCRAFT_LOADED) ? Aspect.getPrimalAspects() : new ArrayList<Aspect>(); + private static final List<Aspect> sPrimalAspects = (THAUMCRAFT_LOADED) ? Aspect.getPrimalAspects() : new ArrayList<Aspect>(); private static boolean sAllowMultipleEggs = false; private static GT_MetaTileEntity_MagicalEnergyAbsorber sActiveSiphon = null; private static int sEnergyPerEndercrystal = 512; private static int sEnergyFromVis = 20; private static int sEnergyPerEssentia = 320; - private static Map<Aspect, Integer> sAspectsEnergy = new HashMap<>(); + private static final Map<Aspect, Integer> sAspectsEnergy = new HashMap<>(); private static int sDragonEggEnergyPerTick = 2048; private int mEfficiency; private int mMaxVisPerDrain; - private MagicalEnergyBB mMagicalEnergyBB = new MagicalEnergyBB(this, mTier, mTier + 2); + private final MagicalEnergyBB mMagicalEnergyBB = new MagicalEnergyBB(this, mTier, mTier + 2); private long mNextGenerateTickRate = 1; private int mNoGenerationTicks = 0; @@ -185,54 +203,84 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; + return new ITexture[]{ + super.getFront(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build(), + OVERLAYS_ENERGY_OUT[mTier]}; } @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT)}; + return new ITexture[]{ + super.getBack(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_FRONT), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_GLOW).glow().build()}; } @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; + return new ITexture[]{ + super.getBottom(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; } @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_DRAGONEGG)}; + return new ITexture[]{ + super.getTop(aColor)[0], + TextureFactory.of(MACHINE_CASING_DRAGONEGG)}; } @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC)}; + return new ITexture[]{ + super.getSides(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_GLOW).glow().build()}; } @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE), - Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]}; + return new ITexture[]{ + super.getFrontActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build(), + OVERLAYS_ENERGY_OUT[mTier]}; } @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_FRONT_ACTIVE)}; + return new ITexture[]{ + super.getBackActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_FRONT_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_FRONT_ACTIVE_GLOW).glow().build()}; } @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; + return new ITexture[]{ + super.getBottomActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; } @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_DRAGONEGG)}; + return new ITexture[]{ + super.getTopActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_DRAGONEGG), + TextureFactory.builder().addIcon(MACHINE_CASING_DRAGONEGG_GLOW).glow().build() + }; } @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_MAGIC_ACTIVE)}; + return new ITexture[]{ + super.getSidesActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_MAGIC_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_CASING_MAGIC_ACTIVE_GLOW).glow().build()}; } @Override @@ -470,12 +518,12 @@ public class GT_MetaTileEntity_MagicalEnergyAbsorber extends GT_MetaTileEntity_B * Handles Bounding Box ranged operations for Magic sources */ static class MagicalEnergyBB { - private GT_MetaTileEntity_MagicalEnergyAbsorber mAbsorber; - private MagicalEnergyBBListener mListener; - private int mDefaultTier; + private final GT_MetaTileEntity_MagicalEnergyAbsorber mAbsorber; + private final MagicalEnergyBBListener mListener; + private final int mDefaultTier; private int mTier; - private int mMaxTier; - private List<UUID> mLivingCrystalIDs = new ArrayList<>(); + private final int mMaxTier; + private final List<UUID> mLivingCrystalIDs = new ArrayList<>(); private List<Aspect> mAvailableAspects; /** diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java index c075fda8a4..7a716e62b4 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_NaquadahReactor.java @@ -2,20 +2,21 @@ package gregtech.common.tileentities.generators; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; +import static gregtech.api.enums.Textures.BlockIcons.*; + public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGenerator { private int mEfficiency; public GT_MetaTileEntity_NaquadahReactor(int aID, String aName, String[] aDescription, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, aDescription, new ITexture[0]); + super(aID, aName, aNameRegional, aTier, aDescription); if (aTier > 8 || aTier < 4) { new Exception("Tier without Recipe Map!").printStackTrace(); } @@ -30,17 +31,20 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe onConfigLoad(); } + @Override public boolean isOutputFacing(byte aSide) { return (aSide > 1) && (aSide != getBaseMetaTileEntity().getFrontFacing()) && (aSide != getBaseMetaTileEntity().getBackFacing()); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_NaquadahReactor(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_NaquadahReactor(mName, mTier, mDescriptionArray, mTextures); } + @Override public GT_Recipe.GT_Recipe_Map getRecipes() { GT_Recipe.GT_Recipe_Map ret; - switch (this.mTier){ + switch (mTier){ case 4: { ret = GT_Recipe.GT_Recipe_Map.sSmallNaquadahReactorFuels; break; @@ -70,10 +74,12 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe return ret; } + @Override public int getCapacity() { return getRecipes() != null ? getRecipes().mMinimalInputFluids>0 ? 8000*(mTier+1) : 0 : 0 ; } + @Override public int getEfficiency() { return mEfficiency == 0 ? onConfigLoad() : mEfficiency; } @@ -83,47 +89,72 @@ public class GT_MetaTileEntity_NaquadahReactor extends GT_MetaTileEntity_BasicGe } public int onConfigLoad() { - return this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SolidNaquadah.efficiency.tier." + this.mTier, getBaseEff()); + return mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "SolidNaquadah.efficiency.tier." + mTier, getBaseEff()); } + @Override public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT)}; + return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of(NAQUADAH_REACTOR_SOLID_FRONT)}; } + @Override public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BACK)}; + return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of(NAQUADAH_REACTOR_SOLID_BACK)}; } + @Override public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BOTTOM)}; + return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of(NAQUADAH_REACTOR_SOLID_BOTTOM)}; } + @Override public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP)}; + return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of(NAQUADAH_REACTOR_SOLID_TOP)}; } + @Override public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_SIDE)}; + return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of(NAQUADAH_REACTOR_SOLID_SIDE)}; } + @Override public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE)}; + return new ITexture[]{ + super.getFrontActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE), + TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_FRONT_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BACK_ACTIVE)}; + return new ITexture[]{ + super.getBackActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_BACK_ACTIVE), + TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_BACK_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE)}; + return new ITexture[]{ + super.getBottomActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE), + TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_BOTTOM_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_TOP_ACTIVE)}; + return new ITexture[]{ + super.getTopActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_TOP_ACTIVE), + TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_TOP_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE)}; + return new ITexture[]{ + super.getSidesActive(aColor)[0], + TextureFactory.of(NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE), + TextureFactory.builder().addIcon(NAQUADAH_REACTOR_SOLID_SIDE_ACTIVE_GLOW).glow().build()}; } @Override diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java index 940559bac4..4ab048a0f7 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_PlasmaGenerator.java @@ -2,14 +2,18 @@ package gregtech.common.tileentities.generators; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_OUT; + public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGenerator { public int mEfficiency; @@ -29,72 +33,105 @@ public class GT_MetaTileEntity_PlasmaGenerator extends GT_MetaTileEntity_BasicGe onConfigLoad(); } - public boolean isOutputFacing(byte aSide) { - return aSide == getBaseMetaTileEntity().getFrontFacing(); + @Override + public ITexture[] getFront(byte aColor) { + return new ITexture[]{ + super.getFront(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS), + OVERLAYS_ENERGY_OUT[mTier]}; } - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_PlasmaGenerator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); + @Override + public ITexture[] getBack(byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } - public GT_Recipe.GT_Recipe_Map getRecipes() { - return GT_Recipe.GT_Recipe_Map.sPlasmaFuels; + @Override + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } - public int getCapacity() { - return 16000; + @Override + public ITexture[] getTop(byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } - public void onConfigLoad() { - this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "PlasmaGenerator.efficiency.tier." + this.mTier, Math.max(10,10 + Math.min(90,this.mTier * 10))); + @Override + public ITexture[] getSides(byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } - - public int getEfficiency() { - return this.mEfficiency; + @Override + public ITexture[] getFrontActive(byte aColor) { + return new ITexture[]{ + super.getFrontActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build(), + OVERLAYS_ENERGY_OUT[mTier]}; } - public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + @Override + public ITexture[] getBackActive(byte aColor) { + return new ITexture[]{ + super.getBackActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; } - public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS)}; + @Override + public ITexture[] getBottomActive(byte aColor) { + return new ITexture[]{ + super.getBottomActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; } - public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS)}; + @Override + public ITexture[] getTopActive(byte aColor) { + return new ITexture[]{ + super.getTopActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; } - public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS)}; + @Override + public ITexture[] getSidesActive(byte aColor) { + return new ITexture[]{ + super.getSidesActive(aColor)[0], + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build()}; } - public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS)}; + @Override + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); } - public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + @Override + public GT_Recipe.GT_Recipe_Map getRecipes() { + return GT_Recipe.GT_Recipe_Map.sPlasmaFuels; } - public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW)}; + @Override + public int getEfficiency() { + return this.mEfficiency; } - public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW)}; + @Override + public int getCapacity() { + return 16000; } - public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW)}; + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_PlasmaGenerator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } - public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW)}; + public void onConfigLoad() { + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "PlasmaGenerator.efficiency.tier." + this.mTier, Math.max(10, 10 + Math.min(90, this.mTier * 10))); } - @Override + @Override public int getPollution() { return 0; } diff --git a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java index 7a1421c3bb..87d18958e2 100644 --- a/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java +++ b/src/main/java/gregtech/common/tileentities/generators/GT_MetaTileEntity_SteamTurbine.java @@ -7,7 +7,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import net.minecraftforge.fluids.FluidStack; @@ -77,45 +77,45 @@ public class GT_MetaTileEntity_SteamTurbine extends GT_MetaTileEntity_BasicGener } public ITexture[] getFront(byte aColor) { - return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_FRONT), + return new ITexture[]{super.getFront(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_FRONT), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } public ITexture[] getBack(byte aColor) { - return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_BACK)}; + return new ITexture[]{super.getBack(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_BACK)}; } public ITexture[] getBottom(byte aColor) { - return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_BOTTOM)}; + return new ITexture[]{super.getBottom(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_BOTTOM)}; } public ITexture[] getTop(byte aColor) { - return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_TOP)}; + return new ITexture[]{super.getTop(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_TOP)}; } public ITexture[] getSides(byte aColor) { - return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_SIDE)}; + return new ITexture[]{super.getSides(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_SIDE)}; } public ITexture[] getFrontActive(byte aColor) { - return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_FRONT_ACTIVE), + return new ITexture[]{super.getFrontActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_FRONT_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; } public ITexture[] getBackActive(byte aColor) { - return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_BACK_ACTIVE)}; + return new ITexture[]{super.getBackActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_BACK_ACTIVE)}; } public ITexture[] getBottomActive(byte aColor) { - return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_BOTTOM_ACTIVE)}; + return new ITexture[]{super.getBottomActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_BOTTOM_ACTIVE)}; } public ITexture[] getTopActive(byte aColor) { - return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_TOP_ACTIVE)}; + return new ITexture[]{super.getTopActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_TOP_ACTIVE)}; } public ITexture[] getSidesActive(byte aColor) { - return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE)}; + return new ITexture[]{super.getSidesActive(aColor)[0], TextureFactory.of(Textures.BlockIcons.STEAM_TURBINE_SIDE_ACTIVE)}; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java index f85b3152bd..2f94437eee 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Bronze.java @@ -6,7 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; public class GT_MetaTileEntity_BasicHull_Bronze extends GT_MetaTileEntity_BasicHull_NonElectric { public GT_MetaTileEntity_BasicHull_Bronze(int aID, String aName, String aNameRegional, int aTier, String aDescription) { @@ -28,9 +28,9 @@ public class GT_MetaTileEntity_BasicHull_Bronze extends GT_MetaTileEntity_BasicH public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - rTextures[0][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[1][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; - rTextures[2][(i + 1)] = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[0][(i + 1)] = new ITexture[]{TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[1][(i + 1)] = new ITexture[]{TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + rTextures[2][(i + 1)] = new ITexture[]{TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZE_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; } return rTextures; } diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java index 7be6ec9a37..df71a13c2b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_BronzeBricks.java @@ -6,7 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; public class GT_MetaTileEntity_BasicHull_BronzeBricks extends GT_MetaTileEntity_BasicHull_NonElectric { public GT_MetaTileEntity_BasicHull_BronzeBricks(int aID, String aName, String aNameRegional, int aTier, String aDescription) { @@ -28,11 +28,11 @@ public class GT_MetaTileEntity_BasicHull_BronzeBricks extends GT_MetaTileEntity_ public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp0 = {TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZEBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp1 = {TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZEBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp2 = {TextureFactory.of(Textures.BlockIcons.MACHINE_BRONZEBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[2][(i + 1)] = tmp2; } return rTextures; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java index ee9accc566..31ae133735 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_Steel.java @@ -6,7 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; public class GT_MetaTileEntity_BasicHull_Steel extends GT_MetaTileEntity_BasicHull_NonElectric { public GT_MetaTileEntity_BasicHull_Steel(int aID, String aName, String aNameRegional, int aTier, String aDescription) { super(aID, aName, aNameRegional, aTier, aDescription); @@ -27,11 +27,11 @@ public class GT_MetaTileEntity_BasicHull_Steel extends GT_MetaTileEntity_BasicHu public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp0 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp1 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp2 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEEL_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[2][(i + 1)] = tmp2; } return rTextures; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java index 0cec1fa4e7..4fe2bca08a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_BasicHull_SteelBricks.java @@ -6,7 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull_NonElectric; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; public class GT_MetaTileEntity_BasicHull_SteelBricks extends GT_MetaTileEntity_BasicHull_NonElectric { public GT_MetaTileEntity_BasicHull_SteelBricks(int aID, String aName, String aNameRegional, int aTier, String aDescription) { @@ -28,11 +28,11 @@ public class GT_MetaTileEntity_BasicHull_SteelBricks extends GT_MetaTileEntity_B public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp0 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_BOTTOM, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp1 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_TOP, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; + ITexture[] tmp2 = {TextureFactory.of(Textures.BlockIcons.MACHINE_STEELBRICKS_SIDE, Dyes.getModulation(i, Dyes._NULL.mRGBa))}; rTextures[2][(i + 1)] = tmp2; } return rTextures; diff --git a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java index ba1c74e66e..12d839d221 100644 --- a/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java +++ b/src/main/java/gregtech/common/tileentities/machines/GT_MetaTileEntity_Hatch_OutputBus_ME.java @@ -1,9 +1,5 @@ package gregtech.common.tileentities.machines; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; - import appeng.api.AEApi; import appeng.api.networking.GridFlags; import appeng.api.networking.energy.IEnergySource; @@ -20,12 +16,16 @@ import appeng.util.Platform; import cpw.mods.fml.common.Optional; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_ME_HATCH; public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatch_OutputBus { private BaseActionSource requestSource = null; @@ -47,12 +47,12 @@ public class GT_MetaTileEntity_Hatch_OutputBus_ME extends GT_MetaTileEntity_Hatc @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ME_HATCH)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_ME_HATCH)}; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ME_HATCH)}; + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_ME_HATCH)}; } @Override diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java index 2fb5066786..cf2939dbaf 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_AdvSeismicProspector.java @@ -3,13 +3,12 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; @@ -25,8 +24,20 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidStack; -import java.util.*; - +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE; import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; @@ -44,18 +55,21 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba 1, // output slot count "Default.png", // GUI name "", // NEI name - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER)); + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), + TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER)); radius = aRadius; step = aStep; } + @Override public String[] getDescription() { return new String[]{ "Place, activate with explosives", @@ -79,6 +93,7 @@ public class GT_MetaTileEntity_AdvSeismicProspector extends GT_MetaTileEntity_Ba step = aStep; } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_AdvSeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName, this.radius, this.step); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java index aabce730d0..c7a7792c3a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java @@ -1,24 +1,42 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.enums.ItemList; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_BOXINATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_BOXINATOR_ACTIVE; + public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine { ItemStack aInputCache; ItemStack aOutputCache; int aTypeCache = 0; public GT_MetaTileEntity_Boxinator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_BOXINATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_BOXINATOR)); + super(aID, aName, aNameRegional, aTier, 1, "Puts things into Boxes", 2, 1, "Packager.png", "", + TextureFactory.of(OVERLAY_SIDE_BOXINATOR_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_BOXINATOR), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_BOXINATOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_BOXINATOR_ACTIVE).glow().build()), + TextureFactory.of(OVERLAY_FRONT_BOXINATOR), + TextureFactory.of(OVERLAY_TOP_BOXINATOR_ACTIVE), + TextureFactory.of(OVERLAY_TOP_BOXINATOR), + TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_BOXINATOR)); } public GT_MetaTileEntity_Boxinator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -29,10 +47,12 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine super(aName, aTier, 1, aDescription, aTextures, 2, 1, aGUIName, aNEIName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Boxinator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } + @Override public GT_Recipe.GT_Recipe_Map getRecipeList() { return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes; } @@ -59,6 +79,7 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine aInputCache = mInputItem.copy(); } + @Override public int checkRecipe() { int tCheck = super.checkRecipe(); if (tCheck != DID_NOT_FIND_RECIPE) { @@ -69,9 +90,9 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine if ((GT_Utility.isStackValid(tSlot0)) && (GT_Utility.isStackValid(tSlot1)) && (GT_Utility.getContainerItem(tSlot0, true) == null)) { if ((ItemList.Schematic_1by1.isStackEqual(tSlot1)) && (tSlot0.stackSize >= 1)) { boolean tIsCached = hasValidCache(tSlot0,1,true); - this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0}); + this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0); if (this.mOutputItems[0] != null) { - if (canOutput(new ItemStack[]{this.mOutputItems[0]})) { + if (canOutput(this.mOutputItems[0])) { tSlot0.stackSize -= 1; calculateOverclockedNess(32,16); //In case recipe is too OP for that machine @@ -86,9 +107,9 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } if ((ItemList.Schematic_2by2.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 4)) { boolean tIsCached = hasValidCache(tSlot0,2,true); - this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0, tSlot0, null, tSlot0, tSlot0}); + this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, null, tSlot0, tSlot0); if (this.mOutputItems[0] != null) { - if (canOutput(new ItemStack[]{this.mOutputItems[0]})) { + if (canOutput(this.mOutputItems[0])) { getInputAt(0).stackSize -= 4; calculateOverclockedNess(32,32); //In case recipe is too OP for that machine @@ -103,9 +124,9 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine } if ((ItemList.Schematic_3by3.isStackEqual(tSlot1)) && (getInputAt(0).stackSize >= 9)) { boolean tIsCached = hasValidCache(tSlot0,3,true); - this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(new ItemStack[]{tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0}); + this.mOutputItems[0] = tIsCached ? aOutputCache.copy() : GT_ModHandler.getRecipeOutput(tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0, tSlot0); if (this.mOutputItems[0] != null) { - if (canOutput(new ItemStack[]{this.mOutputItems[0]})) { + if (canOutput(this.mOutputItems[0])) { getInputAt(0).stackSize -= 9; calculateOverclockedNess(32,64); //In case recipe is too OP for that machine @@ -131,15 +152,15 @@ public class GT_MetaTileEntity_Boxinator extends GT_MetaTileEntity_BasicMachine if ((ItemList.Schematic_1by1.isStackEqual(tInput1)) || (ItemList.Schematic_2by2.isStackEqual(tInput1)) || (ItemList.Schematic_3by3.isStackEqual(tInput1))) { if (hasValidCache(aStack,aTypeCache,false)) return true; - if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, new ItemStack[]{GT_Utility.copyAmount(64L, new Object[]{aStack}), tInput1}) != null) { + if (GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[mTier], null, GT_Utility.copyAmount(64L, aStack), tInput1) != null) { return true; } - if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack}) != null) + if (ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(aStack) != null) return true; - if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, null, aStack, aStack}) != null) { + if (ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) && GT_ModHandler.getRecipeOutput(aStack, aStack, null, aStack, aStack) != null) { return true; } - return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(new ItemStack[]{aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack}) != null); + return ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) && (GT_ModHandler.getRecipeOutput(aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack, aStack) != null); } else { return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.containsInput(aStack); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java index afee5290f0..15e14de5e3 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_CuringOven.java @@ -10,7 +10,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -19,7 +19,7 @@ import net.minecraftforge.fluids.FluidStack; public class GT_MetaTileEntity_CuringOven extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_CuringOven(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Heats tools for hardening", 1, 1, "E_Oven.png", "", new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM"))); + super(aID, aName, aNameRegional, aTier, 1, "Heats tools for hardening", 1, 1, "E_Oven.png", "", TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_SIDE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_FRONT")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_TOP")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM_ACTIVE")), TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/ELECTRIC_OVEN/OVERLAY_BOTTOM"))); } public GT_MetaTileEntity_CuringOven(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java index 2d1caa798c..67822a5dfb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Disassembler.java @@ -2,7 +2,10 @@ package gregtech.common.tileentities.machines.basic; import com.google.common.collect.ArrayListMultimap; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -11,8 +14,8 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -21,12 +24,20 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.IntStream; +import static gregtech.api.enums.Textures.BlockIcons.*; + public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_Disassembler(int aID, String aName, String aNameRegional, int aTier) { @@ -46,14 +57,20 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi "", //Textures - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_DISASSEMBLER), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_DISASSEMBLER), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_DISASSEMBLER), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_DISASSEMBLER) + TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_DISASSEMBLER), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_DISASSEMBLER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_DISASSEMBLER_GLOW).glow().build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_TOP_DISASSEMBLER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_TOP_DISASSEMBLER_ACTIVE_GLOW).glow().build()), + TextureFactory.of(OVERLAY_TOP_DISASSEMBLER), + TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_DISASSEMBLER) ); } @@ -65,11 +82,12 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi super(aName, aTier, 1, aDescription, aTextures, 1, 9, aGUIName, aNEIName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Disassembler(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } - private static final ItemStack[][] alwaysReplace = new ItemStack[][]{ + private static final ItemStack[][] alwaysReplace = { { //ItemStack to look for new ItemStack(Blocks.trapped_chest, 1, OreDictionary.WILDCARD_VALUE) @@ -80,7 +98,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } }; - private static final Object[][] OreDictionaryOverride = new Object[][]{ + private static final Object[][] OreDictionaryOverride = { { //String to look for "plankWood", @@ -130,6 +148,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi is); } + @Override public int checkRecipe() { ItemStack is = getInputAt(0); @@ -232,7 +251,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi return true; } - private static DissassembleReference ensureDowncasting(Collection<DissassembleReference> recipes) { + private static DissassembleReference ensureDowncasting(Collection<? extends DissassembleReference> recipes) { ItemStack[] inputs = recipes.stream() .findFirst() .orElseThrow(NullPointerException::new) @@ -251,7 +270,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi return new DissassembleReference(recipes.stream().mapToInt(x -> x.stackSize).min().orElseThrow(NumberFormatException::new), output, null); } - private static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, List<GT_Recipe> recipesColl) { + private static void handleRecipeTransformation(ItemStack[] inputs, ItemStack[] output, List<? extends GT_Recipe> recipesColl) { for (int i = 0, inputsLength = inputs.length; i < inputsLength; i++) { Set<ItemStack[]> inputsStacks = null; if (recipesColl != null) @@ -293,11 +312,11 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi output[i].stackSize = Math.min(output[i].stackSize, inputs[i].stackSize); //Handles replacement Overrides - ItemStack[] itemStacks = GT_MetaTileEntity_Disassembler.alwaysReplace[0]; + ItemStack[] itemStacks = alwaysReplace[0]; for (int j = 0; j < itemStacks.length; j++) { ItemStack x = itemStacks[j]; if (GT_Utility.areStacksEqual(x, output[i], true)) { - output[i] = GT_MetaTileEntity_Disassembler.alwaysReplace[1][j]; + output[i] = alwaysReplace[1][j]; break; } } @@ -338,7 +357,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi } } - private static void handleInputStacks(Set<ItemStack[]> inputsStacks, AtomicReference<Materials> toRpl, ItemData data, Materials first, int i){ + private static void handleInputStacks(Set<ItemStack[]> inputsStacks, AtomicReference<? super Materials> toRpl, ItemData data, Materials first, int i){ final int finalIndex = i; inputsStacks.forEach(stackArray -> { ItemData dataAgainst = GT_OreDictUnificator.getItemData(stackArray[finalIndex]); @@ -356,7 +375,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi }); } - private static void handleAnyMaterials(Materials first, AtomicReference<Materials> toRpl){ + private static void handleAnyMaterials(Materials first, AtomicReference<? super Materials> toRpl){ if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyIron))) toRpl.set(Materials.Iron); else if (first.mOreReRegistrations.stream().anyMatch(y -> y.equals(Materials.AnyCopper))) @@ -369,7 +388,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi toRpl.set(Materials.Rubber); } - private static void handleDifferentMaterialsOnRecipes(Materials first, Materials second, AtomicReference<Materials> toRpl){ + private static void handleDifferentMaterialsOnRecipes(Materials first, Materials second, AtomicReference<? super Materials> toRpl){ if (!first.equals(second)) if (first.equals(Materials.Aluminium) && second.equals(Materials.Iron)) toRpl.set(second); @@ -397,7 +416,7 @@ public class GT_MetaTileEntity_Disassembler extends GT_MetaTileEntity_BasicMachi toRpl.set(second); } - private static void handleBetterMaterialsVersions(ItemData data, AtomicReference<Materials> toRpl){ + private static void handleBetterMaterialsVersions(ItemData data, AtomicReference<? super Materials> toRpl){ if (Materials.SteelMagnetic.equals(data.mMaterial.mMaterial)) { toRpl.set(Materials.Steel); } else if (Materials.IronMagnetic.equals(data.mMaterial.mMaterial)) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java index 745033f4a3..b6e17c7b08 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Massfabricator.java @@ -1,16 +1,27 @@ package gregtech.common.tileentities.machines.basic; -import gregtech.api.enums.*; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Recipe; import net.minecraftforge.fluids.FluidStack; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MASSFAB; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_MASSFAB; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_MASSFAB; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_MASSFAB_ACTIVE; public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMachine { public static int sUUAperUUM = 1; @@ -19,7 +30,17 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac public static boolean sRequiresUUA = false; public GT_MetaTileEntity_Massfabricator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "UUM = Matter * Fabrication Squared", 1, 1, "Massfabricator.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_MASSFAB), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_MASSFAB)); + super(aID, aName, aNameRegional, aTier, 1, "UUM = Matter * Fabrication Squared", 1, 1, "Massfabricator.png", "", + TextureFactory.of(OVERLAY_SIDE_MASSFAB_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_MASSFAB), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_MASSFAB_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_MASSFAB_ACTIVE_GLOW).glow().build()), + TextureFactory.of(OVERLAY_FRONT_MASSFAB), + TextureFactory.of(OVERLAY_TOP_MASSFAB_ACTIVE), + TextureFactory.of(OVERLAY_TOP_MASSFAB), + TextureFactory.of(OVERLAY_BOTTOM_MASSFAB_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_MASSFAB)); } public GT_MetaTileEntity_Massfabricator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -30,10 +51,12 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Massfabricator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } + @Override public void onConfigLoad(GT_Config aConfig) { super.onConfigLoad(aConfig); sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier); @@ -53,6 +76,7 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac return V[mTier] * 512L; } + @Override public int checkRecipe() { FluidStack tFluid = getDrainableStack(); if ((tFluid == null) || (tFluid.amount < getCapacity())) { @@ -84,14 +108,14 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac mEUt=Integer.MAX_VALUE-1; mMaxProgresstime=Integer.MAX_VALUE-1; }else{ - mEUt= (int)(GT_Values.V[1]<<2);//2^2=4 so shift <<2 + mEUt= (int)(V[1]<<2);//2^2=4 so shift <<2 mMaxProgresstime=(int)xMaxProgresstime; } }else{ //Long EUt calculation - long xEUt=GT_Values.V[1] * (long)Math.pow(2,mTier+2); + long xEUt= V[1] * (long)Math.pow(2,mTier+2); - long tempEUt = GT_Values.V[1]; + long tempEUt = V[1]; mMaxProgresstime = sDurationMultiplier; @@ -114,10 +138,12 @@ public class GT_MetaTileEntity_Massfabricator extends GT_MetaTileEntity_BasicMac } } + @Override public boolean isFluidInputAllowed(FluidStack aFluid) { return aFluid.isFluidEqual(Materials.UUAmplifier.getFluid(1L)); } + @Override public int getCapacity() { return Math.max(sUUAperUUM, 1000); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java index f84c33d422..01f136747c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MicrowaveEnergyTransmitter.java @@ -3,14 +3,13 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.GregTech_API; import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IEnergyConnected; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_MicrowaveEnergyTransmitter; @@ -25,6 +24,11 @@ import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fluids.FluidStack; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEntity_BasicTank { @@ -79,6 +83,7 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt return new GT_MetaTileEntity_MicrowaveEnergyTransmitter(this.mName, this.mTier, this.mDescriptionArray, this.mTextures); } + @Override public String[] getInfoData() { return new String[]{ "Coordinates:", @@ -93,9 +98,18 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide == 0) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; + if (aSide == 0) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; + if (aActive) return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build()}; } + @Override public void saveNBTData(NBTTagCompound aNBT) { if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); aNBT.setInteger("mTargetX", this.mTargetX); @@ -105,6 +119,7 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt aNBT.setBoolean("mDebug", this.mDebug); } + @Override public void loadNBTData(NBTTagCompound aNBT) { mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); this.mTargetX = aNBT.getInteger("mTargetX"); @@ -114,6 +129,7 @@ public class GT_MetaTileEntity_MicrowaveEnergyTransmitter extends GT_MetaTileEnt this.mDebug = aNBT.getBoolean("mDebug"); } + @Override public void onConfigLoad(GT_Config aConfig) { sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); mMaxLoss = Math.max(aConfig.get(ConfigCategories.machineconfig, "MicrowaveTransmitter.MaxLoss", 50), 11); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java index 9b1e5ba1f8..4d7a6c4af5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Miner.java @@ -5,13 +5,12 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.blocks.GT_Block_Ores_Abstract; import gregtech.common.blocks.GT_TileEntity_Ores; - import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; @@ -36,9 +35,9 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { int drillY = 0; boolean isPickingPipes; boolean waitMiningPipe; - final static int[] RADIUS = new int[]{8, 8, 16, 24, 32}; //Miner radius per tier - final static int[] SPEED = new int[]{160, 160, 80, 40, 20}; //Miner cycle time per tier - final static int[] ENERGY = new int[]{8, 8, 32, 128, 512}; //Miner energy consumption per tier + static final int[] RADIUS = {8, 8, 16, 24, 32}; //Miner radius per tier + static final int[] SPEED = {160, 160, 80, 40, 20}; //Miner cycle time per tier + static final int[] ENERGY = {8, 8, 32, 128, 512}; //Miner energy consumption per tier private int radiusConfig; //Miner configured radius private final ArrayList<ChunkPosition> oreBlockPositions = new ArrayList<>(); @@ -52,14 +51,14 @@ public class GT_MetaTileEntity_Miner extends GT_MetaTileEntity_BasicMachine { "Maximum work area " + (RADIUS[aTier] * 2 + 1) + "x" + (RADIUS[aTier] * 2 + 1), "Fortune bonus of " + aTier}, 2, 2, "Miner.png", "", - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), - new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_SIDE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_FRONT")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_TOP")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM_ACTIVE")), + TextureFactory.of(new Textures.BlockIcons.CustomIcon("basicmachines/miner/OVERLAY_BOTTOM"))); radiusConfig = RADIUS[mTier]; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java index 1ee6203593..095c87f948 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_MonsterRepellent.java @@ -1,16 +1,21 @@ package gregtech.common.tileentities.machines.basic; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_SpawnEventHandler; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_TieredMachineBlock { @@ -28,19 +33,28 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered super(aName, aTier, aInvSlotCount, aDescription, aTextures); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_MonsterRepellent(this.mName, this.mTier, this.mInventory.length, this.mDescriptionArray, this.mTextures); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != 1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; + if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; + if (aActive) return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build()}; } @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { if (aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.isServerSide()) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + int[] tCoords = {aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; if ((aTimer % 600 == 0) && !GT_SpawnEventHandler.mobReps.contains(tCoords)) { GT_SpawnEventHandler.mobReps.add(tCoords); } @@ -54,13 +68,13 @@ public class GT_MetaTileEntity_MonsterRepellent extends GT_MetaTileEntity_Tiered @Override public void onFirstTick(IGregTechTileEntity aBaseMetaTileEntity) { - int[] tCoords = new int[]{aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; + int[] tCoords = {aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(), aBaseMetaTileEntity.getZCoord(), aBaseMetaTileEntity.getWorld().provider.dimensionId}; GT_SpawnEventHandler.mobReps.add(tCoords); } @Override public void onRemoval() { - int[] tCoords = new int[]{this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; + int[] tCoords = {this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord(), this.getBaseMetaTileEntity().getWorld().provider.dimensionId}; GT_SpawnEventHandler.mobReps.remove(tCoords); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java index 67db36d6e2..56866fb8db 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_PotionBrewer.java @@ -2,12 +2,11 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -16,9 +15,29 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER_ACTIVE; + public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_PotionBrewer(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Brewing your Drinks", 1, 0, "PotionBrewer.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_POTIONBREWER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_POTIONBREWER)); + super(aID, aName, aNameRegional, aTier, 1, "Brewing your Drinks", 1, 0, "PotionBrewer.png", "", + TextureFactory.of(OVERLAY_SIDE_POTIONBREWER_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_POTIONBREWER), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_POTIONBREWER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_POTIONBREWER_ACTIVE_GLOW).glow().build()), + TextureFactory.of(OVERLAY_FRONT_POTIONBREWER), + TextureFactory.of(OVERLAY_TOP_POTIONBREWER_ACTIVE), + TextureFactory.of(OVERLAY_TOP_POTIONBREWER), + TextureFactory.of(OVERLAY_BOTTOM_POTIONBREWER_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_POTIONBREWER)); } public GT_MetaTileEntity_PotionBrewer(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -29,14 +48,17 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi super(aName, aTier, 1, aDescription, aTextures, 1, 0, aGUIName, aNEIName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_PotionBrewer(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } + @Override public GT_Recipe.GT_Recipe_Map getRecipeList() { return GT_Recipe.GT_Recipe_Map.sBrewingRecipes; } + @Override public int checkRecipe() { int tCheck = super.checkRecipe(); if (tCheck != DID_NOT_FIND_RECIPE) { @@ -87,7 +109,7 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi } if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Glowstone, 1L), getInputAt(0))) { if (!tModifier.startsWith("strong")) { - return setOutput("potion." + tInputName + ".strong" + (tModifier.isEmpty() ? "" : new StringBuilder().append(".").append(tModifier).toString())); + return setOutput("potion." + tInputName + ".strong" + (tModifier.isEmpty() ? "" : "." + tModifier)); } if (tModifier.startsWith("long")) { return setOutput("potion." + tInputName + tModifier.replaceFirst("long", "")); @@ -96,7 +118,7 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi } if (GT_Utility.areStacksEqual(GT_OreDictUnificator.get(OrePrefixes.dust, Materials.Redstone, 1L), getInputAt(0))) { if (!tModifier.startsWith("long")) { - return setOutput("potion." + tInputName + ".long" + (tModifier.isEmpty() ? "" : new StringBuilder().append(".").append(tModifier).toString())); + return setOutput("potion." + tInputName + ".long" + (tModifier.isEmpty() ? "" : "." + tModifier)); } if (tModifier.startsWith("strong")) { return setOutput("potion." + tInputName + tModifier.replaceFirst("strong", "")); @@ -114,7 +136,7 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi return 0; } - private final int setOutput(String aFluidName) { + private int setOutput(String aFluidName) { this.mOutputFluid = FluidRegistry.getFluidStack(aFluidName, 750); if (this.mOutputFluid == null) { this.mOutputFluid = FluidRegistry.getFluidStack("potion.mundane", getFillableStack().amount); @@ -135,10 +157,12 @@ public class GT_MetaTileEntity_PotionBrewer extends GT_MetaTileEntity_BasicMachi return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack); } + @Override public boolean isFluidInputAllowed(FluidStack aFluid) { return (aFluid.getFluid().getName().startsWith("potion.")) || (super.isFluidInputAllowed(aFluid)); } + @Override public int getCapacity() { return 750; } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java index 52a256f5a3..24104ee660 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -8,7 +8,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; @@ -27,7 +27,11 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fluids.IFluidHandler; -import java.util.*; +import java.util.ArrayDeque; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.debugBlockPump; @@ -352,11 +356,11 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { } private int getMaxPumpableDistance() { - return GT_MetaTileEntity_Pump.getMaxDistanceForTier(this.mTier); + return getMaxDistanceForTier(this.mTier); } private long getEuUsagePerAction() { - return GT_MetaTileEntity_Pump.getEuUsagePerTier(this.mTier); + return getEuUsagePerTier(this.mTier); } private boolean hasValidFluid() { @@ -718,7 +722,7 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide == 0 || aSide == 1) ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP)}; + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide == 0 || aSide == 1) ? TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_OUT) : TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP)}; } @Override @@ -729,8 +733,8 @@ public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { return new ITexture[]{ - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), - new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),}; + TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), + TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP), TextureFactory.of(Textures.BlockIcons.OVERLAY_ADV_PUMP),}; } private FakePlayer mFakePlayer = null; diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java index 3df33fc6c4..bbba895f28 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Replicator.java @@ -1,12 +1,15 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.GregTech_API; -import gregtech.api.enums.*; +import gregtech.api.enums.Element; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -17,6 +20,16 @@ import net.minecraftforge.fluids.FluidStack; import java.util.HashMap; import java.util.NoSuchElementException; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_REPLICATOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_REPLICATOR_ACTIVE; + public class GT_MetaTileEntity_Replicator extends GT_MetaTileEntity_BasicMachine { private static int sHeaviestElementMass = 0; @@ -32,7 +45,17 @@ public class GT_MetaTileEntity_Replicator } public GT_MetaTileEntity_Replicator(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Producing Elemental Matter", 1, 1, "Replicator.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_REPLICATOR), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_REPLICATOR)); + super(aID, aName, aNameRegional, aTier, 1, "Producing Elemental Matter", 1, 1, "Replicator.png", "", + TextureFactory.of(OVERLAY_SIDE_REPLICATOR_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_REPLICATOR), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_REPLICATOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_REPLICATOR_ACTIVE_GLOW).glow().build()), + TextureFactory.of(OVERLAY_FRONT_REPLICATOR), + TextureFactory.of(OVERLAY_TOP_REPLICATOR_ACTIVE), + TextureFactory.of(OVERLAY_TOP_REPLICATOR), + TextureFactory.of(OVERLAY_BOTTOM_REPLICATOR_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_REPLICATOR)); } public GT_MetaTileEntity_Replicator(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -43,6 +66,7 @@ public class GT_MetaTileEntity_Replicator super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Replicator(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } @@ -53,6 +77,7 @@ public class GT_MetaTileEntity_Replicator return (long) Math.pow(amount, EXPONENT); } + @Override public int checkRecipe() { FluidStack tFluid = getFillableStack(); if ((tFluid != null) && (tFluid.isFluidEqual(Materials.UUMatter.getFluid(1L)))) { @@ -63,7 +88,7 @@ public class GT_MetaTileEntity_Replicator if ((tFluid.amount >= tMass) && (tMass > 0L)) { this.mEUt = GT_Utility.safeInt(gregtech.api.enums.GT_Values.V[this.mTier],1); - this.mMaxProgresstime = GT_Utility.safeInt(tMass * 1024L / (1 << this.mTier),1); + this.mMaxProgresstime = GT_Utility.safeInt(tMass * 1024L / (1L << this.mTier),1); if (mMaxProgresstime == Integer.MAX_VALUE - 1 || mEUt == Integer.MAX_VALUE - 1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; @@ -106,10 +131,12 @@ public class GT_MetaTileEntity_Replicator return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && ItemList.Cell_Empty.isStackEqual(aStack); } + @Override public boolean isFluidInputAllowed(FluidStack aFluid) { return aFluid.isFluidEqual(Materials.UUMatter.getFluid(1L)); } + @Override public int getCapacity() { if ((sHeaviestElementMass == 0) && (GregTech_API.sPostloadFinished)) { sHeaviestElementMass = Materials.getMaterialsMap().values().stream().mapToInt(material -> (int) cubicFluidMultiplier((int)material.getMass())).max().orElseThrow(NoSuchElementException::new); diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java index 37113e0f9a..d7a66d440a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_RockBreaker.java @@ -2,21 +2,40 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE; + public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachine { public GT_MetaTileEntity_RockBreaker(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Put Lava and Water adjacent", 1, 1, "RockBreaker.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER)); + super(aID, aName, aNameRegional, aTier, 1, "Put Lava and Water adjacent", 1, 1, "RockBreaker.png", "", + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), + TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER)); } public GT_MetaTileEntity_RockBreaker(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -27,10 +46,12 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_RockBreaker(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } + @Override public GT_Recipe.GT_Recipe_Map getRecipeList() { return GT_Recipe.GT_Recipe_Map.sRockBreakerFakeRecipes; } @@ -40,6 +61,7 @@ public class GT_MetaTileEntity_RockBreaker extends GT_MetaTileEntity_BasicMachin return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && getRecipeList().containsInput(aStack); } + @Override public int checkRecipe() { IGregTechTileEntity aBaseMetaTileEntity = getBaseMetaTileEntity(); if ((aBaseMetaTileEntity.getBlockOffset(0, 0, 1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(0, 0, -1) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(-1, 0, 0) == Blocks.water) || (aBaseMetaTileEntity.getBlockOffset(1, 0, 0) == Blocks.water)) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java index 2fcecc41ad..6b53ba1dbe 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Scanner.java @@ -9,13 +9,12 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Assemblyline_Server; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; @@ -29,12 +28,25 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagString; +import static gregtech.api.enums.Textures.BlockIcons.*; import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sScannerFakeRecipes; public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { - + public GT_MetaTileEntity_Scanner(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "Scans Crops and other things.", 1, 1, "Scanner.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_SCANNER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_SCANNER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_SCANNER)); + super(aID, aName, aNameRegional, aTier, 1, "Scans Crops and other things.", 1, 1, "Scanner.png", "", + TextureFactory.of(OVERLAY_SIDE_SCANNER_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_SCANNER), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_SCANNER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_SCANNER_ACTIVE_GLOW).glow().build()), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_SCANNER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_SCANNER_GLOW).glow().build()), + TextureFactory.of(OVERLAY_TOP_SCANNER_ACTIVE), + TextureFactory.of(OVERLAY_TOP_SCANNER), + TextureFactory.of(OVERLAY_BOTTOM_SCANNER_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_SCANNER)); } public GT_MetaTileEntity_Scanner(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -217,14 +229,14 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { if (ItemList.Tool_DataStick.isStackEqual(getSpecialSlot(), false, true) && aStack != null) { for (GT_Recipe.GT_Recipe_AssemblyLine tRecipe : GT_Recipe.GT_Recipe_AssemblyLine.sAssemblylineRecipes) { if (GT_Utility.areStacksEqual(tRecipe.mResearchItem, aStack, true)) { - boolean failScanner=true; - for(GT_Recipe scannerRecipe:sScannerFakeRecipes.mRecipeList){ - if(GT_Utility.areStacksEqual(scannerRecipe.mInputs[0],aStack,true)){ - failScanner=false; + boolean failScanner = true; + for (GT_Recipe scannerRecipe : sScannerFakeRecipes.mRecipeList) { + if (GT_Utility.areStacksEqual(scannerRecipe.mInputs[0], aStack, true)) { + failScanner = false; break; } } - if(failScanner){ + if (failScanner) { return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } @@ -333,7 +345,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { if (mProgresstime >= (mMaxProgresstime - 1)) { if ((this.mOutputItems[0] != null) && (this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707"))) { - GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning"); + GT_Mod.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning"); } } super.onPostTick(aBaseMetaTileEntity, aTick); @@ -356,7 +368,7 @@ public class GT_MetaTileEntity_Scanner extends GT_MetaTileEntity_BasicMachine { public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(212), 10, 1.0F, aX, aY, aZ); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java index ac7dd17607..2abc1011a5 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_SeismicProspector.java @@ -3,13 +3,12 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.objects.ItemData; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import gregtech.common.GT_UndergroundOil; @@ -27,12 +26,34 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; import java.util.List; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE; + public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_BasicMachine { boolean ready = false; public GT_MetaTileEntity_SeismicProspector(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 1, "(DEPRECATED, DO NOT USE! SWAP TO ADVANCED VERSION USING SHAPELESS RECIPE!)", 1, 1, "Default.png", "", new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_ROCK_BREAKER)); + super(aID, aName, aNameRegional, aTier, 1, + "(DEPRECATED, DO NOT USE! SWAP TO ADVANCED VERSION USING SHAPELESS RECIPE!)", 1, 1, + "Default.png", "", + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_SIDE_ROCK_BREAKER), + TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_TOP_ROCK_BREAKER), + TextureFactory.of( + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()), + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER), + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER_ACTIVE), + TextureFactory.of(OVERLAY_BOTTOM_ROCK_BREAKER)); } public GT_MetaTileEntity_SeismicProspector(String aName, int aTier, String aDescription, ITexture[][][] aTextures, String aGUIName, String aNEIName) { @@ -43,6 +64,7 @@ public class GT_MetaTileEntity_SeismicProspector extends GT_MetaTileEntity_Basic super(aName, aTier, 1, aDescription, aTextures, 1, 1, aGUIName, aNEIName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_SeismicProspector(this.mName, this.mTier, this.mDescriptionArray, this.mTextures, this.mGUIName, this.mNEIName); } diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java index c9dbded8f9..7d6c0a29ed 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -1,12 +1,11 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.enums.ConfigCategories; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Config; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_Teleporter; @@ -18,7 +17,14 @@ import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.boss.EntityDragonPart; import net.minecraft.entity.effect.EntityWeatherEffect; -import net.minecraft.entity.item.*; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.projectile.EntityArrow; @@ -37,6 +43,13 @@ import net.minecraftforge.fluids.FluidStack; import java.util.List; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES_GLOW; public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { @@ -171,6 +184,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { } + @Override public String[] getInfoData() { return new String[]{ "Coordinates:", @@ -185,9 +199,21 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], (aSide != this.getBaseMetaTileEntity().getFrontFacing()) ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_SIDES) : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER)}; + if (aSide != this.getBaseMetaTileEntity().getFrontFacing()) return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER_SIDES), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_SIDES_GLOW).glow().build()}; + if (aActive) return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_TELEPORTER), + TextureFactory.builder().addIcon(OVERLAY_TELEPORTER_GLOW).glow().build()}; } + @Override public void saveNBTData(NBTTagCompound aNBT) { if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); aNBT.setInteger("mTargetX", this.mTargetX); @@ -197,6 +223,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { aNBT.setBoolean("mDebug", this.mDebug); } + @Override public void loadNBTData(NBTTagCompound aNBT) { mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); this.mTargetX = aNBT.getInteger("mTargetX"); @@ -206,6 +233,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { this.mDebug = aNBT.getBoolean("mDebug"); } + @Override public void onConfigLoad(GT_Config aConfig) { sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); sPassiveEnergyDrain = aConfig.get(ConfigCategories.machineconfig, "Teleporter.PassiveDrain", sPassiveEnergyDrain); @@ -287,7 +315,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { tTile = tWorld.getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ); } } - if (tTile != null && tTile instanceof IInventory) { + if (tTile instanceof IInventory) { int tStacksize = mInventory[0].stackSize; GT_Utility.moveOneItemStack(this, tTile, (byte) 0, (byte) 0, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); if (mInventory[0] == null || mInventory[0].stackSize < tStacksize) { diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java index 061ca5c4dd..0cc9c83dc4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineFluid.java @@ -22,11 +22,10 @@ package gregtech.common.tileentities.machines.long_distance; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; @@ -34,8 +33,14 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidTankInfo; import net.minecraftforge.fluids.IFluidHandler; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_BACK; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE_GLOW; + public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEntity_LongDistancePipelineBase { - final static FluidTankInfo[] emptyTank = {new FluidTankInfo(null, Integer.MAX_VALUE)}; + static final FluidTankInfo[] emptyTank = {new FluidTankInfo(null, Integer.MAX_VALUE)}; public GT_MetaTileEntity_LongDistancePipelineFluid(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, "Sends fluids over long distances"); @@ -91,7 +96,7 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_LongDistancePipelineFluid(mName, mTier, mDescription, mTextures); + return new GT_MetaTileEntity_LongDistancePipelineFluid(mName, mTier, getDescription()[0], mTextures); } @Override public ITexture[][][] getTextureSet(ITexture[] aTextures) { @@ -101,10 +106,17 @@ public class GT_MetaTileEntity_LongDistancePipelineFluid extends GT_MetaTileEnti @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_FRONT)}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_FLUID_FRONT)}; else if (aSide == GT_Utility.getOppositeSide(aFacing)) - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_BACK)}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_FLUID_BACK)}; else - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_FLUID_SIDE)}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_FLUID_SIDE), + TextureFactory.builder().addIcon(OVERLAY_PIPELINE_FLUID_SIDE_GLOW).glow().build()}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java index da833321e4..18ec03a5a4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java +++ b/src/main/java/gregtech/common/tileentities/machines/long_distance/GT_MetaTileEntity_LongDistancePipelineItem.java @@ -22,19 +22,24 @@ package gregtech.common.tileentities.machines.long_distance; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_BACK; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_FRONT; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE_GLOW; + public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntity_LongDistancePipelineBase { - final static int[] emptyIntArray = new int[0]; + static final int[] emptyIntArray = new int[0]; public GT_MetaTileEntity_LongDistancePipelineItem(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, "Sends Items over long distances"); @@ -169,15 +174,22 @@ public class GT_MetaTileEntity_LongDistancePipelineItem extends GT_MetaTileEntit @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_LongDistancePipelineItem(mName, mTier, mDescription, mTextures); + return new GT_MetaTileEntity_LongDistancePipelineItem(mName, mTier, getDescription()[0], mTextures); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_FRONT)}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_ITEM_FRONT)}; else if (aSide == GT_Utility.getOppositeSide(aFacing)) - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_BACK)}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_ITEM_BACK)}; else - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPELINE_ITEM_SIDE)}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_PIPELINE_ITEM_SIDE), + TextureFactory.builder().addIcon(OVERLAY_PIPELINE_ITEM_SIDE_GLOW).glow().build()}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java index c13d537119..6695c4d0a2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_AssemblyLine.java @@ -1,13 +1,10 @@ package gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; - -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -15,7 +12,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -24,8 +21,15 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.input.Keyboard; + +import java.util.ArrayList; import static gregtech.GT_Mod.GT_FML_LOGGER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_GLOW; public class GT_MetaTileEntity_AssemblyLine extends GT_MetaTileEntity_MultiBlockBase { @@ -40,140 +44,157 @@ public class GT_MetaTileEntity_AssemblyLine super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_AssemblyLine(this.mName); } + @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Assembling Line") - .addInfo("Controller block for the Assembling Line") - .addInfo("Used to make complex machine parts (LuV+)") - .addInfo("Does not make Assembler items") - .addSeparator() - .beginVariableStructureBlock(5, 15, 4, 4, 3, 3, false)//? - .addStructureInfo("From Bottom to Top, Left to Right") - .addStructureInfo("Layer 1 - Solid Steel Machine Casing, Input Bus (last is Output Bus), Solid Steel Machine Casing") - .addStructureInfo("Layer 2 - Reinforced Glass, Assembling Line Casing, Reinforced Glass") - .addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing") - .addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty") - .addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes, aside from the last") - .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller") - .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller")//TT - - .addController("Either Grate on layer 3 of the first slice") - .addEnergyHatch("Any layer 4 casing") - .addMaintenanceHatch("Any layer 1 casing") - .addInputBus("As specified on layer 1") - .addInputHatch("Any layer 1 casing") - .addOutputBus("Replaces Input Bus on final slice") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Assembling Line") + .addInfo("Controller block for the Assembling Line") + .addInfo("Used to make complex machine parts (LuV+)") + .addInfo("Does not make Assembler items") + .addSeparator() + .beginVariableStructureBlock(5, 15, 4, 4, 3, 3, false)//? + .addStructureInfo("From Bottom to Top, Left to Right") + .addStructureInfo("Layer 1 - Solid Steel Machine Casing, Input Bus (last is Output Bus), Solid Steel Machine Casing") + .addStructureInfo("Layer 2 - Reinforced Glass, Assembling Line Casing, Reinforced Glass") + .addStructureInfo("Layer 3 - Grate Machine Casing, Assembler Machine Casing, Grate Machine Casing") + .addStructureInfo("Layer 4 - Empty, Solid Steel Machine Casing, Empty") + .addStructureInfo("Up to 16 repeating slices, each one allows for 1 more item in recipes, aside from the last") + .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller") + .addStructureInfo("Optional - Replace 1x Grate with (Advanced) Data Access Hatch next to the Controller")//TT + + .addController("Either Grate on layer 3 of the first slice") + .addEnergyHatch("Any layer 4 casing") + .addMaintenanceHatch("Any layer 1 casing") + .addInputBus("As specified on layer 1") + .addInputHatch("Any layer 1 casing") + .addOutputBus("Replaces Input Bus on final slice") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ASSEMBLY_LINE)}; + if (aActive) + return new ITexture[]{ + BlockIcons.casingTexturePages[0][16], + TextureFactory.of(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + BlockIcons.casingTexturePages[0][16], + TextureFactory.of(OVERLAY_FRONT_ASSEMBLY_LINE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_GLOW).glow().build()}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16]}; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "AssemblyLine.png"); } + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return null; } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; } + @Override public boolean isFacingValid(byte aFacing) { return aFacing > 1; } + @Override public boolean checkRecipe(ItemStack aStack) { - if(GT_Values.D1) + if (GT_Values.D1) GT_FML_LOGGER.info("Start ALine recipe check"); ArrayList<ItemStack> tDataStickList = getDataItems(2); - if (tDataStickList.size() == 0) return false; - if(GT_Values.D1) - GT_FML_LOGGER.info("Stick accepted, " + tDataStickList.size() + " Data Sticks found"); + if (tDataStickList.isEmpty()) return false; + if (GT_Values.D1) + GT_FML_LOGGER.info("Stick accepted, " + tDataStickList.size() + " Data Sticks found"); - ItemStack tStack[] = new ItemStack[15]; + ItemStack[] tStack = new ItemStack[15]; FluidStack[] tFluids = new FluidStack[4]; boolean findRecipe = false; - nextDS:for (ItemStack tDataStick : tDataStickList){ + nextDS: + for (ItemStack tDataStick : tDataStickList) { NBTTagCompound tTag = tDataStick.getTagCompound(); if (tTag == null) continue; for (int i = 0; i < 15; i++) { - int count = tTag.getInteger("a"+i); + int count = tTag.getInteger("a" + i); if (!tTag.hasKey("" + i) && count <= 0) continue; if (mInputBusses.get(i) == null) { continue nextDS; } - + ItemStack stackInSlot = mInputBusses.get(i).getBaseMetaTileEntity().getStackInSlot(0); boolean flag = true; if (count > 0) { - for (int j = 0; j < count; j++) { - tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j); - if (tStack[i] == null) continue; - if(GT_Values.D1) - GT_FML_LOGGER.info("Item "+i+" : "+tStack[i].getUnlocalizedName()); - if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { - flag = false; - break; - } - } - } + for (int j = 0; j < count; j++) { + tStack[i] = GT_Utility.loadItem(tTag, "a" + i + ":" + j); + if (tStack[i] == null) continue; + if (GT_Values.D1) + GT_FML_LOGGER.info("Item " + i + " : " + tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + break; + } + } + } if (flag) { - tStack[i] = GT_Utility.loadItem(tTag, "" + i); - if (tStack[i] == null) { - flag = false; - continue; - } - if(GT_Values.D1) - GT_FML_LOGGER.info("Item "+i+" : "+tStack[i].getUnlocalizedName()); - if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { - flag = false; - } - } - if(GT_Values.D1) + tStack[i] = GT_Utility.loadItem(tTag, "" + i); + if (tStack[i] == null) { + flag = false; + continue; + } + if (GT_Values.D1) + GT_FML_LOGGER.info("Item " + i + " : " + tStack[i].getUnlocalizedName()); + if (GT_Utility.areStacksEqual(tStack[i], stackInSlot, true) && tStack[i].stackSize <= stackInSlot.stackSize) { + flag = false; + } + } + if (GT_Values.D1) GT_FML_LOGGER.info(i + (flag ? " not accepted" : " accepted")); if (flag) continue nextDS; } - if(GT_Values.D1)GT_FML_LOGGER.info("All Items done, start fluid check"); + if (GT_Values.D1) GT_FML_LOGGER.info("All Items done, start fluid check"); for (int i = 0; i < 4; i++) { if (!tTag.hasKey("f" + i)) continue; tFluids[i] = GT_Utility.loadFluid(tTag, "f" + i); if (tFluids[i] == null) continue; - if(GT_Values.D1) - GT_FML_LOGGER.info("Fluid "+i+" "+tFluids[i].getUnlocalizedName()); + if (GT_Values.D1) + GT_FML_LOGGER.info("Fluid " + i + " " + tFluids[i].getUnlocalizedName()); if (mInputHatches.get(i) == null) { continue nextDS; } FluidStack fluidInHatch = mInputHatches.get(i).mFluid; - if (fluidInHatch == null || !GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { - if(GT_Values.D1) - GT_FML_LOGGER.info(i+" not accepted"); + if (!GT_Utility.areFluidsEqual(fluidInHatch, tFluids[i], true) || fluidInHatch.amount < tFluids[i].amount) { + if (GT_Values.D1) + GT_FML_LOGGER.info(i + " not accepted"); continue nextDS; } - if(GT_Values.D1) - GT_FML_LOGGER.info(i+" accepted"); + if (GT_Values.D1) + GT_FML_LOGGER.info(i + " accepted"); } - if(GT_Values.D1) + if (GT_Values.D1) GT_FML_LOGGER.info("Input accepted, check other values"); if (!tTag.hasKey("output")) continue; @@ -191,13 +212,13 @@ public class GT_MetaTileEntity_AssemblyLine continue; mEUt = tTag.getInteger("eu"); - if(GT_Values.D1)GT_FML_LOGGER.info("Find avaiable recipe"); - findRecipe = true; + if (GT_Values.D1) GT_FML_LOGGER.info("Find avaiable recipe"); + findRecipe = true; break; } if (!findRecipe) return false; - if(GT_Values.D1)GT_FML_LOGGER.info("All checked start consuming inputs"); + if (GT_Values.D1) GT_FML_LOGGER.info("All checked start consuming inputs"); for (int i = 0; i < 15; i++) { if (tStack[i] == null) continue; @@ -213,7 +234,7 @@ public class GT_MetaTileEntity_AssemblyLine mInputHatches.get(i).mFluid = null; } } - if(GT_Values.D1)GT_FML_LOGGER.info("Check overclock"); + if (GT_Values.D1) GT_FML_LOGGER.info("Check overclock"); byte tTier = (byte) Math.max(1, GT_Utility.getTier(getMaxInputVoltage())); this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); @@ -232,7 +253,7 @@ public class GT_MetaTileEntity_AssemblyLine } this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); updateSlots(); - if(GT_Values.D1) + if (GT_Values.D1) GT_FML_LOGGER.info("Recipe sucessfull"); return true; } @@ -245,6 +266,7 @@ public class GT_MetaTileEntity_AssemblyLine return super.onRunningTick(aStack); } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 20) { @@ -252,8 +274,9 @@ public class GT_MetaTileEntity_AssemblyLine } } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - mDataAccessHatches.clear(); + mDataAccessHatches.clear(); int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; if (xDir != 0) { @@ -313,7 +336,7 @@ public class GT_MetaTileEntity_AssemblyLine } tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir, -2, i); if (!addInputToMachineList(tTileEntity, 16) && addOutputToMachineList(tTileEntity, 16)) { - return r > 0 && mEnergyHatches.size() > 0; + return r > 0 && !mEnergyHatches.isEmpty(); } } } else { @@ -373,7 +396,7 @@ public class GT_MetaTileEntity_AssemblyLine } tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(i, -2, zDir); if (!addInputToMachineList(tTileEntity, 16) && addOutputToMachineList(tTileEntity, 16)) { - return r > 0 && mEnergyHatches.size() > 0; + return r > 0 && !mEnergyHatches.isEmpty(); } } } @@ -386,15 +409,14 @@ public class GT_MetaTileEntity_AssemblyLine private boolean isCorrectDataItem(ItemStack aStack, int state){ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true; if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true; - if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true; - return false; + return (state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true); } /** * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb */ public ArrayList<ItemStack> getDataItems(int state) { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); + ArrayList<ItemStack> rList = new ArrayList<>(); if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) { rList.add(mInventory[1]); } @@ -421,18 +443,22 @@ public class GT_MetaTileEntity_AssemblyLine return false; } + @Override public int getMaxEfficiency(ItemStack aStack) { return 10000; } + @Override public int getPollutionPerTick(ItemStack aStack) { return 0; } + @Override public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java index eb1ce1348f..0c650c995a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BrickedBlastFurnace.java @@ -1,20 +1,23 @@ package gregtech.common.tileentities.machines.multi; -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; +import org.lwjgl.input.Keyboard; -public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_PrimitiveBlastFurnace{ - private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_DENSEBRICKS)}; - private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_INACTIVE)}; - private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE)}; +public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_PrimitiveBlastFurnace { + private static final ITexture[] FACING_SIDE = {TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_DENSEBRICKS)}; + private static final ITexture[] FACING_FRONT = {TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_INACTIVE)}; + private static final ITexture[] FACING_ACTIVE = { + TextureFactory.of(Textures.BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE), + TextureFactory.builder().addIcon(BlockIcons.MACHINE_CASING_BRICKEDBLASTFURNACE_ACTIVE_GLOW).glow().build() + }; public GT_MetaTileEntity_BrickedBlastFurnace(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -23,33 +26,30 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri public GT_MetaTileEntity_BrickedBlastFurnace(String aName) { super(aName); } - - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BrickedBlastFurnace(this.mName); - } public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Blast Furnace") - .addInfo("Controller Block for the Bricked Blast Furnace") - .addInfo("Usable for Steel and general Pyrometallurgy") - .addInfo("Has a useful interface, unlike other gregtech multis") - .addPollutionAmount(200) - .addSeparator() - .beginStructureBlock(3, 4, 3, true) - .addController("Front center") - .addOtherStructurePart("Firebricks", "Everything except the controller") - .addStructureInfo("The top block is also empty") - .addStructureInfo("You can share the walls of GT multis, so") - .addStructureInfo("each additional one costs less, up to 4") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } -} + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Blast Furnace") + .addInfo("Controller Block for the Bricked Blast Furnace") + .addInfo("Usable for Steel and general Pyrometallurgy") + .addInfo("Has a useful interface, unlike other gregtech multis") + .addPollutionAmount(200) + .addSeparator() + .beginStructureBlock(3, 4, 3, true) + .addController("Front center") + .addOtherStructurePart("Firebricks", "Everything except the controller") + .addStructureInfo("The top block is also empty") + .addStructureInfo("You can share the walls of GT multis, so") + .addStructureInfo("each additional one costs less, up to 4") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } + } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { return aActive ? FACING_ACTIVE : FACING_FRONT; @@ -57,18 +57,24 @@ public class GT_MetaTileEntity_BrickedBlastFurnace extends GT_MetaTileEntity_Pri return FACING_SIDE; } - @Override - protected boolean isCorrectCasingBlock(Block block) { - return block == GregTech_API.sBlockCasings4; - } + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_BrickedBlastFurnace(this.mName); + } + + @Override + protected boolean isCorrectCasingBlock(Block block) { + return block == GregTech_API.sBlockCasings4; + } - @Override - protected boolean isCorrectCasingMetaID(int metaID) { - return metaID == 15; - } + @Override + protected boolean isCorrectCasingMetaID(int metaID) { + return metaID == 15; + } - @Override - public String getName() { - return "Bricked Blast Furnace"; - } + @Override + public String getName() { + return "Bricked Blast Furnace"; + } } + diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java index 771d186158..93b36d376c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_BronzeBlastFurnace.java @@ -1,17 +1,24 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS; + public class GT_MetaTileEntity_BronzeBlastFurnace extends GT_MetaTileEntity_PrimitiveBlastFurnace { - private static final ITexture[] FACING_SIDE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEPLATEDBRICKS)}; - private static final ITexture[] FACING_FRONT = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE)}; - private static final ITexture[] FACING_ACTIVE = {new GT_RenderedTexture(Textures.BlockIcons.MACHINE_BRONZEBLASTFURNACE_ACTIVE)}; + private static final ITexture[] FACING_SIDE = {TextureFactory.of(MACHINE_BRONZEPLATEDBRICKS)}; + private static final ITexture[] FACING_FRONT = {TextureFactory.of(MACHINE_BRONZEBLASTFURNACE)}; + private static final ITexture[] FACING_ACTIVE = { + TextureFactory.of(MACHINE_BRONZEBLASTFURNACE_ACTIVE), + TextureFactory.builder().addIcon(MACHINE_BRONZEBLASTFURNACE_ACTIVE_GLOW).glow().build() + }; public GT_MetaTileEntity_BronzeBlastFurnace(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -21,14 +28,12 @@ public class GT_MetaTileEntity_BronzeBlastFurnace extends GT_MetaTileEntity_Prim super(aName); } - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_BronzeBlastFurnace(this.mName); - } - + @Override public String[] getDescription() { - return new String[]{"Disabled"}; + return new String[]{"Disabled"}; } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { return aActive ? FACING_ACTIVE : FACING_FRONT; @@ -37,6 +42,11 @@ public class GT_MetaTileEntity_BronzeBlastFurnace extends GT_MetaTileEntity_Prim } @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_BronzeBlastFurnace(this.mName); + } + + @Override protected boolean isCorrectCasingBlock(Block block) { return block == GregTech_API.sBlockCasings1; } @@ -50,6 +60,4 @@ public class GT_MetaTileEntity_BronzeBlastFurnace extends GT_MetaTileEntity_Prim public String getName() { return "Bronze Blast Furnace"; } - - } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java index 1b5ecbb90d..15e52ae32d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Charcoal_Pit.java @@ -1,17 +1,12 @@ package gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; - -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; import gregtech.api.enums.OrePrefixes; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.common.GT_Pollution; @@ -22,11 +17,18 @@ import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.ChunkPosition; import net.minecraftforge.oredict.OreDictionary; +import org.lwjgl.input.Keyboard; + +import java.util.ArrayList; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlockBase { private boolean running = false; - private boolean p1, p2, p3, p4, p5, p6; public GT_MetaTileEntity_Charcoal_Pit(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -36,41 +38,9 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock super(aName); } - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Charcoal_Pit(this.mName); - } - - public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Charcoal Pile Igniter") - .addInfo("Controller for the Charcoal Pit") - .addInfo("Converts Logs into Brittle Charcoal blocks") - .addInfo("Will automatically start when valid") - .addPollutionAmount(100) - .addSeparator() - .beginVariableStructureBlock(3, 11, 3, 6, 3, 11, false) - .addStructureInfo("Can be up to 11x6x11 in size, shape doesn't matter") - .addOtherStructurePart("Bricks", "Bottom layer, under all wood logs") - .addOtherStructurePart("Dirt/Grass", "All logs must be covered by these, the controller, or bricks") - .addOtherStructurePart("Wood Logs", "Inside the previously mentioned blocks") - .addStructureInfo("No air between logs allowed") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } - } - - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == 1) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][10], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER)}; - } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][10]}; - } - - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return null; + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; } @Override @@ -79,33 +49,31 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock return false; } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; } - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } - + @Override public boolean checkRecipe(ItemStack aStack) { if (!checkRecursiveBlocks()) { - this.mEfficiency = 0; - this.mEfficiencyIncrease = 0; - this.mMaxProgresstime = 0; + mEfficiency = 0; + mEfficiencyIncrease = 0; + mMaxProgresstime = 0; running = false; return false; } if (mEfficiency == 0) { - this.mEfficiency = 10000; - this.mEfficiencyIncrease = 10000; - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - GT_Pollution.addPollution(getBaseMetaTileEntity(), mMaxProgresstime*10); + mEfficiency = 10000; + mEfficiencyIncrease = 10000; + mMaxProgresstime = Math.max(1, mMaxProgresstime); + GT_Pollution.addPollution(getBaseMetaTileEntity(), mMaxProgresstime * 10); return true; } else { - this.mEfficiency = 0; - this.mEfficiencyIncrease = 0; - this.mMaxProgresstime = 0; + mEfficiency = 0; + mEfficiencyIncrease = 0; + mMaxProgresstime = 0; } return false; } @@ -114,12 +82,10 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock ArrayList<ChunkPosition> tList1 = new ArrayList<>(); ArrayList<ChunkPosition> tList2 = new ArrayList<>(); - Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(0, -1, 0); - if (!isWoodLog(tBlock, this.getBaseMetaTileEntity().getMetaIDOffset(0, -1, 0))) { - return false; - } else { + Block tBlock = getBaseMetaTileEntity().getBlockOffset(0, -1, 0); + if (isWoodLog(tBlock, getBaseMetaTileEntity().getMetaIDOffset(0, -1, 0))) { tList2.add(new ChunkPosition(0, -1, 0)); - } + } else return false; while (!tList2.isEmpty()) { ChunkPosition tPos = tList2.get(0); tList2.remove(0); @@ -129,91 +95,93 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock } if (running) { for (ChunkPosition tPos : tList1) { - if (isWoodLog(this.getBaseMetaTileEntity().getBlockOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ), this.getBaseMetaTileEntity().getMetaIDOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ))) - this.getBaseMetaTileEntity().getWorld().setBlock(this.getBaseMetaTileEntity().getXCoord() + tPos.chunkPosX, this.getBaseMetaTileEntity().getYCoord() + tPos.chunkPosY, this.getBaseMetaTileEntity().getZCoord() + tPos.chunkPosZ, GregTech_API.sBlockReinforced, 4, 3); + if (isWoodLog(getBaseMetaTileEntity().getBlockOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ), getBaseMetaTileEntity().getMetaIDOffset(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ))) + getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord() + tPos.chunkPosX, getBaseMetaTileEntity().getYCoord() + tPos.chunkPosY, getBaseMetaTileEntity().getZCoord() + tPos.chunkPosZ, GregTech_API.sBlockReinforced, 4, 3); } running = false; return false; } else { - this.mMaxProgresstime = (int) Math.sqrt(tList1.size() * 240000); + mMaxProgresstime = (int) Math.sqrt(tList1.size() * 240000); } running = true; return true; } - private boolean checkAllBlockSides(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList1, ArrayList<ChunkPosition> aList2) { - p1 = false; - p2 = false; - p3 = false; - p4 = false; - p5 = false; - p6 = false; - Block tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX + 1, aY, aZ); - if (aX + 1 < 6 && (isWoodLog(tBlock, this.getBaseMetaTileEntity().getMetaIDOffset(aX + 1, aY, aZ)))) { + private boolean isWoodLog(Block log, int meta) { + for (int id : OreDictionary.getOreIDs(new ItemStack(log, 1, meta))) { + if (OreDictionary.getOreName(id).equals("logWood")) + return true; + } + String tTool = log.getHarvestTool(meta); + return OrePrefixes.log.contains(new ItemStack(log, 1, meta)) && ("axe".equals(tTool)) && (log.getMaterial() == Material.wood); + } + + private boolean checkAllBlockSides(int aX, int aY, int aZ, ArrayList<? super ChunkPosition> aList1, ArrayList<? super ChunkPosition> aList2) { + boolean expandToChunkXPos = false; + boolean expandToChunkXNeg = false; + boolean expandToChunkYPos = false; + boolean expandToChunkYNeg = false; + boolean expandToChunkZPos = false; + boolean expandToChunkZNeg = false; + + Block blockXPos = getBaseMetaTileEntity().getBlockOffset(aX + 1, aY, aZ); + if (aX + 1 < 6 && (isWoodLog(blockXPos, getBaseMetaTileEntity().getMetaIDOffset(aX + 1, aY, aZ)))) { if (!aList1.contains(new ChunkPosition(aX + 1, aY, aZ)) && (!aList2.contains(new ChunkPosition(aX + 1, aY, aZ)))) - p1 = true; - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { + expandToChunkXPos = true; + } else if (!(blockXPos == Blocks.dirt || blockXPos == Blocks.grass)) { return false; } - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX - 1, aY, aZ); - if (aX - 1 > -6 && (isWoodLog(tBlock, this.getBaseMetaTileEntity().getMetaIDOffset(aX - 1, aY, aZ)))) { + Block blockXNeg = getBaseMetaTileEntity().getBlockOffset(aX - 1, aY, aZ); + if (aX - 1 > -6 && (isWoodLog(blockXNeg, getBaseMetaTileEntity().getMetaIDOffset(aX - 1, aY, aZ)))) { if (!aList1.contains(new ChunkPosition(aX - 1, aY, aZ)) && (!aList2.contains(new ChunkPosition(aX - 1, aY, aZ)))) - p2 = true; - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { + expandToChunkXNeg = true; + } else if (!(blockXNeg == Blocks.dirt || blockXNeg == Blocks.grass)) { return false; } - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY + 1, aZ); - if (aY + 1 < 1 && (isWoodLog(tBlock, this.getBaseMetaTileEntity().getMetaIDOffset(aX, aY + 1, aZ)))) { + Block blockYPos = getBaseMetaTileEntity().getBlockOffset(aX, aY + 1, aZ); + if (aY + 1 < 1 && (isWoodLog(blockYPos, getBaseMetaTileEntity().getMetaIDOffset(aX, aY + 1, aZ)))) { if (!aList1.contains(new ChunkPosition(aX, aY + 1, aZ)) && (!aList2.contains(new ChunkPosition(aX, aY + 1, aZ)))) - p3 = true; - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass || (aX == 0 && aY == -1 && aZ == 0 && tBlock == GregTech_API.sBlockMachines))) { + expandToChunkYPos = true; + } else if (!(blockYPos == Blocks.dirt || blockYPos == Blocks.grass || (aX == 0 && aY == -1 && aZ == 0 && blockYPos == GregTech_API.sBlockMachines))) { return false; } - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY - 1, aZ); - if (aY - 1 > -6 && (isWoodLog(tBlock, this.getBaseMetaTileEntity().getMetaIDOffset(aX, aY - 1, aZ)))) { + Block blockYNeg = getBaseMetaTileEntity().getBlockOffset(aX, aY - 1, aZ); + if (aY - 1 > -6 && (isWoodLog(blockYNeg, getBaseMetaTileEntity().getMetaIDOffset(aX, aY - 1, aZ)))) { if (!aList1.contains(new ChunkPosition(aX, aY - 1, aZ)) && (!aList2.contains(new ChunkPosition(aX, aY - 1, aZ)))) - p4 = true; - } else if (tBlock != Blocks.brick_block) { + expandToChunkYNeg = true; + } else if (blockYNeg != Blocks.brick_block) { return false; } - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ + 1); - if (aZ + 1 < 6 && (isWoodLog(tBlock, this.getBaseMetaTileEntity().getMetaIDOffset(aX, aY, aZ + 1)))) { + Block blockZPos = getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ + 1); + if (aZ + 1 < 6 && (isWoodLog(blockZPos, getBaseMetaTileEntity().getMetaIDOffset(aX, aY, aZ + 1)))) { if (!aList1.contains(new ChunkPosition(aX, aY, aZ + 1)) && (!aList2.contains(new ChunkPosition(aX, aY, aZ + 1)))) - p5 = true; - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { + expandToChunkZPos = true; + } else if (!(blockZPos == Blocks.dirt || blockZPos == Blocks.grass)) { return false; } - tBlock = this.getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ - 1); - if (aZ - 1 > -6 && (isWoodLog(tBlock, this.getBaseMetaTileEntity().getMetaIDOffset(aX, aY, aZ - 1)))) { + Block blockZNeg = getBaseMetaTileEntity().getBlockOffset(aX, aY, aZ - 1); + if (aZ - 1 > -6 && (isWoodLog(blockZNeg, getBaseMetaTileEntity().getMetaIDOffset(aX, aY, aZ - 1)))) { if (!aList1.contains(new ChunkPosition(aX, aY, aZ - 1)) && (!aList2.contains(new ChunkPosition(aX, aY, aZ - 1)))) - p6 = true; - } else if (!(tBlock == Blocks.dirt || tBlock == Blocks.grass)) { + expandToChunkZNeg = true; + } else if (!(blockZNeg == Blocks.dirt || blockZNeg == Blocks.grass)) { return false; } aList1.add(new ChunkPosition(aX, aY, aZ)); - if (p1) aList2.add(new ChunkPosition(aX + 1, aY, aZ)); - if (p2) aList2.add(new ChunkPosition(aX - 1, aY, aZ)); - if (p3) aList2.add(new ChunkPosition(aX, aY + 1, aZ)); - if (p4) aList2.add(new ChunkPosition(aX, aY - 1, aZ)); - if (p5) aList2.add(new ChunkPosition(aX, aY, aZ + 1)); - if (p6) aList2.add(new ChunkPosition(aX, aY, aZ - 1)); + if (expandToChunkXPos) aList2.add(new ChunkPosition(aX + 1, aY, aZ)); + if (expandToChunkXNeg) aList2.add(new ChunkPosition(aX - 1, aY, aZ)); + if (expandToChunkYPos) aList2.add(new ChunkPosition(aX, aY + 1, aZ)); + if (expandToChunkYNeg) aList2.add(new ChunkPosition(aX, aY - 1, aZ)); + if (expandToChunkZPos) aList2.add(new ChunkPosition(aX, aY, aZ + 1)); + if (expandToChunkZNeg) aList2.add(new ChunkPosition(aX, aY, aZ - 1)); return true; } - private boolean isWoodLog(Block log, int meta){ - for (int id : OreDictionary.getOreIDs(new ItemStack(log, 1, meta))) { - if(OreDictionary.getOreName(id).equals("logWood")) - return true; - } - String tTool = log.getHarvestTool(meta); - return OrePrefixes.log.contains(new ItemStack(log, 1,meta)) && ((tTool != null) && (tTool.equals("axe"))) && (log.getMaterial() == Material.wood); - } - + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mWrench = true; mScrewdriver = true; @@ -224,19 +192,70 @@ public class GT_MetaTileEntity_Charcoal_Pit extends GT_MetaTileEntity_MultiBlock return true; } + @Override public int getMaxEfficiency(ItemStack aStack) { return 10000; } + @Override public int getPollutionPerTick(ItemStack aStack) { return 0; } + @Override public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } + + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Charcoal_Pit(mName); + } + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Charcoal Pile Igniter") + .addInfo("Controller for the Charcoal Pit") + .addInfo("Converts Logs into Brittle Charcoal blocks") + .addInfo("Will automatically start when valid") + .addPollutionAmount(100) + .addSeparator() + .beginVariableStructureBlock(3, 11, 3, 6, 3, 11, false) + .addStructureInfo("Can be up to 11x6x11 in size, shape doesn't matter") + .addOtherStructurePart("Bricks", "Bottom layer, under all wood logs") + .addOtherStructurePart("Dirt/Grass", "All logs must be covered by these, the controller, or bricks") + .addOtherStructurePart("Wood Logs", "Inside the previously mentioned blocks") + .addStructureInfo("No air between logs allowed") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == 1) { + if (aActive) return new ITexture[]{ + casingTexturePages[0][10], + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ROCK_BREAKER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + casingTexturePages[0][10], + TextureFactory.of(OVERLAY_FRONT_ROCK_BREAKER)}; + } + return new ITexture[]{casingTexturePages[0][10]}; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java index 962fa54bf3..f88dbfba1a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_Cleanroom.java @@ -2,7 +2,6 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMachineCallback; @@ -10,7 +9,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicHull; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; @@ -18,10 +17,12 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; +import org.lwjgl.input.Keyboard; import static gregtech.api.enums.GT_Values.debugCleanroom; - -import org.lwjgl.input.Keyboard; +import static gregtech.api.enums.Textures.BlockIcons.BLOCK_PLASCRETE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_CLEANROOM; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_CLEANROOM_ACTIVE; public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBase { private int mHeight = -1; @@ -34,303 +35,302 @@ public class GT_MetaTileEntity_Cleanroom extends GT_MetaTileEntity_MultiBlockBas super(aName); } - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Cleanroom(mName); - } + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Cleanroom(mName); + } - @Override + @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Cleanroom") - .addInfo("Controller block for the Cleanroom") - .addInfo("Consumes 40 EU/t when first turned on and 4 EU/t once at 100% efficiency when not overclocked")//? - .addInfo("An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV") - .addInfo("2 LV batteries + 1 LV generator or 1 MV generator")//? - .addInfo("Time required to reach full efficiency is propotional to the height of empty space within") - .addInfo("Make sure your Energy Hatch matches! ?") - .addSeparator() - .beginVariableStructureBlock(3, 15, 4, 15, 3, 15, true) - .addController("Top center") - .addCasingInfo("Plascrete", 20) - .addStructureInfo(GT_Values.cleanroomGlass+"% of the Plascrete can be replaced with Reinforced Glass")//check - .addOtherStructurePart("Filter Machine Casing", "Top besides controller and edges") - .addEnergyHatch("LV or MV, any casing")//check - .addMaintenanceHatch("Any casing") - .addStructureInfo("1x Reinforced Door (keep closed or efficiency will reduce)") - .addStructureInfo("Up to 10 Machine Hulls for Item & Energy transfer through walls") - .addStructureInfo("You can also use Diodes for more power") - .addStructureInfo("Diodes also count towards 10 Machine Hulls count limit") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Cleanroom") + .addInfo("Controller block for the Cleanroom") + .addInfo("Consumes 40 EU/t when first turned on and 4 EU/t once at 100% efficiency when not overclocked")//? + .addInfo("An energy hatch accepts up to 2A, so you can use 2A LV or 1A MV") + .addInfo("2 LV batteries + 1 LV generator or 1 MV generator")//? + .addInfo("Time required to reach full efficiency is propotional to the height of empty space within") + .addInfo("Make sure your Energy Hatch matches! ?") + .addSeparator() + .beginVariableStructureBlock(3, 15, 4, 15, 3, 15, true) + .addController("Top center") + .addCasingInfo("Plascrete", 20) + .addStructureInfo(GT_Values.cleanroomGlass + "% of the Plascrete can be replaced with Reinforced Glass")//check + .addOtherStructurePart("Filter Machine Casing", "Top besides controller and edges") + .addEnergyHatch("LV or MV, any casing")//check + .addMaintenanceHatch("Any casing") + .addStructureInfo("1x Reinforced Door (keep closed or efficiency will reduce)") + .addStructureInfo("Up to 10 Machine Hulls for Item & Energy transfer through walls") + .addStructureInfo("You can also use Diodes for more power") + .addStructureInfo("Diodes also count towards 10 Machine Hulls count limit") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getInformation(); + } else { + return tt.getStructureInformation(); + } } - @Override - public boolean checkRecipe(ItemStack aStack) { - mEfficiencyIncrease = 100; - // use the standard overclock mechanism to determine duration and estimate a maximum consumption - calculateOverclockedNessMulti(40, 45 * Math.max(1, mHeight - 1), 1, getMaxInputVoltage()); - // negate it to trigger the special energy consumption function. divide by 10 to get the actual final consumption. - mEUt /= -10; - return true; - } + @Override + public boolean checkRecipe(ItemStack aStack) { + mEfficiencyIncrease = 100; + // use the standard overclock mechanism to determine duration and estimate a maximum consumption + calculateOverclockedNessMulti(40, 45 * Math.max(1, mHeight - 1), 1, getMaxInputVoltage()); + // negate it to trigger the special energy consumption function. divide by 10 to get the actual final consumption. + mEUt /= -10; + return true; + } - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int x = 1; - int z = 1; - int y = 1; - int mDoorCount = 0; - int mHullCount = 0; - int mPlascreteCount = 0; - int mGlassCount = 0; - boolean doorState = false; - this.mUpdate = 100; + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int x = 1; + int z = 1; + int y = 1; + int mDoorCount = 0; + int mHullCount = 0; + int mPlascreteCount = 0; + int mGlassCount = 0; + boolean doorState = false; + this.mUpdate = 100; + + if (debugCleanroom) { + GT_Log.out.println( + "Cleanroom: Checking machine" + ); + } + for (int i = 1; i < 8; i++) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0); + if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { + if (tBlock == GregTech_API.sBlockReinforced || tMeta == 2) { + x = i; + break; + } else { + if (debugCleanroom) { + GT_Log.out.println("Cleanroom: Unable to detect room X edge?"); + } + return false; + } + } + } + for (int i = 1; i < 8; i++) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(0, 0, i); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(0, 0, i); + if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { + if (tBlock == GregTech_API.sBlockReinforced || tMeta == 2) { + z = i; + break; + } else { + if (debugCleanroom) { + GT_Log.out.println("Cleanroom: Unable to detect room Z edge?"); + } + return false; + } + } + } + //detect room square for filters + for (int i = -x + 1; i < x; i++) { + for (int j = -z + 1; j < z; j++) { + if (i == 0 && j == 0) continue; + Block tBlock = aBaseMetaTileEntity.getBlockOffset(j, 0, i); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(j, 0, i); + if (tBlock != GregTech_API.sBlockCasings3 && tMeta != 11) { + return false; + } + } + } - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Checking machine" - ); - } - for (int i = 1; i < 8; i++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0); - if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { - if (tBlock == GregTech_API.sBlockReinforced || tMeta == 2) { - x = i; - break; - } else { - if (debugCleanroom) { - GT_Log.out.println("Cleanroom: Unable to detect room X edge?"); - } - return false; - } - } - } - for (int i = 1; i < 8; i++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(0, 0, i); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(0, 0, i); - if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { - if (tBlock == GregTech_API.sBlockReinforced || tMeta == 2) { - z = i; - break; - } else { - if (debugCleanroom) { - GT_Log.out.println("Cleanroom: Unable to detect room Z edge?"); - } - return false; - } - } - } - //detect room square for filters - for (int i = -x+1; i < x; i++) { - for (int j = -z+1; j < z; j++) { - if (i == 0 && j == 0) continue; - Block tBlock = aBaseMetaTileEntity.getBlockOffset(j, 0, i); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(j, 0, i); - if (tBlock != GregTech_API.sBlockCasings3 && tMeta != 11) { - return false; - } - } - } - - for (int i = -1; i > -16; i--) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(x, i, z); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(x, i, z); - if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { - y = i + 1; - break; - } - } - if (y > -2) { - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Room not tall enough?" - ); - } - return false; - } - for (int dX = -x; dX <= x; dX++) { - for (int dZ = -z; dZ <= z; dZ++) { - for (int dY = 0; dY >= y; dY--) { - if (dX == -x || dX == x || dY == 0 || dY == y || dZ == -z || dZ == z) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(dX, dY, dZ); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(dX, dY, dZ); - if (dY == 0) { // TOP - if (dX == -x || dX == x || dZ == -z || dZ == z) { // Top Border - if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Non reinforced block on top edge? tMeta != 2" - ); - } - return false; - } - } else if (dX != 0 || dZ != 0) { // Top Inner exclude center - if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Non reinforced block on top face interior? tMeta != 11" - ); - } - return false; - } - } - } else if (tBlock == GregTech_API.sBlockReinforced && tMeta == 2) { - mPlascreteCount++; - } else if (tBlock != null && tBlock.getUnlocalizedName().equals("blockAlloyGlass")){ - ++mGlassCount; - } else { - IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); - if ((!this.addMaintenanceToMachineList(tTileEntity, 82)) && (!this.addEnergyInputToMachineList(tTileEntity, 82))) { - if (tBlock instanceof ic2.core.block.BlockIC2Door) { - if ((tMeta & 8) == 0) { - // let's not fiddle with bits anymore. - if (Math.abs(dZ) < z) // on side parallel to z axis - doorState = tMeta == 1 || tMeta == 3 || tMeta == 4 || tMeta == 6; - else if (Math.abs(dX) < x) // on side parallel to x axis - doorState = tMeta == 0 || tMeta == 2 || tMeta == 5 || tMeta == 7; - // corners ignored - } - mDoorCount++; - } else { - if (tTileEntity == null) { - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Missing block? Not a tTileEntity" - ); - } - return false; - } - IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); - if (aMetaTileEntity == null) { - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Missing block? Not a aMetaTileEntity" - ); - } - return false; - } - if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicHull) { - mHullCount++; - } else { - if (debugCleanroom) { - GT_Log.out.println( - "Cleanroom: Incorrect block?" - ); - } - return false; - } - } - } - } - } - } - } - } - if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1 || mDoorCount != 2 || mHullCount > 10) { - return false; - } + for (int i = -1; i > -16; i--) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(x, i, z); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(x, i, z); + if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { + y = i + 1; + break; + } + } + if (y > -2) { + if (debugCleanroom) { + GT_Log.out.println( + "Cleanroom: Room not tall enough?" + ); + } + return false; + } + for (int dX = -x; dX <= x; dX++) { + for (int dZ = -z; dZ <= z; dZ++) { + for (int dY = 0; dY >= y; dY--) { + if (dX == -x || dX == x || dY == 0 || dY == y || dZ == -z || dZ == z) { + Block tBlock = aBaseMetaTileEntity.getBlockOffset(dX, dY, dZ); + int tMeta = aBaseMetaTileEntity.getMetaIDOffset(dX, dY, dZ); + if (dY == 0) { // TOP + if (dX == -x || dX == x || dZ == -z || dZ == z) { // Top Border + if (tBlock != GregTech_API.sBlockReinforced || tMeta != 2) { + if (debugCleanroom) { + GT_Log.out.println( + "Cleanroom: Non reinforced block on top edge? tMeta != 2" + ); + } + return false; + } + } else if (dX != 0 || dZ != 0) { // Top Inner exclude center + if (tBlock != GregTech_API.sBlockCasings3 || tMeta != 11) { + if (debugCleanroom) { + GT_Log.out.println( + "Cleanroom: Non reinforced block on top face interior? tMeta != 11" + ); + } + return false; + } + } + } else if (tBlock == GregTech_API.sBlockReinforced && tMeta == 2) { + mPlascreteCount++; + } else if (tBlock != null && tBlock.getUnlocalizedName().equals("blockAlloyGlass")) { + ++mGlassCount; + } else { + IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(dX, dY, dZ); + if ((!this.addMaintenanceToMachineList(tTileEntity, 82)) && (!this.addEnergyInputToMachineList(tTileEntity, 82))) { + if (tBlock instanceof ic2.core.block.BlockIC2Door) { + if ((tMeta & 8) == 0) { + // let's not fiddle with bits anymore. + if (Math.abs(dZ) < z) // on side parallel to z axis + doorState = tMeta == 1 || tMeta == 3 || tMeta == 4 || tMeta == 6; + else if (Math.abs(dX) < x) // on side parallel to x axis + doorState = tMeta == 0 || tMeta == 2 || tMeta == 5 || tMeta == 7; + // corners ignored + } + mDoorCount++; + } else { + if (tTileEntity == null) { + if (debugCleanroom) { + GT_Log.out.println( + "Cleanroom: Missing block? Not a tTileEntity" + ); + } + return false; + } + IMetaTileEntity aMetaTileEntity = tTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + if (debugCleanroom) { + GT_Log.out.println( + "Cleanroom: Missing block? Not a aMetaTileEntity" + ); + } + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_BasicHull) { + mHullCount++; + } else { + if (debugCleanroom) { + GT_Log.out.println( + "Cleanroom: Incorrect block?" + ); + } + return false; + } + } + } + } + } + } + } + } + if (this.mMaintenanceHatches.size() != 1 || this.mEnergyHatches.size() != 1 || mDoorCount != 2 || mHullCount > 10) { + return false; + } - setCallbacks(x, y, z, aBaseMetaTileEntity); + setCallbacks(x, y, z, aBaseMetaTileEntity); if (doorState) { - this.mEfficiency = Math.max(0, this.mEfficiency - 200); + this.mEfficiency = Math.max(0, this.mEfficiency - 200); } - for(byte i = 0 ; i<6 ; i++){ - byte t = (byte) Math.max(1, (byte)(15/(10000f / this.mEfficiency))); - aBaseMetaTileEntity.setInternalOutputRedstoneSignal(i, t); + for (byte i = 0; i < 6; i++) { + byte t = (byte) Math.max(1, (byte) (15 / (10000f / this.mEfficiency))); + aBaseMetaTileEntity.setInternalOutputRedstoneSignal(i, t); } - float ratio = (((float)mPlascreteCount)/100f)* GT_Values.cleanroomGlass; + float ratio = (((float) mPlascreteCount) / 100f) * GT_Values.cleanroomGlass; this.mHeight = -y; - return mPlascreteCount>=20 && mGlassCount < (int) Math.floor(ratio); + return mPlascreteCount >= 20 && mGlassCount < (int) Math.floor(ratio); } - private void setCallbacks(int x, int y, int z, IGregTechTileEntity aBaseMetaTileEntity){ - for (int dX = -x + 1; dX <= x - 1; dX++) - for (int dZ = -z + 1; dZ <= z - 1; dZ++) - for (int dY = -1; dY >= y + 1; dY--) { - TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityOffset(dX, dY, dZ); + private void setCallbacks(int x, int y, int z, IGregTechTileEntity aBaseMetaTileEntity) { + for (int dX = -x + 1; dX <= x - 1; dX++) + for (int dZ = -z + 1; dZ <= z - 1; dZ++) + for (int dY = -1; dY >= y + 1; dY--) { + TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityOffset(dX, dY, dZ); - if (tTileEntity instanceof IGregTechTileEntity) { - IMetaTileEntity iMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity iMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); - if (iMetaTileEntity instanceof IMachineCallback<?>) - checkAndSetCallback((IMachineCallback<?>) iMetaTileEntity); + if (iMetaTileEntity instanceof IMachineCallback<?>) + checkAndSetCallback((IMachineCallback<?>) iMetaTileEntity); - } else if (tTileEntity instanceof IMachineCallback<?>) - checkAndSetCallback((IMachineCallback<?>) tTileEntity); - } - } + } else if (tTileEntity instanceof IMachineCallback<?>) + checkAndSetCallback((IMachineCallback<?>) tTileEntity); + } + } @SuppressWarnings("unchecked") private void checkAndSetCallback(IMachineCallback<?> iMachineCallback) { - if (debugCleanroom) - GT_Log.out.println( - "Cleanroom: IMachineCallback detected, checking for cleanroom: " + (iMachineCallback.getType() == this.getClass()) - ); - if (iMachineCallback.getType() == this.getClass()) - ((IMachineCallback<GT_MetaTileEntity_Cleanroom>) iMachineCallback).setCallbackBase(this); - } + if (debugCleanroom) + GT_Log.out.println( + "Cleanroom: IMachineCallback detected, checking for cleanroom: " + (iMachineCallback.getType() == this.getClass()) + ); + if (iMachineCallback.getType() == this.getClass()) + ((IMachineCallback<GT_MetaTileEntity_Cleanroom>) iMachineCallback).setCallbackBase(this); + } @Override - public boolean allowGeneralRedstoneOutput(){ - return true; + public boolean allowGeneralRedstoneOutput() { + return true; } public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == 0 || aSide == 1) { - return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.BLOCK_PLASCRETE), - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_TOP_CLEANROOM_ACTIVE : Textures.BlockIcons.OVERLAY_TOP_CLEANROOM)}; - + return new ITexture[]{TextureFactory.of(BLOCK_PLASCRETE), + TextureFactory.of(aActive ? OVERLAY_TOP_CLEANROOM_ACTIVE : OVERLAY_TOP_CLEANROOM)}; } - return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.BLOCK_PLASCRETE)}; + return new ITexture[]{TextureFactory.of(BLOCK_PLASCRETE)}; } - @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); - } + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MultiblockDisplay.png"); + } - @Override - public GT_Recipe.GT_Recipe_Map getRecipeMap() { - return null; - } + @Override + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return null; + } - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } - @Override - public boolean isFacingValid(byte aFacing) { - return aFacing > 1; - } + @Override + public boolean isFacingValid(byte aFacing) { + return aFacing > 1; + } - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java index f16c9d2d4f..e697208a4a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DieselEngine.java @@ -1,13 +1,7 @@ package gregtech.common.tileentities.machines.multi; -import java.util.ArrayList; -import java.util.Collection; - -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -16,7 +10,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -27,6 +21,16 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.input.Keyboard; + +import java.util.ArrayList; +import java.util.Collection; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlockBase { protected int fuelConsumption = 0; @@ -42,42 +46,51 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock super(aName); } + @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Combustion Generator") - .addInfo("Controller block for the Large Combustion Engine") - .addInfo("Supply Diesel Fuels and 1000L of Lubricant per hour to run") - .addInfo("Supply 40L/s of Oxygen to boost output (optional)") - .addInfo("Default: Produces 2048EU/t at 100% fuel efficiency") - .addInfo("Boosted: Produces 6144EU/t at 150% fuel efficiency") - .addInfo("You need to wait for it to reach 300% to output full power") - .addPollutionAmount(20 * getPollutionPerTick(null)) - .addSeparator() - .beginStructureBlock(3, 3, 4, false) - .addController("Front center") - .addCasingInfo("Stable Titanium Machine Casing", 16) - .addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks") - .addOtherStructurePart("Engine Intake Machine Casing", "8x, ring around controller") - .addStructureInfo("Engine Intake Casings must not be obstructed in front (only air blocks)") - .addDynamoHatch("Back center") - .addMaintenanceHatch("One of the casings next to a Gear Box") - .addMufflerHatch("Top middle back, above the rear Gear Box") - .addInputHatch("Diesel Fuel, next to a Gear Box") - .addInputHatch("Lubricant, next to a Gear Box") - .addInputHatch("Oxygen, optional, next to a Gear Box") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Combustion Generator") + .addInfo("Controller block for the Large Combustion Engine") + .addInfo("Supply Diesel Fuels and 1000L of Lubricant per hour to run") + .addInfo("Supply 40L/s of Oxygen to boost output (optional)") + .addInfo("Default: Produces 2048EU/t at 100% fuel efficiency") + .addInfo("Boosted: Produces 6144EU/t at 150% fuel efficiency") + .addInfo("You need to wait for it to reach 300% to output full power") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addSeparator() + .beginStructureBlock(3, 3, 4, false) + .addController("Front center") + .addCasingInfo("Stable Titanium Machine Casing", 16) + .addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks") + .addOtherStructurePart("Engine Intake Machine Casing", "8x, ring around controller") + .addStructureInfo("Engine Intake Casings must not be obstructed in front (only air blocks)") + .addDynamoHatch("Back center") + .addMaintenanceHatch("One of the casings next to a Gear Box") + .addMufflerHatch("Top middle back, above the rear Gear Box") + .addInputHatch("Diesel Fuel, next to a Gear Box") + .addInputHatch("Lubricant, next to a Gear Box") + .addInputHatch("Oxygen, optional, next to a Gear Box") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DIESEL_ENGINE)}; + if (aActive) return new ITexture[]{ + casingTexturePages[0][50], + TextureFactory.of(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + casingTexturePages[0][50], + TextureFactory.of(OVERLAY_FRONT_DIESEL_ENGINE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_DIESEL_ENGINE_GLOW).glow().build()}; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][50]}; + return new ITexture[]{casingTexturePages[0][50]}; } @Override @@ -85,6 +98,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock return getMaxEfficiency(aStack) > 0; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeDieselEngine.png"); } @@ -134,7 +148,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock ArrayList<FluidStack> tFluids = getStoredFluids(); Collection<GT_Recipe> tRecipeList = getFuelMap().mRecipeList; - if(tFluids.size() > 0 && tRecipeList != null) { //Does input hatch have a diesel fuel? + if(!tFluids.isEmpty() && tRecipeList != null) { //Does input hatch have a diesel fuel? for (FluidStack hatchFluid1 : tFluids) { //Loops through hatches for(GT_Recipe aFuel : tRecipeList) { //Loops through diesel fuel recipes FluidStack tLiquid; @@ -283,6 +297,7 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock return 1; } + @Override public int getMaxEfficiency(ItemStack aStack) { return boostEu ? 30000 : 10000; } @@ -315,12 +330,12 @@ public class GT_MetaTileEntity_DieselEngine extends GT_MetaTileEntity_MultiBlock } } - + return new String[]{ EnumChatFormatting.BLUE+"Diesel Engine"+EnumChatFormatting.RESET, StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET +" EU / "+ + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET +" EU", getIdealStatus() == getRepairStatus() ? EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET : EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java index 0fbac9aaf0..55f54c131d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DistillationTower.java @@ -2,13 +2,14 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; @@ -22,6 +23,11 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_GLOW; + public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_MultiBlockBase { private static final int CASING_INDEX = 49; private short controllerY; @@ -39,31 +45,39 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi } public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Distillery") - .addInfo("Controller block for the Distillation Tower") - .addInfo("Fluids are only put out at the correct height") - .addInfo("The correct height equals the slot number in the NEI recipe") - .addSeparator() - .beginVariableStructureBlock(3, 3, 3, 12, 3, 3, true) - .addController("Front bottom") - .addOtherStructurePart("Clean Stainless Steel Machine Casing", "7 x h - 5 (minimum)") - .addEnergyHatch("Any casing") - .addMaintenanceHatch("Any casing") - .addInputHatch("Any bottom layer casing") - .addOutputBus("Any bottom layer casing") - .addOutputHatch("2-11x Output Hatches (One per layer except bottom layer)") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Distillery") + .addInfo("Controller block for the Distillation Tower") + .addInfo("Fluids are only put out at the correct height") + .addInfo("The correct height equals the slot number in the NEI recipe") + .addSeparator() + .beginVariableStructureBlock(3, 3, 3, 12, 3, 3, true) + .addController("Front bottom") + .addOtherStructurePart("Clean Stainless Steel Machine Casing", "7 x h - 5 (minimum)") + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addInputHatch("Any bottom layer casing") + .addOutputBus("Any bottom layer casing") + .addOutputHatch("2-11x Output Hatches (One per layer except bottom layer)") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER)}; + if (aActive) + return new ITexture[]{ + BlockIcons.getCasingTextureForId(CASING_INDEX), + TextureFactory.of(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + BlockIcons.getCasingTextureForId(CASING_INDEX), + TextureFactory.of(OVERLAY_FRONT_DISTILLATION_TOWER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).glow().build()}; } return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)}; } @@ -89,8 +103,8 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi ArrayList<FluidStack> tFluidList = getStoredFluids(); for (int i = 0; i < tFluidList.size() - 1; i++) { for (int j = i + 1; j < tFluidList.size(); j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { tFluidList.remove(j--); } else { tFluidList.remove(i--); @@ -102,12 +116,12 @@ public class GT_MetaTileEntity_DistillationTower extends GT_MetaTileEntity_Multi long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(0, GT_Utility.getTier(tVoltage)); - FluidStack[] tFluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); + FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); if (tFluids.length > 0) { for (FluidStack tFluid : tFluids) { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sDistillationRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], new FluidStack[]{tFluid}); if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, tFluids, new ItemStack[]{})) { + if (tRecipe.isRecipeInputEqual(true, tFluids)) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java index fdb61e1945..d7b7e2aa4d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_DrillerBase.java @@ -3,7 +3,6 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.IChunkLoader; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -13,7 +12,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataA import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_ChunkManager; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import net.minecraft.block.Block; @@ -29,6 +28,11 @@ import net.minecraftforge.common.util.ForgeDirection; import java.util.ArrayList; import static gregtech.api.enums.GT_Values.W; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.getCasingTextureForId; public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_MultiBlockBase implements IChunkLoader { private static final ItemStack miningPipe = GT_ModHandler.getIC2Item("miningPipe", 0); @@ -39,7 +43,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu private Block casingBlock; private int casingMeta; private int frameMeta; - private int casingTextureIndex; + protected int casingTextureIndex; protected boolean isPickingPipes; private ForgeDirection back; @@ -73,10 +77,19 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu workState = STATE_DOWNWARD; } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(casingTextureIndex),new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ORE_DRILL)}; - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(casingTextureIndex)}; + if (aSide == aFacing) { + if (aActive) return new ITexture[]{ + getCasingTextureForId(casingTextureIndex), + TextureFactory.of(OVERLAY_FRONT_ORE_DRILL_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + getCasingTextureForId(casingTextureIndex), + TextureFactory.of(OVERLAY_FRONT_ORE_DRILL), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ORE_DRILL_GLOW).glow().build()}; + } + return new ITexture[]{getCasingTextureForId(casingTextureIndex)}; } @Override @@ -146,7 +159,9 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu /** * Added for compability reasons * @return true if the state is 0 false otherwise. + * @deprecated compatibility reason */ + @Deprecated protected boolean tryLowerPipe() { return tryLowerPipeState(false) == 0; } @@ -199,7 +214,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu if (pipes.stackSize == maxPipes) break; int needPipes = maxPipes - pipes.stackSize; - int transferPipes = storedItem.stackSize < needPipes ? storedItem.stackSize : needPipes; + int transferPipes = Math.min(storedItem.stackSize, needPipes); pipes.stackSize += transferPipes; storedItem.stackSize -= transferPipes; @@ -238,9 +253,10 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu } /** - * Readded for compability + * @deprecated Readded for compability * @return if no pipes are present */ + @Deprecated protected boolean waitForPipes(){ return !isHasMiningPipes(); } @@ -425,7 +441,7 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu return config; } - public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<GT_MetaTileEntity_Hatch_DataAccess>(); + public ArrayList<GT_MetaTileEntity_Hatch_DataAccess> mDataAccessHatches = new ArrayList<>(); /** * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb @@ -433,15 +449,14 @@ public abstract class GT_MetaTileEntity_DrillerBase extends GT_MetaTileEntity_Mu private boolean isCorrectDataItem(ItemStack aStack, int state){ if ((state & 1) != 0 && ItemList.Circuit_Integrated.isStackEqual(aStack, true, true)) return true; if ((state & 2) != 0 && ItemList.Tool_DataStick.isStackEqual(aStack, false, true)) return true; - if ((state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true)) return true; - return false; + return (state & 4) != 0 && ItemList.Tool_DataOrb.isStackEqual(aStack, false, true); } /** * @param state using bitmask, 1 for IntegratedCircuit, 2 for DataStick, 4 for DataOrb */ public ArrayList<ItemStack> getDataItems(int state) { - ArrayList<ItemStack> rList = new ArrayList<ItemStack>(); + ArrayList<ItemStack> rList = new ArrayList<>(); if (GT_Utility.isStackValid(mInventory[1]) && isCorrectDataItem(mInventory[1], state)) { rList.add(mInventory[1]); } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java index d4c1d0be10..5e99491c2e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ElectricBlastFurnace.java @@ -3,7 +3,6 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IHeatingCoil; import gregtech.api.interfaces.ITexture; @@ -12,7 +11,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; @@ -28,11 +27,16 @@ import org.lwjgl.input.Keyboard; import static gregtech.api.enums.GT_Values.V; import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_AbstractMultiFurnace { private int mHeatingCapacity = 0; private int controllerY; - private FluidStack[] pollutionFluidStacks = new FluidStack[]{Materials.CarbonDioxide.getGas(1000), + private final FluidStack[] pollutionFluidStacks = {Materials.CarbonDioxide.getGas(1000), Materials.CarbonMonoxide.getGas(1000), Materials.SulfurDioxide.getGas(1000)}; private static final int CASING_INDEX = 11; @@ -76,19 +80,27 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab .addStructureInfo("Recovery amount scales with Muffler Hatch tier") .addOutputHatch("Platline fluids, Any bottom layer casing") .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return tt.getStructureInformation(); + } else { + return tt.getInformation(); } } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE)}; + if (aActive) + return new ITexture[]{ + casingTexturePages[0][CASING_INDEX], + TextureFactory.of(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + casingTexturePages[0][CASING_INDEX], + TextureFactory.of(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_GLOW).glow().build()}; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]}; + return new ITexture[]{casingTexturePages[0][CASING_INDEX]}; } @Override @@ -124,7 +136,7 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sBlastRecipes.findRecipe( getBaseMetaTileEntity(), false, - gregtech.api.enums.GT_Values.V[tTier], + V[tTier], tFluids, tInputs ); @@ -373,17 +385,17 @@ public class GT_MetaTileEntity_ElectricBlastFurnace extends GT_MetaTileEntity_Ab } return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + Integer.toString(mProgresstime / 20) + EnumChatFormatting.RESET + " s / " + - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime / 20) + EnumChatFormatting.RESET + " s", - StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET + " EU / " + - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET + " EU", - StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + Long.toString(getMaxInputVoltage()) + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " + + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + EnumChatFormatting.YELLOW + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " + EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + - EnumChatFormatting.YELLOW + Float.toString(mEfficiency / 100.0F) + EnumChatFormatting.RESET + " %", + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", StatCollector.translateToLocal("GT5U.EBF.heat") + ": " + EnumChatFormatting.GREEN + mHeatingCapacity + EnumChatFormatting.RESET + " K", StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java index 363d689c84..2457a65dec 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ExtremeDieselEngine.java @@ -1,17 +1,14 @@ package gregtech.common.tileentities.machines.multi; -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import net.minecraft.block.Block; @@ -19,6 +16,13 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import org.lwjgl.input.Keyboard; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_DieselEngine { @@ -32,34 +36,34 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Combustion Generator") - .addInfo("Controller block for the Extreme Combustion Engine") - .addInfo("Supply High Octane Gasoline and 8000L of Lubricant per hour to run") - .addInfo("Supply 320L/s of Liquid Oxygen to boost output (optional)") - .addInfo("Default: Produces 8192EU/t at 100% fuel efficiency") - .addInfo("Boosted: Produces 32768EU/t at 400% fuel efficiency") - .addInfo("You need to wait for it to reach 400% to output full power") - .addPollutionAmount(20 * getPollutionPerTick(null)) - .addSeparator() - .beginStructureBlock(3, 3, 4, false) - .addController("Front center") - .addCasingInfo("Robust Tungstensteel Machine Casing", 16) - .addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks") - .addOtherStructurePart("Extreme Engine Intake Machine Casing", "8x, ring around controller") - .addStructureInfo("Extreme Engine Intake Casings must not be obstructed in front (only air blocks)") - .addDynamoHatch("Back center") - .addMaintenanceHatch("One of the casings next to a Gear Box") - .addMufflerHatch("Top middle back, above the rear Gear Box") - .addInputHatch("HOG, next to a Gear Box") - .addInputHatch("Lubricant, next to a Gear Box") - .addInputHatch("Liquid Oxygen, optional, next to a Gear Box") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Combustion Generator") + .addInfo("Controller block for the Extreme Combustion Engine") + .addInfo("Supply High Octane Gasoline and 8000L of Lubricant per hour to run") + .addInfo("Supply 320L/s of Liquid Oxygen to boost output (optional)") + .addInfo("Default: Produces 8192EU/t at 100% fuel efficiency") + .addInfo("Boosted: Produces 32768EU/t at 400% fuel efficiency") + .addInfo("You need to wait for it to reach 400% to output full power") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addSeparator() + .beginStructureBlock(3, 3, 4, false) + .addController("Front center") + .addCasingInfo("Robust Tungstensteel Machine Casing", 16) + .addOtherStructurePart("Titanium Gear Box Machine Casing", "Inner 2 blocks") + .addOtherStructurePart("Extreme Engine Intake Machine Casing", "8x, ring around controller") + .addStructureInfo("Extreme Engine Intake Casings must not be obstructed in front (only air blocks)") + .addDynamoHatch("Back center") + .addMaintenanceHatch("One of the casings next to a Gear Box") + .addMufflerHatch("Top middle back, above the rear Gear Box") + .addInputHatch("HOG, next to a Gear Box") + .addInputHatch("Lubricant, next to a Gear Box") + .addInputHatch("Liquid Oxygen, optional, next to a Gear Box") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } @Override @@ -70,9 +74,16 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][60], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_EXTREME_DIESEL_ENGINE)}; + if (aActive) return new ITexture[]{ + casingTexturePages[0][60], + TextureFactory.of(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + casingTexturePages[0][60], + TextureFactory.of(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_EXTREME_DIESEL_ENGINE_GLOW).glow().build()}; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][60]}; + return new ITexture[]{casingTexturePages[0][60]}; } @Override @@ -176,8 +187,8 @@ public class GT_MetaTileEntity_ExtremeDieselEngine extends GT_MetaTileEntity_Die return new String[]{ EnumChatFormatting.BLUE+"Extreme Diesel Engine"+EnumChatFormatting.RESET, StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET +" EU / "+ + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET +" EU", getIdealStatus() == getRepairStatus() ? EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET : EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index 62b6feacc7..94f812e5a9 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -1,11 +1,9 @@ package gregtech.common.tileentities.machines.multi; import gregtech.GT_Mod; -import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; import gregtech.api.gui.GT_Container_MultiMachine; -import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; @@ -15,7 +13,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_GUIContainer_FusionReactor; @@ -30,11 +28,23 @@ import net.minecraftforge.fluids.FluidStack; import java.util.ArrayList; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW; + public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity_MultiBlockBase { public GT_Recipe mLastRecipe; public int mEUStore; + static { + Textures.BlockIcons.setCasingTextureForId(52, + TextureFactory.of( + TextureFactory.of(MACHINE_CASING_FUSION_GLASS_YELLOW), + TextureFactory.builder().addIcon(MACHINE_CASING_FUSION_GLASS_YELLOW_GLOW).glow().build() + )); + } + public GT_MetaTileEntity_FusionComputer(int aID, String aName, String aNameRegional, int tier) { super(aID, aName, aNameRegional); } @@ -57,8 +67,10 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity return new GT_GUIContainer_FusionReactor(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "FusionComputer.png", GT_Recipe.GT_Recipe_Map.sFusionRecipes.mNEIName); } + @Override public abstract MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity); + @Override public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { return aSide != getBaseMetaTileEntity().getFrontFacing(); @@ -220,21 +232,17 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity public abstract String[] getDescription(); + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - ITexture[] sTexture; - if (aSide == aFacing) { - sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)), new GT_RenderedTexture(getIconOverlay())}; - } else { - if (!aActive) { - sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; - } else { - sTexture = new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, Dyes.getModulation(-1, Dyes._NULL.mRGBa))}; - } - } - return sTexture; + if (aSide == aFacing) return new ITexture[]{TextureFactory.of(MACHINE_CASING_FUSION_GLASS), getTextureOverlay()}; + if (aActive) return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(52)}; + return new ITexture[]{TextureFactory.of(MACHINE_CASING_FUSION_GLASS)}; } - public abstract IIconContainer getIconOverlay(); + /** + * @return The list of textures overlay + */ + public abstract ITexture getTextureOverlay(); @Override public boolean isCorrectMachinePart(ItemStack aStack) { @@ -260,8 +268,8 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity int tFluidList_sS=tFluidList.size(); for (int i = 0; i < tFluidList_sS - 1; i++) { for (int j = i + 1; j < tFluidList_sS; j++) { - if (GT_Utility.areFluidsEqual((FluidStack) tFluidList.get(i), (FluidStack) tFluidList.get(j))) { - if (((FluidStack) tFluidList.get(i)).amount >= ((FluidStack) tFluidList.get(j)).amount) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { tFluidList.remove(j--); tFluidList_sS=tFluidList.size(); } else { tFluidList.remove(i--); tFluidList_sS=tFluidList.size(); @@ -420,6 +428,7 @@ public abstract class GT_MetaTileEntity_FusionComputer extends GT_MetaTileEntity return true; } + @Override public boolean drainEnergyInput(long aEU) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java index 9da832c81a..39b78c68bd 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer1.java @@ -1,17 +1,23 @@ package gregtech.common.tileentities.machines.multi; -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; +import org.lwjgl.input.Keyboard; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1_GLOW; public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionComputer { + private static final ITexture textureOverlay = TextureFactory.of( + TextureFactory.of(OVERLAY_FUSION1), + TextureFactory.builder().addIcon(OVERLAY_FUSION1_GLOW).glow().build()); + public GT_MetaTileEntity_FusionComputer1(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 6); } @@ -36,6 +42,11 @@ public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionC } @Override + public Block getCasing() { + return GregTech_API.sBlockCasings1; + } + + @Override public int getCasingMeta() { return 6; } @@ -50,45 +61,41 @@ public class GT_MetaTileEntity_FusionComputer1 extends GT_MetaTileEntity_FusionC return 15; } - public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fusion Reactor") - .addInfo("It's over 9000!!!") - .addInfo("Controller block for the Fusion Reactor Mk I") - .addInfo("2048EU/t and 10M EU capacity per Energy Hatch") - .addInfo("If the recipe has a startup cost greater than the") - .addInfo("number of energy hatches * cap, you can't do it") - .addSeparator() - .beginStructureBlock(15, 3, 15, false) - .addController("See diagram when placed") - .addCasingInfo("LuV Machine Casing", 79) - .addStructureInfo("Cover the coils with casing") - .addOtherStructurePart("Superconducting Coil Block", "Center part of the ring") - .addEnergyHatch("1-16, Specified casings") - .addInputHatch("2-16, Specified casings") - .addOutputHatch("1-16, Specified casings") - .addStructureInfo("ALL Hatches must be LuV or better") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } - } - @Override - public int tierOverclock() { - return 1; + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("It's over 9000!!!") + .addInfo("Controller block for the Fusion Reactor Mk I") + .addInfo("2048EU/t and 10M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addSeparator() + .beginStructureBlock(15, 3, 15, false) + .addController("See diagram when placed") + .addCasingInfo("LuV Machine Casing", 79) + .addStructureInfo("Cover the coils with casing") + .addOtherStructurePart("Superconducting Coil Block", "Center part of the ring") + .addEnergyHatch("1-16, Specified casings") + .addInputHatch("2-16, Specified casings") + .addOutputHatch("1-16, Specified casings") + .addStructureInfo("ALL Hatches must be LuV or better") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } @Override - public Block getCasing() { - return GregTech_API.sBlockCasings1; + public ITexture getTextureOverlay() { + return textureOverlay; } @Override - public IIconContainer getIconOverlay() { - return Textures.BlockIcons.OVERLAY_FUSION1; + public int tierOverclock() { + return 1; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java index 7a363f8f6f..2ffa8ba4e1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer2.java @@ -1,17 +1,23 @@ package gregtech.common.tileentities.machines.multi; -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; +import org.lwjgl.input.Keyboard; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION2_GLOW; public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionComputer { + private static final ITexture textureOverlay = TextureFactory.of( + TextureFactory.of(OVERLAY_FUSION2), + TextureFactory.builder().addIcon(OVERLAY_FUSION2_GLOW).glow().build()); + public GT_MetaTileEntity_FusionComputer2(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 6); } @@ -36,6 +42,11 @@ public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionC } @Override + public Block getCasing() { + return GregTech_API.sBlockCasings4; + } + + @Override public int getCasingMeta() { return 6; } @@ -50,44 +61,40 @@ public class GT_MetaTileEntity_FusionComputer2 extends GT_MetaTileEntity_FusionC return 7; } - public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fusion Reactor") - .addInfo("It's over 9000!!!") - .addInfo("Controller block for the Fusion Reactor Mk II") - .addInfo("4096EU/t and 20M EU capacity per Energy Hatch") - .addInfo("If the recipe has a startup cost greater than the") - .addInfo("number of energy hatches * cap, you can't do it") - .addSeparator() - .beginStructureBlock(15, 3, 15, false) - .addController("See diagram when placed") - .addCasingInfo("Fusion Machine Casing", 79) - .addStructureInfo("Cover the coils with casing") - .addOtherStructurePart("Fusion Coil Block", "Center part of the ring") - .addEnergyHatch("1-16, Specified casings") - .addInputHatch("2-16, Specified casings") - .addOutputHatch("1-16, Specified casings") - .addStructureInfo("ALL Hatches must be ZPM or better") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } - } - @Override - public int tierOverclock() { - return 2; + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("It's over 9000!!!") + .addInfo("Controller block for the Fusion Reactor Mk II") + .addInfo("4096EU/t and 20M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addSeparator() + .beginStructureBlock(15, 3, 15, false) + .addController("See diagram when placed") + .addCasingInfo("Fusion Machine Casing", 79) + .addStructureInfo("Cover the coils with casing") + .addOtherStructurePart("Fusion Coil Block", "Center part of the ring") + .addEnergyHatch("1-16, Specified casings") + .addInputHatch("2-16, Specified casings") + .addOutputHatch("1-16, Specified casings") + .addStructureInfo("ALL Hatches must be ZPM or better") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } @Override - public Block getCasing() { - return GregTech_API.sBlockCasings4; + public ITexture getTextureOverlay() { + return textureOverlay; } @Override - public IIconContainer getIconOverlay() { - return Textures.BlockIcons.OVERLAY_FUSION2; + public int tierOverclock() { + return 2; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java index a575427791..e8ae396954 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer3.java @@ -1,17 +1,23 @@ package gregtech.common.tileentities.machines.multi; -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import net.minecraft.block.Block; +import org.lwjgl.input.Keyboard; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION3_GLOW; public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionComputer { + private static final ITexture textureOverlay = TextureFactory.of( + TextureFactory.of(OVERLAY_FUSION3), + TextureFactory.builder().addIcon(OVERLAY_FUSION3_GLOW).glow().build()); + public GT_MetaTileEntity_FusionComputer3(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, 6); } @@ -36,6 +42,11 @@ public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionC } @Override + public Block getCasing() { + return GregTech_API.sBlockCasings4; + } + + @Override public int getCasingMeta() { return 8; } @@ -50,45 +61,41 @@ public class GT_MetaTileEntity_FusionComputer3 extends GT_MetaTileEntity_FusionC return 7; } - public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fusion Reactor") - .addInfo("A SUN DOWN ON EARTH") - .addInfo("Controller block for the Fusion Reactor Mk III") - .addInfo("8192EU/t and 40M EU capacity per Energy Hatch") - .addInfo("If the recipe has a startup cost greater than the") - .addInfo("number of energy hatches * cap, you can't do it") - .addSeparator() - .beginStructureBlock(15, 3, 15, false) - .addController("See diagram when placed") - .addCasingInfo("Fusion Machine Casing Mk II", 79) - .addStructureInfo("Cover the coils with casing") - .addOtherStructurePart("Fusion Coil Block", "Center part of the ring") - .addEnergyHatch("1-16, Specified casings") - .addInputHatch("2-16, Specified casings") - .addOutputHatch("1-16, Specified casings") - .addStructureInfo("ALL Hatches must be UV or better") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } - } - @Override - public int tierOverclock() { - return 4; + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Fusion Reactor") + .addInfo("A SUN DOWN ON EARTH") + .addInfo("Controller block for the Fusion Reactor Mk III") + .addInfo("8192EU/t and 40M EU capacity per Energy Hatch") + .addInfo("If the recipe has a startup cost greater than the") + .addInfo("number of energy hatches * cap, you can't do it") + .addSeparator() + .beginStructureBlock(15, 3, 15, false) + .addController("See diagram when placed") + .addCasingInfo("Fusion Machine Casing Mk II", 79) + .addStructureInfo("Cover the coils with casing") + .addOtherStructurePart("Fusion Coil Block", "Center part of the ring") + .addEnergyHatch("1-16, Specified casings") + .addInputHatch("2-16, Specified casings") + .addOutputHatch("1-16, Specified casings") + .addStructureInfo("ALL Hatches must be UV or better") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } @Override - public Block getCasing() { - return GregTech_API.sBlockCasings4; + public ITexture getTextureOverlay() { + return textureOverlay; } @Override - public IIconContainer getIconOverlay() { - return Textures.BlockIcons.OVERLAY_FUSION3; + public int tierOverclock() { + return 4; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java index dac2183f7f..9ce1de3fec 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java @@ -1,9 +1,6 @@ package gregtech.common.tileentities.machines.multi; -import org.lwjgl.input.Keyboard; - import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -12,7 +9,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; @@ -25,6 +22,13 @@ import net.minecraft.util.StatCollector; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.input.Keyboard; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBlockBase { public static float penalty_per_config = 0.015f; // penalize 1.5% efficiency per circuitry level (1-25) @@ -43,31 +47,32 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc super(aName); } + @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Heat Exchanger") - .addInfo("Controller Block for the Large Heat Exchanger") - .addInfo("More complicated than a Fusion Reactor. Seriously") - .addInfo("Inputs are Hot Coolant or Lava") - .addInfo("Outputs Coolant or Pahoehoe Lava and SH Steam/Steam") - .addInfo("Read the wiki article to understand how it works") - .addInfo("Then go to the Discord to understand the wiki") - .addSeparator() - .beginStructureBlock(3, 4, 3, false) - .addController("Front bottom") - .addCasingInfo("Stable Titanium Machine Casing", 20) - .addOtherStructurePart("Titanium Pipe Casing", "Center 2 blocks") - .addMaintenanceHatch("Any casing") - .addInputHatch("Hot fluid, bottom center") - .addInputHatch("Distilled water, any casing") - .addOutputHatch("Cold fluid, top center") - .addOutputHatch("Steam/SH Steam, any casing") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Heat Exchanger") + .addInfo("Controller Block for the Large Heat Exchanger") + .addInfo("More complicated than a Fusion Reactor. Seriously") + .addInfo("Inputs are Hot Coolant or Lava") + .addInfo("Outputs Coolant or Pahoehoe Lava and SH Steam/Steam") + .addInfo("Read the wiki article to understand how it works") + .addInfo("Then go to the Discord to understand the wiki") + .addSeparator() + .beginStructureBlock(3, 4, 3, false) + .addController("Front bottom") + .addCasingInfo("Stable Titanium Machine Casing", 20) + .addOtherStructurePart("Titanium Pipe Casing", "Center 2 blocks") + .addMaintenanceHatch("Any casing") + .addInputHatch("Hot fluid, bottom center") + .addInputHatch("Distilled water, any casing") + .addOutputHatch("Cold fluid, top center") + .addOutputHatch("Steam/SH Steam, any casing") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } @Override @@ -82,25 +87,38 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc super.saveNBTData(aNBT); } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER)}; + if (aActive) + return new ITexture[]{ + casingTexturePages[0][50], + TextureFactory.of(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + casingTexturePages[0][50], + TextureFactory.of(OVERLAY_FRONT_HEAT_EXCHANGER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).glow().build()}; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][50]}; + return new ITexture[]{casingTexturePages[0][50]}; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeHeatExchanger.png"); } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; } + @Override public boolean isFacingValid(byte aFacing) { return aFacing > 1; } + @Override public boolean checkRecipe(ItemStack aStack) { if (mInputHotFluidHatch.getFluid() == null) return true; @@ -146,11 +164,10 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc this.mEUt = (int) (fluidAmountToConsume * steam_output_multiplier * efficiency); if (do_lava) { mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2pahoehoelava", fluidAmountToConsume), true); - this.mEfficiencyIncrease = 80; } else { mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2coolant", fluidAmountToConsume), true); - this.mEfficiencyIncrease = 80; } + this.mEfficiencyIncrease = 80; return true; } @@ -161,6 +178,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc return usage; } + @Override public boolean onRunningTick(ItemStack aStack) { if (this.mEUt > 0) { int tGeneratedEU = (int) (this.mEUt * 2L * this.mEfficiency / 10000L); // APPROXIMATELY how much steam to generate. @@ -189,6 +207,7 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc return true; } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; @@ -287,21 +306,26 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc return 14; } + @Override public int getMaxEfficiency(ItemStack aStack) { return 10000; } + @Override public int getPollutionPerTick(ItemStack aStack) { return 0; } + @Override public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_HeatExchanger(this.mName); } @@ -314,17 +338,17 @@ public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBloc @Override public String[] getInfoData() { return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress")+": "+ - EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s", - StatCollector.translateToLocal("GT5U.multiblock.usage")+" "+StatCollector.translateToLocal("GT5U.LHE.steam")+": "+ - (superheated?EnumChatFormatting.RED:EnumChatFormatting.YELLOW) + Integer.toString(superheated?-2*mEUt:-mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.problems")+": "+ - EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+ - " "+StatCollector.translateToLocal("GT5U.multiblock.efficiency")+": "+ - EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %", - StatCollector.translateToLocal("GT5U.LHE.superheated")+": "+ (superheated?EnumChatFormatting.RED:EnumChatFormatting.BLUE) + superheated + EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.LHE.superheated")+" "+StatCollector.translateToLocal("GT5U.LHE.threshold")+": "+ EnumChatFormatting.GREEN + superheated_threshold + EnumChatFormatting.RESET + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.usage") + " " + StatCollector.translateToLocal("GT5U.LHE.steam") + ": " + + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.YELLOW) + (superheated ? -2 * mEUt : -mEUt) + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + + " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + StatCollector.translateToLocal("GT5U.LHE.superheated") + ": " + (superheated ? EnumChatFormatting.RED : EnumChatFormatting.BLUE) + superheated + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.LHE.superheated") + " " + StatCollector.translateToLocal("GT5U.LHE.threshold") + ": " + EnumChatFormatting.GREEN + superheated_threshold + EnumChatFormatting.RESET }; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java index 832374f4de..3d979bb862 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ImplosionCompressor.java @@ -2,12 +2,13 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -19,6 +20,11 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW; + public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_MultiBlockBase { public GT_MetaTileEntity_ImplosionCompressor(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -28,64 +34,79 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_ImplosionCompressor(this.mName); } + @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Implosion Compressor") - .addInfo("Explosions are fun") - .addInfo("Controller block for the Implosion Compressor") - .addPollutionAmount(20 * getPollutionPerTick(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfo("Solid Steel Machine Casing", 16) - .addStructureInfo("Casings can be replaced with Explosion Warning Signs") - .addEnergyHatch("Any casing") - .addMaintenanceHatch("Any casing") - .addMufflerHatch("Any casing") - .addInputBus("Any casing") - .addOutputBus("Any casing") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Implosion Compressor") + .addInfo("Explosions are fun") + .addInfo("Controller block for the Implosion Compressor") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front center") + .addCasingInfo("Solid Steel Machine Casing", 16) + .addStructureInfo("Casings can be replaced with Explosion Warning Signs") + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addMufflerHatch("Any casing") + .addInputBus("Any casing") + .addOutputBus("Any casing") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_IMPLOSION_COMPRESSOR)}; + if (aActive) return new ITexture[]{ + BlockIcons.casingTexturePages[0][16], + TextureFactory.of(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + BlockIcons.casingTexturePages[0][16], + TextureFactory.of(OVERLAY_FRONT_IMPLOSION_COMPRESSOR), + TextureFactory.builder().addIcon(OVERLAY_FRONT_IMPLOSION_COMPRESSOR_GLOW).glow().build()}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][16]}; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ImplosionCompressor.png"); } + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sImplosionRecipes; } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; } + @Override public boolean isFacingValid(byte aFacing) { return aFacing > 1; } + @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); int tInputList_sS=tInputList.size(); for (int i = 0; i < tInputList_sS - 1; i++) { for (int j = i + 1; j < tInputList_sS; j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { tInputList.remove(j--); tInputList_sS=tInputList.size(); } else { tInputList.remove(i--); tInputList_sS=tInputList.size(); @@ -94,8 +115,8 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul } } } - ItemStack[] tInputs = tInputList.toArray(new ItemStack[tInputList.size()]); - if (tInputList.size() > 0) { + ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); + if (!tInputList.isEmpty()) { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sImplosionRecipes.findRecipe(getBaseMetaTileEntity(), false, 9223372036854775807L, null, tInputs); if ((tRecipe != null) && (tRecipe.isRecipeInputEqual(true, null, tInputs))) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); @@ -117,13 +138,15 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul return false; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 20) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(5), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(5), 10, 1.0F, aX, aY, aZ); } } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; @@ -151,18 +174,22 @@ public class GT_MetaTileEntity_ImplosionCompressor extends GT_MetaTileEntity_Mul return tAmount >= 16; } + @Override public int getMaxEfficiency(ItemStack aStack) { return 10000; } + @Override public int getPollutionPerTick(ItemStack aStack) { return 500; } + @Override public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java index 2d8ae1f144..841a4fb57c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler.java @@ -4,11 +4,12 @@ import gregtech.GT_Mod; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; @@ -26,6 +27,10 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; import static gregtech.api.enums.GT_Values.STEAM_PER_WATER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_GLOW; public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_MultiBlockBase { private boolean firstRun = true; @@ -43,35 +48,36 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu super(aName); } + @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Boiler") - .addInfo("Controller block for the Large " + getCasingMaterial() + " Boiler") - .addInfo("Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s")//? - .addInfo("A programmed circuit in the main block throttles the boiler (-1000L/s per config)") - .addInfo(String.format("Diesel fuels have 1/4 efficiency - Takes %.2f seconds to heat up", 500.0 / getEfficiencyIncrease()))//? check semifluid again - .addPollutionAmount(20 * getPollutionPerTick(null)) - .addSeparator() - .beginStructureBlock(3, 5, 3, false) - .addController("Front bottom") - .addCasingInfo(getCasingMaterial() + " " + getCasingBlockType() + " Casing", 24)//? - .addOtherStructurePart(getCasingMaterial() + " Fire Boxes", "Bottom layer, 3 minimum") - .addOtherStructurePart(getCasingMaterial() + " Pipe Casing Blocks", "Inner 3 blocks") - .addMaintenanceHatch("Any firebox") - .addMufflerHatch("Any firebox") - .addInputBus("Solid fuel, Any firebox") - .addInputHatch("Liquid fuel, Any firebox") - .addStructureInfo("You can use either, or both") - .addInputHatch("Water, Any firebox") - .addOutputHatch("Steam, any casing") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Boiler") + .addInfo("Controller block for the Large " + getCasingMaterial() + " Boiler") + .addInfo("Produces " + (getEUt() * 40) * (runtimeBoost(20) / 20f) + "L of Steam with 1 Coal at " + getEUt() * 40 + "L/s")//? + .addInfo("A programmed circuit in the main block throttles the boiler (-1000L/s per config)") + .addInfo(String.format("Diesel fuels have 1/4 efficiency - Takes %.2f seconds to heat up", 500.0 / getEfficiencyIncrease()))//? check semifluid again + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addSeparator() + .beginStructureBlock(3, 5, 3, false) + .addController("Front bottom") + .addCasingInfo(getCasingMaterial() + " " + getCasingBlockType() + " Casing", 24)//? + .addOtherStructurePart(getCasingMaterial() + " Fire Boxes", "Bottom layer, 3 minimum") + .addOtherStructurePart(getCasingMaterial() + " Pipe Casing Blocks", "Inner 3 blocks") + .addMaintenanceHatch("Any firebox") + .addMufflerHatch("Any firebox") + .addInputBus("Solid fuel, Any firebox") + .addInputHatch("Liquid fuel, Any firebox") + .addStructureInfo("You can use either, or both") + .addInputHatch("Water, Any firebox") + .addOutputHatch("Steam, any casing") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } - + public abstract String getCasingMaterial(); public abstract Block getCasingBlock(); @@ -96,25 +102,37 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu public abstract int getEfficiencyIncrease(); + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex()), new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER)}; + if (aActive) return new ITexture[]{ + BlockIcons.getCasingTextureForId(getCasingTextureIndex()), + TextureFactory.of(OVERLAY_FRONT_LARGE_BOILER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + BlockIcons.getCasingTextureForId(getCasingTextureIndex()), + TextureFactory.of(OVERLAY_FRONT_LARGE_BOILER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_BOILER_GLOW).glow().build()}; } return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(getCasingTextureIndex())}; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeBoiler.png"); } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; } + @Override public boolean isFacingValid(byte aFacing) { return aFacing > 1; } + @Override public boolean checkRecipe(ItemStack aStack) { //Do we have an integrated circuit with a valid configuration? if (mInventory[1] != null && mInventory[1].getUnlocalizedName().startsWith("gt.integrated_circuit")) { @@ -183,6 +201,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu abstract int runtimeBoost(int mTime); + @Override public boolean onRunningTick(ItemStack aStack) { if (this.mEUt > 0) { if (this.mSuperEfficencyIncrease > 0) @@ -230,6 +249,7 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu super.onPostTick(aBaseMetaTileEntity, aTick); } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; @@ -290,19 +310,23 @@ public abstract class GT_MetaTileEntity_LargeBoiler extends GT_MetaTileEntity_Mu return tCasingAmount >= 24 && tFireboxAmount >= 3; } + @Override public int getMaxEfficiency(ItemStack aStack) { return 10000; } + @Override public int getPollutionPerTick(ItemStack aStack) { int adjustedEUOutput = Math.max(25, getEUt() - 25 * integratedCircuitConfig); return Math.max(1, 12 * adjustedEUOutput / getEUt()); } + @Override public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java index d462b9a36d..c9de809b58 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeChemicalReactor.java @@ -1,13 +1,12 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -16,214 +15,223 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.input.Keyboard; import java.util.ArrayList; -import org.lwjgl.input.Keyboard; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; public class GT_MetaTileEntity_LargeChemicalReactor extends GT_MetaTileEntity_MultiBlockBase { - private final int CASING_INDEX = 176; - - public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_MetaTileEntity_LargeChemicalReactor(String aName) { - super(aName); - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_LargeChemicalReactor(this.mName); - } - - @Override - public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Chemical Reactor") - .addInfo("Controller block for the Large Chemical Reactor") - .addInfo("Does not lose efficiency when overclocked") - .addInfo("Accepts fluids instead of fluid cells") - .addSeparator() - .beginStructureBlock(3, 3, 3, false) - .addController("Front center") - .addCasingInfo("Chemically Inert Machine Casing", 8) - .addOtherStructurePart("PTFE Pipe Machine Casing", "Center") - .addOtherStructurePart("Cupronickel Coil Block", "Adjacent to the PTFE Pipe Machine Casing") - .addEnergyHatch("Any casing") - .addMaintenanceHatch("Any casing") - .addInputBus("Any casing") - .addInputHatch("Any casing") - .addOutputBus("Any casing") - .addOutputHatch("Any casing") - .addStructureInfo("You can have multiple hatches/busses") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } - } - - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, - boolean aRedstone) { - if (aSide == aFacing) { - return new ITexture[] { - Textures.BlockIcons.casingTexturePages[1][48], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR) }; - } - return new ITexture[] { Textures.BlockIcons.casingTexturePages[1][48] }; - } - - @Override + private final int CASING_INDEX = 176; + + public GT_MetaTileEntity_LargeChemicalReactor(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + public GT_MetaTileEntity_LargeChemicalReactor(String aName) { + super(aName); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_LargeChemicalReactor(this.mName); + } + + @Override + public String[] getDescription() { + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Chemical Reactor") + .addInfo("Controller block for the Large Chemical Reactor") + .addInfo("Does not lose efficiency when overclocked") + .addInfo("Accepts fluids instead of fluid cells") + .addSeparator() + .beginStructureBlock(3, 3, 3, false) + .addController("Front center") + .addCasingInfo("Chemically Inert Machine Casing", 8) + .addOtherStructurePart("PTFE Pipe Machine Casing", "Center") + .addOtherStructurePart("Cupronickel Coil Block", "Adjacent to the PTFE Pipe Machine Casing") + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addInputBus("Any casing") + .addInputHatch("Any casing") + .addOutputBus("Any casing") + .addOutputHatch("Any casing") + .addStructureInfo("You can have multiple hatches/busses") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, + boolean aRedstone) { + if (aSide == aFacing) { + if (aActive) return new ITexture[]{ + casingTexturePages[1][48], + TextureFactory.of(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + casingTexturePages[1][48], + TextureFactory.of(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR), + TextureFactory.builder().addIcon(OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_GLOW).glow().build()}; + } + return new ITexture[]{casingTexturePages[1][48]}; + } + + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeChemicalReactor.png"); } - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return true; - } - - @Override - public boolean checkRecipe(ItemStack aStack) { - ArrayList<ItemStack> tInputList = getStoredInputs(); - int tInputList_sS = tInputList.size(); - for (int i = 0; i < tInputList_sS - 1; i++) { - for (int j = i + 1; j < tInputList_sS; j++) { - if (GT_Utility.areStacksEqual((ItemStack) tInputList.get(i), (ItemStack) tInputList.get(j))) { - if (((ItemStack) tInputList.get(i)).stackSize >= ((ItemStack) tInputList.get(j)).stackSize) { - tInputList.remove(j--); - tInputList_sS = tInputList.size(); - } else { - tInputList.remove(i--); - tInputList_sS = tInputList.size(); - break; - } - } - } - } - tInputList.add(mInventory[1]); - ItemStack[] inputs = tInputList.toArray(new ItemStack[tInputList.size()]); - - ArrayList<FluidStack> tFluidList = getStoredFluids(); - int tFluidList_sS = tFluidList.size(); - for (int i = 0; i < tFluidList_sS - 1; i++) { - for (int j = i + 1; j < tFluidList_sS; j++) { - if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { - if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { - tFluidList.remove(j--); - tFluidList_sS = tFluidList.size(); - } else { - tFluidList.remove(i--); - tFluidList_sS = tFluidList.size(); - break; - } - } - } - } - FluidStack[] fluids = tFluidList.toArray(new FluidStack[tFluidList.size()]); - - if (inputs.length > 0 || fluids.length > 0) { - long tVoltage = getMaxInputVoltage(); - byte tier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, - false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs); - if (tRecipe != null && tRecipe.isRecipeInputEqual(true, fluids, inputs)) { - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - - calculatePerfectOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); - } - - this.mOutputItems = tRecipe.mOutputs; - this.mOutputFluids = tRecipe.mFluidOutputs; - this.updateSlots(); - return true; - } - } - return false; - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { - int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; - int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; - int casingAmount = 0; - boolean hasHeatingCoil = false; - // x=width, z=depth, y=height - for (int x = -1 + xDir; x <= xDir + 1; x++) { - for (int z = -1 + zDir; z <= zDir + 1; z++) { - for (int y = -1; y <= 1; y++) { - if (x == 0 && y == 0 && z == 0) { - continue; - } - IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); - Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); - int centerCoords = 0; - if (x == xDir) { - centerCoords++; - } - if (y == 0) { - centerCoords++; - } - if (z == zDir) { - centerCoords++; - } - if (centerCoords == 3) { - if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { - continue; - } else { - return false; - } - } - if (centerCoords == 2 && block == GregTech_API.sBlockCasings5 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) { - hasHeatingCoil = true; - continue; - } - if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX) - && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) - && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { - if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) { - casingAmount++; - } else { - return false; - } - } - - } - } - - } - return casingAmount >= 8 && hasHeatingCoil && !mEnergyHatches.isEmpty() && !mMaintenanceHatches.isEmpty(); - } - - @Override - public int getMaxEfficiency(ItemStack aStack) { - return 10000; - } - - @Override - public int getPollutionPerTick(ItemStack aStack) { - return 0; - } - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return false; - } + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<ItemStack> tInputList = getStoredInputs(); + int tInputList_sS = tInputList.size(); + for (int i = 0; i < tInputList_sS - 1; i++) { + for (int j = i + 1; j < tInputList_sS; j++) { + if (GT_Utility.areStacksEqual(tInputList.get(i), tInputList.get(j))) { + if (tInputList.get(i).stackSize >= tInputList.get(j).stackSize) { + tInputList.remove(j--); + tInputList_sS = tInputList.size(); + } else { + tInputList.remove(i--); + tInputList_sS = tInputList.size(); + break; + } + } + } + } + tInputList.add(mInventory[1]); + ItemStack[] inputs = tInputList.toArray(new ItemStack[0]); + + ArrayList<FluidStack> tFluidList = getStoredFluids(); + int tFluidList_sS = tFluidList.size(); + for (int i = 0; i < tFluidList_sS - 1; i++) { + for (int j = i + 1; j < tFluidList_sS; j++) { + if (GT_Utility.areFluidsEqual(tFluidList.get(i), tFluidList.get(j))) { + if (tFluidList.get(i).amount >= tFluidList.get(j).amount) { + tFluidList.remove(j--); + tFluidList_sS = tFluidList.size(); + } else { + tFluidList.remove(i--); + tFluidList_sS = tFluidList.size(); + break; + } + } + } + } + FluidStack[] fluids = tFluidList.toArray(new FluidStack[0]); + + if (inputs.length > 0 || fluids.length > 0) { + long tVoltage = getMaxInputVoltage(); + byte tier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sMultiblockChemicalRecipes.findRecipe(getBaseMetaTileEntity(), false, + false, gregtech.api.enums.GT_Values.V[tier], fluids, inputs); + if (tRecipe != null && tRecipe.isRecipeInputEqual(true, fluids, inputs)) { + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + calculatePerfectOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, 1, tVoltage); + //In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) + return false; + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mOutputItems = tRecipe.mOutputs; + this.mOutputFluids = tRecipe.mFluidOutputs; + this.updateSlots(); + return true; + } + } + return false; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; + int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + int casingAmount = 0; + boolean hasHeatingCoil = false; + // x=width, z=depth, y=height + for (int x = -1 + xDir; x <= xDir + 1; x++) { + for (int z = -1 + zDir; z <= zDir + 1; z++) { + for (int y = -1; y <= 1; y++) { + if (x == 0 && y == 0 && z == 0) { + continue; + } + IGregTechTileEntity tileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(x, y, z); + Block block = aBaseMetaTileEntity.getBlockOffset(x, y, z); + int centerCoords = 0; + if (x == xDir) { + centerCoords++; + } + if (y == 0) { + centerCoords++; + } + if (z == zDir) { + centerCoords++; + } + if (centerCoords == 3) { + if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 1) { + continue; + } else { + return false; + } + } + if (centerCoords == 2 && block == GregTech_API.sBlockCasings5 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) { + hasHeatingCoil = true; + continue; + } + if (!addInputToMachineList(tileEntity, CASING_INDEX) && !addOutputToMachineList(tileEntity, CASING_INDEX) + && !addMaintenanceToMachineList(tileEntity, CASING_INDEX) + && !addEnergyInputToMachineList(tileEntity, CASING_INDEX)) { + if (block == GregTech_API.sBlockCasings8 && aBaseMetaTileEntity.getMetaIDOffset(x, y, z) == 0) { + casingAmount++; + } else { + return false; + } + } + + } + } + + } + return casingAmount >= 8 && hasHeatingCoil && !mEnergyHatches.isEmpty() && !mMaintenanceHatches.isEmpty(); + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 0; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java index 91bc7496a4..bb7062e4bd 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java @@ -1,11 +1,10 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; @@ -18,6 +17,11 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; import java.util.Collection; +import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS5; +import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; + public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeTurbine { public GT_MetaTileEntity_LargeTurbine_Gas(int aID, String aName, String aNameRegional) { @@ -30,29 +34,29 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_SS_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_SS5) : Textures.BlockIcons.casingTexturePages[0][58]}; + return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_SS_ACTIVE5) : TextureFactory.of(LARGETURBINE_SS5) : casingTexturePages[0][58]}; } public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Gas Turbine") - .addInfo("Controller block for the Large Gas Turbine") - .addInfo("Needs a Turbine, place inside controller") - .addPollutionAmount(20 * getPollutionPerTick(null)) - .addSeparator() - .beginStructureBlock(3, 3, 4, true) - .addController("Front center") - .addCasingInfo("Stainless Steel Turbine Casing", 24) - .addDynamoHatch("Back center") - .addMaintenanceHatch("Side centered") - .addMufflerHatch("Side centered") - .addInputHatch("Gas Fuel, Side centered") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Gas Turbine") + .addInfo("Controller block for the Large Gas Turbine") + .addInfo("Needs a Turbine, place inside controller") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addSeparator() + .beginStructureBlock(3, 3, 4, true) + .addController("Front center") + .addCasingInfo("Stainless Steel Turbine Casing", 24) + .addDynamoHatch("Back center") + .addMaintenanceHatch("Side centered") + .addMufflerHatch("Side centered") + .addInputHatch("Gas Fuel, Side centered") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } public int getFuelValue(FluidStack aLiquid) { @@ -98,7 +102,7 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! int fuelValue = getFuelValue(firstFuelType); - + if (aOptFlow < fuelValue) { // turbine too weak and/or fuel too powerful // at least consume 1L @@ -106,17 +110,17 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT // wastes the extra fuel and generate aOptFlow directly depleteInput(new FluidStack(firstFuelType, 1)); this.storedFluid += 1; - return GT_Utility.safeInt((long)aOptFlow * (long)aBaseEff / 10000L); + return GT_Utility.safeInt((long) aOptFlow * (long) aBaseEff / 10000L); } - - actualOptimalFlow = GT_Utility.safeInt((long)aOptFlow / fuelValue); + + actualOptimalFlow = GT_Utility.safeInt((long) aOptFlow / fuelValue); this.realOptFlow = actualOptimalFlow; - int remainingFlow = GT_Utility.safeInt((long)(actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. + int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. int flow = 0; int totalFlow = 0; - storedFluid=0; + storedFluid = 0; for (FluidStack aFluid : aFluids) { if (aFluid.isFluidEqual(firstFuelType)) { flow = Math.min(aFluid.amount, remainingFlow); // try to use up to 125% of optimal flow w/o exceeding remainingFlow @@ -126,15 +130,15 @@ public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeT totalFlow += flow; // track total input used } } - if(totalFlow<=0)return 0; - tEU = GT_Utility.safeInt((long)totalFlow * fuelValue); + if (totalFlow <= 0) return 0; + tEU = GT_Utility.safeInt((long) totalFlow * fuelValue); - if (totalFlow != actualOptimalFlow) { - float efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float)actualOptimalFlow); - tEU *= efficiency; - tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L); + if (totalFlow == actualOptimalFlow) { + tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L); } else { - tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L); + float efficiency = 1.0f - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); + tEU *= efficiency; + tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L); } return tEU; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java index ef894f29dc..b92a73120b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java @@ -2,11 +2,10 @@ package gregtech.common.tileentities.machines.multi; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; @@ -19,12 +18,16 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; +import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI5; +import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TI_ACTIVE5; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_LargeTurbine { public boolean achievement = false; - private boolean looseFit=false; + private boolean looseFit = false; public GT_MetaTileEntity_LargeTurbine_HPSteam(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -36,31 +39,31 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TI_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TI5) : Textures.BlockIcons.casingTexturePages[0][59]}; + return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_TI_ACTIVE5) : TextureFactory.of(LARGETURBINE_TI5) : casingTexturePages[0][59]}; } public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Steam Turbine") - .addInfo("Controller block for the Large High Pressure Steam Turbine") - .addInfo("Needs a Turbine, place inside controller") - .addInfo("Outputs Steam as well as producing power") - .addInfo("Power output depends on turbine and fitting") - .addInfo("Use screwdriver to adjust fitting of turbine") - .addSeparator() - .beginStructureBlock(3, 3, 4, true) - .addController("Front center") - .addCasingInfo("Titanium Turbine Casing", 24) - .addDynamoHatch("Back center") - .addMaintenanceHatch("Side centered") - .addInputHatch("Superheated Steam, Side centered") - .addOutputHatch("Steam, Side centered") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Steam Turbine") + .addInfo("Controller block for the Large High Pressure Steam Turbine") + .addInfo("Needs a Turbine, place inside controller") + .addInfo("Outputs Steam as well as producing power") + .addInfo("Power output depends on turbine and fitting") + .addInfo("Use screwdriver to adjust fitting of turbine") + .addSeparator() + .beginStructureBlock(3, 3, 4, true) + .addController("Front center") + .addCasingInfo("Titanium Turbine Casing", 24) + .addDynamoHatch("Back center") + .addMaintenanceHatch("Side centered") + .addInputHatch("Superheated Steam, Side centered") + .addOutputHatch("Steam, Side centered") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } @Override @@ -90,25 +93,25 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La @Override int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) { - if(looseFit) { - aOptFlow*=4; - if(aBaseEff>10000){ - aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f); - aBaseEff=7500; - }else if(aBaseEff>7500){ - aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f); - aBaseEff*=0.75f; - }else{ - aBaseEff*=0.75f; + if (looseFit) { + aOptFlow *= 4; + if (aBaseEff > 10000) { + aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); + aBaseEff = 7500; + } else if (aBaseEff > 7500) { + aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); + aBaseEff *= 0.75f; + } else { + aBaseEff *= 0.75f; } } int tEU = 0; int totalFlow = 0; // Byproducts are based on actual flow int flow = 0; - int remainingFlow = GT_Utility.safeInt((long)(aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. + int remainingFlow = GT_Utility.safeInt((long) (aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. this.realOptFlow = aOptFlow; - storedFluid=0; + storedFluid = 0; for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { final FluidStack aFluidStack = aFluids.get(i); if (GT_ModHandler.isSuperHeatedSteam(aFluidStack)) { @@ -119,25 +122,25 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La totalFlow += flow; // track total input used if (!achievement) { try { - GT_Mod.instance.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "efficientsteam"); + GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "efficientsteam"); } catch (Exception ignored) { } achievement = true; } - } else if(GT_ModHandler.isAnySteam(aFluidStack)){ + } else if (GT_ModHandler.isAnySteam(aFluidStack)) { depleteInput(new FluidStack(aFluidStack, aFluidStack.amount)); } } - if(totalFlow<=0)return 0; + if (totalFlow <= 0) return 0; tEU = totalFlow; addOutput(GT_ModHandler.getSteam(totalFlow)); - if (totalFlow != aOptFlow) { - float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float)aOptFlow); + if (totalFlow == aOptFlow) { + tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L); + } else { + float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float) aOptFlow); //if(totalFlow>aOptFlow){efficiency = 1.0f;} tEU *= efficiency; - tEU = Math.max(1, GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L)); - } else { - tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 10000L); + tEU = Math.max(1, GT_Utility.safeInt((long) tEU * (long) aBaseEff / 10000L)); } return tEU; @@ -146,33 +149,32 @@ public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_La @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing()) { - looseFit^=true; + looseFit ^= true; GT_Utility.sendChatToPlayer(aPlayer, looseFit ? trans("500", "Fitting: Loose - More Flow") : trans("501", "Fitting: Tight - More Efficiency")); } } @Override public int getDamageToComponent(ItemStack aStack) { - return (looseFit && XSTR_INSTANCE.nextInt(4)==0)?0:1; + return (looseFit && XSTR_INSTANCE.nextInt(4) == 0) ? 0 : 1; } - - + @Override public String[] getInfoData() { - super.looseFit = looseFit; - return super.getInfoData(); + super.looseFit = looseFit; + return super.getInfoData(); } @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setBoolean("turbineFitting",looseFit); + aNBT.setBoolean("turbineFitting", looseFit); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - looseFit=aNBT.getBoolean("turbineFitting"); + looseFit = aNBT.getBoolean("turbineFitting"); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java index a6dd6ed098..64f4b4c377 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -6,6 +6,7 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.api.render.TextureFactory; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; import gregtech.api.objects.GT_RenderedTexture; @@ -25,6 +26,10 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; import java.util.Collection; +import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; + public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_LargeTurbine { public GT_MetaTileEntity_LargeTurbine_Plasma(int aID, String aName, String aNameRegional) { @@ -37,29 +42,29 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TU_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TU5) : Textures.BlockIcons.casingTexturePages[0][60]}; + return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_TU_ACTIVE5) : TextureFactory.of(Textures.BlockIcons.LARGETURBINE_TU5) : casingTexturePages[0][60]}; } public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Plasma Turbine") - .addInfo("Controller block for the Large Plasma Generator") - .addInfo("Needs a Turbine, place inside controller") - .addInfo("Use your Fusion Reactor to produce the Plasma") - .addSeparator() - .beginStructureBlock(3, 3, 4, true) - .addController("Front center") - .addCasingInfo("Tungstensteel Turbine Casing", 24) - .addDynamoHatch("Back center") - .addMaintenanceHatch("Side centered") - .addInputHatch("Plasma Fluid, Side centered") - .addOutputHatch("Molten Fluid, optional, Side centered") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Plasma Turbine") + .addInfo("Controller block for the Large Plasma Generator") + .addInfo("Needs a Turbine, place inside controller") + .addInfo("Use your Fusion Reactor to produce the Plasma") + .addSeparator() + .beginStructureBlock(3, 3, 4, true) + .addController("Front center") + .addCasingInfo("Tungstensteel Turbine Casing", 24) + .addDynamoHatch("Back center") + .addMaintenanceHatch("Side centered") + .addInputHatch("Plasma Fluid, Side centered") + .addOutputHatch("Molten Fluid, optional, Side centered") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } public int getFuelValue(FluidStack aLiquid) { @@ -103,18 +108,18 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar aOptFlow *= 800;//CHANGED THINGS HERE, check recipe runs once per 20 ticks int tEU = 0; - int actualOptimalFlow = 0; + int actualOptimalFlow = 0; FluidStack firstFuelType = new FluidStack(aFluids.get(0), 0); // Identify a SINGLE type of fluid to process. Doesn't matter which one. Ignore the rest! int fuelValue = getFuelValue(firstFuelType); - actualOptimalFlow = GT_Utility.safeInt((long)Math.ceil((double)aOptFlow / (double)fuelValue)); + actualOptimalFlow = GT_Utility.safeInt((long) Math.ceil((double) aOptFlow / (double) fuelValue)); this.realOptFlow = actualOptimalFlow; // For scanner info - int remainingFlow = GT_Utility.safeInt((long)(actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. + int remainingFlow = GT_Utility.safeInt((long) (actualOptimalFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. int flow = 0; int totalFlow = 0; - storedFluid=0; + storedFluid = 0; for (FluidStack aFluid : aFluids) { if (aFluid.isFluidEqual(firstFuelType)) { flow = Math.min(aFluid.amount, remainingFlow); // try to use up w/o exceeding remainingFlow @@ -125,29 +130,29 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } } String fn = FluidRegistry.getFluidName(firstFuelType); - String[] nameSegments = fn.split("\\.",2); - if (nameSegments.length==2){ - String outputName=nameSegments[1]; + String[] nameSegments = fn.split("\\.", 2); + if (nameSegments.length == 2) { + String outputName = nameSegments[1]; FluidStack output = FluidRegistry.getFluidStack(outputName, totalFlow); - if (output==null){ - output = FluidRegistry.getFluidStack("molten."+outputName, totalFlow); + if (output == null) { + output = FluidRegistry.getFluidStack("molten." + outputName, totalFlow); } - if (output!=null) { + if (output != null) { addOutput(output); } } - if(totalFlow<=0)return 0; - tEU = GT_Utility.safeInt((long)((fuelValue / 20D) * (double)totalFlow)); + if (totalFlow <= 0) return 0; + tEU = GT_Utility.safeInt((long) ((fuelValue / 20D) * (double) totalFlow)); //GT_FML_LOGGER.info(totalFlow+" : "+fuelValue+" : "+aOptFlow+" : "+actualOptimalFlow+" : "+tEU); - if (totalFlow != actualOptimalFlow) { - double efficiency = 1.0D - Math.abs((totalFlow - actualOptimalFlow) / (float)actualOptimalFlow); - - tEU = (int)(tEU * efficiency); - tEU = GT_Utility.safeInt((long)(aBaseEff/10000D*tEU)); + if (totalFlow == actualOptimalFlow) { + tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU)); } else { - tEU = GT_Utility.safeInt((long)(aBaseEff/10000D*tEU)); + double efficiency = 1.0D - Math.abs((totalFlow - actualOptimalFlow) / (float) actualOptimalFlow); + + tEU = (int) (tEU * efficiency); + tEU = GT_Utility.safeInt((long) (aBaseEff / 10000D * tEU)); } return tEU; @@ -158,17 +163,17 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar @Override public boolean checkRecipe(ItemStack aStack) { - if((counter&7)==0 && (aStack==null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() >179)) { + if ((counter & 7) == 0 && (aStack == null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() > 179)) { stopMachine(); return false; } ArrayList<FluidStack> tFluids = getStoredFluids(); - if (tFluids.size() > 0) { + if (!tFluids.isEmpty()) { if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() || this.getBaseMetaTileEntity().hasInventoryBeenModified()) { counter = 0; - baseEff = GT_Utility.safeInt((long)((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); - optFlow = GT_Utility.safeInt((long)Math.max(Float.MIN_NORMAL, + baseEff = GT_Utility.safeInt((long) ((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); + optFlow = GT_Utility.safeInt((long) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() * ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed * 50)); @@ -177,7 +182,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar } } - if(optFlow<=0 || baseEff<=0){ + if (optFlow <= 0 || baseEff <= 0) { stopMachine();//in case the turbine got removed return false; } @@ -188,7 +193,7 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick) // This is how much the turbine can actually change during this tick - int maxChangeAllowed = Math.max(200, GT_Utility.safeInt((long)Math.abs(difference)/5)); + int maxChangeAllowed = Math.max(200, GT_Utility.safeInt((long) Math.abs(difference) / 5)); if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative. @@ -198,8 +203,8 @@ public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_Lar if (this.mEUt <= 0) { //stopMachine(); - this.mEUt=0; - this.mEfficiency=0; + this.mEUt = 0; + this.mEfficiency = 0; return false; } else { this.mMaxProgresstime = 20; diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java index baa63a3e84..fac5fe61df 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java @@ -6,7 +6,7 @@ import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; @@ -20,13 +20,17 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; import static gregtech.api.enums.GT_Values.STEAM_PER_WATER; +import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST5; +import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import static gregtech.api.objects.XSTR.XSTR_INSTANCE; public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_LargeTurbine { private int excessWater; private boolean achievement = false; - private boolean looseFit=false; + private boolean looseFit = false; public GT_MetaTileEntity_LargeTurbine_Steam(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -39,31 +43,31 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_ST5) : Textures.BlockIcons.casingTexturePages[0][57]}; + return new ITexture[]{MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? TextureFactory.of(LARGETURBINE_ST_ACTIVE5) : TextureFactory.of(LARGETURBINE_ST5) : casingTexturePages[0][57]}; } public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Steam Turbine") - .addInfo("Controller block for the Large Steam Turbine") - .addInfo("Needs a Turbine, place inside controller") - .addInfo("Outputs Distilled Water as well as producing power") - .addInfo("Power output depends on turbine and fitting") - .addInfo("Use screwdriver to adjust fitting of turbine") - .addSeparator() - .beginStructureBlock(3, 3, 4, true) - .addController("Front center") - .addCasingInfo("Turbine Casing", 24) - .addDynamoHatch("Back center") - .addMaintenanceHatch("Side centered") - .addInputHatch("Steam, Side centered") - .addOutputHatch("Distilled Water, Side centered") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Steam Turbine") + .addInfo("Controller block for the Large Steam Turbine") + .addInfo("Needs a Turbine, place inside controller") + .addInfo("Outputs Distilled Water as well as producing power") + .addInfo("Power output depends on turbine and fitting") + .addInfo("Use screwdriver to adjust fitting of turbine") + .addSeparator() + .beginStructureBlock(3, 3, 4, true) + .addController("Front center") + .addCasingInfo("Turbine Casing", 24) + .addDynamoHatch("Back center") + .addMaintenanceHatch("Side centered") + .addInputHatch("Steam, Side centered") + .addOutputHatch("Distilled Water, Side centered") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } @Override @@ -100,25 +104,25 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg @Override int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff) { - if(looseFit) { - aOptFlow*=4; - if(aBaseEff>10000){ - aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f); - aBaseEff=7500; - }else if(aBaseEff>7500){ - aOptFlow*=Math.pow(1.1f,((aBaseEff-7500)/10000F)*20f); - aBaseEff*=0.75f; - }else{ - aBaseEff*=0.75f; + if (looseFit) { + aOptFlow *= 4; + if (aBaseEff > 10000) { + aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); + aBaseEff = 7500; + } else if (aBaseEff > 7500) { + aOptFlow *= Math.pow(1.1f, ((aBaseEff - 7500) / 10000F) * 20f); + aBaseEff *= 0.75f; + } else { + aBaseEff *= 0.75f; } } int tEU = 0; int totalFlow = 0; // Byproducts are based on actual flow int flow = 0; - int remainingFlow = GT_Utility.safeInt((long)(aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. + int remainingFlow = GT_Utility.safeInt((long) (aOptFlow * 1.25f)); // Allowed to use up to 125% of optimal flow. Variable required outside of loop for multi-hatch scenarios. this.realOptFlow = aOptFlow; - storedFluid=0; + storedFluid = 0; for (int i = 0; i < aFluids.size() && remainingFlow > 0; i++) { // loop through each hatch; extract inputs and track totals. final FluidStack aFluidStack = aFluids.get(i); if (GT_ModHandler.isAnySteam(aFluidStack)) { @@ -131,20 +135,20 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "muchsteam"); achievement = true; } - }else if(GT_ModHandler.isSuperHeatedSteam(aFluidStack)) { + } else if (GT_ModHandler.isSuperHeatedSteam(aFluidStack)) { depleteInput(new FluidStack(aFluidStack, aFluidStack.amount)); } } - if(totalFlow<=0)return 0; + if (totalFlow <= 0) return 0; tEU = totalFlow; int waterToOutput = condenseSteam(totalFlow); addOutput(GT_ModHandler.getDistilledWater(waterToOutput)); - if (totalFlow != aOptFlow) { - float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float)aOptFlow); - tEU *= efficiency; - tEU = Math.max(1, GT_Utility.safeInt((long)tEU * (long)aBaseEff / 20000L)); + if (totalFlow == aOptFlow) { + tEU = GT_Utility.safeInt((long) tEU * (long) aBaseEff / 20000L); } else { - tEU = GT_Utility.safeInt((long)tEU * (long)aBaseEff / 20000L); + float efficiency = 1.0f - Math.abs((totalFlow - aOptFlow) / (float) aOptFlow); + tEU *= efficiency; + tEU = Math.max(1, GT_Utility.safeInt((long) tEU * (long) aBaseEff / 20000L)); } return tEU; @@ -153,32 +157,32 @@ public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_Larg @Override public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { if (aSide == getBaseMetaTileEntity().getFrontFacing()) { - looseFit^=true; + looseFit ^= true; GT_Utility.sendChatToPlayer(aPlayer, looseFit ? trans("500", "Fitting: Loose - More Flow") : trans("501", "Fitting: Tight - More Efficiency")); } } @Override public int getDamageToComponent(ItemStack aStack) { - return (looseFit && XSTR_INSTANCE.nextInt(4)==0)?0:1; + return (looseFit && XSTR_INSTANCE.nextInt(4) == 0) ? 0 : 1; } - + @Override public String[] getInfoData() { - super.looseFit = looseFit; - return super.getInfoData(); + super.looseFit = looseFit; + return super.getInfoData(); } @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); - aNBT.setBoolean("turbineFitting",looseFit); + aNBT.setBoolean("turbineFitting", looseFit); } @Override public void loadNBTData(NBTTagCompound aNBT) { super.loadNBTData(aNBT); - looseFit=aNBT.getBoolean("turbineFitting"); + looseFit = aNBT.getBoolean("turbineFitting"); } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java index bc85ed97cc..3bf7dc4cfb 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_MultiFurnace.java @@ -2,7 +2,6 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IHeatingCoil; import gregtech.api.interfaces.ITexture; @@ -10,7 +9,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; @@ -26,6 +25,11 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMultiFurnace { private int mLevel = 0; @@ -48,33 +52,39 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Furnace") - .addInfo("Controller Block for the Multi Smelter") - .addInfo("Smelts up to 8-128 items at once") - .addInfo("Items smelted increases with coil tier") - .addPollutionAmount(20 * getPollutionPerTick(null)) - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front bottom") - .addCasingInfo("Heat Proof Machine Casing", 8) - .addOtherStructurePart("Heating Coils", "Middle layer") - .addEnergyHatch("Any bottom casing") - .addMaintenanceHatch("Any bottom casing") - .addMufflerHatch("Top Middle") - .addInputBus("Any bottom casing") - .addOutputBus("Any bottom casing") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) - return tt.getInformation(); + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Furnace") + .addInfo("Controller Block for the Multi Smelter") + .addInfo("Smelts up to 8-128 items at once") + .addInfo("Items smelted increases with coil tier") + .addPollutionAmount(20 * getPollutionPerTick(null)) + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front bottom") + .addCasingInfo("Heat Proof Machine Casing", 8) + .addOtherStructurePart("Heating Coils", "Middle layer") + .addEnergyHatch("Any bottom casing") + .addMaintenanceHatch("Any bottom casing") + .addMufflerHatch("Top Middle") + .addInputBus("Any bottom casing") + .addOutputBus("Any bottom casing") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + return tt.getInformation(); return tt.getStructureInformation(); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_MULTI_SMELTER)}; - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]}; + if (aSide != aFacing) return new ITexture[]{casingTexturePages[0][CASING_INDEX]}; + if (aActive) return new ITexture[]{ + casingTexturePages[0][CASING_INDEX], + TextureFactory.of(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + casingTexturePages[0][CASING_INDEX], + TextureFactory.of(OVERLAY_FRONT_MULTI_SMELTER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_MULTI_SMELTER_GLOW).glow().build()}; } @Override @@ -223,24 +233,24 @@ public class GT_MetaTileEntity_MultiFurnace extends GT_MetaTileEntity_AbstractMu } return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress")+": "+ - EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s", - StatCollector.translateToLocal("GT5U.multiblock.energy")+": "+ - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", - StatCollector.translateToLocal("GT5U.multiblock.usage")+": "+ - EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei")+": "+ - EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+" EU/t(*2A) "+StatCollector.translateToLocal("GT5U.machines.tier")+": "+ - EnumChatFormatting.YELLOW+VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.problems")+": "+ - EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+ - " "+StatCollector.translateToLocal("GT5U.multiblock.efficiency")+": "+ - EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %", - StatCollector.translateToLocal("GT5U.MS.multismelting")+": "+ - EnumChatFormatting.GREEN+mLevel*8+EnumChatFormatting.RESET+" Discount: (EU/t) / "+EnumChatFormatting.GREEN+mCostDiscount+EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %" + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " + + EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + + " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + StatCollector.translateToLocal("GT5U.MS.multismelting") + ": " + + EnumChatFormatting.GREEN + mLevel * 8 + EnumChatFormatting.RESET + " Discount: (EU/t) / " + EnumChatFormatting.GREEN + mCostDiscount + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.pollution") + ": " + EnumChatFormatting.GREEN + mPollutionReduction + EnumChatFormatting.RESET + " %" }; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java index e1a8c0290f..0a0088246b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilCracker.java @@ -3,7 +3,6 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IHeatingCoil; import gregtech.api.interfaces.ITexture; @@ -11,7 +10,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; @@ -27,6 +26,12 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; import java.util.BitSet; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; + public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBase { private ForgeDirection orientation; private int controllerX, controllerZ; @@ -44,34 +49,40 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Cracker") - .addInfo("Controller block for the Oil Cracking Unit") - .addInfo("Thermally cracks heavy hydrocarbons into lighter fractions") - .addInfo("More efficient than the Chemical Reactor") - .addInfo("Place the appropriate circuit in the controller") - .addSeparator() - .beginStructureBlock(5, 3, 3, true) - .addController("Front center") - .addCasingInfo("Clean Stainless Steel Machine Casing", 18) - .addOtherStructurePart("2 Rings of 8 Coils", "Each side of the controller") - .addInfo("Gets 5% energy cost reduction per coil tier") - .addEnergyHatch("Any casing") - .addMaintenanceHatch("Any casing") - .addInputHatch("Steam/Hydrogen, Any middle ring casing") - .addInputHatch("Any left/right side casing") - .addOutputHatch("Any left/right side casing") - .addStructureInfo("Input/Output Hatches must be on opposite sides!") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) return tt.getInformation(); + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Cracker") + .addInfo("Controller block for the Oil Cracking Unit") + .addInfo("Thermally cracks heavy hydrocarbons into lighter fractions") + .addInfo("More efficient than the Chemical Reactor") + .addInfo("Place the appropriate circuit in the controller") + .addSeparator() + .beginStructureBlock(5, 3, 3, true) + .addController("Front center") + .addCasingInfo("Clean Stainless Steel Machine Casing", 18) + .addOtherStructurePart("2 Rings of 8 Coils", "Each side of the controller") + .addInfo("Gets 5% energy cost reduction per coil tier") + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addInputHatch("Steam/Hydrogen, Any middle ring casing") + .addInputHatch("Any left/right side casing") + .addOutputHatch("Any left/right side casing") + .addStructureInfo("Input/Output Hatches must be on opposite sides!") + .toolTipFinisher("Gregtech"); + if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) return tt.getInformation(); return tt.getStructureInformation(); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aSide == aFacing) return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX], - new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER)}; - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][CASING_INDEX]}; + if (aSide == aFacing) { + if (aActive) return new ITexture[]{casingTexturePages[0][CASING_INDEX], + TextureFactory.of(OVERLAY_FRONT_OIL_CRACKER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{casingTexturePages[0][CASING_INDEX], + TextureFactory.of(OVERLAY_FRONT_OIL_CRACKER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW).glow().build()}; + } + return new ITexture[]{casingTexturePages[0][CASING_INDEX]}; } @Override @@ -152,11 +163,11 @@ public class GT_MetaTileEntity_OilCracker extends GT_MetaTileEntity_MultiBlockBa for (int depth = -1; depth < 2; depth++) for (int height = -1; height < 2; height++) for (int slice = -2; slice < 3; slice++) - if (xDir != 0) { - if (isStructureBroken(xDir, zDir, depth, height, slice, aBaseMetaTileEntity, amount, flags)) + if (xDir == 0) { + if (isStructureBroken(xDir, zDir, slice, height, depth, aBaseMetaTileEntity, amount, flags)) return false; } else { - if (isStructureBroken(xDir, zDir, slice, height, depth, aBaseMetaTileEntity, amount, flags)) + if (isStructureBroken(xDir, zDir, depth, height, slice, aBaseMetaTileEntity, amount, flags)) return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java index 3c19be674a..44fb734534 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_OilDrillBase.java @@ -1,8 +1,10 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.objects.GT_ChunkManager; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; @@ -17,13 +19,17 @@ import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import org.lwjgl.input.Keyboard; import java.util.ArrayList; -import org.lwjgl.input.Keyboard; - import static gregtech.api.enums.GT_Values.VN; import static gregtech.api.enums.GT_Values.debugDriller; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_DRILL_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.getCasingTextureForId; import static gregtech.common.GT_UndergroundOil.undergroundOil; import static gregtech.common.GT_UndergroundOil.undergroundOilReadInformation; @@ -42,6 +48,21 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D } @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide == aFacing) { + if (aActive) return new ITexture[]{ + getCasingTextureForId(casingTextureIndex), + TextureFactory.of(OVERLAY_FRONT_OIL_DRILL_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + getCasingTextureForId(casingTextureIndex), + TextureFactory.of(OVERLAY_FRONT_OIL_DRILL), + TextureFactory.builder().addIcon(OVERLAY_FRONT_OIL_DRILL_GLOW).glow().build()}; + } + return new ITexture[]{getCasingTextureForId(casingTextureIndex)}; + } + + @Override public void saveNBTData(NBTTagCompound aNBT) { super.saveNBTData(aNBT); aNBT.setInteger("mOilId", mOilId); @@ -58,30 +79,30 @@ public abstract class GT_MetaTileEntity_OilDrillBase extends GT_MetaTileEntity_D protected String[] getDescriptionInternal(String tierSuffix) { String casings = getCasingBlockItem().get(0).getDisplayName(); - + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Pump") - .addInfo("Controller Block for the Oil/Gas/Fluid Drilling Rig " + (tierSuffix != null ? tierSuffix : "")) - .addInfo("Works on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks") - .addInfo("Use a Screwdriver to configure range") - .addInfo("Use Programmed Circuits to ignore near exhausted oil field") - .addInfo("If total circuit # is greater than output amount it will halt. If it worked right.")//doesn't work - .addSeparator() - .beginStructureBlock(3, 7, 3, false) - .addController("Front bottom") - .addStructureInfo(casings + " form the 3x1x3 Base") - .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)") - .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top") - .addEnergyHatch(VN[getMinTier()] + "+, Any base casing") - .addMaintenanceHatch("Any base casing") - .addInputBus("Mining Pipes or Circuits, optional, any base casing") - .addOutputHatch("Any base casing") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + tt.addMachineType("Pump") + .addInfo("Controller Block for the Oil/Gas/Fluid Drilling Rig " + (tierSuffix != null ? tierSuffix : "")) + .addInfo("Works on " + getRangeInChunks() + "x" + getRangeInChunks() + " chunks") + .addInfo("Use a Screwdriver to configure range") + .addInfo("Use Programmed Circuits to ignore near exhausted oil field") + .addInfo("If total circuit # is greater than output amount it will halt. If it worked right.")//doesn't work + .addSeparator() + .beginStructureBlock(3, 7, 3, false) + .addController("Front bottom") + .addStructureInfo(casings + " form the 3x1x3 Base") + .addOtherStructurePart(casings, " 1x3x1 pillar above the center of the base (2 minimum total)") + .addOtherStructurePart(getFrameMaterial().mName + " Frame Boxes", "Each pillar's side and 1x3x1 on top") + .addEnergyHatch(VN[getMinTier()] + "+, Any base casing") + .addMaintenanceHatch("Any base casing") + .addInputBus("Mining Pipes or Circuits, optional, any base casing") + .addOutputHatch("Any base casing") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java index d86e8cf7f8..684cead86c 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_ProcessingArray.java @@ -4,6 +4,7 @@ import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -11,7 +12,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_ProcessingArray_Manager; import gregtech.api.util.GT_Recipe; @@ -34,6 +35,10 @@ import java.util.Collections; import java.util.List; import static gregtech.api.enums.GT_Values.VN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_GLOW; import static gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine.isValidForLowGravity; public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBlockBase { @@ -51,45 +56,56 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_ProcessingArray(this.mName); } + @Override public String[] getDescription() { - final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Processing Array") - .addInfo("Runs supplied machines as if placed in the world") - .addInfo("Place up to 64 singleblock GT machines into the controller") - .addInfo("Note that tou still need to supply power to them all") - .addInfo("Use a screwdriver to enable separate input busses") - .addInfo("Maximal overclockedness of machines inside: Tier 9") - .addInfo("Doesn't work on certain machines, deal with it") - .addInfo("Use it if you hate GT++, or want even more speed later on") - .addSeparator() - .beginStructureBlock(3, 3, 3, true) - .addController("Front center") - .addCasingInfo("Robust Tungstensteel Machine Casing", 14) - .addEnergyHatch("Any casing") - .addMaintenanceHatch("Any casing") - .addInputBus("Any casing") - .addInputHatch("Any casing") - .addOutputBus("Any casing") - .addOutputHatch("Any casing") - .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { - return tt.getStructureInformation(); - } + final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType("Processing Array") + .addInfo("Runs supplied machines as if placed in the world") + .addInfo("Place up to 64 singleblock GT machines into the controller") + .addInfo("Note that tou still need to supply power to them all") + .addInfo("Use a screwdriver to enable separate input busses") + .addInfo("Maximal overclockedness of machines inside: Tier 9") + .addInfo("Doesn't work on certain machines, deal with it") + .addInfo("Use it if you hate GT++, or want even more speed later on") + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front center") + .addCasingInfo("Robust Tungstensteel Machine Casing", 14) + .addEnergyHatch("Any casing") + .addMaintenanceHatch("Any casing") + .addInputBus("Any casing") + .addInputHatch("Any casing") + .addOutputBus("Any casing") + .addOutputHatch("Any casing") + .toolTipFinisher("Gregtech"); + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { + return tt.getStructureInformation(); + } else { + return tt.getInformation(); + } } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][48], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PROCESSING_ARRAY)}; + if (aActive) return new ITexture[]{ + BlockIcons.casingTexturePages[0][48], + TextureFactory.of(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + BlockIcons.casingTexturePages[0][48], + TextureFactory.of(OVERLAY_FRONT_PROCESSING_ARRAY), + TextureFactory.builder().addIcon(OVERLAY_FRONT_PROCESSING_ARRAY_GLOW).glow().build()}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][48]}; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "ProcessingArray.png"); } @@ -117,29 +133,27 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl } */ + @Override public GT_Recipe_Map getRecipeMap() { if (isCorrectMachinePart(mInventory[1])) { - GT_Recipe_Map aTemp = GT_ProcessingArray_Manager.getRecipeMapForMeta(mInventory[1].getItemDamage()); - if (aTemp != null) { - return aTemp; - } + return GT_ProcessingArray_Manager.getRecipeMapForMeta(mInventory[1].getItemDamage()); } return null; } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { - if (aStack != null && aStack.getUnlocalizedName().startsWith("gt.blockmachines.basicmachine.")) { - return true; - } - return false; + return aStack != null && aStack.getUnlocalizedName().startsWith("gt.blockmachines.basicmachine."); } + @Override public boolean isFacingValid(byte aFacing) { return aFacing > 1; } private String mMachine = ""; + @Override public boolean checkRecipe(ItemStack aStack) { if (!isCorrectMachinePart(mInventory[1])) { return false; @@ -160,7 +174,8 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl machineTier = Integer.parseInt(mMachine.substring(length - 2)); - } catch (NumberFormatException e) { + } catch (NumberFormatException ignored) { + /* do nothing */ } switch (machineTier) { @@ -199,122 +214,120 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl } ArrayList<FluidStack> tFluidList = getStoredFluids(); - FluidStack[] tFluids = (FluidStack[]) tFluidList.toArray(new FluidStack[tFluidList.size()]); + FluidStack[] tFluids = tFluidList.toArray(new FluidStack[0]); if (mSeparate) { - ArrayList<ItemStack> tInputList = new ArrayList<ItemStack>(); - for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { - IGregTechTileEntity tInputBus = tHatch.getBaseMetaTileEntity(); - for (int i = tInputBus.getSizeInventory() - 1; i >= 0; i--) { - if (tInputBus.getStackInSlot(i) != null) - tInputList.add(tInputBus.getStackInSlot(i)); - } - ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); - if (processRecipe(tInputs, tFluids, map)) - return true; - else - tInputList.clear(); - } + ArrayList<ItemStack> tInputList = new ArrayList<>(); + for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) { + IGregTechTileEntity tInputBus = tHatch.getBaseMetaTileEntity(); + for (int i = tInputBus.getSizeInventory() - 1; i >= 0; i--) { + if (tInputBus.getStackInSlot(i) != null) + tInputList.add(tInputBus.getStackInSlot(i)); + } + ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); + if (processRecipe(tInputs, tFluids, map)) + return true; + else + tInputList.clear(); + } } else { - ArrayList<ItemStack> tInputList = getStoredInputs(); - ItemStack[] tInputs = (ItemStack[]) tInputList.toArray(new ItemStack[tInputList.size()]); + ArrayList<ItemStack> tInputList = getStoredInputs(); + ItemStack[] tInputs = tInputList.toArray(new ItemStack[0]); return processRecipe(tInputs, tFluids, map); } return false; } public boolean processRecipe(ItemStack[] tInputs, FluidStack[] tFluids, GT_Recipe.GT_Recipe_Map map) { - if (tInputs.length > 0 || tFluids.length > 0) { - GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); - if (tRecipe != null) { - if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && - !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) - return false; + if (tInputs.length <= 0 && tFluids.length <= 0) return false; + GT_Recipe tRecipe = map.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], tFluids, tInputs); + if (tRecipe == null) return false; + if (GT_Mod.gregtechproxy.mLowGravProcessing && tRecipe.mSpecialValue == -100 && + !isValidForLowGravity(tRecipe, getBaseMetaTileEntity().getWorld().provider.dimensionId)) + return false; - mLastRecipe = tRecipe; - this.mEUt = 0; - this.mOutputItems = null; - this.mOutputFluids = null; - int machines = Math.min(64, mInventory[1].stackSize << mMult); //Upped max Cap to 64 - int i = 0; - for (; i < machines; i++) { - if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { - if (i == 0) { - return false; - } - break; - } - } - this.mMaxProgresstime = tRecipe.mDuration; - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, map.mAmperage, GT_Values.V[tTier]); - //In case recipe is too OP for that machine - if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) - return false; - this.mEUt = GT_Utility.safeInt(((long) this.mEUt * i) >> mMult, 1); - if (mEUt == Integer.MAX_VALUE - 1) + mLastRecipe = tRecipe; + this.mEUt = 0; + this.mOutputItems = null; + this.mOutputFluids = null; + int machines = Math.min(64, mInventory[1].stackSize << mMult); //Upped max Cap to 64 + int i = 0; + for (; i < machines; i++) { + if (!tRecipe.isRecipeInputEqual(true, tFluids, tInputs)) { + if (i == 0) { return false; - - if (this.mEUt > 0) { - this.mEUt = (-this.mEUt); } - ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; - for (int h = 0; h < tRecipe.mOutputs.length; h++) { - if (tRecipe.getOutput(h) != null) { - tOut[h] = tRecipe.getOutput(h).copy(); - tOut[h].stackSize = 0; - } - } - FluidStack tFOut = null; - if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); - for (int f = 0; f < tOut.length; f++) { - if (tRecipe.mOutputs[f] != null && tOut[f] != null) { - for (int g = 0; g < i; g++) { - if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) - tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; - } - } - } - if (tFOut != null) { - int tSize = tFOut.amount; - tFOut.amount = tSize * i; - } - tOut = clean(tOut); - this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); - List<ItemStack> overStacks = new ArrayList<>(); - for (ItemStack itemStack : tOut) { - while (itemStack != null && itemStack.getMaxStackSize() < itemStack.stackSize) { - ItemStack tmp = itemStack.copy(); - tmp.stackSize = tmp.getMaxStackSize(); - itemStack.stackSize = itemStack.stackSize - itemStack.getMaxStackSize(); - overStacks.add(tmp); - } - } - if (overStacks.size() > 0) { - ItemStack[] tmp = new ItemStack[overStacks.size()]; - tmp = overStacks.toArray(tmp); - tOut = ArrayUtils.addAll(tOut, tmp); - } - List<ItemStack> tSList = new ArrayList<ItemStack>(); - for (ItemStack tS : tOut) { - if (tS.stackSize > 0) tSList.add(tS); + break; + } + } + this.mMaxProgresstime = tRecipe.mDuration; + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + calculateOverclockedNessMulti(tRecipe.mEUt, tRecipe.mDuration, map.mAmperage, GT_Values.V[tTier]); + //In case recipe is too OP for that machine + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) + return false; + this.mEUt = GT_Utility.safeInt(((long) this.mEUt * i) >> mMult, 1); + if (mEUt == Integer.MAX_VALUE - 1) + return false; + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + ItemStack[] tOut = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOut[h] = tRecipe.getOutput(h).copy(); + tOut[h].stackSize = 0; + } + } + FluidStack tFOut = null; + if (tRecipe.getFluidOutput(0) != null) tFOut = tRecipe.getFluidOutput(0).copy(); + for (int f = 0; f < tOut.length; f++) { + if (tRecipe.mOutputs[f] != null && tOut[f] != null) { + for (int g = 0; g < i; g++) { + if (getBaseMetaTileEntity().getRandomNumber(10000) < tRecipe.getOutputChance(f)) + tOut[f].stackSize += tRecipe.mOutputs[f].stackSize; } - tOut = tSList.toArray(new ItemStack[tSList.size()]); - this.mOutputItems = tOut; - this.mOutputFluids = new FluidStack[]{tFOut}; - updateSlots(); - return true; } } - return false; + if (tFOut != null) { + int tSize = tFOut.amount; + tFOut.amount = tSize * i; + } + tOut = clean(tOut); + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + List<ItemStack> overStacks = new ArrayList<>(); + for (ItemStack itemStack : tOut) { + while (itemStack != null && itemStack.getMaxStackSize() < itemStack.stackSize) { + ItemStack tmp = itemStack.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + itemStack.stackSize = itemStack.stackSize - itemStack.getMaxStackSize(); + overStacks.add(tmp); + } + } + if (!overStacks.isEmpty()) { + ItemStack[] tmp = new ItemStack[overStacks.size()]; + tmp = overStacks.toArray(tmp); + tOut = ArrayUtils.addAll(tOut, tmp); + } + List<ItemStack> tSList = new ArrayList<>(); + for (ItemStack tS : tOut) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOut = tSList.toArray(new ItemStack[0]); + this.mOutputItems = tOut; + this.mOutputFluids = new FluidStack[]{tFOut}; + updateSlots(); + return true; } public static ItemStack[] clean(final ItemStack[] v) { - List<ItemStack> list = new ArrayList<ItemStack>(Arrays.asList(v)); + List<ItemStack> list = new ArrayList<>(Arrays.asList(v)); list.removeAll(Collections.singleton(null)); - return list.toArray(new ItemStack[list.size()]); + return list.toArray(new ItemStack[0]); } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; @@ -345,34 +358,38 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl @Override public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setBoolean("mSeparate", mSeparate); + super.saveNBTData(aNBT); + aNBT.setBoolean("mSeparate", mSeparate); } @Override - public void loadNBTData(final NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mSeparate = aNBT.getBoolean("mSeparate"); + public void loadNBTData(final NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mSeparate = aNBT.getBoolean("mSeparate"); } @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mSeparate = !mSeparate; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") +" "+mSeparate); + public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mSeparate = !mSeparate; + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal("GT5U.machines.separatebus") + " " + mSeparate); } + @Override public int getMaxEfficiency(ItemStack aStack) { return 10000; } + @Override public int getPollutionPerTick(ItemStack aStack) { return 0; } + @Override public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } @@ -390,26 +407,26 @@ public class GT_MetaTileEntity_ProcessingArray extends GT_MetaTileEntity_MultiBl } return new String[]{ - StatCollector.translateToLocal("GT5U.multiblock.Progress")+": "+ - EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+ - EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s", - StatCollector.translateToLocal("GT5U.multiblock.energy")+": "+ - EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", - StatCollector.translateToLocal("GT5U.multiblock.usage")+": "+ - EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t", - StatCollector.translateToLocal("GT5U.multiblock.mei")+": "+ - EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t(*2A) "+StatCollector.translateToLocal("GT5U.machines.tier")+": "+ - EnumChatFormatting.YELLOW+VN[GT_Utility.getTier(getMaxInputVoltage())]+ EnumChatFormatting.RESET, - StatCollector.translateToLocal("GT5U.multiblock.problems")+": "+ - EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+ - " "+StatCollector.translateToLocal("GT5U.multiblock.efficiency")+": "+ - EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %", - StatCollector.translateToLocal("GT5U.PA.machinetier")+": "+ - EnumChatFormatting.GREEN+tTier+EnumChatFormatting.RESET+ - " "+StatCollector.translateToLocal("GT5U.PA.discount")+": "+ - EnumChatFormatting.GREEN+(1<<mMult)+EnumChatFormatting.RESET + " x", - StatCollector.translateToLocal("GT5U.PA.parallel")+": "+EnumChatFormatting.GREEN+((mInventory[1] != null) ? (mInventory[1].stackSize<<mMult) : 0)+EnumChatFormatting.RESET + StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + mProgresstime / 20 + EnumChatFormatting.RESET + " s / " + + EnumChatFormatting.YELLOW + mMaxProgresstime / 20 + EnumChatFormatting.RESET + " s", + StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + storedEnergy + EnumChatFormatting.RESET + " EU / " + + EnumChatFormatting.YELLOW + maxEnergy + EnumChatFormatting.RESET + " EU", + StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + -mEUt + EnumChatFormatting.RESET + " EU/t", + StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + getMaxInputVoltage() + EnumChatFormatting.RESET + " EU/t(*2A) " + StatCollector.translateToLocal("GT5U.machines.tier") + ": " + + EnumChatFormatting.YELLOW + VN[GT_Utility.getTier(getMaxInputVoltage())] + EnumChatFormatting.RESET, + StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + (getIdealStatus() - getRepairStatus()) + EnumChatFormatting.RESET + + " " + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + ": " + + EnumChatFormatting.YELLOW + mEfficiency / 100.0F + EnumChatFormatting.RESET + " %", + StatCollector.translateToLocal("GT5U.PA.machinetier") + ": " + + EnumChatFormatting.GREEN + tTier + EnumChatFormatting.RESET + + " " + StatCollector.translateToLocal("GT5U.PA.discount") + ": " + + EnumChatFormatting.GREEN + (1 << mMult) + EnumChatFormatting.RESET + " x", + StatCollector.translateToLocal("GT5U.PA.parallel") + ": " + EnumChatFormatting.GREEN + ((mInventory[1] != null) ? (mInventory[1].stackSize << mMult) : 0) + EnumChatFormatting.RESET }; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java index edf652923b..701a81b6ba 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PyrolyseOven.java @@ -5,13 +5,14 @@ import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.HeatingCoilLevel; import gregtech.api.enums.Textures; +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.IHeatingCoil; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -25,6 +26,11 @@ import net.minecraftforge.oredict.OreDictionary; import org.apache.commons.lang3.mutable.MutableBoolean; import org.lwjgl.input.Keyboard; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_GLOW; + public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlockBase { private HeatingCoilLevel coilHeat; @@ -62,17 +68,25 @@ public class GT_MetaTileEntity_PyrolyseOven extends GT_MetaTileEntity_MultiBlock .addOutputBus("Any bottom layer casing") .addOutputHatch("Any bottom layer casing") .toolTipFinisher("Gregtech"); - if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return tt.getInformation(); - } else { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return tt.getStructureInformation(); + } else { + return tt.getInformation(); } } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_PYROLYSE_OVEN)}; + if (aActive) + return new ITexture[]{ + BlockIcons.casingTexturePages[8][66], + TextureFactory.of(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE_GLOW).glow().build()}; + return new ITexture[]{ + BlockIcons.casingTexturePages[8][66], + TextureFactory.of(OVERLAY_FRONT_PYROLYSE_OVEN), + TextureFactory.builder().addIcon(OVERLAY_FRONT_PYROLYSE_OVEN_GLOW).glow().build()}; } return new ITexture[]{Textures.BlockIcons.casingTexturePages[8][66]}; } diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java index 6f00bcb0c6..c800592d0d 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_VacuumFreezer.java @@ -1,13 +1,12 @@ package gregtech.common.tileentities.machines.multi; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -18,6 +17,12 @@ import org.lwjgl.input.Keyboard; import java.util.ArrayList; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; + public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBlockBase { public GT_MetaTileEntity_VacuumFreezer(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -27,10 +32,12 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc super(aName); } + @Override public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_VacuumFreezer(this.mName); } + @Override public String[] getDescription() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Vacuum Freezer") @@ -52,38 +59,57 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc } } + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + ITexture[] rTexture; if (aSide == aFacing) { - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][17], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_VACUUM_FREEZER)}; + if (aActive) { + rTexture = new ITexture[]{ + casingTexturePages[0][17], + TextureFactory.of(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_ACTIVE_GLOW).glow().build()}; + } else { + rTexture = new ITexture[]{ + casingTexturePages[0][17], + TextureFactory.of(OVERLAY_FRONT_VACUUM_FREEZER), + TextureFactory.builder().addIcon(OVERLAY_FRONT_VACUUM_FREEZER_GLOW).glow().build()}; + } + } else { + rTexture = new ITexture[]{casingTexturePages[0][17]}; } - return new ITexture[]{Textures.BlockIcons.casingTexturePages[0][17]}; + return rTexture; } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "VacuumFreezer.png"); } + @Override public GT_Recipe.GT_Recipe_Map getRecipeMap() { return GT_Recipe.GT_Recipe_Map.sVacuumRecipes; } + @Override public boolean isCorrectMachinePart(ItemStack aStack) { return true; } + @Override public boolean isFacingValid(byte aFacing) { return aFacing > 1; } + @Override public boolean checkRecipe(ItemStack aStack) { ArrayList<ItemStack> tInputList = getStoredInputs(); for (ItemStack tInput : tInputList) { long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, new ItemStack[]{tInput}); + GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sVacuumRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[tTier], null, tInput); if (tRecipe != null) { - if (tRecipe.isRecipeInputEqual(true, null, new ItemStack[]{tInput})) { + if (tRecipe.isRecipeInputEqual(true, null, tInput)) { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; @@ -104,6 +130,7 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc return false; } + @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX; int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; @@ -132,18 +159,22 @@ public class GT_MetaTileEntity_VacuumFreezer extends GT_MetaTileEntity_MultiBloc return tAmount >= 16; } + @Override public int getMaxEfficiency(ItemStack aStack) { return 10000; } + @Override public int getPollutionPerTick(ItemStack aStack) { return 0; } + @Override public int getDamageToComponent(ItemStack aStack) { return 0; } + @Override public boolean explodesOnComponentBreak(ItemStack aStack) { return false; } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java index dabe5316ee..edee82f13a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Bronze.java @@ -1,17 +1,26 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE; + public class GT_MetaTileEntity_AlloySmelter_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_AlloySmelter_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Combination Smelter", 2, 1, true); @@ -25,65 +34,95 @@ public class GT_MetaTileEntity_AlloySmelter_Bronze extends GT_MetaTileEntity_Bas super(aName, aDescription, aTextures, 2, 1, true); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_AlloySmelter_Bronze(this.mName, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_AlloySmelter_Bronze(mName, mDescriptionArray, mTextures); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeAlloySmelter.png", GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.mUnlocalizedName); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { - this.mOutputItems[0] = tRecipe.getOutput(0); - this.mEUt = tRecipe.mEUt; - this.mMaxProgresstime = (tRecipe.mDuration * 2); + mOutputItems[0] = tRecipe.getOutput(0); + mEUt = tRecipe.mEUt; + mMaxProgresstime = (tRecipe.mDuration * 2); return 2; } return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(208), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(208), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java index 8a43bf9ef4..b15366b456 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_AlloySmelter_Steel.java @@ -1,17 +1,26 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Steel; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE; + public class GT_MetaTileEntity_AlloySmelter_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_AlloySmelter_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Combination Smelter", 2, 1, true); @@ -25,65 +34,95 @@ public class GT_MetaTileEntity_AlloySmelter_Steel extends GT_MetaTileEntity_Basi super(aName, aDescription, aTextures, 2, 1, true); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_AlloySmelter_Steel(this.mName, this.mDescriptionArray, this.mTextures); + return new GT_MetaTileEntity_AlloySmelter_Steel(mName, mDescriptionArray, mTextures); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelAlloySmelter.png", GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.mUnlocalizedName); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { - this.mOutputItems[0] = tRecipe.getOutput(0); - this.mEUt = (tRecipe.mEUt * 2); - this.mMaxProgresstime = tRecipe.mDuration; + mOutputItems[0] = tRecipe.getOutput(0); + mEUt = (tRecipe.mEUt * 2); + mMaxProgresstime = tRecipe.mDuration; return 2; } return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(208), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(208), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_ALLOY_SMELTER)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_ALLOY_SMELTER_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_ALLOY_SMELTER)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_ALLOY_SMELTER)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_ALLOY_SMELTER)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java index 4f0ce99e5b..b5d9b7d095 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Bronze.java @@ -1,17 +1,26 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE; + public class GT_MetaTileEntity_Compressor_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Compressor_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Compressing Items", 1, 1, false); @@ -25,14 +34,17 @@ public class GT_MetaTileEntity_Compressor_Bronze extends GT_MetaTileEntity_Basic super(aName, aDescription, aTextures, 1, 1, false); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeCompressor.png", GT_Recipe.GT_Recipe_Map.sCompressorRecipes.mUnlocalizedName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Compressor_Bronze(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCompressorRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { @@ -44,46 +56,73 @@ public class GT_MetaTileEntity_Compressor_Bronze extends GT_MetaTileEntity_Basic return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(203), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(203), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java index a5b26076f4..8453c369d2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Compressor_Steel.java @@ -1,17 +1,26 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Steel; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE; + public class GT_MetaTileEntity_Compressor_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Compressor_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Compressing Items", 1, 1, false); @@ -25,14 +34,17 @@ public class GT_MetaTileEntity_Compressor_Steel extends GT_MetaTileEntity_BasicM super(aName, aDescription, aTextures, 1, 1, false); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelCompressor.png", GT_Recipe.GT_Recipe_Map.sCompressorRecipes.mUnlocalizedName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Compressor_Steel(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sCompressorRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { @@ -44,46 +56,73 @@ public class GT_MetaTileEntity_Compressor_Steel extends GT_MetaTileEntity_BasicM return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(203), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(203), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_COMPRESSOR)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_COMPRESSOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_COMPRESSOR)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_COMPRESSOR)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_COMPRESSOR)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_COMPRESSOR)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java index b8cbfb0197..db4faea50e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Bronze.java @@ -7,11 +7,19 @@ import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE; + public class GT_MetaTileEntity_Extractor_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Extractor_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Extracting your first Rubber", 1, 1, false); @@ -25,14 +33,17 @@ public class GT_MetaTileEntity_Extractor_Bronze extends GT_MetaTileEntity_BasicM super(aName, aDescription, aTextures, 1, 1, false); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeExtractor.png", GT_Recipe.GT_Recipe_Map.sExtractorRecipes.mUnlocalizedName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Extractor_Bronze(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sExtractorRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { @@ -44,46 +55,73 @@ public class GT_MetaTileEntity_Extractor_Bronze extends GT_MetaTileEntity_BasicM return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(200), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(200), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java index d5f3c01738..8ebd24a65b 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Extractor_Steel.java @@ -1,17 +1,26 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Steel; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE; + public class GT_MetaTileEntity_Extractor_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Extractor_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Extracting your first Rubber", 1, 1, false); @@ -25,14 +34,17 @@ public class GT_MetaTileEntity_Extractor_Steel extends GT_MetaTileEntity_BasicMa super(aName, aDescription, aTextures, 1, 1, false); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelExtractor.png", GT_Recipe.GT_Recipe_Map.sExtractorRecipes.mUnlocalizedName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Extractor_Steel(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sExtractorRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { @@ -44,46 +56,73 @@ public class GT_MetaTileEntity_Extractor_Steel extends GT_MetaTileEntity_BasicMa return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(200), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(200), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_EXTRACTOR_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_EXTRACTOR)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_EXTRACTOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_EXTRACTOR)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_EXTRACTOR)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_EXTRACTOR)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_EXTRACTOR)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java index ab9fee6b79..50b55f607a 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Bronze.java @@ -1,17 +1,26 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER_ACTIVE; + public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_ForgeHammer_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Forge Hammer", 1, 1, false); @@ -25,14 +34,17 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi super(aName, aDescription, aTextures, 1, 1, false); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_ForgeHammer_Bronze(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeHammer.png", GT_Recipe.GT_Recipe_Map.sHammerRecipes.mUnlocalizedName, (byte) 6, (byte) 3); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { @@ -44,46 +56,73 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze extends GT_MetaTileEntity_Basi return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(1), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(1), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java index 813bb3da24..6145a5b1b2 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_ForgeHammer_Steel.java @@ -1,17 +1,26 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Steel; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER_ACTIVE; + public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_ForgeHammer_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Forge Hammer", 1, 1, false); @@ -25,14 +34,17 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic super(aName, aDescription, aTextures, 1, 1, false); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_ForgeHammer_Steel(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelHammer.png", GT_Recipe.GT_Recipe_Map.sHammerRecipes.mUnlocalizedName, (byte) 6, (byte) 3); } + @Override public int checkRecipe() { GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs()); if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { @@ -44,46 +56,73 @@ public class GT_MetaTileEntity_ForgeHammer_Steel extends GT_MetaTileEntity_Basic return 0; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(1), 10, 1.0F, aX, aY, aZ); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(1), 10, 1.0F, aX, aY, aZ); } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_HAMMER)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_HAMMER)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_HAMMER_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_HAMMER)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_HAMMER)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_HAMMER)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_HAMMER)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_HAMMER)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_HAMMER)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java index de8dd8aa64..f67a94f81e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Bronze.java @@ -1,18 +1,27 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE_ACTIVE; + public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Furnace_Bronze(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Smelting things with compressed Steam", 1, 1, true); @@ -26,14 +35,17 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac super(aName, aDescription, aTextures, 1, 1, true); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeFurnace.png", "smelting"); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Furnace_Bronze(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public int checkRecipe() { if (null != (this.mOutputItems[0] = GT_ModHandler.getSmeltingOutput(getInputAt(0), true, getOutputAt(0)))) { this.mEUt = 4; @@ -48,6 +60,7 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { @@ -55,39 +68,65 @@ public class GT_MetaTileEntity_Furnace_Bronze extends GT_MetaTileEntity_BasicMac } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java index 095328eb95..01e3c1220e 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Furnace_Steel.java @@ -1,18 +1,27 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Steel; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE_ACTIVE; + public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Furnace_Steel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional, "Smelting things with compressed Steam", 1, 1, true); @@ -26,14 +35,17 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach super(aName, aDescription, aTextures, 1, 1, true); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelFurnace.png", "smelting"); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Furnace_Steel(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public int checkRecipe() { if (null != (this.mOutputItems[0] = GT_ModHandler.getSmeltingOutput(getInputAt(0), true, getOutputAt(0)))) { this.mEUt = 8; @@ -48,6 +60,7 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_ModHandler.getSmeltingOutput(GT_Utility.copyAmount(64L, aStack), false, null) != null; } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { @@ -55,39 +68,65 @@ public class GT_MetaTileEntity_Furnace_Steel extends GT_MetaTileEntity_BasicMach } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_FURNACE)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_FURNACE)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_FURNACE_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_FURNACE)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_FURNACE)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE_ACTIVE)}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_FURNACE)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_FURNACE)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_FURNACE)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_FURNACE)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java index 7460b874df..39d539f395 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Bronze.java @@ -1,13 +1,12 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Bronze; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; @@ -19,6 +18,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.Random; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicMachine_Bronze { public GT_MetaTileEntity_Macerator_Bronze(int aID, String aName, String aNameRegional) { @@ -33,20 +33,23 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM super(aName, aDescription, aTextures, 1, 1, false); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "BronzeMacerator.png", GT_Recipe_Map.sMaceratorRecipes.mUnlocalizedName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Macerator_Bronze(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { Random tRandom = getBaseMetaTileEntity().getWorld().rand; new WorldSpawnedEventBuilder.ParticleEventBuilder() - .setMotion(0D,0.0D,0D) + .setMotion(0.0D, 0.0D, 0.0D) .setIdentifier("smoke") .setPosition( aBaseMetaTileEntity.getXCoord() + 0.8F - tRandom.nextFloat() * 0.6F, @@ -58,9 +61,9 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM } } + @Override public int checkRecipe() { GT_Recipe_Map tMap = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes; - if (tMap == null) return DID_NOT_FIND_RECIPE; GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[1], null, null, getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; @@ -68,7 +71,7 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM mOutputBlocked++; return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } - + if (!tRecipe.isRecipeInputEqual(true, new FluidStack[]{getFillableStack()}, getAllInputs())) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.getOutput(0) != null) mOutputItems[0] = tRecipe.getOutput(0); @@ -82,6 +85,7 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { @@ -89,39 +93,66 @@ public class GT_MetaTileEntity_Macerator_Bronze extends GT_MetaTileEntity_BasicM } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR)}; + return new ITexture[]{ + super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{ + super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR)}; + return new ITexture[]{ + super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{ + super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR)}; + return new ITexture[]{ + super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR)}; } } diff --git a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java index 2af1ae0793..7383e9fadc 100644 --- a/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java +++ b/src/main/java/gregtech/common/tileentities/machines/steam/GT_MetaTileEntity_Macerator_Steel.java @@ -1,13 +1,12 @@ package gregtech.common.tileentities.machines.steam; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_BasicMachine; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine_Steel; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; @@ -19,6 +18,7 @@ import net.minecraftforge.fluids.FluidStack; import java.util.Random; import static gregtech.api.enums.GT_Values.V; +import static gregtech.api.enums.Textures.BlockIcons.*; public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMachine_Steel { public GT_MetaTileEntity_Macerator_Steel(int aID, String aName, String aNameRegional) { @@ -33,14 +33,17 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa super(aName, aDescription, aTextures, 1, 1, false); } + @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "SteelMacerator.png", GT_Recipe_Map.sMaceratorRecipes.mUnlocalizedName); } + @Override public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { return new GT_MetaTileEntity_Macerator_Steel(this.mName, this.mDescriptionArray, this.mTextures); } + @Override public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { super.onPreTick(aBaseMetaTileEntity, aTick); if ((aBaseMetaTileEntity.isClientSide()) && (aBaseMetaTileEntity.isActive()) && (aBaseMetaTileEntity.getFrontFacing() != 1) && (aBaseMetaTileEntity.getCoverIDAtSide((byte) 1) == 0) && (!aBaseMetaTileEntity.getOpacityAtSide((byte) 1))) { @@ -58,9 +61,9 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa } } + @Override public int checkRecipe() { GT_Recipe_Map tMap = GT_Recipe.GT_Recipe_Map.sMaceratorRecipes; - if (tMap == null) return DID_NOT_FIND_RECIPE; GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[1], null, null, getAllInputs()); if (tRecipe == null) return DID_NOT_FIND_RECIPE; if (tRecipe.mCanBeBuffered) mLastRecipe = tRecipe; @@ -68,7 +71,7 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa mOutputBlocked++; return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } - + if (!tRecipe.isRecipeInputEqual(true, new FluidStack[]{getFillableStack()}, getAllInputs())) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; if (tRecipe.getOutput(0) != null) mOutputItems[0] = tRecipe.getOutput(0); @@ -82,6 +85,7 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && GT_Recipe_Map.sMaceratorRecipes.containsInput(GT_Utility.copyAmount(64L, aStack)); } + @Override public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) { super.startSoundLoop(aIndex, aX, aY, aZ); if (aIndex == 1) { @@ -89,39 +93,61 @@ public class GT_MetaTileEntity_Macerator_Steel extends GT_MetaTileEntity_BasicMa } } + @Override public void startProcess() { sendLoopStart((byte) 1); } + @Override public ITexture[] getSideFacingActive(byte aColor) { - return new ITexture[]{super.getSideFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{ + super.getSideFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR_ACTIVE)}; } + @Override public ITexture[] getSideFacingInactive(byte aColor) { - return new ITexture[]{super.getSideFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_SIDE_STEAM_MACERATOR)}; + return new ITexture[]{ + super.getSideFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_SIDE_STEAM_MACERATOR)}; } + @Override public ITexture[] getFrontFacingActive(byte aColor) { - return new ITexture[]{super.getFrontFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{ + super.getFrontFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_FRONT_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getFrontFacingInactive(byte aColor) { - return new ITexture[]{super.getFrontFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_STEAM_MACERATOR)}; + return new ITexture[]{super.getFrontFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_FRONT_STEAM_MACERATOR)}; } + @Override public ITexture[] getTopFacingActive(byte aColor) { - return new ITexture[]{super.getTopFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{super.getTopFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE), + TextureFactory.builder().addIcon(OVERLAY_TOP_STEAM_MACERATOR_ACTIVE_GLOW).glow().build()}; } + @Override public ITexture[] getTopFacingInactive(byte aColor) { - return new ITexture[]{super.getTopFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR)}; + return new ITexture[]{super.getTopFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_TOP_STEAM_MACERATOR)}; } + @Override public ITexture[] getBottomFacingActive(byte aColor) { - return new ITexture[]{super.getBottomFacingActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE)}; + return new ITexture[]{super.getBottomFacingActive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR_ACTIVE)}; } + @Override public ITexture[] getBottomFacingInactive(byte aColor) { - return new ITexture[]{super.getBottomFacingInactive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_BOTTOM_STEAM_MACERATOR)}; + return new ITexture[]{super.getBottomFacingInactive(aColor)[0], + TextureFactory.of(OVERLAY_BOTTOM_STEAM_MACERATOR)}; } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java index 1876a16c1b..18fa7a759d 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_DigitalChestBase.java @@ -1,16 +1,12 @@ package gregtech.common.tileentities.storage; -import java.util.HashMap; -import java.util.Map; - import cpw.mods.fml.common.Optional; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.AE2DigitalChestHandler; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import gregtech.common.gui.GT_Container_QuantumChest; import gregtech.common.gui.GT_GUIContainer_QuantumChest; @@ -21,11 +17,51 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; +import java.util.HashMap; +import java.util.Map; + +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_SCHEST_GLOW; + @Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2", striprefs = true) public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEntity_TieredMachineBlock implements appeng.api.storage.IMEMonitor<appeng.api.storage.data.IAEItemStack> { + protected boolean mVoidOverflow = false; private Map<appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack>, Object> listeners = null; + public GT_MetaTileEntity_DigitalChestBase(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "This Chest stores " + CommonSizeCompute(aTier) + " Blocks Use a screwdriver to enable voiding items on overflow"); + super(aID, aName, aNameRegional, aTier, 3, new String[]{ + "This Chest stores " + commonSizeCompute(aTier) + " Blocks", + "Use a screwdriver to enable", + "voiding items on overflow" + }); + } + + protected static int commonSizeCompute(int tier) { + switch (tier) { + case 1: + return 4000000; + case 2: + return 8000000; + case 3: + return 16000000; + case 4: + return 32000000; + case 5: + return 64000000; + case 6: + return 128000000; + case 7: + return 256000000; + case 8: + return 512000000; + case 9: + return 1024000000; + case 10: + return 2147483640; + default: + return 0; + } } public GT_MetaTileEntity_DigitalChestBase(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -36,199 +72,111 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti super(aName, aTier, 3, aDescription, aTextures); } - @Override - public boolean isSimpleMachine() { - return true; + @Optional.Method(modid = "appliedenergistics2") + public static void registerAEIntegration() { + appeng.api.AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AE2DigitalChestHandler()); } + @Optional.Method(modid = "appliedenergistics2") @Override - public boolean isFacingValid(byte aFacing) { - return true; + public void addListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver, Object o) { + if (listeners == null) + listeners = new HashMap<>(); + listeners.put(imeMonitorHandlerReceiver, o); } + @Optional.Method(modid = "appliedenergistics2") @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { - return true; + public void removeListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver) { + if (listeners == null) + listeners = new HashMap<>(); + listeners.remove(imeMonitorHandlerReceiver); } + @Optional.Method(modid = "appliedenergistics2") @Override - public boolean isValidSlot(int aIndex) { - return true; + public appeng.api.config.AccessRestriction getAccess() { + return appeng.api.config.AccessRestriction.READ_WRITE; } + @Optional.Method(modid = "appliedenergistics2") @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); - return true; + public boolean isPrioritized(appeng.api.storage.data.IAEItemStack iaeItemStack) { + return false; } - - protected boolean mVoidOverflow = false; + @Optional.Method(modid = "appliedenergistics2") @Override - public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - mVoidOverflow = !mVoidOverflow; - GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled")); + public boolean canAccept(appeng.api.storage.data.IAEItemStack iaeItemStack) { + ItemStack s = getItemStack(); + if (s == null || iaeItemStack == null) + return true; + return iaeItemStack.isSameType(s); } + @Optional.Method(modid = "appliedenergistics2") @Override - public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_QuantumChest(aPlayerInventory, aBaseMetaTileEntity); + public int getPriority() { + return 0; } + @Optional.Method(modid = "appliedenergistics2") @Override - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_QuantumChest(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + public int getSlot() { + return 0; } + @Optional.Method(modid = "appliedenergistics2") @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { - - if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork()) { - if ((getItemCount() <= 0)) { - setItemStack(null); - setItemCount(0); - } - if (getItemStack() == null && mInventory[0] != null) { - setItemStack(mInventory[0].copy()); - } - int count = getItemCount(); - ItemStack stack = getItemStack(); - int savedCount = count; - - if ((mInventory[0] != null) && ((count < getMaxItemCount())|| mVoidOverflow ) && GT_Utility.areStacksEqual(mInventory[0], stack)) { - count += mInventory[0].stackSize; - if (count <= getMaxItemCount()) { - mInventory[0] = null; - } else { - if (mVoidOverflow) { - mInventory[0] = null; - } else { - mInventory[0].stackSize = (count - getMaxItemCount()); - } - count = getMaxItemCount(); - } - } - if (mInventory[1] == null && stack != null) { - mInventory[1] = stack.copy(); - mInventory[1].stackSize = Math.min(stack.getMaxStackSize(), count); - count -= mInventory[1].stackSize; - } else if ((count > 0) && GT_Utility.areStacksEqual(mInventory[1], stack) && mInventory[1].getMaxStackSize() > mInventory[1].stackSize) { - int tmp = Math.min(count, mInventory[1].getMaxStackSize() - mInventory[1].stackSize); - mInventory[1].stackSize += tmp; - count -= tmp; - } - setItemCount(count); - if (stack != null) { - mInventory[2] = stack.copy(); - mInventory[2].stackSize = Math.min(stack.getMaxStackSize(), count); - } else { - mInventory[2] = null; - } - - if (GregTech_API.mAE2) - notifyListeners(count - savedCount, stack); - if (count != savedCount) - getBaseMetaTileEntity().markDirty(); - } + public boolean validForPass(int i) { + return true; } - abstract protected int getItemCount(); - abstract public void setItemCount(int aCount); - abstract protected ItemStack getItemStack(); - abstract protected void setItemStack(ItemStack s); - - @Override - public int getProgresstime() { - return getItemCount() + (mInventory[0] == null ? 0 : mInventory[0].stackSize) + (mInventory[1] == null ? 0 : mInventory[1].stackSize); - } + protected abstract ItemStack getItemStack(); - @Override - public int maxProgresstime() { - return getMaxItemCount(); - } + protected abstract void setItemStack(ItemStack s); - protected static int CommonSizeCompute(int tier){ - switch(tier){ - case 1: - return 4000000; - case 2: - return 8000000; - case 3: - return 16000000; - case 4: - return 32000000; - case 5: - return 64000000; - case 6: - return 128000000; - case 7: - return 256000000; - case 8: - return 512000000; - case 9: - return 1024000000; - case 10: - return 2147483640; - default: - return 0; + @Optional.Method(modid = "appliedenergistics2") + public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems(final appeng.api.storage.data.IItemList out) { + ItemStack storedStack = getItemStack(); + if (storedStack != null) { + appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack); + s.setStackSize(getItemCount()); + out.add(s); } + return out; } + @Optional.Method(modid = "appliedenergistics2") @Override - public int getMaxItemCount() { - return CommonSizeCompute(mTier); - } - @Override - public ItemStack[] getStoredItemData() { - return mInventory; - } - @Override - public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex == 1; - } - - @Override - public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return aIndex == 0 && (mInventory[0] == null || GT_Utility.areStacksEqual(mInventory[0], aStack)); + public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getStorageList() { + appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> res = new appeng.util.item.ItemList(); + ItemStack storedStack = getItemStack(); + if (storedStack != null) { + appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack); + s.setStackSize(getItemCount()); + res.add(s); + } + return res; } - abstract protected String chestName(); + protected abstract int getItemCount(); - @Optional.Method(modid = "appliedenergistics2") - public static void registerAEIntegration() { - appeng.api.AEApi.instance().registries().externalStorage().addExternalStorageInterface(new AE2DigitalChestHandler()); - } + public abstract void setItemCount(int aCount); @Override - public boolean isGivingInformation() { - return true; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mItemCount", getItemCount()); - if (getItemStack() != null) - aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); - aNBT.setBoolean("mVoidOverflow", mVoidOverflow); + public int getMaxItemCount() { + return commonSizeCompute(mTier); } @Override - public void loadNBTData(NBTTagCompound aNBT) { - if (aNBT.hasKey("mItemCount")) - setItemCount(aNBT.getInteger("mItemCount")); - if (aNBT.hasKey("mItemStack")) - setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"))); - mVoidOverflow = aNBT.getBoolean("mVoidOverflow"); - + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_QuantumChest(aPlayerInventory, aBaseMetaTileEntity); } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - if (aBaseMetaTileEntity.getFrontFacing() == 0 && aSide == 4) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)}; - } - return aSide == aBaseMetaTileEntity.getFrontFacing() ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QCHEST)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};//aSide != aFacing ? mMachineBlock != 0 ? new ITexture[] {Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]} : new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]} : mMachineBlock != 0 ? aActive ? getTexturesActive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : getTexturesInactive(Textures.BlockIcons.CASING_BLOCKS[mMachineBlock]) : aActive ? getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]) : getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1]); + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_QuantumChest(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); } @Override @@ -236,27 +184,6 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti return new ITexture[0][0][0]; } - @Override - public String[] getInfoData() { - - if (getItemStack() == null) { - return new String[]{ - EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GOLD + "No Items" + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET - }; - } - return new String[]{ - EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, - "Stored Items:", - EnumChatFormatting.GOLD + getItemStack().getDisplayName() + EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(getItemCount()) + EnumChatFormatting.RESET + " " + - EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET - }; - } - @Optional.Method(modid = "appliedenergistics2") public appeng.api.storage.data.IAEItemStack injectItems(final appeng.api.storage.data.IAEItemStack input, final appeng.api.config.Actionable mode, final appeng.api.networking.security.BaseActionSource src) { final ItemStack inputStack = input.getItemStack(); @@ -267,35 +194,27 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti ItemStack storedStack = getItemStack(); if (storedStack != null) { if (GT_Utility.areStacksEqual(storedStack, inputStack)) { - if (input.getStackSize() + getItemCount() > getMaxItemCount()) - { - if (mVoidOverflow) - { + if (input.getStackSize() + getItemCount() > getMaxItemCount()) { + if (mVoidOverflow) { if (mode != appeng.api.config.Actionable.SIMULATE) setItemCount(getMaxItemCount()); return null; } - else - { - return createOverflowStack(input.getStackSize() + getItemCount(), mode); - } - } - else { - if (mode != appeng.api.config.Actionable.SIMULATE) - setItemCount(getItemCount() + (int) input.getStackSize()); + return createOverflowStack(input.getStackSize() + getItemCount(), mode); } + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount(getItemCount() + (int) input.getStackSize()); return null; - } else - return input; - } else { - if (mode != appeng.api.config.Actionable.SIMULATE) - setItemStack(inputStack.copy()); - if (input.getStackSize() > getMaxItemCount()) - return createOverflowStack(input.getStackSize(), mode); - else if (mode != appeng.api.config.Actionable.SIMULATE) - setItemCount((int) input.getStackSize()); - return null; + } + return input; } + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemStack(inputStack.copy()); + if (input.getStackSize() > getMaxItemCount()) + return createOverflowStack(input.getStackSize(), mode); + if (mode != appeng.api.config.Actionable.SIMULATE) + setItemCount((int) input.getStackSize()); + return null; } @Optional.Method(modid = "appliedenergistics2") @@ -332,85 +251,133 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti return appeng.api.storage.StorageChannel.ITEMS; } - @Optional.Method(modid = "appliedenergistics2") - public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getAvailableItems(final appeng.api.storage.data.IItemList out) { - ItemStack storedStack = getItemStack(); - if (storedStack != null) { - appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack); - s.setStackSize(getItemCount()); - out.add(s); - } - return out; + @Override + public final void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + mVoidOverflow = !mVoidOverflow; + GT_Utility.sendChatToPlayer(aPlayer, StatCollector.translateToLocal(mVoidOverflow ? "GT5U.machines.voidoveflow.enabled" : "GT5U.machines.voidoveflow.disabled")); } - @Optional.Method(modid = "appliedenergistics2") @Override - public appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> getStorageList() { - appeng.api.storage.data.IItemList<appeng.api.storage.data.IAEItemStack> res = new appeng.util.item.ItemList(); - ItemStack storedStack = getItemStack(); - if (storedStack != null) { - appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(storedStack); - s.setStackSize(getItemCount()); - res.add(s); + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) { + + if (getBaseMetaTileEntity().isServerSide() && getBaseMetaTileEntity().isAllowedToWork()) { + if ((getItemCount() <= 0)) { + setItemStack(null); + setItemCount(0); + } + if (getItemStack() == null && mInventory[0] != null) { + setItemStack(mInventory[0].copy()); + } + int count = getItemCount(); + ItemStack stack = getItemStack(); + int savedCount = count; + + if ((mInventory[0] != null) && ((count < getMaxItemCount()) || mVoidOverflow) && GT_Utility.areStacksEqual(mInventory[0], stack)) { + count += mInventory[0].stackSize; + if (count <= getMaxItemCount()) { + mInventory[0] = null; + } else { + if (mVoidOverflow) { + mInventory[0] = null; + } else { + mInventory[0].stackSize = (count - getMaxItemCount()); + } + count = getMaxItemCount(); + } + } + if (mInventory[1] == null && stack != null) { + mInventory[1] = stack.copy(); + mInventory[1].stackSize = Math.min(stack.getMaxStackSize(), count); + count -= mInventory[1].stackSize; + } else if ((count > 0) && GT_Utility.areStacksEqual(mInventory[1], stack) && mInventory[1].getMaxStackSize() > mInventory[1].stackSize) { + int tmp = Math.min(count, mInventory[1].getMaxStackSize() - mInventory[1].stackSize); + mInventory[1].stackSize += tmp; + count -= tmp; + } + setItemCount(count); + if (stack != null) { + mInventory[2] = stack.copy(); + mInventory[2].stackSize = Math.min(stack.getMaxStackSize(), count); + } else { + mInventory[2] = null; + } + + if (GregTech_API.mAE2) + notifyListeners(count - savedCount, stack); + if (count != savedCount) + getBaseMetaTileEntity().markDirty(); } - return res; } - @Optional.Method(modid = "appliedenergistics2") @Override - public void addListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver, Object o) { - if (listeners == null) - listeners = new HashMap<>(); - listeners.put(imeMonitorHandlerReceiver, o); + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (!aBaseMetaTileEntity.isClientSide()) aBaseMetaTileEntity.openGUI(aPlayer); + return true; } - @Optional.Method(modid = "appliedenergistics2") @Override - public void removeListener(appeng.api.storage.IMEMonitorHandlerReceiver<appeng.api.storage.data.IAEItemStack> imeMonitorHandlerReceiver) { - if (listeners == null) - listeners = new HashMap<>(); - listeners.remove(imeMonitorHandlerReceiver); + public boolean isFacingValid(byte aFacing) { + return true; } - @Optional.Method(modid = "appliedenergistics2") @Override - public appeng.api.config.AccessRestriction getAccess() { - return appeng.api.config.AccessRestriction.READ_WRITE; + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; } - @Optional.Method(modid = "appliedenergistics2") @Override - public boolean isPrioritized(appeng.api.storage.data.IAEItemStack iaeItemStack) { - return false; + public boolean isValidSlot(int aIndex) { + return true; } - @Optional.Method(modid = "appliedenergistics2") @Override - public boolean canAccept(appeng.api.storage.data.IAEItemStack iaeItemStack) { - ItemStack s = getItemStack(); - if (s == null || iaeItemStack == null) - return true; - return iaeItemStack.isSameType(s); + public boolean isSimpleMachine() { + return true; } - @Optional.Method(modid = "appliedenergistics2") @Override - public int getPriority() { - return 0; + public int getProgresstime() { + return getItemCount() + (mInventory[0] == null ? 0 : mInventory[0].stackSize) + (mInventory[1] == null ? 0 : mInventory[1].stackSize); } - @Optional.Method(modid = "appliedenergistics2") @Override - public int getSlot() { - return 0; + public int maxProgresstime() { + return getMaxItemCount(); } - @Optional.Method(modid = "appliedenergistics2") @Override - public boolean validForPass(int i) { + public boolean isGivingInformation() { return true; } + @Override + public String[] getInfoData() { + + if (getItemStack() == null) { + return new String[]{ + EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, + "Stored Items:", + EnumChatFormatting.GOLD + "No Items" + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + "0" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET + }; + } + return new String[]{ + EnumChatFormatting.BLUE + chestName() + EnumChatFormatting.RESET, + "Stored Items:", + EnumChatFormatting.GOLD + getItemStack().getDisplayName() + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + Integer.toString(getItemCount()) + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getMaxItemCount() + EnumChatFormatting.RESET + }; + } + + @Override + public ItemStack[] getStoredItemData() { + return mInventory; + } + + protected abstract String chestName(); + @Optional.Method(modid = "appliedenergistics2") private void notifyListeners(int count, ItemStack stack) { if (listeners == null) { @@ -423,11 +390,49 @@ public abstract class GT_MetaTileEntity_DigitalChestBase extends GT_MetaTileEnti appeng.util.item.AEItemStack s = appeng.util.item.AEItemStack.create(stack); s.setStackSize(count); change.add(s); - listeners.forEach((l,o) ->{ + listeners.forEach((l, o) -> { if (l.isValid(o)) l.postChange(this, change, null); else removeListener(l); }); } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mItemCount", getItemCount()); + if (getItemStack() != null) + aNBT.setTag("mItemStack", getItemStack().writeToNBT(new NBTTagCompound())); + aNBT.setBoolean("mVoidOverflow", mVoidOverflow); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + if (aNBT.hasKey("mItemCount")) + setItemCount(aNBT.getInteger("mItemCount")); + if (aNBT.hasKey("mItemStack")) + setItemStack(ItemStack.loadItemStackFromNBT((NBTTagCompound) aNBT.getTag("mItemStack"))); + mVoidOverflow = aNBT.getBoolean("mVoidOverflow"); + + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 1; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 0 && (mInventory[0] == null || GT_Utility.areStacksEqual(mInventory[0], aStack)); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide != aFacing) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_SCHEST), + TextureFactory.builder().addIcon(OVERLAY_SCHEST_GLOW).glow().build() + }; + } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java index 2eb68e6767..0cf3121773 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_Locker.java @@ -1,18 +1,22 @@ package gregtech.common.tileentities.storage; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.objects.GT_ItemStack; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Utility; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import static gregtech.api.enums.Textures.BlockIcons.LOCKERS; +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAYS_ENERGY_IN; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_LOCKER; + public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlock { public byte mType = 0; @@ -38,11 +42,11 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo public ITexture[][][] getTextureSet(ITexture[] aTextures) { ITexture[][][] rTextures = new ITexture[3][17][]; for (byte i = -1; i < 16; i = (byte) (i + 1)) { - ITexture[] tmp0 = {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(i + 1)]}; + ITexture[] tmp0 = {MACHINE_CASINGS[this.mTier][(i + 1)]}; rTextures[0][(i + 1)] = tmp0; - ITexture[] tmp1 = {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(i + 1)], Textures.BlockIcons.OVERLAYS_ENERGY_IN[this.mTier]}; + ITexture[] tmp1 = {MACHINE_CASINGS[this.mTier][(i + 1)], OVERLAYS_ENERGY_IN[this.mTier]}; rTextures[1][(i + 1)] = tmp1; - ITexture[] tmp2 = {Textures.BlockIcons.MACHINE_CASINGS[this.mTier][(i + 1)], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_LOCKER)}; + ITexture[] tmp2 = {MACHINE_CASINGS[this.mTier][(i + 1)], TextureFactory.of(OVERLAY_LOCKER)}; rTextures[2][(i + 1)] = tmp2; } return rTextures; @@ -50,7 +54,7 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { if (aSide == aFacing) { - return new ITexture[]{this.mTextures[2][(aColorIndex + 1)][0], this.mTextures[2][(aColorIndex + 1)][1], Textures.BlockIcons.LOCKERS[Math.abs(this.mType % Textures.BlockIcons.LOCKERS.length)]}; + return new ITexture[]{this.mTextures[2][(aColorIndex + 1)][0], this.mTextures[2][(aColorIndex + 1)][1], LOCKERS[Math.abs(this.mType % LOCKERS.length)]}; } return this.mTextures[0][(aColorIndex + 1)]; } @@ -96,7 +100,7 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo } public long maxAmperesIn() { - return this.mInventory.length * 2; + return this.mInventory.length * 2L; } public int rechargerSlotStartIndex() { @@ -129,7 +133,7 @@ public class GT_MetaTileEntity_Locker extends GT_MetaTileEntity_TieredMachineBlo public void doSound(byte aIndex, double aX, double aY, double aZ) { if (aIndex == 16) { - GT_Utility.doSoundAtClient((String) GregTech_API.sSoundList.get(3), 1, 1.0F); + GT_Utility.doSoundAtClient(GregTech_API.sSoundList.get(3), 1, 1.0F); } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java index 812f9970ea..396b6d6464 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_QuantumTank.java @@ -1,18 +1,38 @@ package gregtech.common.tileentities.storage; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW; public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_BasicTank { public GT_MetaTileEntity_QuantumTank(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "Stores " + CommonSizeCompute(aTier) + "L of fluid"); + super(aID, aName, aNameRegional, aTier, 3, "Stores " + commonSizeCompute(aTier) + "L of fluid"); + } + + private static int commonSizeCompute(int tier) { + switch (tier) { + case 6: + return 128000000; + case 7: + return 256000000; + case 8: + return 512000000; + case 9: + return 1024000000; + case 10: + return 2147483640; + default: + return 0; + } } public GT_MetaTileEntity_QuantumTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -29,96 +49,84 @@ public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_BasicTank { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_QTANK)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + public boolean isSimpleMachine() { + return true; } @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); + public boolean doesFillContainers() { + return true; } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + public boolean doesEmptyContainers() { return true; } @Override - public boolean isSimpleMachine() { + public boolean canTankBeFilled() { return true; } @Override - public boolean isFacingValid(byte aFacing) { + public boolean canTankBeEmptied() { return true; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean displaysItemStack() { return true; } @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); + public boolean displaysStackSize() { + return false; } @Override - public final byte getUpdateData() { - return 0x00; + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_QuantumTank(mName, mTier, mDescriptionArray, mTextures); } @Override - public boolean doesFillContainers() { - return true; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_QTANK), + TextureFactory.builder().addIcon(OVERLAY_QTANK_GLOW).glow().build() + }; } @Override - public boolean doesEmptyContainers() { + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (!aBaseMetaTileEntity.isClientSide()) aBaseMetaTileEntity.openGUI(aPlayer); return true; } @Override - public boolean canTankBeFilled() { - return true; + public final byte getUpdateData() { + return 0x00; } @Override - public boolean canTankBeEmptied() { + public boolean isFacingValid(byte aFacing) { return true; } @Override - public boolean displaysItemStack() { + public boolean isAccessAllowed(EntityPlayer aPlayer) { return true; } @Override - public boolean displaysStackSize() { - return false; + public int getTankPressure() { + return 100; } @Override - public String[] getInfoData() { - - if (mFluid == null) { - return new String[]{ - EnumChatFormatting.BLUE + "Quantum Tank"+ EnumChatFormatting.RESET, - "Stored Fluid:", - EnumChatFormatting.GOLD + "No Fluid"+ EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(0) + " L"+ EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW + Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET - }; - } - return new String[]{ - EnumChatFormatting.BLUE + "Quantum Tank"+ EnumChatFormatting.RESET, - "Stored Fluid:", - EnumChatFormatting.GOLD + mFluid.getLocalizedName()+ EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L"+ EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW+ Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET - }; + public int getCapacity() { + return commonSizeCompute(mTier); } @Override @@ -127,35 +135,24 @@ public class GT_MetaTileEntity_QuantumTank extends GT_MetaTileEntity_BasicTank { } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_QuantumTank(mName, mTier, mDescriptionArray, mTextures); - } + public String[] getInfoData() { - private static int CommonSizeCompute(int tier){ - switch(tier){ - case 6: - return 128000000; - case 7: - return 256000000; - case 8: - return 512000000; - case 9: - return 1024000000; - case 10: - return 2147483640; - default: - return 0; + if (mFluid == null) { + return new String[]{ + EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET, + "Stored Fluid:", + EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + Integer.toString(0) + " L" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET + }; } - } - - @Override - public int getCapacity() { - return CommonSizeCompute(mTier); - } - - @Override - public int getTankPressure() { - return 100; + return new String[]{ + EnumChatFormatting.BLUE + "Quantum Tank" + EnumChatFormatting.RESET, + "Stored Fluid:", + EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET + }; } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java index 3f53058f8d..e566ba9ed5 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperChest.java @@ -20,20 +20,34 @@ public class GT_MetaTileEntity_SuperChest extends GT_MetaTileEntity_DigitalChest public GT_MetaTileEntity_SuperChest(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } + @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SuperChest(mName, mTier, mDescriptionArray, mTextures); + protected ItemStack getItemStack() { + return mItemStack; } + @Override - protected String chestName(){ return "Super Chest"; } + protected void setItemStack(ItemStack s) { + mItemStack = s; + } + @Override - protected int getItemCount() { return mItemCount; } + protected int getItemCount() { + return mItemCount; + } + @Override public void setItemCount(int aCount) { mItemCount = aCount; } + @Override - protected ItemStack getItemStack(){ return mItemStack; } + protected String chestName() { + return "Super Chest"; + } + @Override - protected void setItemStack(ItemStack s){ mItemStack = s; } + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_SuperChest(mName, mTier, mDescriptionArray, mTextures); + } } diff --git a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java index c8b4bf20d8..41171720f5 100644 --- a/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java +++ b/src/main/java/gregtech/common/tileentities/storage/GT_MetaTileEntity_SuperTank.java @@ -1,18 +1,38 @@ package gregtech.common.tileentities.storage; -import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.common.util.ForgeDirection; + +import static gregtech.api.enums.Textures.BlockIcons.MACHINE_CASINGS; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_QTANK_GLOW; public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_BasicTank { public GT_MetaTileEntity_SuperTank(int aID, String aName, String aNameRegional, int aTier) { - super(aID, aName, aNameRegional, aTier, 3, "Stores " + CommonSizeCompute(aTier) + "L of fluid"); + super(aID, aName, aNameRegional, aTier, 3, "Stores " + commonSizeCompute(aTier) + "L of fluid"); + } + + private static int commonSizeCompute(int tier) { + switch (tier) { + case 1: + return 4000000; + case 2: + return 8000000; + case 3: + return 16000000; + case 4: + return 32000000; + case 5: + return 64000000; + default: + return 0; + } } public GT_MetaTileEntity_SuperTank(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { @@ -29,96 +49,84 @@ public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_BasicTank { } @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return aSide == 1 ? new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_STANK)} : new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]}; + public boolean isSimpleMachine() { + return true; } @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); + public boolean doesFillContainers() { + return true; } @Override - public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { - if (aBaseMetaTileEntity.isClientSide()) return true; - aBaseMetaTileEntity.openGUI(aPlayer); + public boolean doesEmptyContainers() { return true; } @Override - public boolean isSimpleMachine() { + public boolean canTankBeFilled() { return true; } @Override - public boolean isFacingValid(byte aFacing) { + public boolean canTankBeEmptied() { return true; } @Override - public boolean isAccessAllowed(EntityPlayer aPlayer) { + public boolean displaysItemStack() { return true; } @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); + public boolean displaysStackSize() { + return false; } @Override - public final byte getUpdateData() { - return 0x00; + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_SuperTank(mName, mTier, mDescription, mTextures); } @Override - public boolean doesFillContainers() { - return true; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + if (aSide != ForgeDirection.UP.ordinal()) return new ITexture[]{MACHINE_CASINGS[mTier][aColorIndex + 1]}; + return new ITexture[]{ + MACHINE_CASINGS[mTier][aColorIndex + 1], + TextureFactory.of(OVERLAY_QTANK), + TextureFactory.builder().addIcon(OVERLAY_QTANK_GLOW).glow().build() + }; } @Override - public boolean doesEmptyContainers() { + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (!aBaseMetaTileEntity.isClientSide()) aBaseMetaTileEntity.openGUI(aPlayer); return true; } @Override - public boolean canTankBeFilled() { - return true; + public final byte getUpdateData() { + return 0x00; } @Override - public boolean canTankBeEmptied() { + public boolean isFacingValid(byte aFacing) { return true; } @Override - public boolean displaysItemStack() { + public boolean isAccessAllowed(EntityPlayer aPlayer) { return true; } @Override - public boolean displaysStackSize() { - return false; + public int getTankPressure() { + return 100; } @Override - public String[] getInfoData() { - - if (mFluid == null) { - return new String[]{ - EnumChatFormatting.BLUE + "Super Tank"+ EnumChatFormatting.RESET, - "Stored Fluid:", - EnumChatFormatting.GOLD + "No Fluid"+ EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(0) + " L"+ EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW + Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET - }; - } - return new String[]{ - EnumChatFormatting.BLUE + "Super Tank"+ EnumChatFormatting.RESET, - "Stored Fluid:", - EnumChatFormatting.GOLD + mFluid.getLocalizedName()+ EnumChatFormatting.RESET, - EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L"+ EnumChatFormatting.RESET+" "+ - EnumChatFormatting.YELLOW+ Integer.toString(getCapacity()) + " L"+ EnumChatFormatting.RESET - }; + public int getCapacity() { + return commonSizeCompute(mTier); } @Override @@ -127,35 +135,24 @@ public class GT_MetaTileEntity_SuperTank extends GT_MetaTileEntity_BasicTank { } @Override - public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_SuperTank(mName, mTier, mDescription, mTextures); - } + public String[] getInfoData() { - private static int CommonSizeCompute(int tier){ - switch(tier){ - case 1: - return 4000000; - case 2: - return 8000000; - case 3: - return 16000000; - case 4: - return 32000000; - case 5: - return 64000000; - default: - return 0; + if (mFluid == null) { + return new String[]{ + EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET, + "Stored Fluid:", + EnumChatFormatting.GOLD + "No Fluid" + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + "0 L" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET + }; } - } - - @Override - public int getCapacity() { - return CommonSizeCompute(mTier); - } - - @Override - public int getTankPressure() { - return 100; + return new String[]{ + EnumChatFormatting.BLUE + "Super Tank" + EnumChatFormatting.RESET, + "Stored Fluid:", + EnumChatFormatting.GOLD + mFluid.getLocalizedName() + EnumChatFormatting.RESET, + EnumChatFormatting.GREEN + Integer.toString(mFluid.amount) + " L" + EnumChatFormatting.RESET + " " + + EnumChatFormatting.YELLOW + getCapacity() + " L" + EnumChatFormatting.RESET + }; } } diff --git a/src/main/java/gregtech/loaders/misc/GT_CoverLoader.java b/src/main/java/gregtech/loaders/misc/GT_CoverLoader.java index 5082e20f4a..f917c6e1c5 100644 --- a/src/main/java/gregtech/loaders/misc/GT_CoverLoader.java +++ b/src/main/java/gregtech/loaders/misc/GT_CoverLoader.java @@ -1,24 +1,25 @@ package gregtech.loaders.misc; import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.common.covers.GT_Cover_Vent; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; +import static gregtech.api.enums.Textures.BlockIcons.VENT_ADVANCED; +import static gregtech.api.enums.Textures.BlockIcons.VENT_NORMAL; + public class GT_CoverLoader implements Runnable { public void run() { for (byte i = 0; i < 16; i = (byte) (i + 1)) { - GregTech_API.registerCover(new ItemStack(Blocks.carpet, 1, i), new GT_CopiedBlockTexture(Blocks.wool, 0, i), null); + GregTech_API.registerCover(new ItemStack(Blocks.carpet, 1, i), TextureFactory.of(Blocks.wool, i), null); } - GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVent", 1L, 1), new GT_RenderedTexture(Textures.BlockIcons.VENT_NORMAL), new GT_Cover_Vent(1)); - GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentCore", 1L, 1), new GT_RenderedTexture(Textures.BlockIcons.VENT_NORMAL), new GT_Cover_Vent(1)); - GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentGold", 1L, 1), new GT_RenderedTexture(Textures.BlockIcons.VENT_ADVANCED), new GT_Cover_Vent(2)); - GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentSpread", 1L), new GT_RenderedTexture(Textures.BlockIcons.VENT_NORMAL), new GT_Cover_Vent(2)); - GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentDiamond", 1L, 1), new GT_RenderedTexture(Textures.BlockIcons.VENT_ADVANCED), new GT_Cover_Vent(3)); + GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVent", 1L, 1), TextureFactory.of(VENT_NORMAL), new GT_Cover_Vent(1)); + GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentCore", 1L, 1), TextureFactory.of(VENT_NORMAL), new GT_Cover_Vent(1)); + GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentGold", 1L, 1), TextureFactory.of(VENT_ADVANCED), new GT_Cover_Vent(2)); + GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentSpread", 1L), TextureFactory.of(VENT_NORMAL), new GT_Cover_Vent(2)); + GregTech_API.registerCover(GT_ModHandler.getIC2Item("reactorVentDiamond", 1L, 1), TextureFactory.of(VENT_ADVANCED), new GT_Cover_Vent(3)); } } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java index 89d4aeccfb..f48d91bb24 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingCompressed.java @@ -4,7 +4,7 @@ import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.IOreRecipeRegistrator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import net.minecraft.item.ItemStack; @@ -15,7 +15,7 @@ public class ProcessingCompressed implements IOreRecipeRegistrator { public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { GT_ModHandler.removeRecipeByOutputDelayed(aStack); - GregTech_API.registerCover(aStack, new GT_RenderedTexture(aMaterial.mIconSet.mTextures[72], aMaterial.mRGBa, false), null); + GregTech_API.registerCover(aStack, TextureFactory.of(aMaterial.mIconSet.mTextures[72], aMaterial.mRGBa, false), null); //GT_RecipeRegistrator.registerUsagesForMaterials(null, false, GT_Utility.copyAmount(1L, aStack)); } } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFoil.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFoil.java index b9951d60d0..63023f67f3 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingFoil.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingFoil.java @@ -5,7 +5,7 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.IOreRecipeRegistrator; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; @@ -17,6 +17,6 @@ public class ProcessingFoil implements IOreRecipeRegistrator { public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { GT_Values.RA.addBenderRecipe(GT_Utility.copyAmount(1L, GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 4L)), GT_OreDictUnificator.get(OrePrefixes.foil, aMaterial, 4L), (int) Math.max(aMaterial.getMass(), 1L), 24); - GregTech_API.registerCover(aStack, new GT_RenderedTexture(aMaterial.mIconSet.mTextures[70], aMaterial.mRGBa, false), null); + GregTech_API.registerCover(aStack, TextureFactory.of(aMaterial.mIconSet.mTextures[70], aMaterial.mRGBa, false), null); } } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingLens.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingLens.java index 8c8311b129..78afeb4985 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingLens.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingLens.java @@ -5,8 +5,7 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.Textures; -import gregtech.api.objects.GT_MultiTexture; -import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_OreDictUnificator; import net.minecraft.item.ItemStack; @@ -16,11 +15,8 @@ public class ProcessingLens implements gregtech.api.interfaces.IOreRecipeRegistr } public void registerOre(OrePrefixes aPrefix, Materials aMaterial, String aOreDictName, String aModName, ItemStack aStack) { - switch (aMaterial.mName) { + switch (aMaterial.mName) { case "Diamond": - GT_Values.RA.addLatheRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.lens, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 1L), 1200, 30); - GT_Values.RA.addLatheRecipe(GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.lens, aMaterial, 3L), GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), 2400, 16); - break; case "Glass": GT_Values.RA.addLatheRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.lens, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 1L), 1200, 30); GT_Values.RA.addLatheRecipe(GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.lens, aMaterial, 3L), GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 1L), 2400, 16); @@ -28,7 +24,7 @@ public class ProcessingLens implements gregtech.api.interfaces.IOreRecipeRegistr default: GT_Values.RA.addLatheRecipe(GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.lens, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dustSmall, aMaterial, 1L), 1200, 120); GT_Values.RA.addLatheRecipe(GT_OreDictUnificator.get(OrePrefixes.gemExquisite, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.lens, aMaterial, 1L), GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial, 2L), 2400, 30); - GregTech_API.registerCover(aStack, new GT_MultiTexture(Textures.BlockIcons.MACHINE_CASINGS[2][0], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_LENS, aMaterial.mRGBa, false)), new gregtech.common.covers.GT_Cover_Lens(aMaterial.mColor.mIndex)); - } + GregTech_API.registerCover(aStack, TextureFactory.of(Textures.BlockIcons.MACHINE_CASINGS[2][0], TextureFactory.of(Textures.BlockIcons.OVERLAY_LENS, aMaterial.mRGBa, false)), new gregtech.common.covers.GT_Cover_Lens(aMaterial.mColor.mIndex)); + } } } diff --git a/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java b/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java index ec86673c58..a2401b36be 100644 --- a/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java +++ b/src/main/java/gregtech/loaders/oreprocessing/ProcessingPlate.java @@ -8,8 +8,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SubTag; import gregtech.api.enums.TextureSet; import gregtech.api.enums.ToolDictNames; -import gregtech.api.objects.GT_CopiedBlockTexture; -import gregtech.api.objects.GT_StdRenderedTexture; +import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_RecipeRegistrator; @@ -586,12 +585,14 @@ public class ProcessingPlate implements gregtech.api.interfaces.IOreRecipeRegist GregTech_API.registerCover( aStack, // If there is an ItemStack of Block for Materials - tStack != NI ? - // Copy Block texture - new GT_CopiedBlockTexture(Block.getBlockFromItem(tStack.getItem()), 1, tStack.getItemDamage()) : - // or use Materials mRGBa dyed blocs/materialicons/MATERIALSET/block1 icons - new GT_StdRenderedTexture( - aMaterial.mIconSet.mTextures[TextureSet.INDEX_block1], aMaterial.mRGBa, false), + tStack == NI ? + // Use Materials mRGBa dyed blocs/materialicons/MATERIALSET/block1 icons + TextureFactory.builder() + .addIcon(aMaterial.mIconSet.mTextures[TextureSet.INDEX_block1]) + .setRGBA(aMaterial.mRGBa) + .stdOrient().build() : + // or copy Block texture + TextureFactory.of(Block.getBlockFromItem(tStack.getItem()), tStack.getItemDamage()), null); } |