From ed62a8098425cb080862d0a0a5bd86e858a30db0 Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Mon, 12 Aug 2024 12:56:27 +0100 Subject: [PATCH 01/12] Update forge-updates.json (Bump) --- forge-updates.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forge-updates.json b/forge-updates.json index eba2b60..341f897 100644 --- a/forge-updates.json +++ b/forge-updates.json @@ -1,7 +1,7 @@ { "homepage": "https://modrinth.com/mod/create-pattern-schematics", "promos": { - "1.20.1-recommended": "1.1.6", - "1.20.1-latest": "1.1.6" + "1.20.1-recommended": "1.1.8", + "1.20.1-latest": "1.1.8" } } From c7b26bd8953789de202d8742c38bfd7c4ab6447f Mon Sep 17 00:00:00 2001 From: cakeGit <65340665+cakeGit@users.noreply.github.com> Date: Mon, 12 Aug 2024 12:54:37 +0100 Subject: [PATCH 02/12] Auto Publishing --- .env | 3 ++ build.gradle | 99 +++++++++++++++++++++++++++++++++++++++++++++++++- changelog.yaml | 12 ++++++ 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 .env create mode 100644 changelog.yaml diff --git a/.env b/.env new file mode 100644 index 0000000..86b8a43 --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +MODRINTH_PUBLISH_TOKEN=mrp_V6ysVsWcaMCPugrHg5GUob2Uf70dtgzHWVNCt5MPvcvB7fTuyIPNJq2113yC +CURSEFORGE_PUBLISH_TOKEN=cebc739a-b102-4e8f-8642-31ddbf201d78 +DISCORD_WEBHOOK=https://discord.com/api/webhooks/1272505641046642761/PBHgIyMaVC30Ao3ar4kGByyT6xck45god-L3z53HbhXda7x4k4pE3y0okBVlJu3v4NQR diff --git a/build.gradle b/build.gradle index 97f6161..f438836 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,20 @@ - plugins { +import org.yaml.snakeyaml.Yaml + +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath group: 'org.yaml', name: 'snakeyaml', version: '1.19' + } +} + + +plugins { id "architectury-plugin" version "3.4-SNAPSHOT" id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false id "io.github.p03w.machete" version "1.+" // automatic jar compressing on build + id "me.modmuss50.mod-publish-plugin" version "0.6.3" } architectury { @@ -77,3 +90,87 @@ allprojects { enabled = buildNumber != null } } + + +publishMods { + def TOKENS = new HashMap(); + file("$projectDir/.env").readLines().each() { + def (key, value) = it.tokenize('=') + TOKENS.put(key, value) + } + + def cfg = new Yaml().load(new File("$projectDir/changelog.yaml").newInputStream()) + def changelogText = cfg[minecraft_version + "-" + mod_version]; + println("Found Changelog: \n" + changelogText) + + def forgeName = "Create: Pattern Schematics $mod_version Forge $minecraft_version"; + def fabricName = "Create: Pattern Schematics $mod_version Fabric $minecraft_version"; + + def forgeFile = project(":forge").tasks.named("remapJar").get().archiveFile; + def fabricFile = project(":fabric").tasks.named("remapJar").get().archiveFile; + + def forgeEmoji = "<:forge:1267784983771222088>"; + def fabricEmoji = "<:fabric:1267785013936783421>"; + def newVersionPing = "<@&1267779725040947243>"; + + changelog = "Changelog: \n" + changelogText + type = STABLE + + curseforge("forgeCF") { + file = forgeFile + displayName = forgeName + projectId = "1072349" + projectSlug = "create-pattern-schematics" // Required for discord webhook + accessToken = TOKENS.get("CURSEFORGE_PUBLISH_TOKEN") + minecraftVersions.add(minecraft_version) + announcementTitle = "Curseforge download for $forgeEmoji" + modLoaders.add("forge") + + javaVersions.add(JavaVersion.VERSION_17) + clientRequired = true + serverRequired = true + requires("create") + } + modrinth("forgeMR") { + file = forgeFile + displayName = forgeName + projectId = "cpqKG67r" + accessToken = TOKENS.get("MODRINTH_PUBLISH_TOKEN") + minecraftVersions.add(minecraft_version) + announcementTitle = "Modrinth download for $forgeEmoji" + modLoaders.add("forge") + requires("create") + } + + curseforge("fabricCF") { + file = fabricFile + displayName = fabricName + projectId = "1072349" + projectSlug = "create-pattern-schematics" // Required for discord webhook + accessToken = TOKENS.get("CURSEFORGE_PUBLISH_TOKEN") + minecraftVersions.add(minecraft_version) + announcementTitle = "Curseforge download for $fabricEmoji" + modLoaders.add("fabric") + + javaVersions.add(JavaVersion.VERSION_17) + clientRequired = true + serverRequired = true + requires("create-fabric", "fabric-api") + } + modrinth("fabricMR") { + file = fabricFile + displayName = fabricName + projectId = "cpqKG67r" + accessToken = TOKENS.get("MODRINTH_PUBLISH_TOKEN") + minecraftVersions.add(minecraft_version) + announcementTitle = "Modrinth download for $fabricEmoji" + modLoaders.add("fabric") + requires("create-fabric", "fabric-api") + } + + discord("discordUniversal") { + webhookUrl = TOKENS.get("DISCORD_WEBHOOK") + username = "New Version Announcement | Create: Pattern Schematics" + content = "$newVersionPing\n# Create: Pattern Schematics has been updated to $mod_version for $minecraft_version ($fabricEmoji / $forgeEmoji)\n " + changelogText + } +} \ No newline at end of file diff --git a/changelog.yaml b/changelog.yaml new file mode 100644 index 0000000..2f29a92 --- /dev/null +++ b/changelog.yaml @@ -0,0 +1,12 @@ +--- + +1.19.2-1.1.8: | + - Updated mod links in mods.toml and the fabric.mod.json + - Forge now has the update checker configured + - Fixed the copycats not displaying accurately in the ponder (after I failed to cover up my laziness thanks @d4rkfl4sh) + - Added shift control to the clone tool to help with large schematics + - 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) + +... \ No newline at end of file From d17b30cc6172a05c732fc02c3a26b6057ad97cac Mon Sep 17 00:00:00 2001 From: cakeGit <65340665+cakeGit@users.noreply.github.com> Date: Mon, 12 Aug 2024 13:59:47 +0100 Subject: [PATCH 03/12] Renderer changes --- changelog.yaml | 3 + .../mirror/CloneSchematicOutlineRenderer.java | 155 ++++++++++---- .../foundation/mirror/StaticRenderers.java | 200 ++++++++++++++++++ 3 files changed, 316 insertions(+), 42 deletions(-) create mode 100644 common/src/main/java/com/cak/pattern_schematics/foundation/mirror/StaticRenderers.java diff --git a/changelog.yaml b/changelog.yaml index 2f29a92..c859f58 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -8,5 +8,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 (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: | + - 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 ... \ No newline at end of file diff --git a/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/CloneSchematicOutlineRenderer.java b/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/CloneSchematicOutlineRenderer.java index 86bbc09..748e390 100644 --- a/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/CloneSchematicOutlineRenderer.java +++ b/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/CloneSchematicOutlineRenderer.java @@ -1,60 +1,131 @@ package com.cak.pattern_schematics.foundation.mirror; import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; import com.simibubi.create.AllSpecialTextures; import com.simibubi.create.content.schematics.client.SchematicHandler; import com.simibubi.create.foundation.outliner.AABBOutline; +import com.simibubi.create.foundation.render.RenderTypes; import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Iterate; +import net.fabricmc.loader.impl.lib.sat4j.core.Vec; +import net.minecraft.client.renderer.LightTexture; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.Direction; +import net.minecraft.core.Vec3i; +import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; +import org.joml.Matrix4f; +import org.joml.Vector3f; +import org.joml.Vector4f; import java.util.List; +import java.util.Optional; public class CloneSchematicOutlineRenderer { - - public static void renderCloneGridLines(PoseStack ms, PatternSchematicHandler schematicHandler, SuperRenderTypeBuffer buffer) { - ms.pushPose(); - AABBOutline outline = schematicHandler.getGreaterOutline(); - outline.setBounds(schematicHandler.calculateGreaterOutlineBounds()); - outline.getParams() - .colored(0x6886c5) - .lineWidth(1/16f); - for (Direction.Axis axis : Iterate.axes) { - List secondaries = - axis == Direction.Axis.X ? List.of(Direction.Axis.Y, Direction.Axis.Z) : - axis == Direction.Axis.Y ? List.of(Direction.Axis.Y, Direction.Axis.Z) : - List.of(Direction.Axis.X, Direction.Axis.Y); - - - - continue; + + public static void renderCloneGridLines(PoseStack ms, PatternSchematicHandler schematicHandler, SuperRenderTypeBuffer buffer) { + if ( + schematicHandler.cloneScaleMin.equals(new Vec3i(0, 0, 0)) + && schematicHandler.cloneScaleMax.equals(new Vec3i(0, 0, 0)) + ) return; + + ms.pushPose(); + AABBOutline outline = schematicHandler.getGreaterOutline(); + outline.setBounds(schematicHandler.calculateGreaterOutlineBounds()); + outline.getParams() + .colored(0xa6a1af) + .lineWidth(1 / 16f); + outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks()); + + Vec3i min = schematicHandler.cloneScaleMin; + Vec3i max = schematicHandler.cloneScaleMax; + + AABB bounds = schematicHandler.bounds; + Vec3 scale = new Vec3( + bounds.getXsize(), + bounds.getYsize(), + bounds.getZsize() + ); + + Vector4f color = new Vector4f(166 / 256f, 161 / 256f, 175 / 256f, 1); + + for (Direction.Axis axis : Iterate.axes) { + List secondaries = + axis == Direction.Axis.X ? List.of(Direction.Axis.Y, Direction.Axis.Z) : + axis == Direction.Axis.Y ? List.of(Direction.Axis.Z, Direction.Axis.X) : + List.of(Direction.Axis.X, Direction.Axis.Y); + + Direction.Axis secondaryA = secondaries.get(0); + Direction.Axis secondaryB = secondaries.get(1); + + double secondaryScaleA = scale.get(secondaryA); + double secondaryScaleB = scale.get(secondaryB); + + Direction secondaryDirectionA = Direction.fromAxisAndDirection(secondaryA, Direction.AxisDirection.POSITIVE); + Direction secondaryDirectionB = Direction.fromAxisAndDirection(secondaryB, Direction.AxisDirection.POSITIVE); + + + for (Direction.AxisDirection axisDirection : Direction.AxisDirection.values()) { + Direction currentDirection = Direction.fromAxisAndDirection(axis, axisDirection); + Vec3 surfaceOrigin = axisDirection == Direction.AxisDirection.POSITIVE ? + new Vec3(0, 0, 0).with(axis, (max.get(axis) + 1) * scale.get(axis)) : + new Vec3(0, 0, 0).with(axis, min.get(axis) * scale.get(axis)); + + for (int secondaryCellA = min.get(secondaryA); secondaryCellA <= max.get(secondaryA); secondaryCellA++) { + for (int secondaryCellB = min.get(secondaryB); secondaryCellB <= max.get(secondaryB); secondaryCellB++) { + if ( + secondaryCellA == 0 && secondaryCellB == 0 && + ((axisDirection == Direction.AxisDirection.POSITIVE && max.get(axis) == 0) + || (axisDirection == Direction.AxisDirection.NEGATIVE && max.get(axis) == 0)) + ) continue; + + Vec3 faceMin = surfaceOrigin + .relative(secondaryDirectionA, secondaryCellA * secondaryScaleA) + .relative(secondaryDirectionB, secondaryCellB * secondaryScaleB); + + StaticRenderers.renderBoxFace( + ms.last(), buffer, true, false, + toVec3f(faceMin), toVec3f(faceMin + .relative(secondaryDirectionA, secondaryScaleA) + .relative(secondaryDirectionB, secondaryScaleB)), + currentDirection, color, LightTexture.FULL_BRIGHT + ); + } + } + } + } + ms.popPose(); } - outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks()); - ms.popPose(); - } - - public static void renderClone(PoseStack ms, SchematicHandler schematicHandler, SuperRenderTypeBuffer buffer) { - ms.pushPose(); - AABBOutline outline = schematicHandler.getOutline(); - outline.getParams() - .colored(0xa6a1af) - .withFaceTexture(AllSpecialTextures.CHECKERED) - .lineWidth(0); - outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks()); - outline.getParams() - .clearTextures(); - ms.popPose(); - } - - public static void applyOutlineModification(SchematicHandler schematicHandler) { - if (schematicHandler instanceof PatternSchematicHandler) { - AABBOutline outline = schematicHandler.getOutline(); - PatternSchematicHandler patternSchematicHandler = (PatternSchematicHandler) schematicHandler; - outline.getParams() - .colored(0x9352a3).lineWidth(patternSchematicHandler.isRenderingMultiple() ? 3/32f : 1/16f); + + private static Vector3f toVec3f(Vec3 vec) { + return new Vector3f((float) vec.x, (float) vec.y, (float) vec.z); } - } - + + public static void renderClone(PoseStack ms, SchematicHandler schematicHandler, SuperRenderTypeBuffer buffer) { +// ms.pushPose(); +// AABBOutline outline = schematicHandler.getOutline(); +// outline.getParams() +// .colored(0xa6a1af) +// .withFaceTexture(AllSpecialTextures.CHECKERED) +// .lineWidth(0); +// outline.render(ms, buffer, Vec3.ZERO, AnimationTickHolder.getPartialTicks()); +// outline.getParams() +// .clearTextures(); +// ms.popPose(); + } + + public static void applyOutlineModification(SchematicHandler schematicHandler) { + if (schematicHandler instanceof PatternSchematicHandler) { + AABBOutline outline = schematicHandler.getOutline(); + PatternSchematicHandler patternSchematicHandler = (PatternSchematicHandler) schematicHandler; + outline.getParams() + .colored(0x9352a3) + .lineWidth(patternSchematicHandler.isRenderingMultiple() ? 3 / 32f : 1 / 16f); + } + } + } diff --git a/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/StaticRenderers.java b/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/StaticRenderers.java new file mode 100644 index 0000000..ecf8bd1 --- /dev/null +++ b/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/StaticRenderers.java @@ -0,0 +1,200 @@ +package com.cak.pattern_schematics.foundation.mirror; + +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.VertexConsumer; +import com.simibubi.create.AllSpecialTextures; +import com.simibubi.create.foundation.render.RenderTypes; +import com.simibubi.create.foundation.render.SuperRenderTypeBuffer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.OverlayTexture; +import net.minecraft.core.Direction; +import net.minecraft.world.phys.Vec3; +import org.joml.Matrix4f; +import org.joml.Vector3f; +import org.joml.Vector4f; + +/**From {@link com.simibubi.create.foundation.outliner.AABBOutline#render(PoseStack, SuperRenderTypeBuffer, Vec3, float)}*/ +public class StaticRenderers { + + protected static final Vector4f colorTemp1 = new Vector4f(); + + protected static void renderBoxFace(PoseStack.Pose pose, SuperRenderTypeBuffer buffer, boolean cull, boolean highlighted, Vector3f minPos, Vector3f maxPos, Direction face, Vector4f color, int lightmap) { + RenderType renderType = RenderTypes.getOutlineTranslucent(AllSpecialTextures.CHECKERED.getLocation(), cull); + VertexConsumer consumer = buffer.getLateBuffer(renderType); + + float alphaMult = highlighted ? 1 : 0.5f; + colorTemp1.set(color.x(), color.y(), color.z(), color.w() * alphaMult); + color = colorTemp1; + + renderBoxFace(pose, consumer, minPos, maxPos, face, color, lightmap); + } + + protected static final Vector3f pos0Temp = new Vector3f(); + protected static final Vector3f pos1Temp = new Vector3f(); + protected static final Vector3f pos2Temp = new Vector3f(); + protected static final Vector3f pos3Temp = new Vector3f(); + protected static final Vector3f normalTemp = new Vector3f(); + + protected static void renderBoxFace(PoseStack.Pose pose, VertexConsumer consumer, Vector3f minPos, Vector3f maxPos, Direction face, Vector4f color, int lightmap) { + Vector3f pos0 = pos0Temp; + Vector3f pos1 = pos1Temp; + Vector3f pos2 = pos2Temp; + Vector3f pos3 = pos3Temp; + Vector3f normal = normalTemp; + + float minX = minPos.x(); + float minY = minPos.y(); + float minZ = minPos.z(); + float maxX = maxPos.x(); + float maxY = maxPos.y(); + float maxZ = maxPos.z(); + + float maxU; + float maxV; + + switch (face) { + case DOWN -> { + // 0 1 2 3 + pos0.set(minX, minY, maxZ); + pos1.set(minX, minY, minZ); + pos2.set(maxX, minY, minZ); + pos3.set(maxX, minY, maxZ); + maxU = maxX - minX; + maxV = maxZ - minZ; + normal.set(0, -1, 0); + } + case UP -> { + // 4 5 6 7 + pos0.set(minX, maxY, minZ); + pos1.set(minX, maxY, maxZ); + pos2.set(maxX, maxY, maxZ); + pos3.set(maxX, maxY, minZ); + maxU = maxX - minX; + maxV = maxZ - minZ; + normal.set(0, 1, 0); + } + case NORTH -> { + // 7 2 1 4 + pos0.set(maxX, maxY, minZ); + pos1.set(maxX, minY, minZ); + pos2.set(minX, minY, minZ); + pos3.set(minX, maxY, minZ); + maxU = maxX - minX; + maxV = maxY - minY; + normal.set(0, 0, -1); + } + case SOUTH -> { + // 5 0 3 6 + pos0.set(minX, maxY, maxZ); + pos1.set(minX, minY, maxZ); + pos2.set(maxX, minY, maxZ); + pos3.set(maxX, maxY, maxZ); + maxU = maxX - minX; + maxV = maxY - minY; + normal.set(0, 0, 1); + } + case WEST -> { + // 4 1 0 5 + pos0.set(minX, maxY, minZ); + pos1.set(minX, minY, minZ); + pos2.set(minX, minY, maxZ); + pos3.set(minX, maxY, maxZ); + maxU = maxZ - minZ; + maxV = maxY - minY; + normal.set(-1, 0, 0); + } + case EAST -> { + // 6 3 2 7 + pos0.set(maxX, maxY, maxZ); + pos1.set(maxX, minY, maxZ); + pos2.set(maxX, minY, minZ); + pos3.set(maxX, maxY, minZ); + maxU = maxZ - minZ; + maxV = maxY - minY; + normal.set(1, 0, 0); + } + default -> { + maxU = 1; + maxV = 1; + } + } + + bufferQuad(pose, consumer, pos0, pos1, pos2, pos3, color, 0, 0, maxU, maxV, lightmap, normal); + } + + protected static final Vector4f posTransformTemp = new Vector4f(); + protected static final Vector3f normalTransformTemp = new Vector3f(); + + public static void bufferQuad(PoseStack.Pose pose, VertexConsumer consumer, Vector3f pos0, Vector3f pos1, Vector3f pos2, + Vector3f pos3, Vector4f color, float minU, float minV, float maxU, float maxV, int lightmap, Vector3f normal) { + Matrix4f posMatrix = pose.pose(); + + posTransformTemp.set(pos0.x(), pos0.y(), pos0.z(), 1); + posTransformTemp.mul(posMatrix); + double x0 = posTransformTemp.x(); + double y0 = posTransformTemp.y(); + double z0 = posTransformTemp.z(); + + posTransformTemp.set(pos1.x(), pos1.y(), pos1.z(), 1); + posTransformTemp.mul(posMatrix); + double x1 = posTransformTemp.x(); + double y1 = posTransformTemp.y(); + double z1 = posTransformTemp.z(); + + posTransformTemp.set(pos2.x(), pos2.y(), pos2.z(), 1); + posTransformTemp.mul(posMatrix); + double x2 = posTransformTemp.x(); + double y2 = posTransformTemp.y(); + double z2 = posTransformTemp.z(); + + posTransformTemp.set(pos3.x(), pos3.y(), pos3.z(), 1); + posTransformTemp.mul(posMatrix); + double x3 = posTransformTemp.x(); + double y3 = posTransformTemp.y(); + double z3 = posTransformTemp.z(); + + float r = color.x(); + float g = color.y(); + float b = color.z(); + float a = color.w(); + + normalTransformTemp.set(normal); + normalTransformTemp.mul(pose.normal()); + float nx = normalTransformTemp.x(); + float ny = normalTransformTemp.y(); + float nz = normalTransformTemp.z(); + + consumer.vertex(x0, y0, z0) + .color(r, g, b, a) + .uv(minU, minV) + .overlayCoords(OverlayTexture.NO_OVERLAY) + .uv2(lightmap) + .normal(nx, ny, nz) + .endVertex(); + + consumer.vertex(x1, y1, z1) + .color(r, g, b, a) + .uv(minU, maxV) + .overlayCoords(OverlayTexture.NO_OVERLAY) + .uv2(lightmap) + .normal(nx, ny, nz) + .endVertex(); + + consumer.vertex(x2, y2, z2) + .color(r, g, b, a) + .uv(maxU, maxV) + .overlayCoords(OverlayTexture.NO_OVERLAY) + .uv2(lightmap) + .normal(nx, ny, nz) + .endVertex(); + + consumer.vertex(x3, y3, z3) + .color(r, g, b, a) + .uv(maxU, minV) + .overlayCoords(OverlayTexture.NO_OVERLAY) + .uv2(lightmap) + .normal(nx, ny, nz) + .endVertex(); + } + +} From 536bd829438511c0a27529ae13d5628994b74605 Mon Sep 17 00:00:00 2001 From: cakeGit <65340665+cakeGit@users.noreply.github.com> Date: Mon, 12 Aug 2024 14:00:19 +0100 Subject: [PATCH 04/12] ...Oh and bump the version too --- forge-updates.json | 4 ++-- gradle.properties | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/forge-updates.json b/forge-updates.json index 341f897..4f7ac97 100644 --- a/forge-updates.json +++ b/forge-updates.json @@ -1,7 +1,7 @@ { "homepage": "https://modrinth.com/mod/create-pattern-schematics", "promos": { - "1.20.1-recommended": "1.1.8", - "1.20.1-latest": "1.1.8" + "1.20.1-recommended": "1.1.9", + "1.20.1-latest": "1.1.9" } } diff --git a/gradle.properties b/gradle.properties index 9f78870..e66d91b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx2G # Mod Info archives_base_name = pattern_schematics -mod_version = 1.1.8 +mod_version = 1.1.9 maven_group = com.cak.pattern_schematics minecraft_version = 1.20.1 From 322772a184106a33b1b619dd31e91e4545e123cb Mon Sep 17 00:00:00 2001 From: cakeGit <65340665+cakeGit@users.noreply.github.com> Date: Tue, 13 Aug 2024 20:35:33 +0100 Subject: [PATCH 05/12] Bugfix --- changelog.yaml | 2 ++ .../mixin/BlockHelperMixin.java | 29 +++++++++++++++++++ .../pattern_schematics.common.mixins.json | 1 + gradle.properties | 2 +- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java diff --git a/changelog.yaml b/changelog.yaml index c859f58..10f2b9f 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -11,5 +11,7 @@ 1.20.1-1.1.9: | - 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 ... \ No newline at end of file diff --git a/common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java b/common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java new file mode 100644 index 0000000..074472c --- /dev/null +++ b/common/src/main/java/com/cak/pattern_schematics/mixin/BlockHelperMixin.java @@ -0,0 +1,29 @@ +package com.cak.pattern_schematics.mixin; + +import com.simibubi.create.content.trains.track.TrackTargetingBehaviour; +import com.simibubi.create.foundation.blockEntity.SmartBlockEntity; +import com.simibubi.create.foundation.utility.BlockHelper; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Mixin(BlockHelper.class) +public class BlockHelperMixin { + + /**Fix to issue, thanks to @zetttabyte on Discord*/ + @Inject(method = "prepareBlockEntityData", at = @At(value = "RETURN"), remap = false, cancellable = true) + private static void trainTargeting_prepareBlockEntityData(BlockState blockState, BlockEntity blockEntity, CallbackInfoReturnable cir) { + if (blockEntity instanceof SmartBlockEntity smartBlockEntity) { + if (smartBlockEntity.getBehaviour(TrackTargetingBehaviour.TYPE) != null) { + CompoundTag tag = cir.getReturnValue(); + tag.remove("Id"); + cir.setReturnValue(tag); + } + } + } + +} diff --git a/common/src/main/resources/pattern_schematics.common.mixins.json b/common/src/main/resources/pattern_schematics.common.mixins.json index 2531fdc..fd10856 100644 --- a/common/src/main/resources/pattern_schematics.common.mixins.json +++ b/common/src/main/resources/pattern_schematics.common.mixins.json @@ -7,6 +7,7 @@ ], "mixins": [ "AbstractContraptionEntityMixin", + "BlockHelperMixin", "CreateClientMixin", "DeployBaseMixin", "DeployerMovementBehaviorMixin", diff --git a/gradle.properties b/gradle.properties index e66d91b..cc7ee4b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx2G # Mod Info archives_base_name = pattern_schematics -mod_version = 1.1.9 +mod_version = 1.1.10 maven_group = com.cak.pattern_schematics minecraft_version = 1.20.1 From f55b5c1380f86e00263866c916babda6c703ad37 Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:46:04 +0100 Subject: [PATCH 06/12] What happens to the truth, when it is swallowed by a sea of lies --- .../cak/pattern_schematics/registry/PatternSchematicsLang.java | 1 - 1 file changed, 1 deletion(-) diff --git a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java index 8018a24..4461bdc 100644 --- a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java +++ b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java @@ -2,7 +2,6 @@ import java.util.function.BiConsumer; -/**Currently not functional since there's no datagen, but also there isn't much of a need for datagen now the mdo is done so eeh*/ public class PatternSchematicsLang { public static BiConsumer ENTRY_CONSUMER = PatternSchematicsRegistry.REGISTRATE::addRawLang; From 97d259bfeb60cb8fcf4bf57f13015a939017b931 Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:46:52 +0100 Subject: [PATCH 07/12] Version 1.1.11 Changed changed creative mode tab ordering (Also should help for when latest create releases) Also removed some random comments --- changelog.yaml | 3 +- .../PatternSchematicsClientEvents.java | 11 - .../mixin/CreateCreativeModeTabMixin.java | 32 + .../PatternSchematicsTabInsertions.java | 32 + .../registry/PlatformRegistryTransforms.java | 1 + .../pattern_schematics.common.mixins.json | 1 + .../forge/PlatformRegistryTransformsImpl.java | 1 - forge/src/main/resources/pack.mcmeta | 2 +- icon.svg | 1154 +++++++++++++++++ 9 files changed, 1223 insertions(+), 14 deletions(-) create mode 100644 common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java create mode 100644 common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsTabInsertions.java create mode 100644 icon.svg diff --git a/changelog.yaml b/changelog.yaml index 10f2b9f..c57b87b 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -13,5 +13,6 @@ - This also should help to improve performance 1.20.1-1.1.10: | - Fixed signal placement bug - +1.20.1-1.1.11: | + - Changed changed creative mode tab ordering (Also should help for when latest create releases) ... \ No newline at end of file diff --git a/common/src/main/java/com/cak/pattern_schematics/PatternSchematicsClientEvents.java b/common/src/main/java/com/cak/pattern_schematics/PatternSchematicsClientEvents.java index 43448f7..bba13e6 100644 --- a/common/src/main/java/com/cak/pattern_schematics/PatternSchematicsClientEvents.java +++ b/common/src/main/java/com/cak/pattern_schematics/PatternSchematicsClientEvents.java @@ -48,16 +48,5 @@ public static boolean onMouseInput(int button, boolean pressed) { return PatternSchematicsClient.PATTERN_SCHEMATIC_HANDLER.onMouseInput(button, pressed); } - -//Todo: For foge -// @Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD) -// public static class ModBusEvents { -// -// @SubscribeEvent -// public static void registerGuiOverlays(RegisterGuiOverlaysEvent event) { -// event.registerAbove(VanillaGuiOverlay.HOTBAR.id(), "pattern_schematic", PatternSchematicsClient.PATTERN_SCHEMATIC_HANDLER); -// } -// -// } } diff --git a/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java b/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java new file mode 100644 index 0000000..9428901 --- /dev/null +++ b/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java @@ -0,0 +1,32 @@ +package com.cak.pattern_schematics.mixin; + +import com.cak.pattern_schematics.registry.PatternSchematicsTabInsertions; +import net.minecraft.world.item.Item; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +import java.util.List; + +@Mixin(remap = false, targets = "com.simibubi.create.AllCreativeModeTabs$RegistrateDisplayItemsGenerator") +public class CreateCreativeModeTabMixin { + + @Redirect(method = "collectItems", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z")) + private boolean addAdditionalItemInject(List instance, Object element) { + Item itemToAdd = (Item) element; + boolean result = instance.add(itemToAdd); + + if ( + PatternSchematicsTabInsertions.getAllInsertsAfter() + .containsKey(itemToAdd) + ) { + instance.add( + PatternSchematicsTabInsertions.getAllInsertsAfter() + .get(itemToAdd) + ); + } + + return result; + } + +} diff --git a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsTabInsertions.java b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsTabInsertions.java new file mode 100644 index 0000000..ff4f491 --- /dev/null +++ b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsTabInsertions.java @@ -0,0 +1,32 @@ +package com.cak.pattern_schematics.registry; + +import com.google.common.collect.ImmutableMap; +import com.simibubi.create.AllItems; +import com.tterrag.registrate.util.entry.ItemEntry; +import net.minecraft.world.item.Item; + +import java.util.HashMap; +import java.util.Map; + +public class PatternSchematicsTabInsertions { + + + private static Map INSERTS_AFTER = null; + + public static final Map, ItemEntry> REGISTRY_INSERTS_AFTER = Map.of( + AllItems.EMPTY_SCHEMATIC, PatternSchematicsRegistry.EMPTY_PATTERN_SCHEMATIC + ); + + public static Map getAllInsertsAfter() { + if (INSERTS_AFTER != null) { + return INSERTS_AFTER; + } + + INSERTS_AFTER = new HashMap<>(); + for (Map.Entry, ItemEntry> entry : REGISTRY_INSERTS_AFTER.entrySet()) { + INSERTS_AFTER.put(entry.getKey().get(), entry.getValue().get()); + } + return INSERTS_AFTER; + } + +} diff --git a/common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java b/common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java index 41d336f..fc97db0 100644 --- a/common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java +++ b/common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java @@ -8,6 +8,7 @@ public class PlatformRegistryTransforms { + @Deprecated //TODO : not needed, function replaced by tabInsertions @ExpectPlatform public static NonNullUnaryOperator> transformEmptyPatternSchematic() { throw new AssertionError(); diff --git a/common/src/main/resources/pattern_schematics.common.mixins.json b/common/src/main/resources/pattern_schematics.common.mixins.json index fd10856..eed574f 100644 --- a/common/src/main/resources/pattern_schematics.common.mixins.json +++ b/common/src/main/resources/pattern_schematics.common.mixins.json @@ -9,6 +9,7 @@ "AbstractContraptionEntityMixin", "BlockHelperMixin", "CreateClientMixin", + "CreateCreativeModeTabMixin", "DeployBaseMixin", "DeployerMovementBehaviorMixin", "MovementContextMixin", diff --git a/forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java b/forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java index fc478fd..311494b 100644 --- a/forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java +++ b/forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java @@ -9,7 +9,6 @@ public class PlatformRegistryTransformsImpl { public static NonNullUnaryOperator> transformEmptyPatternSchematic() { - Create.LOGGER.info("suknfidjbsfdgknjg"); return (i) -> i.tab(AllCreativeModeTabs.BASE_CREATIVE_TAB.getKey()); } diff --git a/forge/src/main/resources/pack.mcmeta b/forge/src/main/resources/pack.mcmeta index 9252d3d..b25f73a 100644 --- a/forge/src/main/resources/pack.mcmeta +++ b/forge/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "description": "Example Mod", + "description": "Create: Pattern Schematics", "pack_format": 8 } } diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..c2ef7d1 --- /dev/null +++ b/icon.svg @@ -0,0 +1,1154 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From bab95762aafdf923bfd5a986b0bf9644f0d2e876 Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Sun, 25 Aug 2024 17:49:29 +0100 Subject: [PATCH 08/12] Removed unused transform No effect, so no need to bump version --- .../pattern_schematics/PatternSchematics.java | 1 + .../registry/PatternSchematicsRegistry.java | 1 - .../registry/PlatformRegistryTransforms.java | 17 ----------------- .../fabric/PlatformRegistryTransformsImpl.java | 18 ------------------ .../forge/PlatformRegistryTransformsImpl.java | 15 --------------- 5 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java delete mode 100644 fabric/src/main/java/com/cak/pattern_schematics/registry/fabric/PlatformRegistryTransformsImpl.java delete mode 100644 forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java diff --git a/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java b/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java index b4fa889..fa914b9 100644 --- a/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java +++ b/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java @@ -8,6 +8,7 @@ // The value here should match an entry in the META-INF/mods.toml file public class PatternSchematics { + // Define mod id in a common place for everything to reference public static final String MODID = "create_pattern_schematics"; // Directly reference a slf4j logger diff --git a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java index bbf485b..7de2ee5 100644 --- a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java +++ b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java @@ -14,7 +14,6 @@ public class PatternSchematicsRegistry { .item("empty_pattern_schematic", Item::new) .defaultModel() .properties(p -> p.stacksTo(1)) - .transform(PlatformRegistryTransforms.transformEmptyPatternSchematic()) .register(); public static final ItemEntry PATTERN_SCHEMATIC = REGISTRATE diff --git a/common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java b/common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java deleted file mode 100644 index fc97db0..0000000 --- a/common/src/main/java/com/cak/pattern_schematics/registry/PlatformRegistryTransforms.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.cak.pattern_schematics.registry; - -import com.simibubi.create.content.contraptions.AssemblyException; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import dev.architectury.injectables.annotations.ExpectPlatform; -import net.minecraft.world.item.Item; - -public class PlatformRegistryTransforms { - - @Deprecated //TODO : not needed, function replaced by tabInsertions - @ExpectPlatform - public static NonNullUnaryOperator> transformEmptyPatternSchematic() { - throw new AssertionError(); - } - -} diff --git a/fabric/src/main/java/com/cak/pattern_schematics/registry/fabric/PlatformRegistryTransformsImpl.java b/fabric/src/main/java/com/cak/pattern_schematics/registry/fabric/PlatformRegistryTransformsImpl.java deleted file mode 100644 index 085f60d..0000000 --- a/fabric/src/main/java/com/cak/pattern_schematics/registry/fabric/PlatformRegistryTransformsImpl.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.cak.pattern_schematics.registry.fabric; - -import com.simibubi.create.AllCreativeModeTabs; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import net.minecraft.world.item.Item; - -public class PlatformRegistryTransformsImpl { - - public static NonNullUnaryOperator> transformEmptyPatternSchematic() { - return (i) -> i.tab(AllCreativeModeTabs.BASE_CREATIVE_TAB.key()); - } - - public static void registerPackets() { - PatternSchematicPackets.registerPackets(); - } - -} diff --git a/forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java b/forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java deleted file mode 100644 index 311494b..0000000 --- a/forge/src/main/java/com/cak/pattern_schematics/registry/forge/PlatformRegistryTransformsImpl.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.cak.pattern_schematics.registry.forge; - -import com.simibubi.create.AllCreativeModeTabs; -import com.simibubi.create.Create; -import com.tterrag.registrate.builders.ItemBuilder; -import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; -import net.minecraft.world.item.Item; - -public class PlatformRegistryTransformsImpl { - - public static NonNullUnaryOperator> transformEmptyPatternSchematic() { - return (i) -> i.tab(AllCreativeModeTabs.BASE_CREATIVE_TAB.getKey()); - } - -} From d5cd082e5ad9208b1d1bfabd888017a1eab324bb Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Sun, 25 Aug 2024 18:04:03 +0100 Subject: [PATCH 09/12] Bump version fr --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index cc7ee4b..773f84b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx2G # Mod Info archives_base_name = pattern_schematics -mod_version = 1.1.10 +mod_version = 1.1.11 maven_group = com.cak.pattern_schematics minecraft_version = 1.20.1 From 27a1b6062e09bc211a9059496f49ec1f8980ebe0 Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Sun, 25 Aug 2024 23:26:37 +0100 Subject: [PATCH 10/12] Grade bump -> republished --- changelog.yaml | 4 +++- .../pattern_schematics/mixin/CreateCreativeModeTabMixin.java | 1 + forge-updates.json | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog.yaml b/changelog.yaml index c57b87b..7828cf4 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -14,5 +14,7 @@ 1.20.1-1.1.10: | - Fixed signal placement bug 1.20.1-1.1.11: | - - Changed changed creative mode tab ordering (Also should help for when latest create releases) + - Changed creative mode tab ordering (Also should help for when latest create releases) + - Changed to use correct gradle version + ... \ No newline at end of file diff --git a/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java b/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java index 9428901..93f6cba 100644 --- a/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java +++ b/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java @@ -14,6 +14,7 @@ public class CreateCreativeModeTabMixin { @Redirect(method = "collectItems", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z")) private boolean addAdditionalItemInject(List instance, Object element) { Item itemToAdd = (Item) element; + //Ensure execution order, add the instance then add other boolean result = instance.add(itemToAdd); if ( diff --git a/forge-updates.json b/forge-updates.json index 4f7ac97..ca5b342 100644 --- a/forge-updates.json +++ b/forge-updates.json @@ -1,7 +1,7 @@ { "homepage": "https://modrinth.com/mod/create-pattern-schematics", "promos": { - "1.20.1-recommended": "1.1.9", - "1.20.1-latest": "1.1.9" + "1.20.1-recommended": "1.1.11", + "1.20.1-latest": "1.1.11" } } From 1903f1deb9a48accba22a795959051ba70d6e9f4 Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Mon, 26 Aug 2024 01:05:10 +0100 Subject: [PATCH 11/12] Version BUMP for PUBLISH --- changelog.yaml | 4 +++- .../cak/pattern_schematics/PatternSchematics.java | 12 +++++------- .../content/ponder/PatternSchematicsPonderIndex.java | 2 +- .../foundation/mirror/PatternSchematicsToolType.java | 4 ++-- .../registry/PatternSchematicsLang.java | 7 ++++--- .../registry/PatternSchematicsRegistry.java | 4 ++-- .../fabric/PatternSchematicsFabric.java | 4 +++- .../fabric/PatternSchematicsFabricData.java | 10 ++++------ .../forge/PatternSchematicsForge.java | 6 ++++-- gradle.properties | 2 +- 10 files changed, 29 insertions(+), 26 deletions(-) diff --git a/changelog.yaml b/changelog.yaml index 7828cf4..7c6812f 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -16,5 +16,7 @@ 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 ... \ No newline at end of file diff --git a/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java b/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java index fa914b9..c7327a7 100644 --- a/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java +++ b/common/src/main/java/com/cak/pattern_schematics/PatternSchematics.java @@ -2,17 +2,15 @@ import com.cak.pattern_schematics.registry.PatternSchematicsRegistry; import com.cak.pattern_schematics.registry.PlatformPackets; -import com.mojang.logging.LogUtils; +import com.simibubi.create.foundation.data.CreateRegistrate; import net.minecraft.resources.ResourceLocation; -import org.slf4j.Logger; // The value here should match an entry in the META-INF/mods.toml file public class PatternSchematics { - // Define mod id in a common place for everything to reference - public static final String MODID = "create_pattern_schematics"; - // Directly reference a slf4j logger - private static final Logger LOGGER = LogUtils.getLogger(); + public static final String MOD_ID = "create_pattern_schematics"; + + public static final CreateRegistrate REGISTRATE = CreateRegistrate.create(PatternSchematics.MOD_ID); public static void init() { PatternSchematicsRegistry.register(); @@ -21,7 +19,7 @@ public static void init() { } public static ResourceLocation asResource(String loc) { - return new ResourceLocation(MODID, loc); + return new ResourceLocation(MOD_ID, loc); } } diff --git a/common/src/main/java/com/cak/pattern_schematics/content/ponder/PatternSchematicsPonderIndex.java b/common/src/main/java/com/cak/pattern_schematics/content/ponder/PatternSchematicsPonderIndex.java index dbf9a3f..d612785 100644 --- a/common/src/main/java/com/cak/pattern_schematics/content/ponder/PatternSchematicsPonderIndex.java +++ b/common/src/main/java/com/cak/pattern_schematics/content/ponder/PatternSchematicsPonderIndex.java @@ -6,7 +6,7 @@ public class PatternSchematicsPonderIndex { - static final PonderRegistrationHelper HELPER = new PonderRegistrationHelper(PatternSchematics.MODID); + static final PonderRegistrationHelper HELPER = new PonderRegistrationHelper(PatternSchematics.MOD_ID); public static void register() { diff --git a/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/PatternSchematicsToolType.java b/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/PatternSchematicsToolType.java index ea4605a..76acfc1 100644 --- a/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/PatternSchematicsToolType.java +++ b/common/src/main/java/com/cak/pattern_schematics/foundation/mirror/PatternSchematicsToolType.java @@ -44,7 +44,7 @@ public ISchematicTool getTool() { } public MutableComponent getDisplayName() { - return (patternModId ? Component.translatable(PatternSchematics.MODID + ".schematic.tool." + Lang.asId(name())) + return (patternModId ? Component.translatable(PatternSchematics.MOD_ID + ".schematic.tool." + Lang.asId(name())) : Lang.translateDirect("schematic.tool." + Lang.asId(name()))); } @@ -65,7 +65,7 @@ public static boolean isPatternSchematicTool(SchematicToolBase tool) { } public List getDescription() { - return (patternModId ? PatternSchematicsToolType.translatedOptions(PatternSchematics.MODID + ".schematic.tool." + Lang.asId(name()) + ".description", "0", "1", "2", "3") + return (patternModId ? PatternSchematicsToolType.translatedOptions(PatternSchematics.MOD_ID + ".schematic.tool." + Lang.asId(name()) + ".description", "0", "1", "2", "3") : Lang.translatedOptions("schematic.tool." + Lang.asId(name()) + ".description", "0", "1", "2", "3")); } diff --git a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java index 4461bdc..42fe495 100644 --- a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java +++ b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsLang.java @@ -2,9 +2,11 @@ import java.util.function.BiConsumer; +import static com.cak.pattern_schematics.PatternSchematics.REGISTRATE; + public class PatternSchematicsLang { - public static BiConsumer ENTRY_CONSUMER = PatternSchematicsRegistry.REGISTRATE::addRawLang; + public static BiConsumer ENTRY_CONSUMER = REGISTRATE::addRawLang; public static void register() { putLang( @@ -22,8 +24,7 @@ public static void register() { public static void putLang(String... entryKeyPairs) { for (int i = 0; i < entryKeyPairs.length; i+=2) { - PatternSchematicsRegistry.REGISTRATE - .addRawLang(entryKeyPairs[i], entryKeyPairs[i+1]); + REGISTRATE.addRawLang(entryKeyPairs[i], entryKeyPairs[i+1]); } } diff --git a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java index 7de2ee5..c05c107 100644 --- a/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java +++ b/common/src/main/java/com/cak/pattern_schematics/registry/PatternSchematicsRegistry.java @@ -6,10 +6,10 @@ import com.tterrag.registrate.util.entry.ItemEntry; import net.minecraft.world.item.Item; +import static com.cak.pattern_schematics.PatternSchematics.REGISTRATE; + public class PatternSchematicsRegistry { - public static final CreateRegistrate REGISTRATE = CreateRegistrate.create(PatternSchematics.MODID); - public static final ItemEntry EMPTY_PATTERN_SCHEMATIC = REGISTRATE .item("empty_pattern_schematic", Item::new) .defaultModel() diff --git a/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabric.java b/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabric.java index 2224fcf..47dfe74 100644 --- a/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabric.java +++ b/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabric.java @@ -4,12 +4,14 @@ import com.cak.pattern_schematics.registry.PatternSchematicsRegistry; import net.fabricmc.api.ModInitializer; +import static com.cak.pattern_schematics.PatternSchematics.REGISTRATE; + public class PatternSchematicsFabric implements ModInitializer { @Override public void onInitialize() { PatternSchematics.init(); - PatternSchematicsRegistry.REGISTRATE.register(); + REGISTRATE.register(); } } diff --git a/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabricData.java b/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabricData.java index e6dbd6e..395f0bf 100644 --- a/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabricData.java +++ b/fabric/src/main/java/com/cak/pattern_schematics/fabric/PatternSchematicsFabricData.java @@ -5,22 +5,20 @@ import com.cak.pattern_schematics.content.ponder.PatternSchematicsPonderTags; import com.cak.pattern_schematics.registry.PatternSchematicsRegistry; import com.cak.pattern_schematics.registry.PatternSchematicsLang; -import com.simibubi.create.Create; import com.simibubi.create.foundation.ponder.PonderLocalization; -import com.simibubi.create.infrastructure.ponder.AllPonderTags; -import com.simibubi.create.infrastructure.ponder.GeneralText; -import com.simibubi.create.infrastructure.ponder.PonderIndex; import com.simibubi.create.infrastructure.ponder.SharedText; import io.github.fabricators_of_create.porting_lib.data.ExistingFileHelper; import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +import static com.cak.pattern_schematics.PatternSchematics.REGISTRATE; + public class PatternSchematicsFabricData implements DataGeneratorEntrypoint { @Override public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { ExistingFileHelper helper = ExistingFileHelper.withResourcesFromArg(); - PatternSchematicsRegistry.REGISTRATE.setupDatagen(fabricDataGenerator.createPack(), helper); + REGISTRATE.setupDatagen(fabricDataGenerator.createPack(), helper); PatternSchematicsLang.register(); PatternSchematicsPonderTags.register(); @@ -29,7 +27,7 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { SharedText.gatherText(); PonderLocalization.generateSceneLang(); - PonderLocalization.provideLang(PatternSchematics.MODID, PatternSchematicsLang.ENTRY_CONSUMER); + PonderLocalization.provideLang(PatternSchematics.MOD_ID, PatternSchematicsLang.ENTRY_CONSUMER); } } diff --git a/forge/src/main/java/com/cak/pattern_schematics/forge/PatternSchematicsForge.java b/forge/src/main/java/com/cak/pattern_schematics/forge/PatternSchematicsForge.java index 315ae96..5351b26 100644 --- a/forge/src/main/java/com/cak/pattern_schematics/forge/PatternSchematicsForge.java +++ b/forge/src/main/java/com/cak/pattern_schematics/forge/PatternSchematicsForge.java @@ -8,13 +8,15 @@ import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -@Mod(PatternSchematics.MODID) +import static com.cak.pattern_schematics.PatternSchematics.REGISTRATE; + +@Mod(PatternSchematics.MOD_ID) public class PatternSchematicsForge { public PatternSchematicsForge() { // registrate must be given the mod event bus on forge before registration IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); - PatternSchematicsRegistry.REGISTRATE.registerEventListeners(eventBus); + REGISTRATE.registerEventListeners(eventBus); PatternSchematics.init(); DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> PatternSchematicsForgeClient::onInitializeClient); diff --git a/gradle.properties b/gradle.properties index 773f84b..bbbce33 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx2G # Mod Info archives_base_name = pattern_schematics -mod_version = 1.1.11 +mod_version = 1.1.12 maven_group = com.cak.pattern_schematics minecraft_version = 1.20.1 From a7d4667dc1222d7906e7b7e37b8c38f417b2bfd8 Mon Sep 17 00:00:00 2001 From: Cake <65340665+cakeGit@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:43:00 +0100 Subject: [PATCH 12/12] 1.1.13 - Crafting --- changelog.yaml | 2 ++ .../mixin/CreateCreativeModeTabMixin.java | 2 +- .../pattern_schematic_paper_substitutes.json | 6 ++++++ .../items/schematic_paper_substitutes.json | 6 ++++++ .../pattern_schematic_from_substitute.json | 18 ++++++++++++++++++ .../recipes/schematic_from_substitute.json | 15 +++++++++++++++ forge-updates.json | 4 ++-- .../pattern_schematic_from_substitute.json | 18 ++++++++++++++++++ .../recipes/schematic_from_substitute.json | 15 +++++++++++++++ gradle.properties | 2 +- 10 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 common/src/main/resources/data/create_pattern_schematics/tags/items/pattern_schematic_paper_substitutes.json create mode 100644 common/src/main/resources/data/create_pattern_schematics/tags/items/schematic_paper_substitutes.json create mode 100644 fabric/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json create mode 100644 fabric/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json create mode 100644 forge/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json create mode 100644 forge/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json diff --git a/changelog.yaml b/changelog.yaml index 7c6812f..e66ed96 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -19,4 +19,6 @@ 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 ... \ No newline at end of file diff --git a/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java b/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java index 93f6cba..3d86698 100644 --- a/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java +++ b/common/src/main/java/com/cak/pattern_schematics/mixin/CreateCreativeModeTabMixin.java @@ -14,7 +14,7 @@ public class CreateCreativeModeTabMixin { @Redirect(method = "collectItems", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z")) private boolean addAdditionalItemInject(List instance, Object element) { Item itemToAdd = (Item) element; - //Ensure execution order, add the instance then add other + //Ensure execution order, add the instance then add otherg boolean result = instance.add(itemToAdd); if ( diff --git a/common/src/main/resources/data/create_pattern_schematics/tags/items/pattern_schematic_paper_substitutes.json b/common/src/main/resources/data/create_pattern_schematics/tags/items/pattern_schematic_paper_substitutes.json new file mode 100644 index 0000000..f374458 --- /dev/null +++ b/common/src/main/resources/data/create_pattern_schematics/tags/items/pattern_schematic_paper_substitutes.json @@ -0,0 +1,6 @@ +{ + "values": [ + "create:schematic", + "create:empty_schematic" + ] +} \ No newline at end of file diff --git a/common/src/main/resources/data/create_pattern_schematics/tags/items/schematic_paper_substitutes.json b/common/src/main/resources/data/create_pattern_schematics/tags/items/schematic_paper_substitutes.json new file mode 100644 index 0000000..c0cbd44 --- /dev/null +++ b/common/src/main/resources/data/create_pattern_schematics/tags/items/schematic_paper_substitutes.json @@ -0,0 +1,6 @@ +{ + "values": [ + "create_pattern_schematics:pattern_schematic", + "create_pattern_schematics:empty_pattern_schematic" + ] +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json b/fabric/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json new file mode 100644 index 0000000..4d67e32 --- /dev/null +++ b/fabric/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "create:iron_sheet" + }, + { + "tag": "create_pattern_schematics:pattern_schematic_paper_substitutes" + }, + { + "tag": "c:pink_dyes" + } + ], + "result": { + "item": "create_pattern_schematics:empty_pattern_schematic" + } +} \ No newline at end of file diff --git a/fabric/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json b/fabric/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json new file mode 100644 index 0000000..b8ac0b8 --- /dev/null +++ b/fabric/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "create_pattern_schematics:schematic_paper_substitutes" + }, + { + "tag": "c:light_blue_dyes" + } + ], + "result": { + "item": "create:empty_schematic" + } +} \ No newline at end of file diff --git a/forge-updates.json b/forge-updates.json index ca5b342..28296a9 100644 --- a/forge-updates.json +++ b/forge-updates.json @@ -1,7 +1,7 @@ { "homepage": "https://modrinth.com/mod/create-pattern-schematics", "promos": { - "1.20.1-recommended": "1.1.11", - "1.20.1-latest": "1.1.11" + "1.20.1-recommended": "1.1.13", + "1.20.1-latest": "1.1.13" } } diff --git a/forge/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json b/forge/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json new file mode 100644 index 0000000..d9b6b27 --- /dev/null +++ b/forge/src/main/resources/data/pattern_schematics/recipes/pattern_schematic_from_substitute.json @@ -0,0 +1,18 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "item": "create:iron_sheet" + }, + { + "tag": "create_pattern_schematics:pattern_schematic_paper_substitutes" + }, + { + "tag": "forge:dyes/pink" + } + ], + "result": { + "item": "create_pattern_schematics:empty_pattern_schematic" + } +} \ No newline at end of file diff --git a/forge/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json b/forge/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json new file mode 100644 index 0000000..6536198 --- /dev/null +++ b/forge/src/main/resources/data/pattern_schematics/recipes/schematic_from_substitute.json @@ -0,0 +1,15 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "create_pattern_schematics:schematic_paper_substitutes" + }, + { + "tag": "forge:dyes/light_blue" + } + ], + "result": { + "item": "create:empty_schematic" + } +} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index bbbce33..ec63454 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs = -Xmx2G # Mod Info archives_base_name = pattern_schematics -mod_version = 1.1.12 +mod_version = 1.1.13 maven_group = com.cak.pattern_schematics minecraft_version = 1.20.1