Skip to content

Commit

Permalink
Merge branch 'Port-1.19.2' into 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cakeGit authored Nov 6, 2024
2 parents 8e6379c + 5ac9b38 commit dd7b3c8
Show file tree
Hide file tree
Showing 67 changed files with 1,320 additions and 1,210 deletions.
4 changes: 2 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
- Fixed display bug, thanks to discord user @karolofgutovo for reporting
- Created ponder system with 1 ponder about printing (contraption ponder coming soon)
- (Technical) Created datagen
-

1.1.4:
- Fixed a bug with deployers placing at the wrong offsets
- Created bulk apply system to reduce pain of having to put a schematic on each individual deployer
Expand All @@ -22,4 +22,4 @@

1.1.8:
- Made the schematicannon result in the proper item (previously would give Create's schematic no matter what)
- Added an indicator when applying a non positioned schematic to a contraption deployer
- Added an indicator when applying a non positioned schematic to a contraption deployer_
13 changes: 8 additions & 5 deletions changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,22 @@
- Made the schematicannon result in the proper item (previously would give Create's schematic no matter what)
- Added an indicator when applying a non positioned schematic to a contraption deployer
(This is a port, so this is the list of all changes from version 1.1.6->1.1.8)
1.20.1-1.1.9: |
1.19.2-1.1.13: |
- Updated to 1.1.13 from 1.20.1 branch
- Reduced visual clutter on schematic clone highlights [Example of new system](https://media.discordapp.net/attachments/1267781614591676426/1272539875136114820/2024-08-12_13.56.54.png?ex=66bb589c&is=66ba071c&hm=7870a62f2b19ea94babd9fd1c250ee8eaecfb8827f0b1c4dfaa08f7d3080d299&=&format=webp&quality=lossless&width=1168&height=614)
- This also should help to improve performance
1.20.1-1.1.10: |
- Fixed signal placement bug
1.20.1-1.1.11: |
- Changed creative mode tab ordering (Also should help for when latest create releases)
- Changed to use correct gradle version
1.20.1-1.1.12: |
- Misc refactor
- Mainly just to bump version to republish
1.20.1-1.1.13: |
- Added crafting using existing schematics instead of paper
1.19.2-1.1.15: |
- Updated to 1.1.15 from 1.20.1
- Update logo for 1.20.1
- Added Spanish gameplay translations
1.20.1-1.1.14: |
- Update logo for 1.20.1
1.20.1-1.1.15: |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 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)]
// 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)]
ef2d06ece9923cc75b5e3dc3070df2808f1cdb74 assets\create_pattern_schematics\models\item\pattern_schematic.json
8810e95491d447d2f23ff40d2a9dc511b4922ca8 assets\create_pattern_schematics\lang\en_us.json
1a219ed86763a03c3793a893757a3c253c4c620e assets\create_pattern_schematics\lang\en_ud.json
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package com.cak.pattern_schematics;

import com.cak.pattern_schematics.content.ponder.PatternSchematicsPonderTags;
import com.cak.pattern_schematics.content.ponder.PatternSchematicsPonderIndex;
import com.cak.pattern_schematics.content.ponder.PatternSchematicsPonderTags;
import com.cak.pattern_schematics.foundation.mirror.PatternSchematicHandler;
import com.cak.pattern_schematics.registry.PlatformPackets;

public class PatternSchematicsClient {

/**Treat as final, the variable is initialised by platform*/
public static PatternSchematicHandler PATTERN_SCHEMATIC_HANDLER;

public static void init() {
PlatformPackets.getChannel().initClientListener();
}

public static void setup() {
PatternSchematicsPonderTags.register();
PatternSchematicsPonderIndex.register();
}


/**
* Treat as final, the variable is initialised by platform
*/
public static PatternSchematicHandler PATTERN_SCHEMATIC_HANDLER;

public static void init() {
PlatformPackets.getChannel().initClientListener();
}

public static void setup() {
PatternSchematicsPonderTags.register();
PatternSchematicsPonderIndex.register();
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package com.cak.pattern_schematics;

import com.jozufozu.flywheel.event.RenderLayerEvent;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.foundation.render.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import net.minecraft.client.Minecraft;
import net.minecraft.world.phys.Vec3;

Expand Down Expand Up @@ -48,5 +46,5 @@ public static boolean onMouseInput(int button, boolean pressed) {

return PatternSchematicsClient.PATTERN_SCHEMATIC_HANDLER.onMouseInput(button, pressed);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class PlatformGetter {
* net.examplemod.fabric.ExampleExpectPlatformImpl#platformName() Actual Forge:
* net.examplemod.forge.ExampleExpectPlatformImpl#platformName()
* <p>
* <a href="https://plugins.jetbrains.com/plugin/16210-architectury">You should also get the IntelliJ plugin to help
* <a href="https://plugins.jetbrains.com/plugin/16210-architectury">You should also get the IntelliJ plugin to
* help
* with @ExpectPlatform.</a>
*/
@ExpectPlatform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,32 @@
import com.cak.pattern_schematics.registry.PatternSchematicsRegistry;
import com.simibubi.create.content.schematics.SchematicItem;
import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderGetter;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;

public class PatternSchematicItem extends SchematicItem {

public PatternSchematicItem(Properties properties) {
super(properties);
}

public static ItemStack create(HolderGetter<Block> lookup, String schematic, String owner) {
ItemStack blueprint = PatternSchematicsRegistry.PATTERN_SCHEMATIC.asStack();

CompoundTag tag = new CompoundTag();
tag.putBoolean("Deployed", false);
tag.putString("Owner", owner);
tag.putString("File", schematic);
tag.put("Anchor", NbtUtils.writeBlockPos(BlockPos.ZERO));
tag.putString("Rotation", Rotation.NONE.name());
tag.putString("Mirror", Mirror.NONE.name());
blueprint.setTag(tag);
public PatternSchematicItem(Properties properties) {
super(properties);
}

public static ItemStack create(String schematic, String owner) {
ItemStack blueprint = PatternSchematicsRegistry.PATTERN_SCHEMATIC.asStack();

CompoundTag tag = new CompoundTag();
tag.putBoolean("Deployed", false);
tag.putString("Owner", owner);
tag.putString("File", schematic);
tag.put("Anchor", NbtUtils.writeBlockPos(BlockPos.ZERO));
tag.putString("Rotation", Rotation.NONE.name());
tag.putString("Mirror", Mirror.NONE.name());
blueprint.setTag(tag);

writeSize(blueprint);
return blueprint;
}

writeSize(lookup, blueprint);
return blueprint;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.cak.pattern_schematics.registry.PatternSchematicsRegistry;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.trains.entity.Train;
import com.simibubi.create.foundation.ponder.*;
import com.simibubi.create.foundation.ponder.element.EntityElement;
import com.simibubi.create.foundation.ponder.element.InputWindowElement;
Expand All @@ -14,8 +13,6 @@
import net.minecraft.core.Vec3i;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,45 @@
import net.minecraft.world.phys.Vec3;

public class CloneTool extends SchematicToolBase {

@Override
public boolean handleRightClick() {
return false;
}

@Override
public boolean handleMouseWheel(double delta) {
if (!schematicSelected && !AllKeys.shiftDown())
return true;

if (!(schematicHandler instanceof PatternSchematicHandler patternSchematicHandler))
throw new RuntimeException("Clone tool bound in a normal SchematicHandler!");
@Override
public boolean handleRightClick() {
return false;
}

LocalPlayer player = Minecraft.getInstance().player;
Direction face = (AllKeys.shiftDown() && player != null) ? facingOfPlayer(player) : selectedFace;
@Override
public boolean handleMouseWheel(double delta) {
if (!schematicSelected && !AllKeys.shiftDown())
return true;

if (!(schematicHandler instanceof PatternSchematicHandler patternSchematicHandler))
throw new RuntimeException("Clone tool bound in a normal SchematicHandler!");

LocalPlayer player = Minecraft.getInstance().player;
Direction face = (AllKeys.shiftDown() && player != null) ? facingOfPlayer(player) : selectedFace;

boolean isPositive = face.getAxisDirection() == Direction.AxisDirection.POSITIVE;

Vec3i cloneScale;
if (isPositive)
cloneScale = patternSchematicHandler.getCloneScaleMax();
else
cloneScale = patternSchematicHandler.getCloneScaleMin();

cloneScale = cloneScale.relative(face, Mth.sign(delta));

if (isPositive)
patternSchematicHandler.setCloneScaleMax(cloneScale);
else
patternSchematicHandler.setCloneScaleMin(cloneScale);

schematicHandler.markDirty();
return true;
}

boolean isPositive = face.getAxisDirection() == Direction.AxisDirection.POSITIVE;
private Direction facingOfPlayer(LocalPlayer player) {
Vec3 lookAngle = player.getLookAngle();
return Direction.getNearest(lookAngle.x, lookAngle.y, lookAngle.z);
}

Vec3i cloneScale;
if (isPositive)
cloneScale = patternSchematicHandler.getCloneScaleMax();
else
cloneScale = patternSchematicHandler.getCloneScaleMin();

cloneScale = cloneScale.relative(face, Mth.sign(delta));

if (isPositive)
patternSchematicHandler.setCloneScaleMax(cloneScale);
else
patternSchematicHandler.setCloneScaleMin(cloneScale);

schematicHandler.markDirty();
return true;
}

private Direction facingOfPlayer(LocalPlayer player) {
Vec3 lookAngle = player.getLookAngle();
return Direction.getNearest(lookAngle.x, lookAngle.y, lookAngle.z);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.simibubi.create.foundation.networking.SimplePacketBase;

public interface GenericNetworker {

void initServerListener();
void initClientListener();
void sendToServer(SimplePacketBase packet);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,63 @@
import com.simibubi.create.AllItems;
import com.simibubi.create.content.schematics.SchematicItem;
import com.tterrag.registrate.util.entry.ItemEntry;
import net.minecraft.core.HolderGetter;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;

import java.util.Arrays;
import java.util.List;

public enum SchematicUploadItemSource {

DEFAULT(SchematicItem::create, 0, List.of(
AllItems.EMPTY_SCHEMATIC,
AllItems.SCHEMATIC_AND_QUILL,
AllItems.SCHEMATIC
) ),
PATTERN(PatternSchematicItem::create, 1, List.of(
PatternSchematicsRegistry.EMPTY_PATTERN_SCHEMATIC,
PatternSchematicsRegistry.PATTERN_SCHEMATIC
))
;

final SchematicItemFactory factory;
final int nbtValue;
final List<ItemEntry<? extends Item>> schematicSourceItem;

SchematicUploadItemSource(SchematicItemFactory factory, int nbtValue, List<ItemEntry<? extends Item>> schematicSourceItem) {
this.factory = factory;
this.nbtValue = nbtValue;
this.schematicSourceItem = schematicSourceItem;
}

public SchematicItemFactory getFactory() {
return factory;
}

public int getNbtValue() {
return nbtValue;
}

public List<ItemEntry<? extends Item>> getSchematicSourceItems() {
return schematicSourceItem;
}

public static SchematicUploadItemSource tryFromItemStack(ItemStack stack) {
return Arrays.stream(values())
.filter(source -> source.getSchematicSourceItems()
.stream().anyMatch(sourceItem -> sourceItem.isIn(stack)))
.findAny().orElse(null);
}

public static SchematicUploadItemSource tryFromInt(int nbtValue) {
return Arrays.stream(values())
.filter(source -> source.getNbtValue() == nbtValue)
.findAny().orElse(null);
}

public static interface SchematicItemFactory {
ItemStack create(HolderGetter<Block> lookup, String schematic, String owner);
}


DEFAULT(SchematicItem::create, 0, List.of(
AllItems.EMPTY_SCHEMATIC,
AllItems.SCHEMATIC_AND_QUILL,
AllItems.SCHEMATIC
)),
PATTERN(PatternSchematicItem::create, 1, List.of(
PatternSchematicsRegistry.EMPTY_PATTERN_SCHEMATIC,
PatternSchematicsRegistry.PATTERN_SCHEMATIC
));

final SchematicItemFactory factory;
final int nbtValue;
final List<ItemEntry<? extends Item>> schematicSourceItem;

SchematicUploadItemSource(SchematicItemFactory factory, int nbtValue, List<ItemEntry<? extends Item>> schematicSourceItem) {
this.factory = factory;
this.nbtValue = nbtValue;
this.schematicSourceItem = schematicSourceItem;
}

public SchematicItemFactory getFactory() {
return factory;
}

public int getNbtValue() {
return nbtValue;
}

public List<ItemEntry<? extends Item>> getSchematicSourceItems() {
return schematicSourceItem;
}

public static SchematicUploadItemSource tryFromItemStack(ItemStack stack) {
return Arrays.stream(values())
.filter(source -> source.getSchematicSourceItems()
.stream().anyMatch(sourceItem -> sourceItem.isIn(stack)))
.findAny().orElse(null);
}

public static SchematicUploadItemSource tryFromInt(int nbtValue) {
return Arrays.stream(values())
.filter(source -> source.getNbtValue() == nbtValue)
.findAny().orElse(null);
}

public static interface SchematicItemFactory {

ItemStack create(String schematic, String owner);

}

}
Loading

0 comments on commit dd7b3c8

Please sign in to comment.