Skip to content

Commit d309206

Browse files
committed
Misc fixes to 1.1.8
1 parent 7911420 commit d309206

File tree

9 files changed

+81
-10
lines changed

9 files changed

+81
-10
lines changed

Changelog.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,8 @@
1818
- Fixed the copycats not displaying accurately in the ponder (after I failed to cover up my laziness thanks @d4rkfl4sh)
1919

2020
1.1.7:
21-
- Added shift control to the clone tool to help with large schematics
21+
- Added shift control to the clone tool to help with large schematics
22+
23+
1.1.8:
24+
- 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
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// 1.20.1 2024-08-08T10:30:57.8897314 Create: Pattern Schematics/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.20.1 2024-08-08T18:26:37.0204495 Create: Pattern Schematics/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-
6ac9903ab645348e7c2bfd192d301b96bd4105b0 assets\create_pattern_schematics\lang\en_us.json
4-
b5855848d47f69759bff9f8ef35dfae49ba7338d 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/generated/resources/assets/create_pattern_schematics/lang/en_ud.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"create_pattern_schematics.contraption_application.applied_to": " oʇ ɔıʇɐɯǝɥɔs uɹǝʇʇɐd pǝıןddⱯ",
33
"create_pattern_schematics.contraption_application.deployers": ")s(ɹǝʎoןdǝp ",
4+
"create_pattern_schematics.contraption_application.not_positioned": "¡pǝuoıʇısod ʇou ɔıʇɐɯǝɥɔS :ɔıʇɐɯǝɥɔs ʎןddɐ ʇ,upןnoƆ",
45
"create_pattern_schematics.ponder.schematic_printing.header": "sɔıʇɐɯǝɥɔs uɹǝʇʇɐd ɥʇıʍ suɹǝʇʇɐd buıʇuıɹԀ",
56
"create_pattern_schematics.ponder.schematic_printing.text_1": "ǝɔɹnos ɐ sɐ ǝsn oʇ ɔıʇɐɯǝɥɔs ɐ ǝʌɐs ʇsɹıɟ ʇsnɯ noʎ 'sɔıʇɐɯǝɥɔs uɹǝʇʇɐd ǝsn o⟘",
67
"create_pattern_schematics.ponder.schematic_printing.text_2": "ɔıʇɐɯǝɥɔs uɹǝʇʇɐd ʎʇdɯǝ uɐ ɥʇıʍ ǝןqɐʇ ɔıʇɐɯǝɥɔs ɐ ǝsn 'uǝɥ⟘",
@@ -18,7 +19,7 @@
1819
"create_pattern_schematics.schematic.tool.clone": "ǝuoןƆ",
1920
"create_pattern_schematics.schematic.tool.clone.description.0": "ɔıʇɐɯǝɥɔs pǝʇɔǝןǝs ǝɥʇ sʇɐǝdǝᴚ",
2021
"create_pattern_schematics.schematic.tool.clone.description.1": "˙ʇı ʇɐǝdǝɹ oʇ ןןoɹɔS-]Ꞁᴚ⟘Ɔ[ puɐ ɔıʇɐɯǝɥɔS ǝɥʇ ʇɐ ʇuıoԀ",
21-
"create_pattern_schematics.schematic.tool.clone.description.2": "buıɔɐɟ ǝɹɐ noʎ uoıʇɔǝɹıp ǝɥʇ uı ʇɐǝdǝɹ oʇ ןןoɹɔS-]⟘ℲIHS+Ꞁᴚ⟘Ɔ[ 'ʎןǝʌıʇɐuɹǝʇןⱯ",
22+
"create_pattern_schematics.schematic.tool.clone.description.2": "buıɔɐɟ ǝɹɐ noʎ uoıʇɔǝɹıp ǝɥʇ uı ǝuoןɔ oʇ ןןoɹɔS-]⟘ℲIHS+Ꞁᴚ⟘Ɔ[ 'ʎןǝʌıʇɐuɹǝʇןⱯ",
2223
"create_pattern_schematics.schematic.tool.clone.description.3": "",
2324
"item.create_pattern_schematics.empty_pattern_schematic": "ɔıʇɐɯǝɥɔS uɹǝʇʇɐԀ ʎʇdɯƎ",
2425
"item.create_pattern_schematics.pattern_schematic": "ɔıʇɐɯǝɥɔS uɹǝʇʇɐԀ"

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"create_pattern_schematics.contraption_application.applied_to": "Applied pattern schematic to ",
33
"create_pattern_schematics.contraption_application.deployers": " deployer(s)",
4+
"create_pattern_schematics.contraption_application.not_positioned": "Couldn't apply schematic: Schematic not positioned!",
45
"create_pattern_schematics.ponder.schematic_printing.header": "Printing patterns with pattern schematics",
56
"create_pattern_schematics.ponder.schematic_printing.text_1": "To use pattern schematics, you must first save a schematic to use as a source",
67
"create_pattern_schematics.ponder.schematic_printing.text_2": "Then, use a schematic table with an empty pattern schematic",
@@ -18,7 +19,7 @@
1819
"create_pattern_schematics.schematic.tool.clone": "Clone",
1920
"create_pattern_schematics.schematic.tool.clone.description.0": "Repeats the selected schematic",
2021
"create_pattern_schematics.schematic.tool.clone.description.1": "Point at the Schematic and [CTRL]-Scroll to repeat it.",
21-
"create_pattern_schematics.schematic.tool.clone.description.2": "Alternatively, [CTRL+SHIFT]-Scroll to repeat in the direction you are facing",
22+
"create_pattern_schematics.schematic.tool.clone.description.2": "Alternatively, [CTRL+SHIFT]-Scroll to clone in the direction you are facing",
2223
"create_pattern_schematics.schematic.tool.clone.description.3": "",
2324
"item.create_pattern_schematics.empty_pattern_schematic": "Empty Pattern Schematic",
2425
"item.create_pattern_schematics.pattern_schematic": "Pattern Schematic"

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

+14-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.simibubi.create.content.contraptions.behaviour.MovementContext;
1010
import com.simibubi.create.content.kinetics.deployer.DeployerBlock;
1111
import com.simibubi.create.content.logistics.filter.FilterItemStack;
12+
import net.minecraft.ChatFormatting;
1213
import net.minecraft.client.gui.screens.Screen;
1314
import net.minecraft.core.BlockPos;
1415
import net.minecraft.core.Direction;
@@ -49,15 +50,26 @@ public void handlePlayerInteraction(
4950
Player player, BlockPos localPos, Direction side,
5051
InteractionHand interactionHand, CallbackInfoReturnable<Boolean> cir
5152
) {
52-
if (player.level().isClientSide || !player.isShiftKeyDown() || !player.getItemInHand(interactionHand).is(PatternSchematicsRegistry.PATTERN_SCHEMATIC.get()))
53+
ItemStack stack = player.getItemInHand(interactionHand);
54+
if (player.level().isClientSide || !player.isShiftKeyDown() || !stack.is(PatternSchematicsRegistry.PATTERN_SCHEMATIC.get()))
5355
return;
5456

57+
if (!stack.hasTag() || !stack.getOrCreateTag().getBoolean("Deployed")) {
58+
player.displayClientMessage(
59+
Component.translatable("create_pattern_schematics.contraption_application.not_positioned")
60+
.withStyle(ChatFormatting.RED),
61+
true
62+
);
63+
cir.setReturnValue(true);
64+
return;
65+
}
66+
5567
Pair<StructureTemplate.StructureBlockInfo, MovementContext> actor = contraption.getActorAt(localPos);
5668

5769
if (actor == null || !actor.getLeft().state().is(AllBlocks.DEPLOYER.get()))
5870
return;
5971

60-
int appliedCount = pattern_schematics$performBulkSchematicApply(actor.getLeft().state().getValue(DeployerBlock.FACING), actor.getRight().localPos, player.getItemInHand(interactionHand));
72+
int appliedCount = pattern_schematics$performBulkSchematicApply(actor.getLeft().state().getValue(DeployerBlock.FACING), actor.getRight().localPos, stack);
6173

6274
player.displayClientMessage(
6375
Component.translatable("create_pattern_schematics.contraption_application.applied_to")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.cak.pattern_schematics.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+
@Mixin(value = SchematicannonBlockEntity.class, remap = false)
19+
public class SchematicannonBlockEntityMixin {
20+
21+
@Shadow public SchematicannonInventory inventory;
22+
@Unique
23+
private boolean pattern_schematics$currentThreadIsOfPatternSchematic = false;
24+
25+
@Inject(method = "finishedPrinting", at = @At("HEAD"))
26+
private void finishedPrinting(CallbackInfo ci) {
27+
pattern_schematics$currentThreadIsOfPatternSchematic = !inventory.getStackInSlot(0).isEmpty() &&
28+
inventory.getStackInSlot(0).is(PatternSchematicsRegistry.PATTERN_SCHEMATIC.get());
29+
}
30+
31+
@Redirect(method = "finishedPrinting", at = @At(value = "INVOKE", target = "Lcom/simibubi/create/content/schematics/cannon/SchematicannonInventory;setStackInSlot(ILnet/minecraft/world/item/ItemStack;)V", remap = true))
32+
private void setStackInSlot(SchematicannonInventory instance, int slot, ItemStack stack) {
33+
if (slot != 1) {
34+
instance.setStackInSlot(slot, stack);
35+
return;
36+
}
37+
38+
Item resultItem = pattern_schematics$currentThreadIsOfPatternSchematic ?
39+
PatternSchematicsRegistry.EMPTY_PATTERN_SCHEMATIC.get() :
40+
AllItems.EMPTY_SCHEMATIC.get();
41+
42+
//Check if the result slot is either empty or matching
43+
ItemStack current = inventory.getStackInSlot(1);
44+
boolean resultSlotIsAvailable = current.isEmpty() ||
45+
current.is(resultItem);
46+
47+
int putSlot = resultSlotIsAvailable ? 1 : 0;
48+
inventory.setStackInSlot(putSlot, resultItem.getDefaultInstance());
49+
}
50+
51+
}

common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public static void register() {
1616
"create_pattern_schematics.schematic.tool.clone.description.3", "",
1717
"create_pattern_schematics.ponder.schematic_printing.header", "Printing with pattern schematics",
1818
"create_pattern_schematics.contraption_application.applied_to", "Applied pattern schematic to ",
19-
"create_pattern_schematics.contraption_application.deployers", " deployer(s)"
19+
"create_pattern_schematics.contraption_application.deployers", " deployer(s)",
20+
"create_pattern_schematics.contraption_application.not_positioned", "Couldn't apply schematic: Schematic not positioned!"
2021
);
2122
}
2223

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

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"DeployBaseMixin",
1212
"DeployerMovementBehaviorMixin",
1313
"MovementContextMixin",
14+
"SchematicannonBlockEntityMixin",
1415
"SchematicInstancesMixin",
1516
"SchematicItemMixin",
1617
"SchematicPrinterMixin",

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx2G
22

33
# Mod Info
44
archives_base_name = pattern_schematics
5-
mod_version = 1.1.7
5+
mod_version = 1.1.8
66
maven_group = com.cak.pattern_schematics
77

88
minecraft_version = 1.20.1

0 commit comments

Comments
 (0)