Skip to content

Commit 681d751

Browse files
committed
Resolve merge issues
1 parent e2c48ff commit 681d751

File tree

13 files changed

+95
-141
lines changed

13 files changed

+95
-141
lines changed

Changelog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- Fixed display bug, thanks to discord user @karolofgutovo for reporting
33
- Created ponder system with 1 ponder about printing (contraption ponder coming soon)
44
- (Technical) Created datagen
5-
-
5+
66
1.1.4:
77
- Fixed a bug with deployers placing at the wrong offsets
88
- Created bulk apply system to reduce pain of having to put a schematic on each individual deployer
@@ -22,4 +22,4 @@
2222

2323
1.1.8:
2424
- Made the schematicannon result in the proper item (previously would give Create's schematic no matter what)
25-
- Added an indicator when applying a non positioned schematic to a contraption deployer
25+
- Added an indicator when applying a non positioned schematic to a contraption deployer_
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +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)]
1+
// 1.19.2 2024-08-12T10:49:58.5148174 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)]
22
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
3+
8810e95491d447d2f23ff40d2a9dc511b4922ca8 assets\create_pattern_schematics\lang\en_us.json
4+
1a219ed86763a03c3793a893757a3c253c4c620e assets\create_pattern_schematics\lang\en_ud.json
55
19e25b53bb643c63106b1f83e2f1fe5a6ac63f13 assets\create_pattern_schematics\models\item\empty_pattern_schematic.json

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

Lines changed: 0 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -160,116 +160,6 @@ public static void schematicPrinting(SceneBuilder scene, SceneBuildingUtil util)
160160
scene.markAsFinished();
161161
}
162162

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

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
import com.simibubi.create.foundation.utility.AnimationTickHolder;
99
import com.simibubi.create.foundation.utility.Iterate;
1010
import net.minecraft.core.Direction;
11+
import net.minecraft.core.Vec3i;
12+
import net.minecraft.world.phys.AABB;
1113
import net.minecraft.world.phys.Vec3;
1214

1315
import java.util.List;
@@ -16,22 +18,34 @@ public class CloneSchematicOutlineRenderer {
1618

1719
public static void renderCloneGridLines(PoseStack ms, PatternSchematicHandler schematicHandler, SuperRenderTypeBuffer buffer) {
1820
ms.pushPose();
19-
AABBOutline outline = schematicHandler.getGreaterOutline();
20-
outline.setBounds(schematicHandler.calculateGreaterOutlineBounds());
21+
AABBOutline outline = schematicHandler.getOutline();
2122
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;
23+
.colored(0xa6a1af)
24+
.withFaceTexture(AllSpecialTextures.CHECKERED)
25+
.lineWidth(1/32f);
26+
// for (Direction.Axis axis : Iterate.axes) {
27+
// List<Direction.Axis> secondaries =
28+
// axis == Direction.Axis.X ? List.of(Direction.Axis.Y, Direction.Axis.Z) :
29+
// axis == Direction.Axis.Y ? List.of(Direction.Axis.Y, Direction.Axis.Z) :
30+
// List.of(Direction.Axis.X, Direction.Axis.Y);
31+
//TODO: Actually do the optimisation, draw only outer lines
32+
Vec3i min = schematicHandler.cloneScaleMin;
33+
Vec3i max = schematicHandler.cloneScaleMax;
34+
AABB bounds = schematicHandler.getBounds();
35+
Vec3i size = new Vec3i(bounds.getXsize(), bounds.getYsize(), bounds.getZsize());
36+
37+
for (int x = min.getX(); x <= max.getX(); x++) {
38+
for (int y = min.getY(); y <= max.getY(); y++) {
39+
for (int z = min.getZ(); z <= max.getZ(); z++) {
40+
boolean isRenderingMain = (x == 0) && (y == 0) && (z == 0);
41+
if (isRenderingMain) continue;
42+
ms.pushPose();
43+
ms.translate(x * size.getX(), y * size.getY(), z * size.getZ());
44+
outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks());
45+
ms.popPose();
46+
}
47+
}
3348
}
34-
outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks());
3549
ms.popPose();
3650
}
3751

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,6 @@ else if (fb && !lr)
264264
if (isRenderingMain) {
265265
currentTool.getTool()
266266
.renderOnSchematic(ms, buffer);
267-
} else if (deployed) {
268-
SimpleSchematicOutlineRenderer.render(ms, this, buffer);
269267
}
270268

271269
ms.popPose();

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void handlePlayerInteraction(
5151
InteractionHand interactionHand, CallbackInfoReturnable<Boolean> cir
5252
) {
5353
ItemStack stack = player.getItemInHand(interactionHand);
54-
if (player.level().isClientSide || !player.isShiftKeyDown() || !stack.is(PatternSchematicsRegistry.PATTERN_SCHEMATIC.get()))
54+
if (player.level.isClientSide || !player.isShiftKeyDown() || !stack.is(PatternSchematicsRegistry.PATTERN_SCHEMATIC.get()))
5555
return;
5656

5757
if (!stack.hasTag() || !stack.getOrCreateTag().getBoolean("Deployed")) {
@@ -70,7 +70,7 @@ public void handlePlayerInteraction(
7070
return;
7171

7272
int appliedCount = pattern_schematics$performBulkSchematicApply(
73-
actor.getLeft().state().getValue(DeployerBlock.FACING),
73+
actor.getLeft().state.getValue(DeployerBlock.FACING),
7474
actor.getRight().localPos,
7575
player.getItemInHand(interactionHand)
7676
);

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
package com.cak.pattern_schematics.mixin;
22

33
import com.cak.pattern_schematics.PatternSchematicsClient;
4+
import com.cak.pattern_schematics.foundation.mirror.CloneSchematicOutlineRenderer;
45
import com.cak.pattern_schematics.foundation.mirror.PatternSchematicHandler;
56
import com.cak.pattern_schematics.foundation.mirror.PatternSchematicsToolType;
6-
import com.cak.pattern_schematics.foundation.mirror.CloneSchematicOutlineRenderer;
7-
import com.cak.pattern_schematics.foundation.mirror.SimpleSchematicOutlineRenderer;
8-
import com.simibubi.create.Create;
97
import com.simibubi.create.CreateClient;
108
import com.simibubi.create.content.schematics.client.SchematicHandler;
119
import com.simibubi.create.content.schematics.client.tools.SchematicToolBase;
@@ -43,7 +41,7 @@ public void init(CallbackInfo ci) {
4341

4442
@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))
4543
public void renderOnSchematic(CallbackInfo ci) {
46-
SimpleSchematicOutlineRenderer.applyOutlineModification(schematicHandler);
44+
CloneSchematicOutlineRenderer.applyOutlineModification(schematicHandler);
4745
}
4846

4947
@Unique

common/src/main/resources/pattern_schematics.common.mixins.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"DeployBaseMixin",
1313
"DeployerMovementBehaviorMixin",
1414
"MovementContextMixin",
15-
"SchematicannonBlockEntityMixin",
1615
"SchematicInstancesMixin",
1716
"SchematicItemMixin",
1817
"SchematicPrinterMixin",
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.cak.pattern_schematics.fabric.mixin;
2+
3+
import com.cak.pattern_schematics.registry.PatternSchematicsRegistry;
4+
import com.simibubi.create.AllItems;
5+
import com.simibubi.create.content.schematics.cannon.SchematicannonBlockEntity;
6+
import com.simibubi.create.content.schematics.cannon.SchematicannonInventory;
7+
import net.minecraft.world.item.Item;
8+
import net.minecraft.world.item.ItemStack;
9+
import org.spongepowered.asm.mixin.Mixin;
10+
import org.spongepowered.asm.mixin.Shadow;
11+
import org.spongepowered.asm.mixin.Unique;
12+
import org.spongepowered.asm.mixin.injection.At;
13+
import org.spongepowered.asm.mixin.injection.Inject;
14+
import org.spongepowered.asm.mixin.injection.Redirect;
15+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
16+
17+
/**Change the second inventory set item call to be the pattern schematic if there was a pattern schematic previously present
18+
* Note that due to class resolution issues, the mixin has to be duplicated across both platforms*/
19+
@Mixin(value = SchematicannonBlockEntity.class, remap = false)
20+
public class SchematicannonBlockEntityMixin {
21+
22+
@Shadow public SchematicannonInventory inventory;
23+
@Unique
24+
private boolean pattern_schematics$currentThreadIsOfPatternSchematic = false;
25+
26+
@Inject(method = "finishedPrinting", at = @At("HEAD"))
27+
private void finishedPrinting(CallbackInfo ci) {
28+
pattern_schematics$currentThreadIsOfPatternSchematic = !inventory.getStackInSlot(0).isEmpty() &&
29+
inventory.getStackInSlot(0).is(PatternSchematicsRegistry.PATTERN_SCHEMATIC.get());
30+
}
31+
32+
@Redirect(method = "finishedPrinting", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/schematics/cannon/SchematicannonInventory;setStackInSlot(ILnet/minecraft/world/item/ItemStack;)V", remap = true))
33+
private void setStackInSlot(SchematicannonInventory instance, int slot, ItemStack stack) {
34+
if (slot != 1) {
35+
instance.setStackInSlot(slot, stack);
36+
return;
37+
}
38+
39+
Item resultItem = pattern_schematics$currentThreadIsOfPatternSchematic ?
40+
PatternSchematicsRegistry.EMPTY_PATTERN_SCHEMATIC.get() :
41+
AllItems.EMPTY_SCHEMATIC.get();
42+
43+
//Check if the result slot is either empty or matching
44+
ItemStack current = inventory.getStackInSlot(1);
45+
boolean resultSlotIsAvailable = current.isEmpty() ||
46+
current.is(resultItem);
47+
48+
int putSlot = resultSlotIsAvailable ? 1 : 0;
49+
inventory.setStackInSlot(putSlot, resultItem.getDefaultInstance());
50+
}
51+
52+
}

fabric/src/main/resources/pattern_schematics.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"client": [
77
],
88
"mixins": [
9+
"SchematicannonBlockEntityMixin",
910
"SchematicannonInventoryMixin",
1011
"SchematicTableBlockEntityMixin",
1112
"SchematicTableMenuMixin"

0 commit comments

Comments
 (0)