Skip to content
Closed
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
5 changes: 0 additions & 5 deletions .gitattributes

This file was deleted.

11 changes: 6 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
types:
- opened
- edited
- synchronize
- labeled
- unlabeled
Expand All @@ -16,13 +17,13 @@ permissions:

jobs:
build:
uses: ldtteam/operapublicacreator/.github/workflows/gradle.build.yaml@ng7
uses: ldtteam/operapublicacreator/.github/workflows/gradle.build.yaml@main
with:
java: 21
java: 17
secrets: inherit
pre-release:
uses: ldtteam/operapublicacreator/.github/workflows/gradle.prerelease.yaml@ng7
uses: ldtteam/operapublicacreator/.github/workflows/gradle.prerelease.yaml@main
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && contains( github.event.pull_request.labels.*.name, 'Pre-release')
with:
java: 21
secrets: inherit
java: 17
secrets: inherit
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ permissions:

jobs:
release:
uses: ldtteam/operapublicacreator/.github/workflows/gradle.publish.yaml@ng7
uses: ldtteam/operapublicacreator/.github/workflows/gradle.publish.yaml@main
with:
java: 21
java: 17
curse_release_type: ${{ contains(github.ref, 'release') && 'release' || 'beta' }}
secrets: inherit
secrets: inherit
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
# gradle
/build
/.gradle
/runs

# other
/.vscode
/eclipse
/run
/runClient
/runServer
/runs/
.cache
/libs

Expand Down
75 changes: 74 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,74 @@
apply from: 'https://raw.githubusercontent.com/ldtteam/OperaPublicaCreator/ng7/gradle/mod.gradle'
tableau {
project {
group = "com.ldtteam"
publisher = "LDTTeam"
modId = "structurize"
}

sourceSets {
api {
isPartOfPrimaryJar = true
neogradle {
isModSource = true
}
}
main {
dependencies {
implementation sourceSets.named('api')
}
}
}

maven {
publishAsLDTTeamMod()
publishLocally()
pom({
usingGnu3License()
usingGit()
})
}
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs.addAll(['-Xmaxerrs', '1000', '-Xmaxwarns', '1000'])
}

// NeoGradle 7.1.x does not strip @OnlyIn annotations that Vineflower adds back
// during decompilation for MC 26.x. The NeoForm and UserDev patches expect them
// removed before nested type declarations. We also restore blank-line separators
// that Vineflower collapses between consecutive declarations.
tasks.matching { it.name == 'neoFormPatch' }.configureEach {
doFirst {
def decompileJar = project.file("build/neoForm/neoFormJoined26.2-2/steps/decompile/outputs.jar")
if (!decompileJar.exists()) return

def workDir = new File(project.buildDir, "onlyin-fix")
workDir.deleteDir()
workDir.mkdirs()

def zipTree = project.zipTree(decompileJar)
def javaFiles = []
zipTree.visit { details ->
def dest = new File(workDir, details.path)
if (details.directory) { dest.mkdirs() } else { dest.parentFile.mkdirs(); details.copyTo(dest); if (dest.name.endsWith('.java')) javaFiles << dest }
}

javaFiles.each { f ->
def text = f.text
// Strip @OnlyIn when it immediately precedes any nested type declaration
// at any indentation level. Preserves top-level class annotations.
def fixed = text.replaceAll(
/(?m)^( +)@OnlyIn\s*\([^)]*\)\n(\1(?:public |private |protected )?(?:static |final |abstract )?(?:class |interface |record |enum |@interface ))/,
'$2')
// Restore blank lines between closing brace and next declaration at same indent.
fixed = fixed.replaceAll(
/(?m)^(\}+)\n( +(?:public|private|protected)\s+(?:static\s+)?(?:class |record |interface |enum ))/,
'$1\n\n$2')
if (fixed != text) f.text = fixed
}

def ant = new groovy.ant.AntBuilder()
ant.jar(destfile: decompileJar.absolutePath, basedir: workDir)
workDir.deleteDir()
}
}
49 changes: 19 additions & 30 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,32 +1,26 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.daemon=false

modId=structurize
modGroup=com.ldtteam
modVersion=0.0.1
local.version=0.0.1-local
modBaseName=structurize

javaVersion=21
javaVersion=25
useJavaToolChains=true

#The currently running forge.
forgeVersion=21.1.84
# Minecraft and NeoForge
minecraft.version=26.2
minecraft.additionalVersions=
neoforge.version=26.2.0.66

fmlRange=[4,)
forgeRange=[21.0.143,)
minecraftRange=[1.21, 1.22)
fml_range=[11,)
neoforge_range=[26.2,)
minecraft_range=[26.2, 27)
blockUiRange=[0.0.1,)
domumOrnamentumRange=[1.0.0,)

#The version for forge (dependency)
exactMinecraftVersion=1.21.1
#The main version on curseforge
minecraftVersion=1.21.1
#Comma seperated list of mc versions, which are marked as compatible on curseforge
additionalMinecraftVersions=1.21

blockUiVersion=1.0.191-1.21.1-snapshot
domumOrnamentumVersion=1.0.203-1.21.1-snapshot
usesMCVersionOrderFirst=true

githubUrl=https://github.com/ldtteam/Structurize
gitUrl=https://github.com/ldtteam/Structurize.git
Expand All @@ -36,19 +30,14 @@ projectUrl=https://www.curseforge.com/minecraft/mc-mods/Structurize
curseId=298744
usesCurse=true

usesParchment=true
parchmentMinecraftVersion=1.21
parchmentMappingsVersion=2024.07.28

usesCrowdin=false
crowdinId=structurize

usesDatagen=true
additionalModsInDataGen=domum_ornamentum
dataGeneratorsVersion=1.20.4-0.1.57-ALPHA

requiredCurseDependencies=domum-ornamentum;blockui

useDefaultTestSystem=true
runtimeSourceSets=main
projectHasApi=false
runtimeSourceSets=api;test;main
librarySourceSets=api;test;main;datagen;
projectHasApi=true
primaryJarClassifier=
usesSonarQube=false
4 changes: 2 additions & 2 deletions gradle/configuration.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
project.ext.customChangelogHeader = "\n" +
"### Required Dependencies: \n" +
"- BlockUI: ${project.blockUiVersion} (or above)\n" +
"- Domum Ornamentum: ${project.domumOrnamentumVersion} (or above)\n"
"- BlockUI: 0.0.1-local (or above)\n" +
"- Domum Ornamentum: 1.0.0-local (or above)\n"
15 changes: 10 additions & 5 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
repositories {
mavenLocal()
}

dependencies {
implementation "com.ldtteam:blockui:${project.blockUiVersion}"
apiImplementation "com.ldtteam:blockui:0.0.1-local"
implementation "com.ldtteam:blockui:0.0.1-local"

implementation "com.ldtteam:domum-ornamentum:${project.domumOrnamentumVersion}"
apiImplementation "com.ldtteam:domum-ornamentum:1.0.0-local"
implementation "com.ldtteam:domum-ornamentum:1.0.0-local"
runtimeOnly "com.ldtteam:domum-ornamentum:1.0.0-local"

implementation (("com.ldtteam:datagenerators:${project.dataGeneratorsVersion}:universal")) {
transitive = false
}
testImplementation 'junit:junit:4.13.2'
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
9 changes: 5 additions & 4 deletions gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 18 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
pluginManagement {
repositories {
maven { url = uri('/tmp/maven-local') }
gradlePluginPortal()
maven {
url = uri('https://ldtteam.jfrog.io/artifactory/tableau/')
name = 'Tableau'
}
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
id 'com.ldtteam.tableau' version '0.0.96-j21.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}

gradle.startParameter.setProjectProperties(new HashMap<>(gradle.startParameter.getProjectProperties()))
gradle.startParameter.getProjectProperties().put("build.start", Long.toString(System.currentTimeMillis()))
rootProject.name = 'structurize'

rootProject.name = "structurize"
features {
usesGit = true
usesCurse = true
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.ldtteam.structurize.api;
package com.ldtteam.structurize.api.util;

import com.ldtteam.structurize.api.util.constant.Constants;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.levelgen.Heightmap;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -55,10 +57,10 @@ public static void writeToNBT(final CompoundTag compound, final String name, fin
*/
public static BlockPos readFromNBT(final CompoundTag compound, final String name)
{
final CompoundTag coordsCompound = compound.getCompound(name);
final int x = coordsCompound.getInt("x");
final int y = coordsCompound.getInt("y");
final int z = coordsCompound.getInt("z");
final CompoundTag coordsCompound = compound.getCompoundOrEmpty(name);
final int x = coordsCompound.getIntOr("x", 0);
final int y = coordsCompound.getIntOr("y", 0);
final int z = coordsCompound.getIntOr("z", 0);
return new BlockPos(x, y, z);
}

Expand Down Expand Up @@ -98,6 +100,27 @@ public static long getDistanceSquared(final BlockPos block1, final BlockPos bloc
return result;
}

/**
* Get the rotation enum value from the amount of rotations.
*
* @param rotations the amount of rotations.
* @return the enum Rotation.
*/
public static Rotation getRotationFromRotations(final int rotations)
{
switch (rotations)
{
case Constants.ROTATE_ONCE:
return Rotation.CLOCKWISE_90;
case Constants.ROTATE_TWICE:
return Rotation.CLOCKWISE_180;
case Constants.ROTATE_THREE_TIMES:
return Rotation.COUNTERCLOCKWISE_90;
default:
return Rotation.NONE;
}
}

/**
* Check if the given position is inside the given corners, corner order does not matter
*
Expand Down Expand Up @@ -250,7 +273,7 @@ public static BlockPos findSafeTeleportPos(@NotNull final Level level,

for (final BlockPos start : BlockPos.betweenClosed(target, top))
{
if (target.getY() < level.getMinBuildHeight()) continue;
if (target.getY() < level.getMinY()) continue;

for (final BlockPos pos : BlockPos.spiralAround(start, 15, Direction.SOUTH, Direction.EAST))
{
Expand Down
Loading