diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java index 8e3a62a6b..5356f0306 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/BeltType.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.base.flwdata; import com.jozufozu.flywheel.api.struct.Batched; -import com.jozufozu.flywheel.api.struct.BatchingTransformer; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; +import com.jozufozu.flywheel.core.model.ModelTransformer; import com.jozufozu.flywheel.util.RenderMath; import com.mojang.math.Quaternion; import com.simibubi.create.content.contraptions.KineticDebugger; @@ -13,7 +13,6 @@ import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.resources.ResourceLocation; public class BeltType implements Instanced, Batched { @@ -38,29 +37,26 @@ public class BeltType implements Instanced, Batched { } @Override - public BatchingTransformer getTransformer() { - return (d, sbb) -> { + public void transform(BeltData d, ModelTransformer.Params b) { + float spriteHeight = d.maxV - d.minV; + double scroll = d.rotationalSpeed * AnimationTickHolder.getRenderTime() / (31.5 * 16) + d.rotationOffset; + scroll = scroll - Math.floor(scroll); + scroll = scroll * spriteHeight * RenderMath.f(d.scrollMult); - float spriteHeight = d.maxV - d.minV; - double scroll = d.rotationalSpeed * AnimationTickHolder.getRenderTime() / (31.5 * 16) + d.rotationOffset; - scroll = scroll - Math.floor(scroll); - scroll = scroll * spriteHeight * RenderMath.f(d.scrollMult); + float finalScroll = (float) scroll; + b.shiftUV((builder, u, v) -> { + float targetU = u - d.sourceU + d.minU; + float targetV = v - d.sourceV + d.minV + + finalScroll; + builder.uv(targetU, targetV); + }); - float finalScroll = (float) scroll; - sbb.shiftUV((builder, u, v) -> { - float targetU = u - d.sourceU + d.minU; - float targetV = v - d.sourceV + d.minV - + finalScroll; - builder.uv(targetU, targetV); - }); - - sbb.translate(d.x + 0.5, d.y + 0.5, d.z + 0.5) - .multiply(new Quaternion(d.qX, d.qY, d.qZ, d.qW)) - .unCentre() - .light(d.getPackedLight()); - if (KineticDebugger.isActive()) { - sbb.color(d.r, d.g, d.b, d.a); - } - }; + b.translate(d.x + 0.5, d.y + 0.5, d.z + 0.5) + .multiply(new Quaternion(d.qX, d.qY, d.qZ, d.qW)) + .unCentre() + .light(d.getPackedLight()); + if (KineticDebugger.isActive()) { + b.color(d.r, d.g, d.b, d.a); + } } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java index 400afd94f..fd1f444b5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/flwdata/RotatingType.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.base.flwdata; import com.jozufozu.flywheel.api.struct.Batched; -import com.jozufozu.flywheel.api.struct.BatchingTransformer; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; +import com.jozufozu.flywheel.core.model.ModelTransformer; import com.jozufozu.flywheel.util.RenderMath; import com.mojang.math.Vector3f; import com.simibubi.create.content.contraptions.KineticDebugger; @@ -13,7 +13,6 @@ import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.resources.ResourceLocation; public class RotatingType implements Instanced, Batched { @@ -38,19 +37,17 @@ public class RotatingType implements Instanced, Batched getTransformer() { - return (d, b) -> { - float angle = ((AnimationTickHolder.getRenderTime() * d.rotationalSpeed * 3f / 10 + d.rotationOffset) % 360); + public void transform(RotatingData d, ModelTransformer.Params b) { + float angle = ((AnimationTickHolder.getRenderTime() * d.rotationalSpeed * 3f / 10 + d.rotationOffset) % 360); - Vector3f axis = new Vector3f(RenderMath.f(d.rotationAxisX), RenderMath.f(d.rotationAxisY), RenderMath.f(d.rotationAxisZ)); - b.light(d.getPackedLight()) - .translate(d.x + 0.5, d.y + 0.5, d.z + 0.5) - .multiply(axis.rotationDegrees(angle)) - .unCentre(); + Vector3f axis = new Vector3f(RenderMath.f(d.rotationAxisX), RenderMath.f(d.rotationAxisY), RenderMath.f(d.rotationAxisZ)); + b.light(d.getPackedLight()) + .translate(d.x + 0.5, d.y + 0.5, d.z + 0.5) + .multiply(axis.rotationDegrees(angle)) + .unCentre(); - if (KineticDebugger.isActive()) { - b.color(d.r, d.g, d.b, d.a); - } - }; + if (KineticDebugger.isActive()) { + b.color(d.r, d.g, d.b, d.a); + } } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java index 5ff165d7c..8978472ae 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/flwdata/ActorType.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.components.actors.flwdata; import com.jozufozu.flywheel.api.struct.Batched; -import com.jozufozu.flywheel.api.struct.BatchingTransformer; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; +import com.jozufozu.flywheel.core.model.ModelTransformer; import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; @@ -33,9 +33,7 @@ public class ActorType implements Instanced, Batched { } @Override - public BatchingTransformer getTransformer() { - return (d, sbb) -> { + public void transform(ActorData d, ModelTransformer.Params b) { - }; } } diff --git a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java index 4d3a67b04..8eecc5662 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/flap/FlapType.java @@ -1,16 +1,14 @@ package com.simibubi.create.content.logistics.block.flap; import com.jozufozu.flywheel.api.struct.Batched; -import com.jozufozu.flywheel.api.struct.BatchingTransformer; import com.jozufozu.flywheel.api.struct.Instanced; import com.jozufozu.flywheel.api.struct.StructWriter; import com.jozufozu.flywheel.backend.gl.attrib.VertexFormat; import com.jozufozu.flywheel.backend.gl.buffer.VecBuffer; -import com.mojang.math.Vector3f; +import com.jozufozu.flywheel.core.model.ModelTransformer; import com.simibubi.create.foundation.render.AllInstanceFormats; import com.simibubi.create.foundation.render.AllProgramSpecs; -import net.minecraft.client.renderer.LightTexture; import net.minecraft.resources.ResourceLocation; public class FlapType implements Instanced, Batched { @@ -35,18 +33,16 @@ public class FlapType implements Instanced, Batched { } @Override - public BatchingTransformer getTransformer() { - return (d, sbb) -> { - sbb.translate(d.x, d.y, d.z) - .centre() - .rotateY(-d.horizontalAngle) - .unCentre() - .translate(d.pivotX, d.pivotY, d.pivotZ) - .rotateX(getFlapAngle(d.flapness, d.intensity, d.flapScale)) - .translateBack(d.pivotX, d.pivotY, d.pivotZ) - .translate(d.segmentOffsetX, d.segmentOffsetY, d.segmentOffsetZ) - .light(d.getPackedLight()); - }; + public void transform(FlapData d, ModelTransformer.Params b) { + b.translate(d.x, d.y, d.z) + .centre() + .rotateY(-d.horizontalAngle) + .unCentre() + .translate(d.pivotX, d.pivotY, d.pivotZ) + .rotateX(getFlapAngle(d.flapness, d.intensity, d.flapScale)) + .translateBack(d.pivotX, d.pivotY, d.pivotZ) + .translate(d.segmentOffsetX, d.segmentOffsetY, d.segmentOffsetZ) + .light(d.getPackedLight()); } private static float getFlapAngle(float flapness, float intensity, float scale) { diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index ed817e63b..bbb796f35 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -283,9 +283,9 @@ public class ClientEvents { Level level = Minecraft.getInstance().level; BlockPos blockPos = info.getBlockPosition(); FluidState fluidstate = level.getFluidState(blockPos); - if (info.getPosition().y > blockPos.getY() + fluidstate.getHeight(level, blockPos)) + if (info.getPosition().y > blockPos.getY() + fluidstate.getHeight(level, blockPos)) return; - + Fluid fluid = fluidstate.getType(); if (fluid.isSame(AllFluids.CHOCOLATE.get())) {