mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 12:33:57 +01:00
Implemented Model Data Initializer to StandardBogeyRenderer
This commit is contained in:
parent
6d98a1f469
commit
91727cc84a
@ -1,5 +1,6 @@
|
|||||||
package com.simibubi.create.content.logistics.trains;
|
package com.simibubi.create.content.logistics.trains;
|
||||||
|
|
||||||
|
import com.jozufozu.flywheel.api.MaterialManager;
|
||||||
import com.jozufozu.flywheel.util.transform.Transform;
|
import com.jozufozu.flywheel.util.transform.Transform;
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
@ -12,6 +13,13 @@ import net.minecraft.nbt.CompoundTag;
|
|||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import static com.simibubi.create.AllBlockPartials.LARGE_BOGEY_WHEELS;
|
||||||
|
import static com.simibubi.create.AllBlockPartials.BOGEY_PIN;
|
||||||
|
import static com.simibubi.create.AllBlockPartials.BOGEY_DRIVE;
|
||||||
|
import static com.simibubi.create.AllBlockPartials.BOGEY_PISTON;
|
||||||
|
import static com.simibubi.create.AllBlockPartials.SMALL_BOGEY_WHEELS;
|
||||||
|
import static com.simibubi.create.AllBlockPartials.BOGEY_FRAME;
|
||||||
|
|
||||||
public class StandardBogeyRenderer extends BogeyRenderer {
|
public class StandardBogeyRenderer extends BogeyRenderer {
|
||||||
|
|
||||||
public StandardBogeyRenderer() {
|
public StandardBogeyRenderer() {
|
||||||
@ -19,13 +27,22 @@ public class StandardBogeyRenderer extends BogeyRenderer {
|
|||||||
renderers.put(BogeySize.LARGE, this::renderLarge);
|
renderers.put(BogeySize.LARGE, this::renderLarge);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initialiseContraptionModelData(MaterialManager materialManager, BogeySize size) {
|
||||||
|
// Large
|
||||||
|
createModelInstances(materialManager, LARGE_BOGEY_WHEELS, BOGEY_DRIVE, BOGEY_PISTON, BOGEY_PIN);
|
||||||
|
// Small
|
||||||
|
createModelInstances(materialManager, SMALL_BOGEY_WHEELS, 2);
|
||||||
|
createModelInstances(materialManager, BOGEY_FRAME);
|
||||||
|
}
|
||||||
|
|
||||||
public void renderSmall(CompoundTag bogeyData, float wheelAngle, PoseStack ms, int light,
|
public void renderSmall(CompoundTag bogeyData, float wheelAngle, PoseStack ms, int light,
|
||||||
@Nullable VertexConsumer vb) {
|
@Nullable VertexConsumer vb) {
|
||||||
boolean inContraption = vb != null;
|
boolean inContraption = vb != null;
|
||||||
Transform<?> transform = getTransformFromPartial(AllBlockPartials.BOGEY_FRAME, inContraption);
|
Transform<?> transform = getTransformFromPartial(BOGEY_FRAME, inContraption);
|
||||||
finalize(transform, ms, light, vb);
|
finalize(transform, ms, light, vb);
|
||||||
|
|
||||||
Transform<?>[] wheels = getTransformsFromPartial(AllBlockPartials.SMALL_BOGEY_WHEELS, inContraption, 2);
|
Transform<?>[] wheels = getTransformsFromPartial(SMALL_BOGEY_WHEELS, inContraption, 2);
|
||||||
for (int side : Iterate.positiveAndNegative) {
|
for (int side : Iterate.positiveAndNegative) {
|
||||||
if (!inContraption)
|
if (!inContraption)
|
||||||
ms.pushPose();
|
ms.pushPose();
|
||||||
@ -42,22 +59,22 @@ public class StandardBogeyRenderer extends BogeyRenderer {
|
|||||||
@Nullable VertexConsumer vb) {
|
@Nullable VertexConsumer vb) {
|
||||||
boolean inContraption = vb != null;
|
boolean inContraption = vb != null;
|
||||||
|
|
||||||
Transform<?> bogeyDrive = getTransformFromPartial(AllBlockPartials.BOGEY_DRIVE, inContraption);
|
Transform<?> bogeyDrive = getTransformFromPartial(BOGEY_DRIVE, inContraption);
|
||||||
finalize(bogeyDrive, ms, light, vb);
|
finalize(bogeyDrive, ms, light, vb);
|
||||||
|
|
||||||
Transform<?> bogeyPiston = getTransformFromPartial(AllBlockPartials.BOGEY_PISTON, inContraption)
|
Transform<?> bogeyPiston = getTransformFromPartial(BOGEY_PISTON, inContraption)
|
||||||
.translate(0, 0, 1 / 4f * Math.sin(AngleHelper.rad(wheelAngle)));
|
.translate(0, 0, 1 / 4f * Math.sin(AngleHelper.rad(wheelAngle)));
|
||||||
finalize(bogeyPiston, ms, light, vb);
|
finalize(bogeyPiston, ms, light, vb);
|
||||||
|
|
||||||
if (!inContraption)
|
if (!inContraption)
|
||||||
ms.pushPose();
|
ms.pushPose();
|
||||||
|
|
||||||
Transform<?> bogeyWheels = getTransformFromPartial(AllBlockPartials.LARGE_BOGEY_WHEELS, inContraption)
|
Transform<?> bogeyWheels = getTransformFromPartial(LARGE_BOGEY_WHEELS, inContraption)
|
||||||
.translate(0, 1, 0)
|
.translate(0, 1, 0)
|
||||||
.rotateX(wheelAngle);
|
.rotateX(wheelAngle);
|
||||||
finalize(bogeyWheels, ms, light, vb);
|
finalize(bogeyWheels, ms, light, vb);
|
||||||
|
|
||||||
Transform<?> bogeyPin = getTransformFromPartial(AllBlockPartials.BOGEY_PIN, inContraption)
|
Transform<?> bogeyPin = getTransformFromPartial(BOGEY_PIN, inContraption)
|
||||||
.translate(0, 1, 0)
|
.translate(0, 1, 0)
|
||||||
.rotateX(wheelAngle)
|
.rotateX(wheelAngle)
|
||||||
.translate(0, 1 / 4f, 0)
|
.translate(0, 1 / 4f, 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user