From 13a8a5dd2669e6b1de7006e595a45549f98ac80a Mon Sep 17 00:00:00 2001 From: bombcar Date: Mon, 8 Jan 2024 19:20:16 -0600 Subject: [PATCH] Fix for CCC/L 1.2.0 threadsafe rendering (#10) * update bs, threadsafe rendering * fix buildscripts for jenkins --- build.gradle | 4 +-- dependencies.gradle | 8 ++--- repositories.gradle | 7 ---- .../common/ItemEnderStorageRenderer.java | 11 +++--- .../storage/item/EnderChestRenderer.java | 20 ++++++----- .../storage/liquid/EnderTankRenderer.java | 36 ++++++++++--------- .../storage/liquid/TankSynchroniser.java | 7 ++-- src/main/resources/mcmod.info | 13 +++---- 8 files changed, 48 insertions(+), 58 deletions(-) diff --git a/build.gradle b/build.gradle index 952a3c5..3eb19a2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1704650211 +//version: 1704751096 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -786,7 +786,7 @@ dependencies { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.35') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.4.4') } java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} diff --git a/dependencies.gradle b/dependencies.gradle index e5f473b..78d7e4a 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,10 +1,8 @@ // Add your dependencies here dependencies { - compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.1:dev") - compile("com.github.GTNewHorizons:CodeChickenCore:1.1.3:dev") + api("com.github.GTNewHorizons:CodeChickenLib:1.2.0:dev") + api("com.github.GTNewHorizons:CodeChickenCore:1.2.0:dev") - compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") { - transitive = false - } + devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.5.3-GTNH:dev") } diff --git a/repositories.gradle b/repositories.gradle index 036d7c2..c227b16 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,11 +1,4 @@ // Add any additional repositories for your dependencies here repositories { - maven { - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - } - maven { - url = "https://jitpack.io" - } } diff --git a/src/main/java/codechicken/enderstorage/common/ItemEnderStorageRenderer.java b/src/main/java/codechicken/enderstorage/common/ItemEnderStorageRenderer.java index cee7c20..c360d2c 100644 --- a/src/main/java/codechicken/enderstorage/common/ItemEnderStorageRenderer.java +++ b/src/main/java/codechicken/enderstorage/common/ItemEnderStorageRenderer.java @@ -31,15 +31,16 @@ public void renderItem(ItemRenderType type, ItemStack item, Object... data) { int rotation = 0; if (type == ItemRenderType.ENTITY) rotation = 3; + final CCRenderState state = CCRenderState.instance(); switch (item.getItemDamage() >> 12) { case 0: - EnderChestRenderer.renderChest(rotation, freq, !owner.equals("global"), d.x, d.y, d.z, 0, 0); + EnderChestRenderer.renderChest(state, rotation, freq, !owner.equals("global"), d.x, d.y, d.z, 0, 0); break; case 1: - CCRenderState.reset(); - CCRenderState.pullLightmap(); - CCRenderState.useNormals = true; - EnderTankRenderer.renderTank(rotation, 0, freq, !owner.equals("global"), d.x, d.y, d.z, 0); + state.reset(); + state.pullLightmap(); + state.useNormals = true; + EnderTankRenderer.renderTank(state, rotation, 0, freq, !owner.equals("global"), d.x, d.y, d.z, 0); EnderTankRenderer.renderLiquid(TankSynchroniser.getClientLiquid(freq, owner), d.x, d.y, d.z); break; } diff --git a/src/main/java/codechicken/enderstorage/storage/item/EnderChestRenderer.java b/src/main/java/codechicken/enderstorage/storage/item/EnderChestRenderer.java index 090d059..9ef4c08 100644 --- a/src/main/java/codechicken/enderstorage/storage/item/EnderChestRenderer.java +++ b/src/main/java/codechicken/enderstorage/storage/item/EnderChestRenderer.java @@ -25,8 +25,8 @@ public class EnderChestRenderer extends TileEntitySpecialRenderer { public EnderChestRenderer() {} - public static void renderChest(int rotation, int freq, boolean owned, double x, double y, double z, int offset, - float lidAngle) { + public static void renderChest(CCRenderState state, int rotation, int freq, boolean owned, double x, double y, + double z, int offset, float lidAngle) { if (!EnderStorage.disableFXChest) { TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance; renderEndPortal.render( @@ -41,7 +41,7 @@ public static void renderChest(int rotation, int freq, boolean owned, double x, } GL11.glColor4f(1, 1, 1, 1); - CCRenderState.changeTexture("enderstorage:textures/enderchest.png"); + state.changeTexture("enderstorage:textures/enderchest.png"); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPushMatrix(); GL11.glColor4f(1, 1, 1, 1); @@ -67,10 +67,10 @@ public static void renderChest(int rotation, int freq, boolean owned, double x, 0.04); GL11.glDisable(GL11.GL_LIGHTING); - CCRenderState.changeTexture("enderstorage:textures/hedronmap.png"); - CCRenderState.startDrawing(4); + state.changeTexture("enderstorage:textures/hedronmap.png"); + state.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); - CCRenderState.draw(); + state.draw(); GL11.glEnable(GL11.GL_LIGHTING); } @@ -129,12 +129,14 @@ private static void addVecWithUV(Vector3 vec, double u, double v) { } public void renderTileEntityAt(TileEntity tile, double d, double d1, double d2, float f) { - CCRenderState.reset(); - CCRenderState.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); - CCRenderState.useNormals = true; + final CCRenderState state = CCRenderState.instance(); + state.reset(); + state.setBrightness(tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord); + state.useNormals = true; TileEnderChest chest = (TileEnderChest) tile; renderChest( + state, chest.rotation, chest.freq, !chest.owner.equals("global"), diff --git a/src/main/java/codechicken/enderstorage/storage/liquid/EnderTankRenderer.java b/src/main/java/codechicken/enderstorage/storage/liquid/EnderTankRenderer.java index 5b560c2..df8db0e 100644 --- a/src/main/java/codechicken/enderstorage/storage/liquid/EnderTankRenderer.java +++ b/src/main/java/codechicken/enderstorage/storage/liquid/EnderTankRenderer.java @@ -68,11 +68,13 @@ public class EnderTankRenderer extends TileEntitySpecialRenderer { public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float f) { TileEnderTank tank = (TileEnderTank) tile; - CCRenderState.reset(); - CCRenderState.pullLightmap(); - CCRenderState.useNormals = true; + final CCRenderState state = CCRenderState.instance(); + state.reset(); + state.pullLightmap(); + state.useNormals = true; renderTank( + state, tank.rotation, (float) MathHelper.interpolate(tank.pressure_state.b_rotate, tank.pressure_state.a_rotate, f) * 0.01745F, @@ -85,8 +87,8 @@ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, fl renderLiquid(tank.liquid_state.c_liquid, x, y, z); } - public static void renderTank(int rotation, float valve, int freq, boolean owned, double x, double y, double z, - int offset) { + public static void renderTank(CCRenderState state, int rotation, float valve, int freq, boolean owned, double x, + double y, double z, int offset) { if (!EnderStorage.disableFXTank) { TileEntityRendererDispatcher info = TileEntityRendererDispatcher.instance; renderEndPortal.render( @@ -106,25 +108,25 @@ public static void renderTank(int rotation, float valve, int freq, boolean owned GL11.glTranslated(x + 0.5, y, z + 0.5); GL11.glRotatef(-90 * (rotation + 2), 0, 1, 0); - CCRenderState.changeTexture("enderstorage:textures/endertank.png"); - CCRenderState.startDrawing(4); + state.changeTexture("enderstorage:textures/endertank.png"); + state.startDrawing(4); tankModel.render(); - CCRenderState.draw(); + state.draw(); - CCRenderState.changeTexture("enderstorage:textures/buttons.png"); - CCRenderState.startDrawing(7); + state.changeTexture("enderstorage:textures/buttons.png"); + state.startDrawing(7); for (int i = 0; i < 3; i++) { int colour = EnderStorageManager.getColourFromFreq(freq, i); buttons[i].render(new UVTranslation(0.25 * (colour % 4), 0.25 * (colour / 4))); } - CCRenderState.draw(); + state.draw(); new Rotation(valve, new Vector3(0, 0, 1)).at(new Vector3(0, 0.4165, 0)).glApply(); - CCRenderState.changeTexture("enderstorage:textures/endertank.png"); - CCRenderState.startDrawing(4); + state.changeTexture("enderstorage:textures/endertank.png"); + state.startDrawing(4); valveModel.render(new UVTranslation(0, owned ? 13 / 64D : 0)); - CCRenderState.draw(); + state.draw(); GL11.glPopMatrix(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); @@ -135,10 +137,10 @@ public static void renderTank(int rotation, float valve, int freq, boolean owned 0.04); GL11.glDisable(GL11.GL_LIGHTING); - CCRenderState.changeTexture("enderstorage:textures/hedronmap.png"); - CCRenderState.startDrawing(4); + state.changeTexture("enderstorage:textures/hedronmap.png"); + state.startDrawing(4); CCModelLibrary.icosahedron4.render(pearlMat); - CCRenderState.draw(); + state.draw(); GL11.glEnable(GL11.GL_LIGHTING); } diff --git a/src/main/java/codechicken/enderstorage/storage/liquid/TankSynchroniser.java b/src/main/java/codechicken/enderstorage/storage/liquid/TankSynchroniser.java index f699f35..0ab760b 100644 --- a/src/main/java/codechicken/enderstorage/storage/liquid/TankSynchroniser.java +++ b/src/main/java/codechicken/enderstorage/storage/liquid/TankSynchroniser.java @@ -9,6 +9,9 @@ import net.minecraftforge.event.world.WorldEvent.Unload; import net.minecraftforge.fluids.FluidStack; +import com.google.common.collect.Sets; +import com.google.common.collect.Sets.SetView; + import codechicken.core.ClientUtils; import codechicken.core.ServerUtils; import codechicken.core.fluid.FluidUtils; @@ -17,10 +20,6 @@ import codechicken.enderstorage.internal.EnderStorageSPH; import codechicken.lib.math.MathHelper; import codechicken.lib.packet.PacketCustom; - -import com.google.common.collect.Sets; -import com.google.common.collect.Sets.SetView; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent; import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent; diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 5616e48..aa8f091 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,18 +2,13 @@ { "modid": "${modId}", "name": "${modName}", - "description": "Stores your stuff in the END! - -Credits: Ecu - original idea, design, - chest and pouch texture - Rosethorns - tank model - Soaryn - tank texture - -Supporters: Blkdragon112", + "description": "Stores your stuff in the END!", + "Credits": "Ecu - original idea, design, chest and pouch texture. Rosethorns - tank model. Soaryn - tank texture", + "Supporters": "Blkdragon112", "version": "${modVersion}", "mcversion": "${minecraftVersion}", "url": "http://www.minecraftforum.net/topic/909223", "authorList": [ "ChickenBones" ], "dependencies": [ "CodeChickenCore" ] } -] \ No newline at end of file +]