Compare commits

...
3 Commits
Author SHA1 Message Date
Worive 525fcc56ad Update buildscript to v2 (#40) 2026-03-08 19:23:42 +01:00
Woriveandgithub-actions[bot] a36120fc91 Add dynamic render option without relying on doesTick (#38)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-08 10:50:16 +01:00
Worive 238b041f12 Revert light value caching, applying better iteration to avoid null exceptions (#37) 2025-12-08 10:04:49 +01:00
10 changed files with 65 additions and 62 deletions

No files matched your search

+32 -2
View File
@@ -39,10 +39,34 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = false
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
@@ -174,6 +198,12 @@ curseForgeRelations =
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
# runClientWorkingDirectory = run/client
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
+12
View File
@@ -0,0 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/faa12903720d410b387cc69ccafb1a74/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a4c09dd2e2d7079373d30e524bbc2829/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/b96cb7670c095245220e7d01d5927b58/redirect
toolchainVersion=25
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.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+2 -5
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
Vendored
+1 -2
View File
@@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
+1 -3
View File
@@ -17,7 +17,5 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.46'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.23'
}
@@ -305,7 +305,10 @@ class BlockMultipart extends Block(Material.rock) {
}
override def getLightValue(world: IBlockAccess, x: Int, y: Int, z: Int): Int =
world.getBlockMetadata(x, y, z)
getTile(world, x, y, z) match {
case null => 0
case tile => tile.getLightValue
}
override def randomDisplayTick(
world: World,
@@ -316,6 +316,12 @@ abstract class TMultiPart {
*/
def doesTick = true
/** Return whether this part needs to be included in the dynamic render loop
* (renderDynamic). Default is false. Override this to true for parts like
* lights that need per-frame rendering but no logic updates.
*/
def shouldRenderDynamic = false
/** Called once per world tick. This will be called even if doesTick returns
* false if another part in the space needs ticks.
*/
@@ -40,8 +40,6 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
private var doesTick = false
private var cachedLightValue: Int = 0
private[multipart] def from(that: TileMultipart) {
copyFrom(that)
loadFrom(that)
@@ -118,6 +116,7 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
override def validate() {
super.validate()
if (worldObj != null && worldObj.isRemote)
TileCache.add(this)
}
@@ -170,25 +169,9 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
*/
def getWeakChanges = false
def getLightValue: Int = cachedLightValue
override def shouldRefresh(
oldBlock: Block,
newBlock: Block,
oldMeta: Int,
newMeta: Int,
world: World,
x: Int,
y: Int,
z: Int
): Boolean = {
oldBlock != newBlock
}
private def updateLight(): Unit = {
def getLightValue: Int = {
if (partList.isEmpty) {
cachedLightValue = 0
return
return 0
}
var max = 0
@@ -197,23 +180,8 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
val l = it.next().getLightValue
if (l > max) max = l
}
cachedLightValue = max
if (
worldObj != null && worldObj.getBlockMetadata(
xCoord,
yCoord,
zCoord
) != cachedLightValue
) {
worldObj.setBlockMetadataWithNotify(
xCoord,
yCoord,
zCoord,
cachedLightValue,
3
)
}
max
}
def getExplosionResistance(entity: Entity) =
@@ -336,10 +304,6 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
bindPart(part)
part.bind(this)
if (part.getLightValue > cachedLightValue) {
cachedLightValue = part.getLightValue
}
if (!doesTick && part.doesTick)
setTicking(true)
}
@@ -394,10 +358,6 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
part.onRemoved()
part.tile = null
if (removedLightValue == cachedLightValue && removedLightValue > 0) {
updateLight()
}
if (partList.isEmpty) {
worldObj.setBlockToAir(xCoord, yCoord, zCoord)
} else {
@@ -420,8 +380,6 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
clearParts()
parts.foreach(p => addPart_do(p))
updateLight()
if (worldObj != null) {
if (worldObj.isRemote)
operate(_.onWorldJoin())
@@ -434,7 +392,6 @@ class TileMultipart extends TileEntity with IChunkLoadTile {
*/
def clearParts() {
partList = Seq()
cachedLightValue = 0
}
/** Writes the description of this tile, and all parts composing it, to packet
@@ -523,7 +480,8 @@ trait TileMultipartClient extends TileMultipart {
def updateRenderCache() {
if (partList != null) {
val (dynamic, static) = partList.partition(_.doesTick)
val (dynamic, static) =
partList.partition(p => p.doesTick || p.shouldRenderDynamic)
val sArr = static.toArray
val dArr = dynamic.toArray