Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.19.2 Update to 1.1.13 #3

Merged
merged 12 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -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
99 changes: 98 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -77,3 +90,87 @@ allprojects {
enabled = buildNumber != null
}
}


publishMods {
def TOKENS = new HashMap<String, String>();
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
}
}
24 changes: 24 additions & 0 deletions changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---

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)
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
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
...
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +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();
Expand All @@ -20,7 +19,7 @@ public static void init() {
}

public static ResourceLocation asResource(String loc) {
return new ResourceLocation(MODID, loc);
return new ResourceLocation(MOD_ID, loc);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
//
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -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() {

Expand Down
Original file line number Diff line number Diff line change
@@ -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<Direction.Axis> 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<Direction.Axis> 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);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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())));
}

Expand All @@ -65,7 +65,7 @@ public static boolean isPatternSchematicTool(SchematicToolBase tool) {
}

public List<Component> 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"));
}

Expand Down
Loading
Loading