|
| 1 | +package com.cak.pattern_schematics.foundation.mirror; |
| 2 | + |
| 3 | +import com.mojang.blaze3d.vertex.PoseStack; |
| 4 | +import com.simibubi.create.AllSpecialTextures; |
| 5 | +import com.simibubi.create.content.schematics.client.SchematicHandler; |
| 6 | +import com.simibubi.create.foundation.outliner.AABBOutline; |
| 7 | +import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; |
| 8 | +import com.simibubi.create.foundation.utility.AnimationTickHolder; |
| 9 | +import com.simibubi.create.foundation.utility.Iterate; |
| 10 | +import net.minecraft.core.Direction; |
| 11 | +import net.minecraft.world.phys.Vec3; |
| 12 | + |
| 13 | +import java.util.List; |
| 14 | + |
| 15 | +public class CloneSchematicOutlineRenderer { |
| 16 | + |
| 17 | + public static void renderCloneGridLines(PoseStack ms, PatternSchematicHandler schematicHandler, SuperRenderTypeBuffer buffer) { |
| 18 | + ms.pushPose(); |
| 19 | + AABBOutline outline = schematicHandler.getGreaterOutline(); |
| 20 | + outline.setBounds(schematicHandler.calculateGreaterOutlineBounds()); |
| 21 | + outline.getParams() |
| 22 | + .colored(0x6886c5) |
| 23 | + .lineWidth(1/16f); |
| 24 | + for (Direction.Axis axis : Iterate.axes) { |
| 25 | + List<Direction.Axis> secondaries = |
| 26 | + axis == Direction.Axis.X ? List.of(Direction.Axis.Y, Direction.Axis.Z) : |
| 27 | + axis == Direction.Axis.Y ? List.of(Direction.Axis.Y, Direction.Axis.Z) : |
| 28 | + List.of(Direction.Axis.X, Direction.Axis.Y); |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + continue; |
| 33 | + } |
| 34 | + outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks()); |
| 35 | + ms.popPose(); |
| 36 | + } |
| 37 | + |
| 38 | + public static void renderClone(PoseStack ms, SchematicHandler schematicHandler, SuperRenderTypeBuffer buffer) { |
| 39 | + ms.pushPose(); |
| 40 | + AABBOutline outline = schematicHandler.getOutline(); |
| 41 | + outline.getParams() |
| 42 | + .colored(0xa6a1af) |
| 43 | + .withFaceTexture(AllSpecialTextures.CHECKERED) |
| 44 | + .lineWidth(0); |
| 45 | + outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks()); |
| 46 | + outline.getParams() |
| 47 | + .clearTextures(); |
| 48 | + ms.popPose(); |
| 49 | + } |
| 50 | + |
| 51 | + public static void applyOutlineModification(SchematicHandler schematicHandler) { |
| 52 | + if (schematicHandler instanceof PatternSchematicHandler) { |
| 53 | + AABBOutline outline = schematicHandler.getOutline(); |
| 54 | + PatternSchematicHandler patternSchematicHandler = (PatternSchematicHandler) schematicHandler; |
| 55 | + outline.getParams() |
| 56 | + .colored(0x9352a3).lineWidth(patternSchematicHandler.isRenderingMultiple() ? 3/32f : 1/16f); |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | +} |
0 commit comments