Port to 1.21 & Add NeoForge support

This commit is contained in:
Martin Prokoph
2024-06-17 14:55:41 +02:00
parent 6be616e91e
commit ecc50e77e2
102 changed files with 568 additions and 425 deletions

View File

@@ -1,76 +1,65 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'maven-publish'
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
archivesBaseName = project.archives_base_name
version = project.mod_version
group = project.maven_group
loom {
architectury {
minecraft = rootProject.minecraft_version
}
dependencies {
//to change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}
subprojects {
apply plugin: "dev.architectury.loom"
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
// The following line declares the yarn mappings you may select this one as well.
mappings loom.layered {
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
}
}
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
}
remapJar {
archiveVersion = "${project.version}-${project.minecraft_version}"
archiveBaseName = "${project.archivesBaseName}"
}
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 21
}
ext {
releaseChangelog = {
def changes = new StringBuilder()
changes << "## Better Beds v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/BetterBeds/commits/)"
def proc = "git log --max-count=1 --pretty=format:%s".execute()
proc.in.eachLine { line ->
def processedLine = line.toString()
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
changes << "\n- ${processedLine.capitalize()}"
}
}
proc.waitFor()
return changes.toString()
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
java {
withSourcesJar()
}
}

23
common/build.gradle Normal file
View File

@@ -0,0 +1,23 @@
architectury {
common(rootProject.enabled_platforms.split(","))
}
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
}
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -1,27 +1,27 @@
package eu.midnightdust.betterbeds.mixin;
import net.minecraft.block.*;
import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = BedBlock.class, priority = 2000)
public abstract class MixinBedBlock extends HorizontalFacingBlock {
protected MixinBedBlock(Settings settings) {
super(settings);
}
@Inject(at = @At("RETURN"), method = "getRenderType", cancellable = true)
private void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
cir.setReturnValue(BlockRenderType.MODEL);
}
@Override
@SuppressWarnings("deprecation")
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
return neighborState.getBlock() instanceof BedBlock;
}
}
package eu.midnightdust.betterbeds.mixin;
import net.minecraft.block.*;
import net.minecraft.util.math.Direction;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = BedBlock.class, priority = 2000)
public abstract class MixinBedBlock extends HorizontalFacingBlock {
protected MixinBedBlock(Settings settings) {
super(settings);
}
@Inject(at = @At("RETURN"), method = "getRenderType", cancellable = true)
private void getRenderType(BlockState state, CallbackInfoReturnable<BlockRenderType> cir) {
cir.setReturnValue(BlockRenderType.MODEL);
}
@Override
@SuppressWarnings("deprecation")
public boolean isSideInvisible(BlockState state, BlockState neighborState, Direction offset) {
return neighborState.getBlock() instanceof BedBlock;
}
}

View File

@@ -1,25 +1,25 @@
package eu.midnightdust.betterbeds.mixin;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Map;
@Mixin(BlockEntityRendererFactories.class)
public abstract class MixinBlockEntityRendererDispatcher {
@Shadow @Final private static Map<BlockEntityType<?>, BlockEntityRendererFactory<?>> FACTORIES;
@Inject(method = "register", at = @At("TAIL"))
private static <T extends BlockEntity> void bb$onRegister(BlockEntityType<? extends T> type, BlockEntityRendererFactory<T> factory, CallbackInfo ci) {
FACTORIES.remove(BlockEntityType.BED);
}
}
package eu.midnightdust.betterbeds.mixin;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Map;
@Mixin(BlockEntityRendererFactories.class)
public abstract class MixinBlockEntityRendererDispatcher {
@Shadow @Final private static Map<BlockEntityType<?>, BlockEntityRendererFactory<?>> FACTORIES;
@Inject(method = "register", at = @At("TAIL"))
private static <T extends BlockEntity> void bb$onRegister(BlockEntityType<? extends T> type, BlockEntityRendererFactory<T> factory, CallbackInfo ci) {
FACTORIES.remove(BlockEntityType.BED);
}
}

View File

@@ -0,0 +1 @@
{}

View File

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -1,6 +1,10 @@
{
"pack": {
"pack_format": 12,
"supported_formats": {
"min_inclusive": 12,
"max_inclusive": 100
},
"description": "§2Makes beds look fancier and allows them to connect <3"
}
}

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

100
fabric/build.gradle Normal file
View File

@@ -0,0 +1,100 @@
plugins {
id 'com.github.johnrengelman.shadow'
id "me.shedaniel.unified-publishing"
}
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
}
architectury {
platformSetupLoomIde()
fabric()
}
loom {
}
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
archivesBaseName = rootProject.archives_base_name + "-fabric"
}
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
shadowJar {
exclude "architectury.common.json"
configurations = [project.configurations.shadowCommon]
archiveClassifier = "dev-shadow"
}
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
}
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
unifiedPublishing {
project {
displayName = "Better Beds $project.version - Fabric $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["fabric","quilt"]
mainPublication remapJar
relations {
depends {
curseforge = "fabric-api"
modrinth = "fabric-api"
}
}
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
}
}

View File

@@ -0,0 +1,15 @@
package eu.midnightdust.fabric.betterbeds;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;
public class BetterBedsFabric implements ClientModInitializer {
public void onInitializeClient() {
FabricLoader.getInstance().getModContainer("betterbeds").ifPresent(modContainer -> {
ResourceManagerHelper.registerBuiltinResourcePack(Identifier.of("betterbeds:fancyconnectedbeds"), modContainer, ResourcePackActivationType.NORMAL);
});
}
}

View File

@@ -22,7 +22,7 @@
"entrypoints": {
"client": [
"eu.midnightdust.betterbeds.BetterBedsClient"
"eu.midnightdust.fabric.betterbeds.BetterBedsFabric"
]
},
@@ -32,7 +32,7 @@
"depends": {
"fabric-api": "*",
"minecraft": ">=1.19.3"
"minecraft": ">=1.21"
},
"custom": {
"modmenu": {

View File

@@ -1,17 +1,21 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx2G
org.gradle.jvmargs=-Xmx4096M
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.3
loader_version=0.14.11
minecraft_version=1.21
yarn_mappings=1.21+build.2
enabled_platforms=fabric,neoforge
# Mod Properties
mod_version = 1.3.0
maven_group = eu.midnightdust.motschen
archives_base_name = betterbeds
archives_base_name=betterbeds
mod_version=1.4.0
maven_group=eu.midnightdust
release_type=release
curseforge_id=443782
modrinth_id=kKwy3HU9
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.69.1+1.19.3
fabric_loader_version=0.15.11
fabric_api_version=0.100.1+1.21
neoforge_version=21.0.14-beta
yarn_mappings_patch_neoforge_version = 1.21+build.4
quilt_loader_version=0.19.0-beta.18
quilt_fabric_api_version=7.0.1+0.83.0-1.20

Binary file not shown.

View File

@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

31
gradlew vendored
View File

@@ -55,7 +55,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/.
@@ -83,10 +83,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# 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
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +131,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \

184
gradlew.bat vendored
View File

@@ -1,92 +1,92 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
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 %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
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 %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

104
neoforge/build.gradle Normal file
View File

@@ -0,0 +1,104 @@
plugins {
id 'com.github.johnrengelman.shadow'
id "me.shedaniel.unified-publishing"
}
repositories {
maven {
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases'
}
}
architectury {
platformSetupLoomIde()
neoForge()
}
loom {
accessWidenerPath = project(":common").loom.accessWidenerPath
}
configurations {
common {
canBeResolved = true
canBeConsumed = false
}
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentNeoForge.extendsFrom common
// Files in this configuration will be bundled into your mod using the Shadow plugin.
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
shadowBundle {
canBeResolved = true
canBeConsumed = false
}
}
dependencies {
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
}
processResources {
inputs.property 'version', project.version
filesMatching('META-INF/neoforge.mods.toml') {
expand version: project.version
}
}
shadowJar {
configurations = [project.configurations.shadowBundle]
archiveClassifier = 'dev-shadow'
}
remapJar {
input.set shadowJar.archiveFile
}
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
unifiedPublishing {
project {
displayName = "Better Beds $project.version - NeoForge $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["neoforge"]
mainPublication remapJar
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
}
}

View File

@@ -0,0 +1 @@
loom.platform=neoforge

View File

@@ -0,0 +1,38 @@
package eu.midnightdust.neoforge.betterbeds;
import net.minecraft.resource.*;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModList;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.event.AddPackFindersEvent;
import net.neoforged.neoforgespi.locating.IModFile;
import java.util.Optional;
import static eu.midnightdust.neoforge.betterbeds.BetterBedsNeoForge.MOD_ID;
@EventBusSubscriber(modid = MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class BetterBedsClientEvents {
@SubscribeEvent
public static void addPackFinders(AddPackFindersEvent event) {
if (event.getPackType() == ResourceType.CLIENT_RESOURCES) {
registerResourcePack(event, Identifier.of(MOD_ID,"fancyconnectedbeds"), false);
}
}
private static void registerResourcePack(AddPackFindersEvent event, Identifier id, boolean alwaysEnabled) {
event.addRepositorySource(((profileAdder) -> {
IModFile file = ModList.get().getModFileById(id.getNamespace()).getFile();
try {
ResourcePackProfile.PackFactory pack = new DirectoryResourcePack.DirectoryBackedFactory(file.findResource("resourcepacks/" + id.getPath()));
ResourcePackInfo info = new ResourcePackInfo(id.toString(), Text.of(id.getNamespace()+"/"+id.getPath()), ResourcePackSource.BUILTIN, Optional.empty());
ResourcePackProfile packProfile = ResourcePackProfile.create(info, pack, ResourceType.CLIENT_RESOURCES, new ResourcePackPosition(alwaysEnabled, ResourcePackProfile.InsertionPosition.TOP, false));
if (packProfile != null) {
profileAdder.accept(packProfile);
}
} catch (NullPointerException e) {e.fillInStackTrace();}
}));
}
}

View File

@@ -0,0 +1,10 @@
package eu.midnightdust.neoforge.betterbeds;
import net.neoforged.fml.common.Mod;
@Mod(BetterBedsNeoForge.MOD_ID)
public class BetterBedsNeoForge {
public static final String MOD_ID = "betterbeds";
public BetterBedsNeoForge() {}
}

View File

@@ -0,0 +1,31 @@
modLoader = "javafml"
loaderVersion = "[2,)"
#issueTrackerURL = ""
license = "MIT License"
[[mods]]
modId = "betterbeds"
version = "${version}"
displayName = "Better Beds"
logoFile = "betterbeds.png"
authors = "TeamMidnightDust, Motschen"
description = '''
Changes the renderer of the bed to use block models instead of a block entity renderer!
'''
[[mixins]]
config = "betterbeds.mixins.json"
[[dependencies.betterbeds]]
modId = "neoforge"
mandatory = true
versionRange = "[21.0,)"
ordering = "NONE"
side = "BOTH"
[[dependencies.betterbeds]]
modId = "minecraft"
mandatory = true
versionRange = "[1.21,)"
ordering = "NONE"
side = "BOTH"

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,10 +1,15 @@
pluginManagement {
repositories {
maven {
name "Fabric"
url "https://maven.fabricmc.net/"
}
mavenCentral()
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.neoforged.net/releases" }
gradlePluginPortal()
}
}
}
include("common")
include("fabric")
//include("quilt")
include("neoforge")
rootProject.name = "betterbeds"

View File

@@ -1,18 +0,0 @@
package eu.midnightdust.betterbeds;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.ResourcePackActivationType;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.util.Identifier;
public class BetterBedsClient implements ClientModInitializer {
public void onInitializeClient() {
FabricLoader.getInstance().getModContainer("betterbeds").ifPresent(modContainer -> {
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("betterbeds:fancybeds"), modContainer, ResourcePackActivationType.NORMAL);
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("betterbeds:connectedbeds"), modContainer, ResourcePackActivationType.NORMAL);
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("betterbeds:fancyconnectedbeds"), modContainer, ResourcePackActivationType.NORMAL);
});
}
}

View File

@@ -1,44 +0,0 @@
{
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"particle": "block/oak_planks"
},
"elements": [
{
"from": [0, 0, 0],
"to": [3, 3, 3],
"faces": {
"north": {"uv": [12.5, 5.25, 13.25, 6], "texture": "#bed", "cullface": "west"},
"east": {"uv": [14.75, 5.25, 15.5, 6], "texture": "#bed", "cullface": "west"},
"south": {"uv": [14, 5.25, 14.75, 6], "texture": "#bed", "cullface": "west"},
"west": {"uv": [13.25, 5.25, 14, 6], "texture": "#bed", "cullface": "west"},
"down": {"uv": [14, 4.5, 14.75, 5.25], "texture": "#bed", "cullface": "west"}
}
},
{
"from": [13, 0, 0],
"to": [16, 3, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [21, 8, 8]},
"faces": {
"north": {"uv": [14, 3.75, 13.25, 4.5], "texture": "#bed", "cullface": "east"},
"east": {"uv": [12.5, 3.75, 13.25, 4.5], "texture": "#bed", "cullface": "east"},
"south": {"uv": [14.75, 3.75, 15.5, 4.5], "texture": "#bed", "cullface": "east"},
"west": {"uv": [14, 3.75, 14.75, 4.5], "texture": "#bed", "cullface": "east"},
"down": {"uv": [14, 3, 14.75, 3.75], "texture": "#bed", "cullface": "east"}
}
},
{
"from": [0, 3, 0],
"to": [16, 9, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 11, 8]},
"faces": {
"north": {"uv": [5.5, 5.5, 9.5, 7], "rotation": 180, "texture": "#bed", "cullface": "north"},
"east": {"uv": [0, 7, 1.5, 11], "rotation": 270, "texture": "#bed", "cullface": "east"},
"west": {"uv": [5.5, 7, 7, 11], "rotation": 90, "texture": "#bed", "cullface": "west"},
"up": {"uv": [1.5, 7, 5.5, 11], "rotation": 180, "texture": "#bed"},
"down": {"uv": [7, 7, 11, 11], "texture": "#bed"}
}
}
]
}

View File

@@ -1,45 +0,0 @@
{
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"particle": "block/oak_planks"
},
"elements": [
{
"from": [0, 0, 13],
"to": [3, 3, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 21]},
"faces": {
"north": {"uv": [14.75, 0.75, 15.5, 1.5], "texture": "#bed", "cullface": "west"},
"east": {"uv": [14, 0.75, 14.75, 1.5], "texture": "#bed", "cullface": "west"},
"south": {"uv": [13.25, 0.75, 14, 1.5], "texture": "#bed", "cullface": "west"},
"west": {"uv": [12.5, 0.75, 13.25, 1.5], "texture": "#bed", "cullface": "west"},
"down": {"uv": [14, 0, 14.75, 0.75], "texture": "#bed", "cullface": "west"}
}
},
{
"from": [13, 0, 13],
"to": [16, 3, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [21, 8, 21]},
"faces": {
"north": {"uv": [14, 2.25, 14.75, 3], "texture": "#bed", "cullface": "east"},
"east": {"uv": [13.25, 2.25, 14, 3], "texture": "#bed", "cullface": "east"},
"south": {"uv": [12.5, 2.25, 13.25, 3], "texture": "#bed", "cullface": "east"},
"west": {"uv": [14.75, 2.25, 15.5, 3], "texture": "#bed", "cullface": "east"},
"down": {"uv": [14, 1.5, 14.75, 2.25], "texture": "#bed", "cullface": "east"}
}
},
{
"from": [0, 3, 0],
"to": [16, 9, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 11, 8]},
"faces": {
"east": {"uv": [0, 1.5, 1.5, 5.5], "rotation": 270, "texture": "#bed", "cullface": "east"},
"south": {"uv": [1.5, 0, 5.5, 1.5], "rotation": 180, "texture": "#bed", "cullface": "south"},
"west": {"uv": [5.5, 1.5, 7, 5.5], "rotation": 90, "texture": "#bed", "cullface": "west"},
"up": {"uv": [1.5, 1.5, 5.5, 5.5], "rotation": 180, "texture": "#bed"},
"down": {"uv": [7, 1.5, 11, 5.5], "texture": "#bed"}
}
}
]
}

View File

@@ -1,6 +0,0 @@
{
"pack": {
"pack_format": 12,
"description": "§2Allows beds to connect <3"
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -1,69 +0,0 @@
{
"credit": "Made with Blockbench",
"texture_size": [64, 64],
"textures": {
"particle": "block/oak_planks"
},
"elements": [
{
"from": [0, 0, 13],
"to": [3, 3, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 8, 21]},
"faces": {
"north": {"uv": [14.75, 0.75, 15.5, 1.5], "texture": "#bed"},
"east": {"uv": [14, 0.75, 14.75, 1.5], "texture": "#bed"},
"south": {"uv": [13.25, 0.75, 14, 1.5], "texture": "#bed", "cullface": "south"},
"west": {"uv": [12.5, 0.75, 13.25, 1.5], "texture": "#bed", "cullface": "west"},
"down": {"uv": [14, 0, 14.75, 0.75], "texture": "#bed", "cullface": "down"}
}
},
{
"from": [13, 0, 13],
"to": [16, 3, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [21, 8, 21]},
"faces": {
"north": {"uv": [14, 2.25, 14.75, 3], "texture": "#bed"},
"east": {"uv": [13.25, 2.25, 14, 3], "texture": "#bed", "cullface": "east"},
"south": {"uv": [12.5, 2.25, 13.25, 3], "texture": "#bed", "cullface": "south"},
"west": {"uv": [14.75, 2.25, 15.5, 3], "texture": "#bed"},
"down": {"uv": [14, 1.5, 14.75, 2.25], "texture": "#bed", "cullface": "down"}
}
},
{
"from": [0, 3, 0],
"to": [16, 9, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 11, 8]},
"faces": {
"east": {"uv": [0, 1.5, 1.5, 5.5], "rotation": 270, "texture": "#bed", "cullface": "east"},
"south": {"uv": [1.5, 0, 5.5, 1.5], "rotation": 180, "texture": "#bed", "cullface": "south"},
"west": {"uv": [5.5, 1.5, 7, 5.5], "rotation": 90, "texture": "#bed", "cullface": "west"},
"up": {"uv": [1.5, 1.5, 5.5, 5.5], "rotation": 180, "texture": "#bed"},
"down": {"uv": [7, 7, 11, 11], "texture": "#bed"}
}
},
{
"from": [0, 9, 8],
"to": [16, 10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 17, 16]},
"faces": {
"north": {"uv": [1.5, 3.25, 5.5, 3.5], "texture": "#bed"},
"east": {"uv": [1.5, 1.5, 1.75, 3.5], "rotation": 270, "texture": "#bed", "cullface": "east"},
"south": {"uv": [1.5, 1.5, 5.5, 1.75], "texture": "#bed", "cullface": "south"},
"west": {"uv": [5.25, 1.5, 5.5, 3.5], "rotation": 90, "texture": "#bed", "cullface": "west"},
"up": {"uv": [1.5, 1.5, 5.5, 3.5], "rotation": 180, "texture": "#bed"}
}
},
{
"from": [1, 10, 9],
"to": [15, 11, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 18, 16]},
"faces": {
"north": {"uv": [1.75, 3.25, 5.25, 3.5], "texture": "#bed"},
"east": {"uv": [1.75, 1.75, 2, 3.25], "rotation": 90, "texture": "#bed"},
"south": {"uv": [1.75, 0.5, 5.25, 0.75], "texture": "#bed"},
"west": {"uv": [5, 1.75, 5.25, 3.25], "rotation": 90, "texture": "#bed"},
"up": {"uv": [1.75, 1.75, 5.25, 3.25], "rotation": 180, "texture": "#bed"}
}
}
]
}

Some files were not shown because too many files have changed in this diff Show More