Compare commits

..
8 Commits
Author SHA1 Message Date
Martin Robertz 361c851706 update 2024-09-10 16:55:44 +02:00
Darren Eberly ebb2517488 Mixin ordering compat with NEID (#5)
* Mixin ordering compat with NEID

* spotless
2024-09-10 12:40:03 +01:00
Connor-Colenso ff97e8841c Merge pull request #4 from GTNewHorizons/fix-empty-metadata 2024-08-26 12:49:06 +01:00
NotAPenguin b60e19b434 fix the empty metadata array but now for TE transformer 2024-08-26 13:04:16 +02:00
Connor-Colenso cb9de2d290 Merge pull request #3 from GTNewHorizons/fix-empty-blockarray
Fix crash when metadata array is empty
2024-08-20 13:09:12 +01:00
NotAPenguin ec2b6a9007 More proper fix 2024-08-20 14:00:44 +02:00
NotAPenguin d9ceee01b5 fix crash when metadata array is empty 2024-08-20 13:43:45 +02:00
Martin Robertz d1817ea4c2 update 2024-08-18 14:59:51 +02:00
9 changed files with 71 additions and 11 deletions

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
dependencies {
api('com.github.GTNewHorizons:NotEnoughIds:1.5.4-pre:dev')
api('com.github.GTNewHorizons:NotEnoughIds:2.1.0:dev')
}
+17 -5
View File
@@ -33,7 +33,7 @@ channel = stable
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
@@ -61,6 +61,9 @@ gradleTokenModId = MODID
# [DEPRECATED] Mod name replacement token.
gradleTokenModName = MODNAME
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName = GROUPNAME
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
@@ -82,6 +85,11 @@ accessTransformersFile =
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = true
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = true
@@ -114,16 +122,22 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https://nexus.gtnewhorizons.com/repository/releases/
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
@@ -187,5 +201,3 @@ curseForgeRelations =
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
gradleTokenGroupName = GROUPNAME
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+5 -2
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Vendored
+2
View File
@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.8'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
}
@@ -17,7 +17,12 @@ import com.gtnewhorizons.postea.utility.ChunkFixerUtility;
@Mixin(AnvilChunkLoader.class)
public abstract class MixinAnvilChunkLoader {
@Inject(method = "checkedReadChunkFromNBT__Async", at = @At("HEAD"), remap = false)
@Inject(
method = "checkedReadChunkFromNBT__Async",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/chunk/storage/AnvilChunkLoader;readChunkFromNBT(Lnet/minecraft/world/World;Lnet/minecraft/nbt/NBTTagCompound;)Lnet/minecraft/world/chunk/Chunk;"),
remap = false)
private void onCheckedReadChunkFromNBT__Async(World world, int x, int z, NBTTagCompound compound,
CallbackInfoReturnable<Object[]> cir) {
ChunkFixerUtility.processChunkNBT(compound, world);
@@ -60,6 +60,15 @@ public class ChunkFixerUtility {
// Blocks16 and Data16 exist only because of NEID.
byte[] blockArray = section.getByteArray("Blocks16");
byte[] metadataArray = section.getByteArray("Data16");
// If metadata array is empty, it was all zeroes. We create a new array to write our new values to,
// and only save this when a nonzero value was written
boolean wasAllZero = false;
if (metadataArray.length == 0) {
wasAllZero = true;
metadataArray = new byte[8192];
}
// Keep track of if we write a nonzero element to the metadata array
boolean hasWrittenNonZero = false;
byte sectionY = section.getByte("Y");
@@ -84,6 +93,11 @@ public class ChunkFixerUtility {
blockConversionInfo.blockName = blockName;
blockConversionInfo.blockID = blockId;
blockConversionInfo.metadata = (byte) metadata; // Updated
// If we wrote a nonzero metadata, keep track of this because it means the
// new array needs to be written back to NBT
if (metadata != 0) {
hasWrittenNonZero = true;
}
blockConversionInfo.world = world;
int x = index % 16;
@@ -107,6 +121,12 @@ public class ChunkFixerUtility {
metadataArray[index * 2 + 1] = (byte) (newMetadata & 0xFF);
}
}
// After processing all replacements, if we made a new metadata array and wrote a nonzero value to it,
// write it back to world NBT to save
if (wasAllZero && hasWrittenNonZero) {
section.setByteArray("Data16", metadataArray);
}
}
}
@@ -136,6 +156,17 @@ public class ChunkFixerUtility {
int chunkZPos) {
byte[] blockArray = section.getByteArray("Blocks16");
byte[] metadataArray = section.getByteArray("Data16"); // Updated to use Data16
// If metadata array is empty, it was all zeroes. We create a new array to write our new values to,
// and only save this when a nonzero value was written
boolean wasAllZero = false;
if (metadataArray.length == 0) {
wasAllZero = true;
metadataArray = new byte[8192];
}
// Keep track of if we write a nonzero element to the metadata array
boolean hasWrittenNonZero = false;
byte y = section.getByte("Y");
List<ConversionInfo> filteredList = filterConversionInfosByY(conversionInfoList, y);
@@ -145,6 +176,13 @@ public class ChunkFixerUtility {
int index = computeBlockIndex(localCoords);
setBlockInfo(info.blockInfo.block, index, blockArray);
setMetadata(info.blockInfo.metadata, index, metadataArray); // This uses the updated setMetadata
if (info.blockInfo.metadata != 0) hasWrittenNonZero = true;
}
// After processing all replacements, if we made a new metadata array and wrote a nonzero value to it,
// write it back to world NBT to save
if (wasAllZero && hasWrittenNonZero) {
section.setByteArray("Data16", metadataArray);
}
}