diff options
author | BucketBrigade <138534411+CookieBrigade@users.noreply.github.com> | 2024-09-13 18:00:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-14 01:00:19 +0200 |
commit | e7a32141309838050e533e8fd422f7773e0d465c (patch) | |
tree | c3b302130d85d34f3e311ff798d05ecbebdeb598 /src/main/java/goodgenerator | |
parent | 82793acd17f82173fbd06f663d6a01a7e9e306d2 (diff) | |
download | GT5-Unofficial-e7a32141309838050e533e8fd422f7773e0d465c.tar.gz GT5-Unofficial-e7a32141309838050e533e8fd422f7773e0d465c.tar.bz2 GT5-Unofficial-e7a32141309838050e533e8fd422f7773e0d465c.zip |
Antimatter Finishing touches (#3181)
Diffstat (limited to 'src/main/java/goodgenerator')
3 files changed, 66 insertions, 39 deletions
diff --git a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java index 8f5b522d3c..0fa1a539f3 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/AntimatterForge.java @@ -107,6 +107,8 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo private long guiPassiveEnergy = 0; private long guiActiveEnergy = 0; + private boolean canRender = false; + private List<AntimatterOutputHatch> amOutputHatches = new ArrayList<>(16); private static final ClassValue<IStructureDefinition<AntimatterForge>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<AntimatterForge>>() { @@ -183,7 +185,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo .addInfo(EnumChatFormatting.LIGHT_PURPLE + "Dimensions not included!" + EnumChatFormatting.GRAY) .addInfo("Converts protomatter into antimatter") .addInfo( - "Consumes 10 000 000 + (" + EnumChatFormatting.DARK_BLUE + "Consumes 10 000 000 + (" + EnumChatFormatting.DARK_AQUA + "Antimatter" + EnumChatFormatting.GRAY + " * " @@ -194,7 +196,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo + EnumChatFormatting.GRAY + " EU/t passively. The consumption decays by 0.5% every tick when empty") .addInfo( - "Uses (" + EnumChatFormatting.DARK_BLUE + "Uses (" + EnumChatFormatting.DARK_AQUA + "Antimatter" + EnumChatFormatting.GRAY + " * " @@ -216,7 +218,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo + "10% of antimatter will be voided!" + EnumChatFormatting.GRAY) .addInfo( - "Produces (" + EnumChatFormatting.DARK_BLUE + "Produces (" + EnumChatFormatting.DARK_AQUA + "Antimatter" + EnumChatFormatting.GRAY + "^" @@ -228,14 +230,14 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo + String.valueOf(this.baseSkew) + EnumChatFormatting.GRAY + ", 1) of antimatter per cycle, consuming equal amounts of Protomatter") - .addInfo("The change can be negative! (N = Skewed Normal Distribution)") + .addInfo("The change can be negative! (N = Normal Distribution with mean of 0.2)") .addSeparator() .addInfo("Can be supplied with stabilization fluids to improve antimatter generation") .addInfo( EnumChatFormatting.GREEN + "Magnetic Stabilization" + EnumChatFormatting.GRAY + " (Uses " - + EnumChatFormatting.DARK_BLUE + + EnumChatFormatting.DARK_AQUA + "Antimatter" + EnumChatFormatting.GRAY + "^0.5 per cycle)") @@ -251,7 +253,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo EnumChatFormatting.DARK_PURPLE + "Gravity Stabilization" + EnumChatFormatting.GRAY + " (Uses " - + EnumChatFormatting.DARK_BLUE + + EnumChatFormatting.DARK_AQUA + "Antimatter" + EnumChatFormatting.GRAY + "^0.5 per cycle)") @@ -271,7 +273,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo EnumChatFormatting.GOLD + "Containment Stabilization" + EnumChatFormatting.GRAY + " (Uses " - + EnumChatFormatting.DARK_BLUE + + EnumChatFormatting.DARK_AQUA + "Antimatter" + EnumChatFormatting.GRAY + "^(2/7) per operation)") @@ -285,7 +287,7 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo EnumChatFormatting.AQUA + "Activation Stabilization" + EnumChatFormatting.GRAY + " (Uses " - + EnumChatFormatting.DARK_BLUE + + EnumChatFormatting.DARK_AQUA + "Antimatter" + EnumChatFormatting.GRAY + "^(1/3) per operation)") @@ -298,7 +300,6 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo + "+0.10" + EnumChatFormatting.GRAY) .addSeparator() - .addSeparator() .addCasingInfoMin("Antimatter Containment Casing", 512, false) .addCasingInfoMin("Magnetic Flux Casing", 2274, false) .addCasingInfoMin("Gravity Stabilization Casing", 623, false) @@ -886,22 +887,26 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo } public void updateAntimatterSize(float antimatterAmount) { - TileAntimatter render = forceGetAntimatterRender(); - - if (antimatterAmount < 0) { - setProtoRender(false); - render.setCoreSize(0); + if (antimatterAmount <= 0) { + destroyAntimatterRender(); return; } + TileAntimatter render = getAntimatterRender(); + if (render == null) { + createAntimatterRender(); + render = getAntimatterRender(); + } + float size = (float) Math.pow(antimatterAmount, 0.17); render.setCoreSize(size); } public void setProtoRender(boolean flag) { - TileAntimatter render = forceGetAntimatterRender(); + TileAntimatter render = getAntimatterRender(); + if (render == null) return; render.setProtomatterRender(flag); - if (flag) render.setRotationFields(getRotation(), getDirection()); + render.setRotationFields(getRotation(), getDirection()); } public TileAntimatter getAntimatterRender() { @@ -973,12 +978,4 @@ public class AntimatterForge extends MTEExtendedPowerMultiBlockBase<AntimatterFo world.setBlock(wX, wY, wZ, Blocks.air); world.setBlock(wX, wY, wZ, Loaders.antimatterRenderBlock); } - - public TileAntimatter forceGetAntimatterRender() { - TileAntimatter render = getAntimatterRender(); - if (render != null) return render; - else createAntimatterRender(); - return getAntimatterRender(); - } - } diff --git a/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java b/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java index 8e2027b36d..13494f9234 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/render/TileAntimatter.java @@ -16,9 +16,9 @@ public class TileAntimatter extends TileEntity { public boolean shouldRender = true; // Antimatter Core settings - public static final float spikeR = 0.82f, spikeG = 0.92f, spikeB = 1f; - public static final float coreR = 0.43f, coreG = 0.40f, coreB = 1f; - public static final float maximalRadius = 9; // Includes core radius + spike length + public static final float spikeR = 0.153f, spikeG = 0.435f, spikeB = 1f; + public static final float coreR = 0.435f, coreG = 0.718f, coreB = 1f; + public static final float maximalRadius = 7; // Includes core radius + spike length // Due to being partially managed by a global timer, rotationSpeedMultiplier shouldn't change // Otherwise it'll cause a snapping effect public final float rotationSpeedMultiplier = 1; @@ -27,7 +27,7 @@ public class TileAntimatter extends TileEntity { public float coreScaleSnapshot = 1f; public final float coreScaleTransitionTime = 2.5f; public float timeSnapshot; - public float spikeFactor = 1f; + public float spikeFactor = .01f; // Protomatter Settings public static float protoSpiralMaxRadius = .5f; diff --git a/src/main/java/goodgenerator/client/render/AntimatterRenderer.java b/src/main/java/goodgenerator/client/render/AntimatterRenderer.java index 3b988b4491..c6d4f689c6 100644 --- a/src/main/java/goodgenerator/client/render/AntimatterRenderer.java +++ b/src/main/java/goodgenerator/client/render/AntimatterRenderer.java @@ -26,11 +26,11 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { private static ShaderProgram antimatterProgram; private static IModelCustom antimatterModel; private static IModelCustom containerModel; + private static IModelCustom ringModel; private static final float modelNormalize = .5f; private int uColorSpike = -1; private int uColorCore = -1; - private int uSpikeMult = -1; private int uScale = -1; private int uScaleSnapshot = -1; private int uTime = -1; @@ -49,6 +49,10 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { private boolean initialized = false; + // Glowy Ring + private static ShaderProgram glowProgram; + private int uGlowColor = -1; + private static final float[] promomatterVerticies = { // Front Face -0.5f, 0.5f, 0.5f, -0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f, 0.5f, 0.5f, 0.5f, @@ -75,6 +79,9 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { ResourceLocation location = new ResourceLocation(GoodGenerator.resourceDomain, "models/SmoothSphere.obj"); containerModel = (IModelCustom) new WavefrontObject(location); + + ResourceLocation ringLocation = new ResourceLocation(GoodGenerator.resourceDomain, "models/GlowRing.obj"); + ringModel = (IModelCustom) new WavefrontObject(ringLocation); } private void init() { @@ -90,13 +97,11 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { uScaleSnapshot = antimatterProgram.getUniformLocation("u_ScaleSnapshot"); uTime = antimatterProgram.getUniformLocation("u_Time"); uTimeSnapshot = antimatterProgram.getUniformLocation("u_TimeSnapshot"); - uSpikeMult = antimatterProgram.getUniformLocation("u_SpikeMult"); uOpacity = antimatterProgram.getUniformLocation("u_Opacity"); uColorCore = antimatterProgram.getUniformLocation("u_ColorCore"); uColorSpike = antimatterProgram.getUniformLocation("u_ColorSpike"); } catch (NullPointerException e) { System.out.println(e.getMessage()); - ShaderProgram.clear(); return; } @@ -123,7 +128,6 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { uProtomatterColor = protomatterProgram.getUniformLocation("u_Color"); uProtomatterSpiralRadius = protomatterProgram.getUniformLocation("u_SpiralRadius"); } catch (NullPointerException e) { - ShaderProgram.clear(); return; } @@ -143,6 +147,21 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { GL20.glUniform3(uProtomatterVertices, bufferBeamVertex); GL20.glUniform1f(uCubeCount, particleCount); ShaderProgram.clear(); + GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); + + try { + glowProgram = new ShaderProgram( + GoodGenerator.resourceDomain, + "shaders/glow.vert.glsl", + "shaders/glow.frag.glsl"); + uGlowColor = glowProgram.getUniformLocation("u_Color"); + glowProgram.use(); + GL20.glUniform3f(uGlowColor, 0, 1f, 1f); + + } catch (NullPointerException e) { + return; + } + ShaderProgram.clear(); initialized = true; } @@ -174,24 +193,22 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { GL20.glUniform1f(uTime, realTime); GL20.glUniform1f(uTimeSnapshot, snapTime); - GL20.glUniform1f(uSpikeMult, tile.spikeFactor); GL20.glUniform1f(uScale, coreSize); GL20.glUniform1f(uScaleSnapshot, coreSizeSnapshot); GL11.glDisable(GL11.GL_CULL_FACE); + GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); antimatterModel.renderAll(); ShaderProgram.clear(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glColor3f(0, 0, 0); - GL11.glScalef( - -coreSize * (1 + tile.spikeFactor), - -coreSize * (1 + tile.spikeFactor), - -coreSize * (1 + tile.spikeFactor)); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + GL11.glScalef(-TileAntimatter.maximalRadius, -TileAntimatter.maximalRadius, -TileAntimatter.maximalRadius); containerModel.renderAll(); - - GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0); GL11.glPopMatrix(); GL11.glPopAttrib(); } @@ -225,6 +242,17 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { } + public void renderRing(TileAntimatter tile, double x, double y, double z, float timer) { + GL11.glPushMatrix(); + GL11.glColor3f(0, 1, 1); + GL11.glTranslated(x, y, z); + glowProgram.use(); + GL11.glRotatef(tile.rotationAngle, tile.rotX, tile.rotY, tile.rotZ); + ringModel.renderAll(); + ShaderProgram.clear(); + GL11.glPopMatrix(); + } + @Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float timeSinceLastTick) { @@ -249,5 +277,7 @@ public class AntimatterRenderer extends TileEntitySpecialRenderer { if (!Antimatter.protomatterRender) return; renderProtomatterBeam(Antimatter, tx, ty, tz, timer); + + renderRing(Antimatter, tx, ty, tz, timer); } } |