From 7a4a430a1fbef24a288c333b372b2188fe80e0b0 Mon Sep 17 00:00:00 2001 From: Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:39:59 +0000 Subject: Optimise EOH Renderer and fix transparency bug (#258) * Clean up EOH rendering and fix transparency bug * Optimise the renderer somewhat * Lower poly count of space shell * spotlessApply * fix wci * update bs+deps * Change EOH render hitbox * Imports + spotless * Fix bounding box and culling * Update src/main/java/com/github/technus/tectech/rendering/EOH/EOH_RenderingUtils.java Co-authored-by: Raven Szewczyk * Update src/main/java/com/github/technus/tectech/rendering/EOH/EOH_RenderingUtils.java Co-authored-by: Raven Szewczyk * Update src/main/java/com/github/technus/tectech/rendering/EOH/EOH_RenderingUtils.java Co-authored-by: Raven Szewczyk * Add constant * blendfunc * Hitbox change * Spotless --------- Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com> Co-authored-by: GitHub GTNH Actions Co-authored-by: Martin Robertz Co-authored-by: Connor Colenso Co-authored-by: Raven Szewczyk --- .../github/technus/tectech/loader/MainLoader.java | 5 +- .../loader/recipe/ResearchStationAssemblyLine.java | 23 +- .../tectech/loader/thing/MachineLoader.java | 290 +++++++++++++++++++- .../github/technus/tectech/proxy/ClientProxy.java | 8 +- .../tectech/rendering/EOH/EOH_ItemRenderer.java | 95 +++++++ .../tectech/rendering/EOH/EOH_RenderingUtils.java | 265 ++++++++++++++++++ .../technus/tectech/rendering/EOH/EOH_TESR.java | 90 +++++++ .../tectech/thing/block/EOH_RenderBlock.java | 76 ++++++ .../tectech/thing/block/EyeOfHarmonyBlock.java | 71 ----- .../tectech/thing/block/RenderEyeOfHarmony.java | 299 --------------------- .../tectech/thing/block/TileEyeOfHarmony.java | 17 +- .../tectech/thing/casing/TT_Container_Casings.java | 4 +- .../tectech/thing/item/RenderEyeOfHarmonyItem.java | 100 ------- .../tectech/thing/metaTileEntity/Textures.java | 42 ++- .../hatch/GT_MetaTileEntity_Hatch_Uncertainty.java | 8 +- .../multi/GT_MetaTileEntity_EM_EyeOfHarmony.java | 15 +- .../multi/GT_MetaTileEntity_EM_switch.java | 7 +- .../multi/GT_MetaTileEntity_TM_teslaCoil.java | 15 +- .../base/GT_MetaTileEntity_MultiblockBase_EM.java | 13 +- .../GT_MetaTileEntity_DebugPowerGenerator.java | 6 +- .../single/GT_MetaTileEntity_TT_Transformer.java | 6 +- .../single/GT_MetaTileEntity_TeslaCoil.java | 6 +- 22 files changed, 969 insertions(+), 492 deletions(-) create mode 100644 src/main/java/com/github/technus/tectech/rendering/EOH/EOH_ItemRenderer.java create mode 100644 src/main/java/com/github/technus/tectech/rendering/EOH/EOH_RenderingUtils.java create mode 100644 src/main/java/com/github/technus/tectech/rendering/EOH/EOH_TESR.java create mode 100644 src/main/java/com/github/technus/tectech/thing/block/EOH_RenderBlock.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java delete mode 100644 src/main/java/com/github/technus/tectech/thing/item/RenderEyeOfHarmonyItem.java (limited to 'src/main/java') diff --git a/src/main/java/com/github/technus/tectech/loader/MainLoader.java b/src/main/java/com/github/technus/tectech/loader/MainLoader.java index d4e436157b..cacf236134 100644 --- a/src/main/java/com/github/technus/tectech/loader/MainLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/MainLoader.java @@ -1,6 +1,9 @@ package com.github.technus.tectech.loader; -import static com.github.technus.tectech.TecTech.*; +import static com.github.technus.tectech.TecTech.LOGGER; +import static com.github.technus.tectech.TecTech.configTecTech; +import static com.github.technus.tectech.TecTech.creativeTabTecTech; +import static com.github.technus.tectech.TecTech.proxy; import static com.github.technus.tectech.loader.TecTechConfig.DEBUG_MODE; import static gregtech.api.enums.Mods.NewHorizonsCoreMod; import static gregtech.api.enums.Mods.TwilightForest; diff --git a/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java b/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java index 1dd36e0ed6..aa55361e7c 100644 --- a/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java +++ b/src/main/java/com/github/technus/tectech/loader/recipe/ResearchStationAssemblyLine.java @@ -2,7 +2,28 @@ package com.github.technus.tectech.loader.recipe; import static com.github.technus.tectech.loader.recipe.BaseRecipeLoader.getItemContainer; import static com.google.common.math.LongMath.pow; -import static gregtech.api.enums.Mods.*; +import static gregtech.api.enums.Mods.Avaritia; +import static gregtech.api.enums.Mods.AvaritiaAddons; +import static gregtech.api.enums.Mods.BartWorks; +import static gregtech.api.enums.Mods.BloodMagic; +import static gregtech.api.enums.Mods.DraconicEvolution; +import static gregtech.api.enums.Mods.EternalSingularity; +import static gregtech.api.enums.Mods.ExtraUtilities; +import static gregtech.api.enums.Mods.GTNHIntergalactic; +import static gregtech.api.enums.Mods.GTPlusPlus; +import static gregtech.api.enums.Mods.GTPlusPlusEverglades; +import static gregtech.api.enums.Mods.GalaxySpace; +import static gregtech.api.enums.Mods.GoodGenerator; +import static gregtech.api.enums.Mods.GraviSuite; +import static gregtech.api.enums.Mods.GregTech; +import static gregtech.api.enums.Mods.IndustrialCraft2; +import static gregtech.api.enums.Mods.KekzTech; +import static gregtech.api.enums.Mods.KubaTech; +import static gregtech.api.enums.Mods.NewHorizonsCoreMod; +import static gregtech.api.enums.Mods.SGCraft; +import static gregtech.api.enums.Mods.SuperSolarPanels; +import static gregtech.api.enums.Mods.Thaumcraft; +import static gregtech.api.enums.Mods.TinkersGregworks; import static gregtech.api.util.GT_ModHandler.getModItem; import static gregtech.api.util.GT_RecipeBuilder.MINUTES; import static gregtech.api.util.GT_RecipeBuilder.SECONDS; diff --git a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java index 70765ecddc..e0a373e67a 100644 --- a/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java +++ b/src/main/java/com/github/technus/tectech/loader/thing/MachineLoader.java @@ -1,6 +1,294 @@ package com.github.technus.tectech.loader.thing; -import static com.github.technus.tectech.thing.CustomItemList.*; +import static com.github.technus.tectech.thing.CustomItemList.DATApipe; +import static com.github.technus.tectech.thing.CustomItemList.DATApipeBlock; +import static com.github.technus.tectech.thing.CustomItemList.LASERpipe; +import static com.github.technus.tectech.thing.CustomItemList.LASERpipeBlock; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_IV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_LuV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UEV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UHV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UIV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UMV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_UXV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_BuckConverter_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.Machine_DebugGenny; +import static com.github.technus.tectech.thing.CustomItemList.Machine_DebugPollutor; +import static com.github.technus.tectech.thing.CustomItemList.Machine_DebugWriter; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Computer; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_DataBank; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_EyeOfHarmony; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Infuser; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Microwave; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Research; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Switch; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_TeslaCoil; +import static com.github.technus.tectech.thing.CustomItemList.Machine_Multi_Transformer; +import static com.github.technus.tectech.thing.CustomItemList.Machine_OwnerDetector; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_EV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_HV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_IV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_LV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_1by1_MV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_EV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_HV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_IV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_LV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_2by2_MV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_EV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_HV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_IV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_LV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_3by3_MV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_EV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_HV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_IV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_LV; +import static com.github.technus.tectech.thing.CustomItemList.Machine_TeslaCoil_4by4_MV; +import static com.github.technus.tectech.thing.CustomItemList.ParametrizerTXT_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.ParametrizerX_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.Parametrizer_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.UncertaintyX_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.Uncertainty_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.UnusedStuff; +import static com.github.technus.tectech.thing.CustomItemList.capacitor_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.dataInAss_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.dataIn_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.dataOutAss_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.dataOut_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti16_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti4_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoMulti64_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel1_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel2_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel3_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel4_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel5_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel6_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel7_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_dynamoTunnel9001; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti16_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti4_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyMulti64_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel1_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel2_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel3_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel4_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel5_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel6_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel7_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyTunnel9001; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_MAX; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti16_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_MAX; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti4_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_EV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_IV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_LuV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_MAX; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UEV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UHV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UIV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UMV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessMulti64_ZPM; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel1_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel2_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel3_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel4_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel5_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel6_UXV; +import static com.github.technus.tectech.thing.CustomItemList.eM_energyWirelessTunnel7_UXV; +import static com.github.technus.tectech.thing.CustomItemList.hatch_CreativeData; +import static com.github.technus.tectech.thing.CustomItemList.hatch_CreativeMaintenance; +import static com.github.technus.tectech.thing.CustomItemList.holder_Hatch; +import static com.github.technus.tectech.thing.CustomItemList.rack_Hatch; import static com.github.technus.tectech.util.CommonValues.V; import net.minecraft.init.Blocks; diff --git a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java index 0baf9a3f24..68b3fb7a0f 100644 --- a/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java +++ b/src/main/java/com/github/technus/tectech/proxy/ClientProxy.java @@ -15,11 +15,11 @@ import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.common.util.ForgeDirection; import com.github.technus.tectech.Reference; +import com.github.technus.tectech.rendering.EOH.EOH_ItemRenderer; +import com.github.technus.tectech.rendering.EOH.EOH_TESR; import com.github.technus.tectech.thing.block.QuantumGlassBlock; import com.github.technus.tectech.thing.block.QuantumGlassRender; -import com.github.technus.tectech.thing.block.RenderEyeOfHarmony; import com.github.technus.tectech.thing.block.TileEyeOfHarmony; -import com.github.technus.tectech.thing.item.RenderEyeOfHarmonyItem; import com.gtnewhorizon.structurelib.entity.fx.WeightlessParticleFX; import cpw.mods.fml.client.FMLClientHandler; @@ -35,9 +35,9 @@ public class ClientProxy extends CommonProxy { RenderingRegistry.registerBlockHandler(QuantumGlassBlock.renderID, new QuantumGlassRender()); MinecraftForgeClient - .registerItemRenderer(Item.getItemFromBlock(eyeOfHarmonyRenderBlock), new RenderEyeOfHarmonyItem()); + .registerItemRenderer(Item.getItemFromBlock(eyeOfHarmonyRenderBlock), new EOH_ItemRenderer()); - ClientRegistry.bindTileEntitySpecialRenderer(TileEyeOfHarmony.class, new RenderEyeOfHarmony()); + ClientRegistry.bindTileEntitySpecialRenderer(TileEyeOfHarmony.class, new EOH_TESR()); } @Override diff --git a/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_ItemRenderer.java b/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_ItemRenderer.java new file mode 100644 index 0000000000..d8c4be71f1 --- /dev/null +++ b/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_ItemRenderer.java @@ -0,0 +1,95 @@ +package com.github.technus.tectech.rendering.EOH; + +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.STAR_LAYER_0; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.STAR_LAYER_1; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.STAR_LAYER_2; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.starModel; +import static java.lang.Math.pow; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; + +public class EOH_ItemRenderer implements IItemRenderer { + + @Override + public boolean handleRenderType(ItemStack item, ItemRenderType type) { + return true; + } + + @Override + public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { + return true; + } + + @Override + public void renderItem(ItemRenderType type, ItemStack item, Object... data) { + GL11.glPushMatrix(); + + if (type == ItemRenderType.INVENTORY) GL11.glRotated(180, 0, 1, 0); + else if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { + GL11.glTranslated(0.5, 0.5, 0.5); + if (type == ItemRenderType.EQUIPPED) GL11.glRotated(90, 0, 1, 0); + } + + // Render star stuff. + renderStarLayer(0, STAR_LAYER_0, 1.0f); + renderStarLayer(1, STAR_LAYER_1, 0.4f); + renderStarLayer(2, STAR_LAYER_2, 0.2f); + + GL11.glPopMatrix(); + } + + private void renderStarLayer(int layer, ResourceLocation texture, float alpha) { + + // Begin animation. + GL11.glPushMatrix(); + + // OpenGL settings, not sure exactly what these do. + + // Disables lighting, so star is always lit (I think). + GL11.glDisable(GL11.GL_LIGHTING); + // Culls things out of line of sight? + GL11.glEnable(GL11.GL_CULL_FACE); + // Merges colours of the various layers of the star? + GL11.glEnable(GL11.GL_BLEND); + // ??? + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + // Bind animation to layer of star. + FMLClientHandler.instance().getClient().getTextureManager().bindTexture(texture); + + // 0.01f magic number to shrink sphere obj down. + // Size obtained from the multis current recipe. + float scale = 0.01f; + + // Put each subsequent layer further out. + scale *= pow(1.04f, layer); + + // Scale the star up in the x, y and z directions. + GL11.glScalef(scale, scale, scale); + + switch (layer) { + case 0 -> GL11.glRotatef(130 + (System.currentTimeMillis() / 64) % 360, 0F, 1F, 1F); + case 1 -> GL11.glRotatef(-49 + (System.currentTimeMillis() / 64) % 360, 1F, 1F, 0F); + case 2 -> GL11.glRotatef(67 + (System.currentTimeMillis() / 64) % 360, 1F, 0F, 1F); + } + + // Set colour and alpha (transparency) of the star layer. + GL11.glColor4f(1, 1, 1, alpha); + + starModel.renderAll(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_LIGHTING); + + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + // Finish animation. + GL11.glPopMatrix(); + } + +} diff --git a/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_RenderingUtils.java b/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_RenderingUtils.java new file mode 100644 index 0000000000..74e8ecc9bf --- /dev/null +++ b/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_RenderingUtils.java @@ -0,0 +1,265 @@ +package com.github.technus.tectech.rendering.EOH; + +import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.STAR_LAYER_0; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.STAR_LAYER_1; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.STAR_LAYER_2; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.spaceModel; +import static com.github.technus.tectech.rendering.EOH.EOH_TESR.starModel; +import static java.lang.Math.pow; + +import java.awt.Color; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.util.IIcon; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; + +import org.lwjgl.opengl.GL11; + +import cpw.mods.fml.client.FMLClientHandler; + +public abstract class EOH_RenderingUtils { + + public static void renderStar(IItemRenderer.ItemRenderType type, Color color) { + GL11.glPushMatrix(); + + if (type == IItemRenderer.ItemRenderType.INVENTORY) GL11.glRotated(180, 0, 1, 0); + else if (type == IItemRenderer.ItemRenderType.EQUIPPED + || type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) { + GL11.glTranslated(0.5, 0.5, 0.5); + if (type == IItemRenderer.ItemRenderType.EQUIPPED) GL11.glRotated(90, 0, 1, 0); + } + + // Render star stuff. + renderStarLayer(0, STAR_LAYER_0, color, 1.0f); + renderStarLayer(1, STAR_LAYER_1, color, 0.4f); + renderStarLayer(2, STAR_LAYER_2, color, 0.2f); + + GL11.glPopMatrix(); + } + + public static void renderStar(IItemRenderer.ItemRenderType type) { + renderStar(type, new Color(1.0f, 0.4f, 0.05f, 1.0f)); + } + + private static void renderStarLayer(int layer, ResourceLocation texture, Color color, float alpha) { + + // Begin animation. + GL11.glPushMatrix(); + + // OpenGL settings, not sure exactly what these do. + + // Disables lighting, so star is always lit (I think). + GL11.glDisable(GL11.GL_LIGHTING); + // Culls triangles/quads facing away from the camera + GL11.glEnable(GL11.GL_CULL_FACE); + // Allows alpha blending to occur (transparency-based color mixing) + GL11.glEnable(GL11.GL_BLEND); + // ??? + if (alpha < 1.0f) { + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); + } else { + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + } + + // Bind image to layer of star. + FMLClientHandler.instance().getClient().getTextureManager().bindTexture(texture); + + // 0.01f magic number to shrink sphere obj down. + // Size obtained from the multis current recipe. + float scale = 0.01f; + + // Put each subsequent layer further out. + scale *= pow(1.04f, layer); + + // Scale the star up in the x, y and z directions. + GL11.glScalef(scale, scale, scale); + + switch (layer) { + case 0 -> GL11.glRotatef(130 + (System.currentTimeMillis() / 64) % 360, 0F, 1F, 1F); + case 1 -> GL11.glRotatef(-49 + (System.currentTimeMillis() / 64) % 360, 1F, 1F, 0F); + case 2 -> GL11.glRotatef(67 + (System.currentTimeMillis() / 64) % 360, 1F, 0F, 1F); + } + + // Set colour and alpha (transparency) of the star layer. + final float red = color.getRed() / 255.0f; + final float green = color.getGreen() / 255.0f; + final float blue = color.getBlue() / 255.0f; + + GL11.glColor4f(red, green, blue, alpha); + + starModel.renderAll(); + GL11.glDisable(GL11.GL_BLEND); + GL11.glDepthMask(true); + GL11.glEnable(GL11.GL_LIGHTING); + + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + // Finish animation. + GL11.glPopMatrix(); + } + + public static void beginRenderingBlocksInWorld(final float blockSize) { + final Tessellator tes = Tessellator.instance; + + GL11.glPushMatrix(); + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + + GL11.glDisable(GL11.GL_LIGHTING); + + tes.setColorOpaque_F(1f, 1f, 1f); + tes.startDrawingQuads(); + + GL11.glScalef(blockSize, blockSize, blockSize); + } + + public static void endRenderingBlocksInWorld() { + Tessellator.instance.draw(); + + GL11.glPopAttrib(); + GL11.glPopMatrix(); + } + + static final double[] BLOCK_X = { -0.5, -0.5, +0.5, +0.5, +0.5, +0.5, -0.5, -0.5 }; + static final double[] BLOCK_Y = { +0.5, -0.5, -0.5, +0.5, +0.5, -0.5, -0.5, +0.5 }; + static final double[] BLOCK_Z = { +0.5, +0.5, +0.5, +0.5, -0.5, -0.5, -0.5, -0.5 }; + + public static void addRenderedBlockInWorld(final Block block, final int meta, final double x, final double y, + final double z) { + final Tessellator tes = Tessellator.instance; + + IIcon texture; + + double minU; + double maxU; + double minV; + double maxV; + + { + texture = block.getIcon(4, meta); + + minU = texture.getMinU(); + maxU = texture.getMaxU(); + minV = texture.getMinV(); + maxV = texture.getMaxV(); + + tes.addVertexWithUV(x + BLOCK_X[1], y + BLOCK_Y[1], z + BLOCK_Z[1], maxU, maxV); + tes.addVertexWithUV(x + BLOCK_X[0], y + BLOCK_Y[0], z + BLOCK_Z[0], maxU, minV); + tes.addVertexWithUV(x + BLOCK_X[7], y + BLOCK_Y[7], z + BLOCK_Z[7], minU, minV); + tes.addVertexWithUV(x + BLOCK_X[6], y + BLOCK_Y[6], z + BLOCK_Z[6], minU, maxV); + } + + { + // Bottom face. + texture = block.getIcon(0, meta); + + minU = texture.getMinU(); + maxU = texture.getMaxU(); + minV = texture.getMinV(); + maxV = texture.getMaxV(); + + tes.addVertexWithUV(x + BLOCK_X[5], y + BLOCK_Y[5], z + BLOCK_Z[5], maxU, minV); + tes.addVertexWithUV(x + BLOCK_X[2], y + BLOCK_Y[2], z + BLOCK_Z[2], maxU, maxV); + tes.addVertexWithUV(x + BLOCK_X[1], y + BLOCK_Y[1], z + BLOCK_Z[1], minU, maxV); + tes.addVertexWithUV(x + BLOCK_X[6], y + BLOCK_Y[6], z + BLOCK_Z[6], minU, minV); + } + + { + texture = block.getIcon(2, meta); + + minU = texture.getMinU(); + maxU = texture.getMaxU(); + minV = texture.getMinV(); + maxV = texture.getMaxV(); + + tes.addVertexWithUV(x + BLOCK_X[6], y + BLOCK_Y[6], z + BLOCK_Z[6], maxU, maxV); + tes.addVertexWithUV(x + BLOCK_X[7], y + BLOCK_Y[7], z + BLOCK_Z[7], maxU, minV); + tes.addVertexWithUV(x + BLOCK_X[4], y + BLOCK_Y[4], z + BLOCK_Z[4], minU, minV); + tes.addVertexWithUV(x + BLOCK_X[5], y + BLOCK_Y[5], z + BLOCK_Z[5], minU, maxV); + } + + { + texture = block.getIcon(5, meta); + + minU = texture.getMinU(); + maxU = texture.getMaxU(); + minV = texture.getMinV(); + maxV = texture.getMaxV(); + + tes.addVertexWithUV(x + BLOCK_X[5], y + BLOCK_Y[5], z + BLOCK_Z[5], maxU, maxV); + tes.addVertexWithUV(x + BLOCK_X[4], y + BLOCK_Y[4], z + BLOCK_Z[4], maxU, minV); + tes.addVertexWithUV(x + BLOCK_X[3], y + BLOCK_Y[3], z + BLOCK_Z[3], minU, minV); + tes.addVertexWithUV(x + BLOCK_X[2], y + BLOCK_Y[2], z + BLOCK_Z[2], minU, maxV); + } + + { + texture = block.getIcon(1, meta); + + minU = texture.getMinU(); + maxU = texture.getMaxU(); + minV = texture.getMinV(); + maxV = texture.getMaxV(); + + tes.addVertexWithUV(x + BLOCK_X[3], y + BLOCK_Y[3], z + BLOCK_Z[3], maxU, maxV); + tes.addVertexWithUV(x + BLOCK_X[4], y + BLOCK_Y[4], z + BLOCK_Z[4], maxU, minV); + tes.addVertexWithUV(x + BLOCK_X[7], y + BLOCK_Y[7], z + BLOCK_Z[7], minU, minV); + tes.addVertexWithUV(x + BLOCK_X[0], y + BLOCK_Y[0], z + BLOCK_Z[0], minU, maxV); + } + + { + texture = block.getIcon(3, meta); + + minU = texture.getMinU(); + maxU = texture.getMaxU(); + minV = texture.getMinV(); + maxV = texture.getMaxV(); + + tes.addVertexWithUV(x + BLOCK_X[2], y + BLOCK_Y[2], z + BLOCK_Z[2], maxU, maxV); + tes.addVertexWithUV(x + BLOCK_X[3], y + BLOCK_Y[3], z + BLOCK_Z[3], maxU, minV); + tes.addVertexWithUV(x + BLOCK_X[0], y + BLOCK_Y[0], z + BLOCK_Z[0], minU, minV); + tes.addVertexWithUV(x + BLOCK_X[1], y + BLOCK_Y[1], z + BLOCK_Z[1], minU, maxV); + } + } + + public static void renderBlockInWorld(final Block block, final int meta, final float blockSize) { + beginRenderingBlocksInWorld(blockSize); + + addRenderedBlockInWorld(block, meta, 0, 0, 0); + + endRenderingBlocksInWorld(); + } + + public static void renderOuterSpaceShell() { + + // Save current OpenGL state. + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + + // Begin animation. + GL11.glPushMatrix(); + + // Disables lighting, so star is always lit. + GL11.glDisable(GL11.GL_LIGHTING); + // Merges colors of the various layers of the star. + // GL11.glEnable(GL11.GL_BLEND); + + // Bind animation to layer of star. + FMLClientHandler.instance().getClient().getTextureManager() + .bindTexture(new ResourceLocation(MODID, "models/spaceLayer.png")); + + final float scale = 0.01f * 17.5f; + // Scale the star up in the x, y and z directions. + GL11.glScalef(scale, scale, scale); + + GL11.glColor4f(1, 1, 1, 1); + + spaceModel.renderAll(); + + // Finish animation. + GL11.glPopMatrix(); + + // Restore previous OpenGL state. + GL11.glPopAttrib(); + } + +} diff --git a/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_TESR.java b/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_TESR.java new file mode 100644 index 0000000000..8f7dfded5e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/rendering/EOH/EOH_TESR.java @@ -0,0 +1,90 @@ +package com.github.technus.tectech.rendering.EOH; + +import static com.github.technus.tectech.Reference.MODID; +import static com.github.technus.tectech.rendering.EOH.EOH_RenderingUtils.renderBlockInWorld; +import static com.github.technus.tectech.rendering.EOH.EOH_RenderingUtils.renderOuterSpaceShell; +import static com.github.technus.tectech.rendering.EOH.EOH_RenderingUtils.renderStar; + +import net.minecraft.client.renderer.texture.TextureMap; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.IItemRenderer; +import net.minecraftforge.client.model.AdvancedModelLoader; +import net.minecraftforge.client.model.IModelCustom; + +import org.lwjgl.opengl.GL11; + +import com.github.technus.tectech.thing.block.TileEyeOfHarmony; + +public class EOH_TESR extends TileEntitySpecialRenderer { + + public static final ResourceLocation STAR_LAYER_0 = new ResourceLocation(MODID, "models/StarLayer0.png"); + public static final ResourceLocation STAR_LAYER_1 = new ResourceLocation(MODID, "models/StarLayer1.png"); + public static final ResourceLocation STAR_LAYER_2 = new ResourceLocation(MODID, "models/StarLayer2.png"); + public static IModelCustom starModel; + public static IModelCustom spaceModel; + + public EOH_TESR() { + starModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Star.obj")); + spaceModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Space.obj")); + } + + @Override + public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { + if (!(tile instanceof TileEyeOfHarmony EOHRenderTile)) return; + + GL11.glPushMatrix(); + // Required to centre the render to the middle of the block. + GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); + + GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + + // Space shell. + renderOuterSpaceShell(); + + // Render the planets. + renderOrbitObjects(EOHRenderTile); + + // Render the star itself. + renderStar(IItemRenderer.ItemRenderType.INVENTORY); + GL11.glPopAttrib(); + + GL11.glPopMatrix(); + } + + private void renderOrbitObjects(final TileEyeOfHarmony EOHRenderTile) { + + if (EOHRenderTile.getOrbitingObjects() != null) { + + if (EOHRenderTile.getOrbitingObjects().size() == 0) { + EOHRenderTile.generateImportantInfo(); + } + + for (TileEyeOfHarmony.OrbitingObject t : EOHRenderTile.getOrbitingObjects()) { + renderOrbit(EOHRenderTile, t); + } + } + } + + void renderOrbit(final TileEyeOfHarmony EOHRenderTile, final TileEyeOfHarmony.OrbitingObject orbitingObject) { + // Render orbiting body. + GL11.glPushMatrix(); + + GL11.glRotatef(orbitingObject.zAngle, 0, 0, 1); + GL11.glRotatef(orbitingObject.xAngle, 1, 0, 0); + GL11.glRotatef((orbitingObject.rotationSpeed * 0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); + GL11.glTranslated(-0.2 - orbitingObject.distance - STAR_RESCALE * EOHRenderTile.getSize(), 0, 0); + GL11.glRotatef((orbitingObject.orbitSpeed * 0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); + + this.bindTexture(TextureMap.locationBlocksTexture); + renderBlockInWorld(orbitingObject.block, 0, orbitingObject.scale); + + GL11.glPopMatrix(); + } + + private static final float STAR_RESCALE = 0.2f; + +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/EOH_RenderBlock.java b/src/main/java/com/github/technus/tectech/thing/block/EOH_RenderBlock.java new file mode 100644 index 0000000000..962c31a67e --- /dev/null +++ b/src/main/java/com/github/technus/tectech/thing/block/EOH_RenderBlock.java @@ -0,0 +1,76 @@ +package com.github.technus.tectech.thing.block; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import com.github.technus.tectech.TecTech; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +public class EOH_RenderBlock extends Block { + + public EOH_RenderBlock() { + super(Material.iron); + this.setResistance(20f); + this.setHardness(-1.0f); + this.setCreativeTab(TecTech.creativeTabTecTech); + this.setBlockName("Eye of Harmony Renderer"); + this.setLightLevel(100.0f); + registerOther(this); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister iconRegister) { + blockIcon = iconRegister.registerIcon("gregtech:iconsets/TRANSPARENT"); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + public boolean canRenderInPass(int a) { + return true; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return new TileEyeOfHarmony(); + } + + public static void registerOther(Block block) { + String name = block.getUnlocalizedName().substring(block.getUnlocalizedName().indexOf(".") + 1); + GameRegistry.registerBlock(block, name.substring(name.indexOf(":") + 1)); + } + + @Override + public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) { + return new ArrayList<>(); + } + + @Override + public boolean isCollidable() { + return false; + } + +} diff --git a/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java b/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java deleted file mode 100644 index a126fa2eb2..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/block/EyeOfHarmonyBlock.java +++ /dev/null @@ -1,71 +0,0 @@ -package com.github.technus.tectech.thing.block; - -import java.util.ArrayList; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - -import com.github.technus.tectech.TecTech; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class EyeOfHarmonyBlock extends Block { - - public EyeOfHarmonyBlock() { - super(Material.iron); - this.setResistance(20f); - this.setHardness(-1.0f); - this.setCreativeTab(TecTech.creativeTabTecTech); - this.setBlockName("Eye of Harmony Renderer"); - this.setLightLevel(100.0f); - registerOther(this); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - blockIcon = iconRegister.registerIcon("gregtech:iconsets/TRANSPARENT"); - } - - @Override - public boolean isOpaqueCube() { - return false; - } - - @Override - public boolean canRenderInPass(int a) { - return true; - } - - @Override - public boolean renderAsNormalBlock() { - return false; - } - - @Override - public boolean hasTileEntity(int metadata) { - return true; - } - - @Override - public TileEntity createTileEntity(World world, int metadata) { - return new TileEyeOfHarmony(); - } - - public static void registerOther(Block block) { - String name = block.getUnlocalizedName().substring(block.getUnlocalizedName().indexOf(".") + 1); - GameRegistry.registerBlock(block, name.substring(name.indexOf(":") + 1)); - } - - @Override - public ArrayList getDrops(World world, int x, int y, int z, int meta, int fortune) { - return new ArrayList<>(); - } - -} diff --git a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java b/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java deleted file mode 100644 index 7fe0d144f9..0000000000 --- a/src/main/java/com/github/technus/tectech/thing/block/RenderEyeOfHarmony.java +++ /dev/null @@ -1,299 +0,0 @@ -package com.github.technus.tectech.thing.block; - -import static com.github.technus.tectech.Reference.MODID; -import static java.lang.Math.pow; - -import net.minecraft.block.Block; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.texture.TextureMap; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.AdvancedModelLoader; -import net.minecraftforge.client.model.IModelCustom; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.FMLClientHandler; - -public class RenderEyeOfHarmony extends TileEntitySpecialRenderer { - - public static final ResourceLocation STAR_LAYER_0 = new ResourceLocation(MODID, "models/StarLayer0.png"); - public static final ResourceLocation STAR_LAYER_1 = new ResourceLocation(MODID, "models/StarLayer1.png"); - public static final ResourceLocation STAR_LAYER_2 = new ResourceLocation(MODID, "models/StarLayer2.png"); - public static IModelCustom starModel; - private static IModelCustom spaceModel; - - public RenderEyeOfHarmony() { - starModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Star.obj")); - spaceModel = AdvancedModelLoader.loadModel(new ResourceLocation(MODID, "models/Space.obj")); - } - - @Override - public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { - if (!(tile instanceof TileEyeOfHarmony EOHRenderTile)) return; - - // Render outer space layer. - - { - GL11.glPushMatrix(); - GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5); - renderOuterSpaceShell(); - - renderOrbitObjects(EOHRenderTile); - - // Render star stuff. - renderStarLayer(EOHRenderTile, 0, STAR_LAYER_0, 1.0f); - renderStarLayer(EOHRenderTile, 1, STAR_LAYER_1, 0.4f); - renderStarLayer(EOHRenderTile, 2, STAR_LAYER_2, 0.2f); - - GL11.glPopMatrix(); - } - } - - private void renderOrbitObjects(final TileEyeOfHarmony EOHRenderTile) { - - if (EOHRenderTile.getOrbitingObjects() != null) { - - if (EOHRenderTile.getOrbitingObjects().size() == 0) { - EOHRenderTile.generateImportantInfo(); - } - - for (TileEyeOfHarmony.OrbitingObject t : EOHRenderTile.getOrbitingObjects()) { - renderOrbit(EOHRenderTile, t); - } - } - } - - void renderOrbit(final TileEyeOfHarmony EOHRenderTile, final TileEyeOfHarmony.OrbitingObject orbitingObject) { - // Render orbiting body. - GL11.glPushMatrix(); - GL11.glRotatef(orbitingObject.zAngle, 0, 0, 1); - GL11.glRotatef(orbitingObject.xAngle, 1, 0, 0); - GL11.glRotatef((orbitingObject.rotationSpeed * 0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); - GL11.glTranslated(-0.2 - orbitingObject.distance - STAR_RESCALE * EOHRenderTile.getSize(), 0, 0); - GL11.glRotatef((orbitingObject.orbitSpeed * 0.1f * EOHRenderTile.angle) % 360.0f, 0F, 1F, 0F); - renderBlockInWorld(orbitingObject.block, 0, orbitingObject.scale); - GL11.glPopMatrix(); - } - - public static void renderOuterSpaceShell() { - - // Begin animation. - GL11.glPushMatrix(); - - // OpenGL settings, not sure exactly what these do. - - // Disables lighting, so star is always lit (I think). - GL11.glDisable(GL11.GL_LIGHTING); - // Merges colours of the various layers of the star? - GL11.glEnable(GL11.GL_BLEND); - - // Bind animation to layer of star. - FMLClientHandler.instance().getClient().getTextureManager() - .bindTexture(new ResourceLocation(MODID, "models/spaceLayer.png")); - - final float scale = 0.01f * 17.5f; - // Scale the star up in the x, y and z directions. - GL11.glScalef(scale, scale, scale); - - GL11.glColor4f(1, 1, 1, 1); - - spaceModel.renderAll(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_LIGHTING); - - // Finish animation. - GL11.glPopMatrix(); - } - - private static final float STAR_RESCALE = 0.2f; - - private void renderStarLayer(TileEyeOfHarmony EOHRenderTile, int layer, ResourceLocation texture, float alpha) { - - // Begin animation. - GL11.glPushMatrix(); - - // OpenGL settings, not sure exactly what these do. - - // Disables lighting, so star is always lit (I think). - GL11.glDisable(GL11.GL_LIGHTING); - // Culls things out of line of sight? - GL11.glEnable(GL11.GL_CULL_FACE); - // Merges colours of the various layers of the star? - GL11.glEnable(GL11.GL_BLEND); - // ??? - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - - // Bind animation to layer of star. - FMLClientHandler.instance().getClient().getTextureManager().bindTexture(texture); - - // 0.01f magic number to shrink sphere obj down. - // Size obtained from the multis current recipe. - float scale = 0.01f * STAR_RESCALE * EOHRenderTile.getSize(); - - // Put each subsequent layer further out. - scale *= pow(1.04f, layer); - - // Scale the star up in the x, y and z directions. - GL11.glScalef(scale, scale, scale); - - switch (layer) { - case 0: - GL11.glRotatef(130, 0F, 1F, 1F); - break; - case 1: - GL11.glRotatef(-49, 1F, 1F, 0F); - break; - case 2: - GL11.glRotatef(67, 1F, 0F, 1F); - break; - } - - // Set colour and alpha (transparency) of the star layer. - GL11.glColor4f(1, 1, 1, alpha); - - // Spin the star around according to the multi time dilation tier. - GL11.glRotatef((0.03f * EOHRenderTile.angle * EOHRenderTile.getRotationSpeed()) % 360.0f, 0F, 0F, 1F); - - starModel.renderAll(); - GL11.glDisable(GL11.GL_BLEND); - GL11.glDepthMask(true); - GL11.glEnable(GL11.GL_LIGHTING); - - // Finish animation. - GL11.glPopMatrix(); - } - - private void renderBlockInWorld(Block block, int meta, float blockSize) { - Tessellator tes = Tessellator.instance; - - this.bindTexture(TextureMap.locationBlocksTexture); - - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - tes.setColorOpaque_F(1f, 1f, 1f); - - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDisable(GL11.GL_ALPHA_TEST); - GL11.glEnable(GL11.GL_BLEND); - tes.setColorOpaque_F(1f, 1f, 1f); - - // Add the rendering calls here (Can and should use helper functions that do the vertex calls) - - double x = 0; - double y = 0; - double z = 0; - - double[] X = { x - 0.5, x - 0.5, x + 0.5, x + 0.5, x + 0.5, x + 0.5, x - 0.5, x - 0.5 }; - double[] Y = { y + 0.5, y - 0.5, y - 0.5, y + 0.5, y + 0.5, y - 0.5, y - 0.5, y + 0.5 }; - double[] Z = { z + 0.5, z + 0.5, z + 0.5, z + 0.5, z - 0.5, z - 0.5, z - 0.5, z - 0.5 }; - - tes.startDrawingQuads(); - - GL11.glScalef(blockSize, blockSize, blockSize); - - IIcon texture; - - double minU; - double maxU; - double minV; - double maxV; - - { - texture = block.getIcon(4, meta); - - minU = texture.getMinU(); - maxU = texture.getMaxU(); - minV = texture.getMinV(); - maxV = texture.getMaxV(); - - tes.addVertexWithUV(X[1], Y[1], Z[1], maxU, maxV); - tes.addVertexWithUV(X[0], Y[0], Z[0], maxU, minV); - tes.addVertexWithUV(X[7], Y[7], Z[7], minU, minV); - tes.addVertexWithUV(X[6], Y[6], Z[6], minU, maxV); - } - - { - // Bottom face. - texture = block.getIcon(0, meta); - - minU = texture.getMinU(); - maxU = texture.getMaxU(); - minV = texture.getMinV(); - maxV = texture.getMaxV(); - -