Skip to content

Commit

Permalink
Remove datagen cache files, track existing mods, bump Gradle and MDG
Browse files Browse the repository at this point in the history
  • Loading branch information
62832 committed Jul 22, 2024
1 parent 04b8fce commit 0062be8
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 86 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ build
eclipse
run
.directory
src/generated/resources/.cache
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ neoForge {
"--mod", modId,
"--all",
"--output", file("src/generated/resources/").absolutePath,
"--existing", file("src/main/resources/").absolutePath
"--existing", file("src/main/resources/").absolutePath,
"--existing-mod", "ae2",
"--existing-mod", "merequester"
)
sourceSet = sourceSets.getByName("data")
}
Expand All @@ -68,9 +70,7 @@ neoForge {

tasks {
jar {
from(rootProject.file("LICENSE")) {
rename { "${it}_$modId" }
}
from(rootProject.file("LICENSE"))
}

withType<JavaCompile> {
Expand Down
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.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
7 changes: 5 additions & 2 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -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/.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 ##########################################################################
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pluginManagement {
plugins {
id("net.neoforged.moddev") version "0.1.112"
id("net.neoforged.moddev.repositories") version "0.1.112"
id("net.neoforged.moddev") version "1.0.14"
id("net.neoforged.moddev.repositories") version "1.0.14"
id("com.diffplug.spotless") version "6.25.0"
}
}
Expand Down
25 changes: 6 additions & 19 deletions src/data/java/gripe/_90/fulleng/datagen/FullModelProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.minecraft.data.models.blockstates.Variant;
import net.minecraft.data.models.blockstates.VariantProperties;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.client.model.generators.ModelProvider;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.registries.DeferredBlock;

Expand Down Expand Up @@ -37,18 +36,13 @@ protected void registerStatesAndModels() {
terminal(FullblockEnergistics.REQUESTER_TERMINAL, "merequester:part/requester_terminal");
}

private void terminal(DeferredBlock<?> terminal, String texturePrefix) {
var existing = models().existingFileHelper;
existing.trackGenerated(ResourceLocation.parse(texturePrefix + "_bright"), ModelProvider.TEXTURE);
existing.trackGenerated(ResourceLocation.parse(texturePrefix + "_medium"), ModelProvider.TEXTURE);
existing.trackGenerated(ResourceLocation.parse(texturePrefix + "_dark"), ModelProvider.TEXTURE);

private void terminal(DeferredBlock<?> terminal, String lightsTexture) {
var onModel = terminal != FullblockEnergistics.TERMINAL
? models().withExistingParent(
"block/" + terminal.getId().getPath(), FullblockEnergistics.MODID + ":block/terminal")
.texture("lightsBright", texturePrefix + "_bright")
.texture("lightsMedium", texturePrefix + "_medium")
.texture("lightsDark", texturePrefix + "_dark")
.texture("lightsBright", lightsTexture + "_bright")
.texture("lightsMedium", lightsTexture + "_medium")
.texture("lightsDark", lightsTexture + "_dark")
.renderType("cutout")
: models().getExistingFile(
ResourceLocation.fromNamespaceAndPath(FullblockEnergistics.MODID, "block/terminal"));
Expand All @@ -57,22 +51,15 @@ private void terminal(DeferredBlock<?> terminal, String texturePrefix) {
.with(createFacingSpinDispatch())
.with(PropertyDispatch.property(FullBlock.POWERED).generate(powered -> Variant.variant()
.with(VariantProperties.MODEL, powered ? onModel.getLocation() : TERMINAL_OFF)));
registeredBlocks.put(terminal.get(), () -> builder.get().getAsJsonObject());
registeredBlocks.put(terminal.get(), builder.get()::getAsJsonObject);
simpleBlockItem(terminal.get(), onModel);
}

private void monitor(DeferredBlock<?> monitor, String texturePrefix) {
var existing = models().existingFileHelper;
existing.trackGenerated(ResourceLocation.parse(texturePrefix + "_bright"), ModelProvider.TEXTURE);
existing.trackGenerated(ResourceLocation.parse(texturePrefix + "_medium"), ModelProvider.TEXTURE);
existing.trackGenerated(ResourceLocation.parse(texturePrefix + "_dark"), ModelProvider.TEXTURE);
existing.trackGenerated(ResourceLocation.parse(texturePrefix + "_dark_locked"), ModelProvider.TEXTURE);

var unlockedModel = models().withExistingParent(
"block/" + monitor.getId().getPath(), FullblockEnergistics.MODID + ":block/terminal")
.texture("lightsBright", texturePrefix + "_bright")
.texture("lightsMedium", texturePrefix + "_medium")
.texture("lightsDark", texturePrefix + "_dark")
.renderType("cutout");
var lockedModel = models().withExistingParent(
"block/" + monitor.getId().getPath(), FullblockEnergistics.MODID + ":block/terminal")
Expand All @@ -90,7 +77,7 @@ private void monitor(DeferredBlock<?> monitor, String texturePrefix) {
!powered
? TERMINAL_OFF
: locked ? lockedModel.getLocation() : unlockedModel.getLocation())));
registeredBlocks.put(monitor.get(), () -> builder.get().getAsJsonObject());
registeredBlocks.put(monitor.get(), builder.get()::getAsJsonObject);
simpleBlockItem(monitor.get(), unlockedModel);
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 0062be8

Please sign in to comment.