Skip to content

Commit 616d6d4

Browse files
committed
1.1.5
1 parent e70c263 commit 616d6d4

File tree

12 files changed

+221
-30
lines changed

12 files changed

+221
-30
lines changed

Changelog.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
- (Technical) Created datagen
55
1.1.4:
66
- Fixed a bug with deployers placing at the wrong offsets
7-
- Created bulk apply system to reduce pain of having to put a schematic on each individual deployer
7+
- Created bulk apply system to reduce pain of having to put a schematic on each individual deployer
8+
1.1.5:
9+
- Fixed clone outlines rendering on a non-deployed schematic
10+
- Improved tool usage on pattern schematics (thanks @d4rkfl4sh for the suggestion)
11+
- Added ponder for contraption uses of schematics

common/src/generated/resources/.cache/a0215e79d0b720ef451ebefde67e867b1dd8939d

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// 1.19.2 2024-08-04T14:33:10.2803239 Registrate Provider for create_pattern_schematics [Recipes, Advancements, Loot tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
2+
ef2d06ece9923cc75b5e3dc3070df2808f1cdb74 assets\create_pattern_schematics\models\item\pattern_schematic.json
3+
942ec2c362ab8fe5bb67e1ab30ffc6559ffcb677 assets\create_pattern_schematics\lang\en_us.json
4+
57ae8de9deafee3b663ab9547d413bf9ccc3130d assets\create_pattern_schematics\lang\en_ud.json
5+
19e25b53bb643c63106b1f83e2f1fe5a6ac63f13 assets\create_pattern_schematics\models\item\empty_pattern_schematic.json

common/src/generated/resources/assets/create_pattern_schematics/lang/en_ud.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"create_pattern_schematics.contraption_application.applied_to": " oʇ ɔıʇɐɯǝɥɔs uɹǝʇʇɐd pǝıןddⱯ",
3-
"create_pattern_schematics.contraption_application.deployers": "sɹǝʎoןdǝp ",
3+
"create_pattern_schematics.contraption_application.deployers": ")s(ɹǝʎoןdǝp ",
44
"create_pattern_schematics.ponder.schematic_printing.header": "sɔıʇɐɯǝɥɔs uɹǝʇʇɐd ɥʇıʍ suɹǝʇʇɐd buıʇuıɹԀ",
55
"create_pattern_schematics.ponder.schematic_printing.text_1": "ǝɔɹnos ɐ sɐ ǝsn oʇ ɔıʇɐɯǝɥɔs ɐ ǝʌɐs ʇsɹıɟ ʇsnɯ noʎ 'sɔıʇɐɯǝɥɔs uɹǝʇʇɐd ǝsn o⟘",
66
"create_pattern_schematics.ponder.schematic_printing.text_2": "ɔıʇɐɯǝɥɔs uɹǝʇʇɐd ʎʇdɯǝ uɐ ɥʇıʍ ǝןqɐʇ ɔıʇɐɯǝɥɔs ɐ ǝsn 'uǝɥ⟘",
@@ -11,6 +11,10 @@
1111
"create_pattern_schematics.ponder.schematic_printing.text_7": "sǝuoןɔ ןןɐ oʇ ʎןddɐ uǝɥʇ ןןıʍ uoıʇɐʇoɹ sıɥ⟘",
1212
"create_pattern_schematics.ponder.tag.pattern_schematics": "sɔıʇɐɯǝɥɔS uɹǝʇʇɐԀ",
1313
"create_pattern_schematics.ponder.tag.pattern_schematics.description": "sɔıʇɐɯǝɥɔs uɹǝʇʇɐd ɥʇıʍ buıʇuıɹԀ",
14+
"create_pattern_schematics.ponder.train_schematic_printing.header": "suıɐɹʇ ɥʇıʍ buıʇuıɹd ɔıʇɐɯǝɥɔs ǝʇıuıɟuI",
15+
"create_pattern_schematics.ponder.train_schematic_printing.text_1": "ʞɔıןƆ ʇɥbıᴚ + ʇɟıɥS ɥʇıʍ sɹǝʎoןdǝp pǝןqɯǝssɐ ɟo dnoɹb ɐ oʇ pǝıןddɐ ǝq uɐɔ ɔıʇɐɯǝɥɔs uɹǝʇʇɐd ǝןbuıs Ɐ",
16+
"create_pattern_schematics.ponder.train_schematic_printing.text_2": "ןɐnsn sɐ pǝɔɐןd uǝǝq sɐɥ ɔıʇɐɯǝɥɔs ǝɥʇ 'ǝɹǝH",
17+
"create_pattern_schematics.ponder.train_schematic_printing.text_3": "buıʇɐǝdǝɹ ɔıʇɐɯǝɥɔs ǝɥʇ uı ʇןnsǝɹ ןןıʍ ɹǝɥʇɹnɟ uıɐɹʇ ǝɥʇ buıʌoɯ ʇnᗺ",
1418
"create_pattern_schematics.schematic.tool.clone": "ǝuoןƆ",
1519
"create_pattern_schematics.schematic.tool.clone.description.0": "ɔıʇɐɯǝɥɔs pǝʇɔǝןǝs ǝɥʇ sʇɐǝdǝᴚ",
1620
"create_pattern_schematics.schematic.tool.clone.description.1": "˙ʇı ʇɐǝdǝɹ oʇ ןןoɹɔS-]Ꞁᴚ⟘Ɔ[ puɐ ɔıʇɐɯǝɥɔS ǝɥʇ ʇɐ ʇuıoԀ",

common/src/generated/resources/assets/create_pattern_schematics/lang/en_us.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"create_pattern_schematics.contraption_application.applied_to": "Applied pattern schematic to ",
3-
"create_pattern_schematics.contraption_application.deployers": " deployers",
3+
"create_pattern_schematics.contraption_application.deployers": " deployer(s)",
44
"create_pattern_schematics.ponder.schematic_printing.header": "Printing patterns with pattern schematics",
55
"create_pattern_schematics.ponder.schematic_printing.text_1": "To use pattern schematics, you must first save a schematic to use as a source",
66
"create_pattern_schematics.ponder.schematic_printing.text_2": "Then, use a schematic table with an empty pattern schematic",
@@ -11,6 +11,10 @@
1111
"create_pattern_schematics.ponder.schematic_printing.text_7": "This rotation will then apply to all clones",
1212
"create_pattern_schematics.ponder.tag.pattern_schematics": "Pattern Schematics",
1313
"create_pattern_schematics.ponder.tag.pattern_schematics.description": "Printing with pattern schematics",
14+
"create_pattern_schematics.ponder.train_schematic_printing.header": "Infinite schematic printing with trains",
15+
"create_pattern_schematics.ponder.train_schematic_printing.text_1": "A single pattern schematic can be applied to a group of assembled deployers with Shift + Right Click",
16+
"create_pattern_schematics.ponder.train_schematic_printing.text_2": "Here, the schematic has been placed as usual",
17+
"create_pattern_schematics.ponder.train_schematic_printing.text_3": "But moving the train further will result in the schematic repeating",
1418
"create_pattern_schematics.schematic.tool.clone": "Clone",
1519
"create_pattern_schematics.schematic.tool.clone.description.0": "Repeats the selected schematic",
1620
"create_pattern_schematics.schematic.tool.clone.description.1": "Point at the Schematic and [CTRL]-Scroll to repeat it.",

common/src/main/java/com/cak/pattern_schematics/content/ponder/PatternSchematicPonderScenes.java

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22

33
import com.cak.pattern_schematics.registry.PatternSchematicsRegistry;
44
import com.simibubi.create.AllItems;
5+
import com.simibubi.create.content.trains.entity.Train;
56
import com.simibubi.create.foundation.ponder.*;
67
import com.simibubi.create.foundation.ponder.element.EntityElement;
78
import com.simibubi.create.foundation.ponder.element.InputWindowElement;
9+
import com.simibubi.create.foundation.ponder.element.WorldSectionElement;
810
import com.simibubi.create.foundation.utility.Pointing;
911
import net.minecraft.core.BlockPos;
1012
import net.minecraft.core.Direction;
1113
import net.minecraft.core.Vec3i;
1214
import net.minecraft.world.entity.Entity;
1315
import net.minecraft.world.item.ItemStack;
16+
import net.minecraft.world.level.block.Block;
17+
import net.minecraft.world.level.block.Blocks;
1418
import net.minecraft.world.phys.AABB;
1519
import net.minecraft.world.phys.Vec3;
1620

@@ -152,4 +156,114 @@ public static void schematicPrinting(SceneBuilder scene, SceneBuildingUtil util)
152156
scene.markAsFinished();
153157
}
154158

159+
public static void trainSchematicPrinting(SceneBuilder scene, SceneBuildingUtil util) {
160+
scene.title("train_schematic_printing", "Infinite schematic printing with trains");
161+
scene.scaleSceneView(0.75f);
162+
scene.configureBasePlate(0, 0, 12);
163+
scene.world.showSection(util.select.layer(0), Direction.UP);
164+
scene.idle(20);
165+
166+
//Remove the flowerbed so it can be replaced later#
167+
Selection flowerBed = util.select.fromTo(1, 1, 2, 10, 2, 4);
168+
scene.world.replaceBlocks(
169+
flowerBed, Blocks.AIR.defaultBlockState(), false
170+
);
171+
scene.world.showSection(flowerBed, Direction.DOWN);
172+
173+
//Fill in train tracks
174+
BlockPos
175+
sectionFrom = new BlockPos(11, 1, 6),
176+
selectionTo = new BlockPos(11, 2, 8);
177+
178+
for (int i = 0; i <= 12; i++) {
179+
scene.world.showSection(util.select.fromTo(sectionFrom, selectionTo), Direction.DOWN);
180+
scene.idle(2);
181+
182+
sectionFrom = sectionFrom.offset(-1, 0, 0);
183+
selectionTo = selectionTo.offset(-1, 0, 0);
184+
}
185+
186+
scene.idle(10);
187+
188+
//Place train
189+
scene.world.showSection(util.select.fromTo(10, 3, 7, 11, 4, 7), Direction.DOWN);
190+
scene.idle(20);
191+
scene.world.showSection(util.select.fromTo(10, 3, 2, 10, 4, 6), Direction.SOUTH);
192+
scene.idle(20);
193+
194+
//Applying schematic
195+
scene.addKeyframe();
196+
197+
scene.overlay.showSelectionWithText(util.select.fromTo(10, 3, 2, 10, 3, 4), 80)
198+
.placeNearTarget()
199+
.pointAt(new Vec3(10.5, 3.5, 3.5))
200+
.text("A single pattern schematic can be applied to a group of assembled deployers with Shift + Right Click");
201+
202+
scene.idle(80);
203+
204+
scene.overlay.showControls(
205+
new InputWindowElement(new Vec3(10.5, 3.5, 3.5), Pointing.DOWN)
206+
.withItem(PatternSchematicsRegistry.PATTERN_SCHEMATIC.get().getDefaultInstance())
207+
.rightClick()
208+
.whileSneaking(), 50
209+
);
210+
scene.idle(60);
211+
212+
//Train moves 2 blocks to show original schematic
213+
scene.addKeyframe();
214+
215+
ElementLink<WorldSectionElement> trainSection = scene.world.makeSectionIndependent(
216+
util.select.fromTo(10, 3, 2, 11, 4, 7)
217+
);
218+
219+
scene.world.moveSection(trainSection, new Vec3(-1, 0, 0), 10);
220+
scene.world.animateBogey(util.grid.at(10, 3, 7), 1f, 10);
221+
222+
for (int x = 10; x >= 9; x--) {
223+
for (int z = 2; z <= 4; z++) {
224+
scene.world.moveDeployer(util.grid.at(10, 3, z), 1, 4);
225+
}
226+
scene.idle(4);
227+
scene.world.restoreBlocks(util.select.fromTo(x, 1, 2, x, 2, 4));
228+
scene.idle(1);
229+
for (int z = 2; z <= 4; z++) {
230+
scene.world.moveDeployer(util.grid.at(10, 3, z), -1, 4);
231+
}
232+
scene.idle(5);
233+
}
234+
scene.idle(30);
235+
236+
scene.overlay.showSelectionWithText(util.select.fromTo(9, 1, 2, 10, 2, 4), 80)
237+
.placeNearTarget()
238+
.pointAt(new Vec3(10, 2, 3.5))
239+
.text("Here, the schematic has been placed as usual");
240+
scene.idle(90);
241+
242+
scene.overlay.showText(80)
243+
.placeNearTarget()
244+
.pointAt(new Vec3(8.5, 3.5, 7.5))
245+
.text("But moving the train further will result in the schematic repeating");
246+
scene.idle(90);
247+
248+
scene.world.moveSection(trainSection, new Vec3(-8, 0, 0), 80);
249+
scene.world.animateBogey(util.grid.at(10, 3, 7), 8f, 80);
250+
251+
scene.idle(5);
252+
for (int x = 8; x >= 1; x--) {
253+
for (int z = 2; z <= 4; z++) {
254+
scene.world.moveDeployer(util.grid.at(10, 3, z), 1, 4);
255+
}
256+
scene.idle(4);
257+
scene.world.restoreBlocks(util.select.fromTo(x, 1, 2, x, 2, 4));
258+
scene.idle(1);
259+
for (int z = 2; z <= 4; z++) {
260+
scene.world.moveDeployer(util.grid.at(10, 3, z), -1, 4);
261+
}
262+
scene.idle(5);
263+
}
264+
265+
scene.idle(20);
266+
scene.markAsFinished();
267+
}
268+
155269
}

common/src/main/java/com/cak/pattern_schematics/content/ponder/PatternSchematicsPonderIndex.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ public class PatternSchematicsPonderIndex {
1111
public static void register() {
1212

1313
HELPER.forComponents(PatternSchematicsRegistry.EMPTY_PATTERN_SCHEMATIC, PatternSchematicsRegistry.PATTERN_SCHEMATIC)
14-
.addStoryBoard("pattern_schematic/schematic_printing", PatternSchematicPonderScenes::schematicPrinting, PatternSchematicsPonderTags.PATTERN_SCHEMATIC);
14+
.addStoryBoard("pattern_schematic/schematic_printing",
15+
PatternSchematicPonderScenes::schematicPrinting, PatternSchematicsPonderTags.PATTERN_SCHEMATIC)
16+
.addStoryBoard("pattern_schematic/train_schematic_printing",
17+
PatternSchematicPonderScenes::trainSchematicPrinting, PatternSchematicsPonderTags.PATTERN_SCHEMATIC);
1518

1619
}
1720

common/src/main/java/com/cak/pattern_schematics/foundation/mirror/PatternSchematicHandler.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,9 @@ else if (fb && !lr)
257257
if (isRenderingMain) {
258258
currentTool.getTool()
259259
.renderOnSchematic(ms, buffer);
260-
} else SimpleSchematicOutlineRenderer.render(ms, this, buffer);
260+
} else if (deployed) {
261+
SimpleSchematicOutlineRenderer.render(ms, this, buffer);
262+
}
261263

262264
ms.popPose();
263265
}
@@ -444,5 +446,23 @@ public boolean isRenderingMultiple() {
444446
return isRenderingMultiple;
445447
}
446448

449+
public AABB getExtendedBounds() {
450+
AABB originalBounds = getBounds();
451+
Vec3 boundsLength = new Vec3(
452+
originalBounds.getXsize(),
453+
originalBounds.getYsize(),
454+
originalBounds.getZsize()
455+
);
456+
return getBounds()
457+
.expandTowards(
458+
new Vec3(cloneScaleMin.getX(), cloneScaleMin.getY(), cloneScaleMin.getZ())
459+
.multiply(boundsLength)
460+
)
461+
.expandTowards(
462+
new Vec3(cloneScaleMax.getX(), cloneScaleMax.getY(), cloneScaleMax.getZ())
463+
.multiply(boundsLength)
464+
);
465+
}
466+
447467
}
448468

common/src/main/java/com/cak/pattern_schematics/mixin/SchematicToolBaseMixin.java

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,74 @@
44
import com.cak.pattern_schematics.foundation.mirror.PatternSchematicHandler;
55
import com.cak.pattern_schematics.foundation.mirror.PatternSchematicsToolType;
66
import com.cak.pattern_schematics.foundation.mirror.SimpleSchematicOutlineRenderer;
7+
import com.simibubi.create.Create;
78
import com.simibubi.create.CreateClient;
89
import com.simibubi.create.content.schematics.client.SchematicHandler;
910
import com.simibubi.create.content.schematics.client.tools.SchematicToolBase;
11+
import com.simibubi.create.foundation.utility.RaycastHelper;
12+
import net.minecraft.client.Minecraft;
13+
import net.minecraft.core.Direction;
14+
import net.minecraft.world.phys.AABB;
1015
import org.spongepowered.asm.mixin.Mixin;
1116
import org.spongepowered.asm.mixin.Shadow;
17+
import org.spongepowered.asm.mixin.Unique;
1218
import org.spongepowered.asm.mixin.injection.At;
1319
import org.spongepowered.asm.mixin.injection.Inject;
20+
import org.spongepowered.asm.mixin.injection.Redirect;
1421
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
1522

1623
@Mixin(value = SchematicToolBase.class, remap = false)
17-
public class SchematicToolBaseMixin {
18-
19-
@Shadow
20-
protected SchematicHandler schematicHandler;
21-
22-
/**Praise be to simi that none of the calls to this are specific enough that a slapped on extends in {@link PatternSchematicHandler} works*/
23-
@Inject(method = "init", at = @At("TAIL"))
24-
public void init(CallbackInfo ci) {
25-
schematicHandler =
26-
(PatternSchematicsToolType.isPatternSchematicTool((SchematicToolBase) (Object) this) ?
27-
PatternSchematicsClient.PATTERN_SCHEMATIC_HANDLER : CreateClient.SCHEMATIC_HANDLER);
28-
}
29-
30-
@Inject(method = "renderOnSchematic", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lcom/simibubi/create/foundation/outliner/AABBOutline;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/simibubi/create/foundation/render/SuperRenderTypeBuffer;Lnet/minecraft/world/phys/Vec3;F)V", remap = true))
31-
public void renderOnSchematic(CallbackInfo ci) {
32-
SimpleSchematicOutlineRenderer.applyOutlineModification(schematicHandler);
33-
}
34-
24+
public abstract class SchematicToolBaseMixin {
25+
26+
@Shadow
27+
protected SchematicHandler schematicHandler;
28+
29+
@Shadow
30+
public abstract void init();
31+
32+
/**
33+
* Praise be to simi that none of the calls to this are specific enough that a slapped on extends in
34+
* {@link PatternSchematicHandler} works
35+
*/
36+
@Inject(method = "init", at = @At("TAIL"))
37+
public void init(CallbackInfo ci) {
38+
schematicHandler =
39+
(PatternSchematicsToolType.isPatternSchematicTool((SchematicToolBase) (Object) this) ?
40+
PatternSchematicsClient.PATTERN_SCHEMATIC_HANDLER : CreateClient.SCHEMATIC_HANDLER);
41+
}
42+
43+
@Inject(method = "renderOnSchematic", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Lcom/simibubi/create/foundation/outliner/AABBOutline;render(Lcom/mojang/blaze3d/vertex/PoseStack;Lcom/simibubi/create/foundation/render/SuperRenderTypeBuffer;Lnet/minecraft/world/phys/Vec3;F)V", remap = true))
44+
public void renderOnSchematic(CallbackInfo ci) {
45+
SimpleSchematicOutlineRenderer.applyOutlineModification(schematicHandler);
46+
}
47+
48+
@Unique
49+
private static boolean pattern_schematics$currentThreadIsPatternSchematic = false;
50+
@Unique
51+
private static AABB pattern_schematics$currentThreadPatternBounds;
52+
53+
@Redirect(method = "updateTargetPos", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/schematics/client/SchematicHandler;getBounds()Lnet/minecraft/world/phys/AABB;", remap = true))
54+
public AABB getExtendedBounds(SchematicHandler instance) {
55+
if (instance instanceof PatternSchematicHandler patternSchematics) {
56+
pattern_schematics$currentThreadIsPatternSchematic = true;
57+
pattern_schematics$currentThreadPatternBounds = patternSchematics.getExtendedBounds();
58+
return patternSchematics.getExtendedBounds();
59+
}
60+
pattern_schematics$currentThreadIsPatternSchematic = false;
61+
return instance.getBounds();
62+
}
63+
64+
@Redirect(method = "updateTargetPos", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/foundation/utility/RaycastHelper$PredicateTraceResult;getFacing()Lnet/minecraft/core/Direction;", remap = true))
65+
public Direction getFacingResult(RaycastHelper.PredicateTraceResult instance) {
66+
if (
67+
pattern_schematics$currentThreadIsPatternSchematic &&
68+
pattern_schematics$currentThreadPatternBounds.contains(
69+
schematicHandler.getTransformation().toLocalSpace(Minecraft.getInstance().player.getEyePosition())
70+
)
71+
) {
72+
return instance.getFacing().getOpposite();
73+
}
74+
return instance.getFacing();
75+
}
76+
3577
}

0 commit comments

Comments
 (0)