я в ахуе

This commit is contained in:
YuRaNnNzZZ 2024-09-07 09:20:40 +03:00
parent 6ecf0dceb0
commit 2598a7fd97
Signed by: YuRaNnNzZZ
GPG Key ID: 5F71738C85A6006D
23 changed files with 193 additions and 218 deletions

4
.gitignore vendored
View File

@ -20,6 +20,7 @@ build
# other # other
eclipse eclipse
run run
runs
run-data run-data
design/ design/
@ -27,6 +28,3 @@ libs/
logs/ logs/
/src/generated/resources /src/generated/resources
# Files from Forge MDK
forge*changelog.txt

View File

@ -1,10 +1,15 @@
plugins { plugins {
id 'java-library'
id 'eclipse' id 'eclipse'
id 'idea' id 'idea'
id 'maven-publish' id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'net.neoforged.gradle.userdev' version '7.0.145'
id 'org.jetbrains.kotlin.jvm' version '1.9.20' id 'org.jetbrains.kotlin.jvm' version '1.9.22'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.20' id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.22'
}
tasks.named('wrapper', Wrapper).configure {
distributionType = Wrapper.DistributionType.BIN
} }
version = "${minecraft_version}-${mod_version}" version = "${minecraft_version}-${mod_version}"
@ -14,119 +19,88 @@ base {
archivesName = mod_id archivesName = mod_id
} }
java.toolchain.languageVersion = JavaLanguageVersion.of(17) java.toolchain.languageVersion = JavaLanguageVersion.of(21)
minecraft { runs {
mappings channel: 'official', version: minecraft_version configureEach {
systemProperty 'forge.logging.markers', 'REGISTRIES'
systemProperty 'forge.logging.console.level', 'debug'
copyIdeResources = true modSource project.sourceSets.main
}
runs { client {
configureEach { systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
workingDirectory project.file('run') }
property 'forge.logging.markers', 'REGISTRIES' server {
property 'forge.logging.console.level', 'debug' systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
programArgument '--nogui'
}
property 'mixin.env.remapRefMap', 'true' gameTestServer {
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
}
mods { data {
"${mod_id}" { programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
source sourceSets.main
}
}
}
client {
property 'forge.enabledGameTestNamespaces', mod_id
}
server {
property 'forge.enabledGameTestNamespaces', mod_id
args '--nogui'
}
data {
workingDirectory project.file('run-data')
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
}
} }
} }
sourceSets.main.resources { srcDir 'src/generated/resources' } sourceSets.main.resources { srcDir 'src/generated/resources' }
configurations {
runtimeClasspath.extendsFrom localRuntime
}
repositories { repositories {
mavenLocal()
maven { maven {
name = 'Kotlin for Forge' name = 'Kotlin for Forge'
url = 'https://thedarkcolour.github.io/KotlinForForge/' url = 'https://thedarkcolour.github.io/KotlinForForge/'
} }
maven {
name = 'Jared\'s maven'
url = 'https://maven.blamejared.com/'
content {
includeGroup 'mezz.jei'
}
}
maven { maven {
name = 'Modmaven' name = 'Modmaven'
url = 'https://modmaven.dev/' url = 'https://modmaven.dev/'
content { content {
includeGroup 'appeng' includeGroup 'appeng'
includeGroup 'mezz.jei'
} }
} }
} }
dependencies { dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation "net.neoforged:neoforge:${neo_version}"
implementation "thedarkcolour:kotlinforforge:${kff_version}" implementation "thedarkcolour:kotlinforforge-neoforge:${kff_version}"
implementation fg.deobf("appeng:appliedenergistics2-forge:${ae2_version}") implementation "appeng:appliedenergistics2-neoforge:${ae2_version}"
runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
} }
tasks.named('processResources', ProcessResources).configure { tasks.withType(ProcessResources).configureEach {
var replaceProperties = [ var replaceProperties = [
loader_name: loader_name, loader_version_range: loader_version_range, loader_name: loader_name, loader_version_range: loader_version_range,
mod_id: mod_id, mod_version: mod_version, mod_id: mod_id, mod_version: mod_version,
forge_version_range: forge_version_range, neo_version: neo_version, neo_version_range: neo_version_range,
minecraft_version_range: minecraft_version_range, minecraft_version_range: minecraft_version_range,
ae2_version_range: ae2_version_range, ae2_version_range: ae2_version_range,
] ]
inputs.properties replaceProperties inputs.properties replaceProperties
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { filesMatching(['META-INF/neoforge.mods.toml']) {
expand replaceProperties + [project: project] expand replaceProperties
} }
} }
tasks.named('jar', Jar).configure {
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : "YuRaNnNzZZ",
'Specification-Version' : '1',
'Implementation-Title' : project.name,
'Implementation-Version' : project.jar.archiveVersion,
'Implementation-Vendor' : "YuRaNnNzZZ",
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
finalizedBy 'reobfJar'
}
publishing { publishing {
publications { publications {
register('mavenJava', MavenPublication) { register('mavenJava', MavenPublication) {
artifact jar from components.java
} }
} }
repositories { repositories {
maven { maven {
url "file://${project.projectDir}/mcmodsrepo" url "file://${project.projectDir}/repo"
} }
} }
} }
@ -134,3 +108,10 @@ publishing {
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' options.encoding = 'UTF-8'
} }
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}

View File

@ -4,18 +4,18 @@ org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false org.gradle.daemon=false
mod_id=ae2quartz mod_id=ae2quartz
mod_version=1.0.0 mod_version=1.1.0
minecraft_version=1.20.1 minecraft_version=1.21
minecraft_version_range=[1.20.1,1.21) minecraft_version_range=[1.21,1.22)
forge_version=47.2.0 neo_version=21.0.167
forge_version_range=[47,) neo_version_range=[21.0.0-beta,)
loader_name=kotlinforforge loader_name=kotlinforforge
loader_version_range=[4.10,) loader_version_range=[5.5,)
kff_version=4.10.0 kff_version=5.5.0
ae2_version=15.0.20 ae2_version=19.0.4-alpha
ae2_version_range=[15,) ae2_version_range=[19,)
jei_version=15.2.0.27 jei_version=19.8.2.99

Binary file not shown.

View File

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

34
gradlew vendored
View File

@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -83,10 +85,9 @@ done
# This is normally unused # This is normally unused
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. ' "$PWD" ) || exit
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -133,10 +134,13 @@ location of your Java installation."
fi fi
else else
JAVACMD=java 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 Please set the JAVA_HOME variable in your environment to match the
location of your Java installation." location of your Java installation."
fi
fi fi
# Increase the maximum file descriptors if we can. # Increase the maximum file descriptors if we can.
@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. # 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 ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. # 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" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -197,11 +201,15 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
# shell script including quotes and variable substitutions, so put them in DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded. # 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 -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \

22
gradlew.bat vendored
View File

@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail
@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute if exist "%JAVA_EXE%" goto execute
echo. echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. echo location of your Java installation. 1>&2
goto fail goto fail

View File

@ -1,13 +1,11 @@
pluginManagement { pluginManagement {
repositories { repositories {
mavenLocal()
gradlePluginPortal() gradlePluginPortal()
maven { maven { url = 'https://maven.neoforged.net/releases' }
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
} }
} }
plugins { plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
} }

View File

@ -1,16 +1,19 @@
package ru.yurannnzzz.ae2quartz package ru.yurannnzzz.ae2quartz
import net.minecraftforge.fml.common.Mod import net.minecraft.resources.ResourceLocation
import net.neoforged.fml.common.Mod
import ru.yurannnzzz.ae2quartz.data.onDataGather import ru.yurannnzzz.ae2quartz.data.onDataGather
import ru.yurannnzzz.ae2quartz.event.addCreativeTabItems import ru.yurannnzzz.ae2quartz.event.addCreativeTabItems
import ru.yurannnzzz.ae2quartz.registry.ModBlocks import ru.yurannnzzz.ae2quartz.registry.ModBlocks
import ru.yurannnzzz.ae2quartz.registry.ModItems import ru.yurannnzzz.ae2quartz.registry.ModItems
import thedarkcolour.kotlinforforge.forge.MOD_BUS import thedarkcolour.kotlinforforge.neoforge.forge.MOD_BUS
@Mod(AE2QuartzMod.MOD_ID) @Mod(AE2QuartzMod.MOD_ID)
object AE2QuartzMod { object AE2QuartzMod {
const val MOD_ID = "ae2quartz" const val MOD_ID = "ae2quartz"
fun loc(id: String): ResourceLocation = ResourceLocation.fromNamespaceAndPath(MOD_ID, id)
init { init {
ModBlocks.registry.register(MOD_BUS) ModBlocks.registry.register(MOD_BUS)
ModItems.registry.register(MOD_BUS) ModItems.registry.register(MOD_BUS)

View File

@ -4,12 +4,11 @@ import net.minecraft.core.RegistrySetBuilder
import net.minecraft.core.registries.Registries import net.minecraft.core.registries.Registries
import net.minecraft.data.loot.LootTableProvider import net.minecraft.data.loot.LootTableProvider
import net.minecraft.data.loot.LootTableProvider.SubProviderEntry import net.minecraft.data.loot.LootTableProvider.SubProviderEntry
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import net.minecraftforge.common.data.BlockTagsProvider import net.neoforged.neoforge.common.data.BlockTagsProvider
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider
import net.minecraftforge.data.event.GatherDataEvent import net.neoforged.neoforge.data.event.GatherDataEvent
import net.minecraftforge.registries.ForgeRegistries import net.neoforged.neoforge.registries.NeoForgeRegistries
import ru.yurannnzzz.ae2quartz.AE2QuartzMod.MOD_ID import ru.yurannnzzz.ae2quartz.AE2QuartzMod.MOD_ID
import ru.yurannnzzz.ae2quartz.data.client.English import ru.yurannnzzz.ae2quartz.data.client.English
import ru.yurannnzzz.ae2quartz.data.client.ModBlockStateProvider import ru.yurannnzzz.ae2quartz.data.client.ModBlockStateProvider
@ -25,39 +24,38 @@ import ru.yurannnzzz.ae2quartz.data.server.registerPlacedFeatures
fun onDataGather(event: GatherDataEvent) { fun onDataGather(event: GatherDataEvent) {
val gen = event.generator val gen = event.generator
val efh = event.existingFileHelper
val out = gen.packOutput
gen.addProvider(event.includeClient(), ModBlockStateProvider(out, MOD_ID, efh)) gen.addProvider(event.includeClient(), ModBlockStateProvider(gen.packOutput, MOD_ID, event.existingFileHelper))
gen.addProvider(event.includeClient(), ModItemModelProvider(out, MOD_ID, efh)) gen.addProvider(event.includeClient(), ModItemModelProvider(gen.packOutput, MOD_ID, event.existingFileHelper))
gen.addProvider(event.includeClient(), English(out, MOD_ID)) gen.addProvider(event.includeClient(), English(gen.packOutput, MOD_ID))
gen.addProvider(event.includeClient(), Russian(out, MOD_ID)) gen.addProvider(event.includeClient(), Russian(gen.packOutput, MOD_ID))
gen.addProvider( gen.addProvider(
event.includeServer(), event.includeServer(),
ModRecipeProvider(out) ModRecipeProvider(gen.packOutput, event.lookupProvider)
) )
val blockTagsProvider: BlockTagsProvider = gen.addProvider( val blockTagsProvider: BlockTagsProvider = gen.addProvider(
event.includeServer(), event.includeServer(),
ModBlockTagsProvider(out, event.lookupProvider, MOD_ID, efh) ModBlockTagsProvider(gen.packOutput, event.lookupProvider, MOD_ID, event.existingFileHelper)
) )
gen.addProvider( gen.addProvider(
event.includeServer(), event.includeServer(),
ModItemTagsProvider(out, event.lookupProvider, blockTagsProvider.contentsGetter(), MOD_ID, efh) ModItemTagsProvider(gen.packOutput, event.lookupProvider, blockTagsProvider.contentsGetter(), MOD_ID, event.existingFileHelper)
) )
gen.addProvider( gen.addProvider(
event.includeServer(), event.includeServer(),
LootTableProvider( LootTableProvider(
out, gen.packOutput,
emptySet<ResourceLocation>(), mutableSetOf(),
listOf(SubProviderEntry({ ModBlockLootProvider() }, LootContextParamSets.BLOCK)) listOf(SubProviderEntry({ ModBlockLootProvider(event.lookupProvider) }, LootContextParamSets.BLOCK)),
event.lookupProvider
) )
) )
val registrySetBuilder = RegistrySetBuilder() val registrySetBuilder = RegistrySetBuilder()
.add(Registries.CONFIGURED_FEATURE, ::registerConfiguredFeatures) .add(Registries.CONFIGURED_FEATURE, ::registerConfiguredFeatures)
.add(Registries.PLACED_FEATURE, ::registerPlacedFeatures) .add(Registries.PLACED_FEATURE, ::registerPlacedFeatures)
.add(ForgeRegistries.Keys.BIOME_MODIFIERS, ::registerBiomeModifiers) .add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ::registerBiomeModifiers)
event.generator.addProvider( event.generator.addProvider(
event.includeServer(), event.includeServer(),
DatapackBuiltinEntriesProvider( DatapackBuiltinEntriesProvider(

View File

@ -1,9 +1,9 @@
package ru.yurannnzzz.ae2quartz.data.client package ru.yurannnzzz.ae2quartz.data.client
import net.minecraft.data.PackOutput import net.minecraft.data.PackOutput
import net.minecraftforge.client.model.generators.BlockStateProvider import net.neoforged.neoforge.client.model.generators.BlockStateProvider
import net.minecraftforge.client.model.generators.ConfiguredModel import net.neoforged.neoforge.client.model.generators.ConfiguredModel
import net.minecraftforge.common.data.ExistingFileHelper import net.neoforged.neoforge.common.data.ExistingFileHelper
import ru.yurannnzzz.ae2quartz.registry.ModBlocks import ru.yurannnzzz.ae2quartz.registry.ModBlocks
class ModBlockStateProvider(output: PackOutput?, modid: String?, exFileHelper: ExistingFileHelper?) : class ModBlockStateProvider(output: PackOutput?, modid: String?, exFileHelper: ExistingFileHelper?) :

View File

@ -2,18 +2,18 @@ package ru.yurannnzzz.ae2quartz.data.client
import net.minecraft.data.PackOutput import net.minecraft.data.PackOutput
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraftforge.client.model.generators.ItemModelProvider import net.neoforged.neoforge.client.model.generators.ItemModelProvider
import net.minecraftforge.client.model.generators.ModelFile.UncheckedModelFile import net.neoforged.neoforge.client.model.generators.ModelFile
import net.minecraftforge.common.data.ExistingFileHelper import net.neoforged.neoforge.common.data.ExistingFileHelper
class ModItemModelProvider(output: PackOutput?, modid: String?, existingFileHelper: ExistingFileHelper?) : class ModItemModelProvider(output: PackOutput?, modid: String?, existingFileHelper: ExistingFileHelper?) :
ItemModelProvider(output, modid, existingFileHelper) { ItemModelProvider(output, modid, existingFileHelper) {
override fun registerModels() { override fun registerModels() {
val netherQuartzDustTexture = ResourceLocation("ae2", "item/nether_quartz_dust") val netherQuartzDustTexture = ResourceLocation.fromNamespaceAndPath("ae2", "item/nether_quartz_dust")
existingFileHelper.trackGenerated(netherQuartzDustTexture, TEXTURE) existingFileHelper.trackGenerated(netherQuartzDustTexture, TEXTURE)
getBuilder(modLoc("item/nether_quartz_dust").toString()) getBuilder(modLoc("item/nether_quartz_dust").toString())
.parent(UncheckedModelFile("item/generated")) .parent(ModelFile.UncheckedModelFile("item/generated"))
.texture("layer0", netherQuartzDustTexture) .texture("layer0", netherQuartzDustTexture)
withExistingParent( withExistingParent(

View File

@ -1,7 +1,7 @@
package ru.yurannnzzz.ae2quartz.data.client package ru.yurannnzzz.ae2quartz.data.client
import net.minecraft.data.PackOutput import net.minecraft.data.PackOutput
import net.minecraftforge.common.data.LanguageProvider import net.neoforged.neoforge.common.data.LanguageProvider
import ru.yurannnzzz.ae2quartz.registry.ModBlocks import ru.yurannnzzz.ae2quartz.registry.ModBlocks
import ru.yurannnzzz.ae2quartz.registry.ModItems import ru.yurannnzzz.ae2quartz.registry.ModItems

View File

@ -1,6 +1,8 @@
package ru.yurannnzzz.ae2quartz.data.server package ru.yurannnzzz.ae2quartz.data.server
import appeng.core.definitions.AEItems import appeng.core.definitions.AEItems
import net.minecraft.core.HolderLookup
import net.minecraft.core.registries.Registries
import net.minecraft.data.loot.BlockLootSubProvider import net.minecraft.data.loot.BlockLootSubProvider
import net.minecraft.world.flag.FeatureFlags import net.minecraft.world.flag.FeatureFlags
import net.minecraft.world.item.enchantment.Enchantments import net.minecraft.world.item.enchantment.Enchantments
@ -10,24 +12,21 @@ import net.minecraft.world.level.storage.loot.entries.LootItem
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator
import net.minecraftforge.registries.RegistryObject
import ru.yurannnzzz.ae2quartz.registry.ModBlocks import ru.yurannnzzz.ae2quartz.registry.ModBlocks
import java.util.concurrent.CompletableFuture
class ModBlockLootProvider : BlockLootSubProvider(emptySet(), FeatureFlags.REGISTRY.allFlags()) { class ModBlockLootProvider(provider: CompletableFuture<HolderLookup.Provider>)
: BlockLootSubProvider(emptySet(), FeatureFlags.REGISTRY.allFlags(), provider.get()) {
override fun generate() { override fun generate() {
add(ModBlocks.QUARTZ_ORE.get(), this::createCertusQuartsOreDrops) add(ModBlocks.QUARTZ_ORE.get(), this::createCertusQuartsOreDrops)
add(ModBlocks.DEEPSLATE_QUARTZ_ORE.get(), this::createCertusQuartsOreDrops) add(ModBlocks.DEEPSLATE_QUARTZ_ORE.get(), this::createCertusQuartsOreDrops)
} }
override fun getKnownBlocks(): Iterable<Block> { override fun getKnownBlocks(): Iterable<Block> {
return Iterable { return ModBlocks.registry.entries.stream().map { it.get() }.toList()
ModBlocks.registry.entries
.stream()
.flatMap { obj: RegistryObject<Block> -> obj.stream() }
.iterator()
}
} }
private val enchantments = registries.lookupOrThrow(Registries.ENCHANTMENT)
private fun createCertusQuartsOreDrops(block: Block): LootTable.Builder { private fun createCertusQuartsOreDrops(block: Block): LootTable.Builder {
return createSilkTouchDispatchTable( return createSilkTouchDispatchTable(
block, block,
@ -35,7 +34,7 @@ class ModBlockLootProvider : BlockLootSubProvider(emptySet(), FeatureFlags.REGIS
block, block,
LootItem.lootTableItem(AEItems.CERTUS_QUARTZ_CRYSTAL) LootItem.lootTableItem(AEItems.CERTUS_QUARTZ_CRYSTAL)
.apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0f, 3.0f))) .apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0f, 3.0f)))
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE)) .apply(ApplyBonusCount.addOreBonusCount(enchantments.getOrThrow(Enchantments.FORTUNE)))
) )
) )
} }

View File

@ -3,9 +3,9 @@ package ru.yurannnzzz.ae2quartz.data.server
import net.minecraft.core.HolderLookup import net.minecraft.core.HolderLookup
import net.minecraft.data.PackOutput import net.minecraft.data.PackOutput
import net.minecraft.tags.BlockTags import net.minecraft.tags.BlockTags
import net.minecraftforge.common.Tags import net.neoforged.neoforge.common.Tags
import net.minecraftforge.common.data.BlockTagsProvider import net.neoforged.neoforge.common.data.BlockTagsProvider
import net.minecraftforge.common.data.ExistingFileHelper import net.neoforged.neoforge.common.data.ExistingFileHelper
import ru.yurannnzzz.ae2quartz.registry.ModBlocks import ru.yurannnzzz.ae2quartz.registry.ModBlocks
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture

View File

@ -5,8 +5,8 @@ import net.minecraft.core.HolderLookup
import net.minecraft.data.PackOutput import net.minecraft.data.PackOutput
import net.minecraft.data.tags.ItemTagsProvider import net.minecraft.data.tags.ItemTagsProvider
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraftforge.common.Tags import net.neoforged.neoforge.common.Tags
import net.minecraftforge.common.data.ExistingFileHelper import net.neoforged.neoforge.common.data.ExistingFileHelper
import ru.yurannnzzz.ae2quartz.registry.ModItems import ru.yurannnzzz.ae2quartz.registry.ModItems
import java.util.concurrent.CompletableFuture import java.util.concurrent.CompletableFuture

View File

@ -4,35 +4,31 @@ import appeng.core.definitions.AEItems
import appeng.datagen.providers.tags.ConventionTags import appeng.datagen.providers.tags.ConventionTags
import appeng.recipes.handlers.InscriberProcessType import appeng.recipes.handlers.InscriberProcessType
import appeng.recipes.handlers.InscriberRecipeBuilder import appeng.recipes.handlers.InscriberRecipeBuilder
import net.minecraft.core.HolderLookup
import net.minecraft.data.PackOutput import net.minecraft.data.PackOutput
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.RecipeProvider import net.minecraft.data.recipes.RecipeProvider
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import ru.yurannnzzz.ae2quartz.AE2QuartzMod import ru.yurannnzzz.ae2quartz.AE2QuartzMod.loc
import ru.yurannnzzz.ae2quartz.registry.ModItems import ru.yurannnzzz.ae2quartz.registry.ModItems
import java.util.function.Consumer import java.util.concurrent.CompletableFuture
class ModRecipeProvider(output: PackOutput?) : RecipeProvider(output) { class ModRecipeProvider(output: PackOutput, provider: CompletableFuture<HolderLookup.Provider>) : RecipeProvider(output, provider) {
override fun buildRecipes(consumer: Consumer<FinishedRecipe>) { override fun buildRecipes(recipeOutput: RecipeOutput) {
InscriberRecipeBuilder InscriberRecipeBuilder
.inscribe(ConventionTags.ALL_NETHER_QUARTZ, ModItems.NETHER_QUARTZ_DUST.get(), 1) .inscribe(ConventionTags.ALL_NETHER_QUARTZ, ModItems.NETHER_QUARTZ_DUST.get(), 1)
.setMode(InscriberProcessType.INSCRIBE) .setMode(InscriberProcessType.INSCRIBE)
.save(consumer, modLoc("inscriber/nether_quartz_dust")) .save(recipeOutput, loc("inscriber/nether_quartz_dust"))
SimpleCookingRecipeBuilder SimpleCookingRecipeBuilder
.smelting(Ingredient.of(ModTags.NETHER_QUARTZ_DUST), RecipeCategory.MISC, AEItems.SILICON, .35f, 200) .smelting(Ingredient.of(ModTags.NETHER_QUARTZ_DUST), RecipeCategory.MISC, AEItems.SILICON, .35f, 200)
.unlockedBy("has_nether_quartz_dust", has(ModTags.NETHER_QUARTZ_DUST)) .unlockedBy("has_nether_quartz_dust", has(ModTags.NETHER_QUARTZ_DUST))
.save(consumer, modLoc("smelting/silicon_from_nether_quartz_dust")) .save(recipeOutput, loc("smelting/silicon_from_nether_quartz_dust"))
SimpleCookingRecipeBuilder SimpleCookingRecipeBuilder
.blasting(Ingredient.of(ModTags.NETHER_QUARTZ_DUST), RecipeCategory.MISC, AEItems.SILICON, .35f, 100) .blasting(Ingredient.of(ModTags.NETHER_QUARTZ_DUST), RecipeCategory.MISC, AEItems.SILICON, .35f, 100)
.unlockedBy("has_nether_quartz_dust", has(ModTags.NETHER_QUARTZ_DUST)) .unlockedBy("has_nether_quartz_dust", has(ModTags.NETHER_QUARTZ_DUST))
.save(consumer, modLoc("blasting/silicon_from_nether_quartz_dust")) .save(recipeOutput, loc("blasting/silicon_from_nether_quartz_dust"))
}
fun modLoc(path: String): ResourceLocation {
return ResourceLocation(AE2QuartzMod.MOD_ID, path)
} }
} }

View File

@ -8,8 +8,8 @@ import net.minecraft.world.level.block.Block
object ModTags { object ModTags {
val CERTUS_QUARTZ_ORE_BLOCK: TagKey<Block> = val CERTUS_QUARTZ_ORE_BLOCK: TagKey<Block> =
TagKey.create(Registries.BLOCK, ResourceLocation("forge", "ores/certus_quartz")) TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("c", "ores/certus_quartz"))
val CERTUS_QUARTZ_ORE: TagKey<Item> = val CERTUS_QUARTZ_ORE: TagKey<Item> =
TagKey.create(Registries.ITEM, ResourceLocation("forge", "ores/certus_quartz")) TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "ores/certus_quartz"))
val NETHER_QUARTZ_DUST: TagKey<Item> = TagKey.create(Registries.ITEM, ResourceLocation("forge", "dusts/quartz")) val NETHER_QUARTZ_DUST: TagKey<Item> = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "dusts/quartz"))
} }

View File

@ -2,9 +2,8 @@ package ru.yurannnzzz.ae2quartz.data.server
import net.minecraft.core.HolderSet import net.minecraft.core.HolderSet
import net.minecraft.core.registries.Registries import net.minecraft.core.registries.Registries
import net.minecraft.data.worldgen.BootstapContext import net.minecraft.data.worldgen.BootstrapContext
import net.minecraft.resources.ResourceKey import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.BiomeTags import net.minecraft.tags.BiomeTags
import net.minecraft.tags.BlockTags import net.minecraft.tags.BlockTags
import net.minecraft.world.level.levelgen.GenerationStep import net.minecraft.world.level.levelgen.GenerationStep
@ -17,10 +16,9 @@ import net.minecraft.world.level.levelgen.placement.HeightRangePlacement
import net.minecraft.world.level.levelgen.placement.InSquarePlacement import net.minecraft.world.level.levelgen.placement.InSquarePlacement
import net.minecraft.world.level.levelgen.placement.PlacedFeature import net.minecraft.world.level.levelgen.placement.PlacedFeature
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest
import net.minecraftforge.common.world.BiomeModifier import net.neoforged.neoforge.common.world.BiomeModifier
import net.minecraftforge.common.world.ForgeBiomeModifiers.AddFeaturesBiomeModifier import net.neoforged.neoforge.registries.NeoForgeRegistries
import net.minecraftforge.registries.ForgeRegistries import ru.yurannnzzz.ae2quartz.AE2QuartzMod.loc
import ru.yurannnzzz.ae2quartz.AE2QuartzMod.MOD_ID
import ru.yurannnzzz.ae2quartz.registry.ModBlocks import ru.yurannnzzz.ae2quartz.registry.ModBlocks
/* /*
@ -32,11 +30,11 @@ private object ConfiguredFeatures {
val QUARTZ_ORE = key("quartz_ore") val QUARTZ_ORE = key("quartz_ore")
private fun key(name: String): ResourceKey<ConfiguredFeature<*, *>> { private fun key(name: String): ResourceKey<ConfiguredFeature<*, *>> {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, ResourceLocation(MOD_ID, name)) return ResourceKey.create(Registries.CONFIGURED_FEATURE, loc(name))
} }
} }
fun registerConfiguredFeatures(context: BootstapContext<ConfiguredFeature<*, *>>) { fun registerConfiguredFeatures(context: BootstrapContext<ConfiguredFeature<*, *>>) {
val target = listOf( val target = listOf(
OreConfiguration.target( OreConfiguration.target(
TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES), TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES),
@ -58,11 +56,11 @@ private object PlacedFeatures {
val QUARTZ_ORE = key("quartz_ore") val QUARTZ_ORE = key("quartz_ore")
private fun key(name: String): ResourceKey<PlacedFeature> { private fun key(name: String): ResourceKey<PlacedFeature> {
return ResourceKey.create(Registries.PLACED_FEATURE, ResourceLocation(MOD_ID, name)) return ResourceKey.create(Registries.PLACED_FEATURE, loc(name))
} }
} }
fun registerPlacedFeatures(context: BootstapContext<PlacedFeature>) { fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
val configured = context.lookup(Registries.CONFIGURED_FEATURE) val configured = context.lookup(Registries.CONFIGURED_FEATURE)
context.register( context.register(
@ -81,17 +79,17 @@ private object BiomeModifiers {
val QUARTZ_ORE = key("quartz_ore") val QUARTZ_ORE = key("quartz_ore")
private fun key(name: String): ResourceKey<BiomeModifier> { private fun key(name: String): ResourceKey<BiomeModifier> {
return ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, ResourceLocation(MOD_ID, name)) return ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS, loc(name))
} }
} }
fun registerBiomeModifiers(context: BootstapContext<BiomeModifier>) { fun registerBiomeModifiers(context: BootstrapContext<BiomeModifier>) {
val placed = context.lookup(Registries.PLACED_FEATURE) val placed = context.lookup(Registries.PLACED_FEATURE)
val biomes = context.lookup(Registries.BIOME) val biomes = context.lookup(Registries.BIOME)
context.register( context.register(
BiomeModifiers.QUARTZ_ORE, BiomeModifiers.QUARTZ_ORE,
AddFeaturesBiomeModifier( net.neoforged.neoforge.common.world.BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD), biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placed.getOrThrow(PlacedFeatures.QUARTZ_ORE)), HolderSet.direct(placed.getOrThrow(PlacedFeatures.QUARTZ_ORE)),
GenerationStep.Decoration.UNDERGROUND_ORES GenerationStep.Decoration.UNDERGROUND_ORES

View File

@ -1,13 +1,13 @@
package ru.yurannnzzz.ae2quartz.event package ru.yurannnzzz.ae2quartz.event
import appeng.api.ids.AECreativeTabIds import appeng.api.ids.AECreativeTabIds
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent
import ru.yurannnzzz.ae2quartz.registry.ModItems import ru.yurannnzzz.ae2quartz.registry.ModItems
fun addCreativeTabItems(event: BuildCreativeModeTabContentsEvent) { fun addCreativeTabItems(event: BuildCreativeModeTabContentsEvent) {
if (event.tabKey === AECreativeTabIds.MAIN) { if (event.tabKey === AECreativeTabIds.MAIN) {
event.accept(ModItems.QUARTZ_ORE) event.accept(ModItems.QUARTZ_ORE.get())
event.accept(ModItems.DEEPSLATE_QUARTZ_ORE) event.accept(ModItems.DEEPSLATE_QUARTZ_ORE.get())
event.accept(ModItems.NETHER_QUARTZ_DUST) event.accept(ModItems.NETHER_QUARTZ_DUST.get())
} }
} }

View File

@ -1,19 +1,17 @@
package ru.yurannnzzz.ae2quartz.registry package ru.yurannnzzz.ae2quartz.registry
import net.minecraft.util.valueproviders.UniformInt import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.DropExperienceBlock import net.minecraft.world.level.block.DropExperienceBlock
import net.minecraft.world.level.block.SoundType import net.minecraft.world.level.block.SoundType
import net.minecraft.world.level.block.state.BlockBehaviour import net.minecraft.world.level.block.state.BlockBehaviour
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
import net.minecraft.world.level.material.MapColor import net.minecraft.world.level.material.MapColor
import net.minecraftforge.registries.DeferredRegister import net.neoforged.neoforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistries
import net.minecraftforge.registries.RegistryObject
import ru.yurannnzzz.ae2quartz.AE2QuartzMod import ru.yurannnzzz.ae2quartz.AE2QuartzMod
import java.util.function.Supplier
object ModBlocks { object ModBlocks {
val registry: DeferredRegister<Block> = DeferredRegister.create(ForgeRegistries.BLOCKS, AE2QuartzMod.MOD_ID) val registry = DeferredRegister.createBlocks(AE2QuartzMod.MOD_ID)
private val quartsOreBlockBehavior = BlockBehaviour.Properties.of() private val quartsOreBlockBehavior = BlockBehaviour.Properties.of()
.mapColor(MapColor.STONE) .mapColor(MapColor.STONE)
@ -21,19 +19,20 @@ object ModBlocks {
.requiresCorrectToolForDrops() .requiresCorrectToolForDrops()
.strength(3.0f, 3.0f) .strength(3.0f, 3.0f)
val QUARTZ_ORE: RegistryObject<Block> = registry.register("quartz_ore") { val QUARTZ_ORE = registry.register("quartz_ore", Supplier {
DropExperienceBlock( DropExperienceBlock(
quartsOreBlockBehavior, UniformInt.of(2, 5),
UniformInt.of(2, 5) quartsOreBlockBehavior
) )
} })
val DEEPSLATE_QUARTZ_ORE: RegistryObject<Block> = registry.register("deepslate_quartz_ore") {
val DEEPSLATE_QUARTZ_ORE = registry.register("deepslate_quartz_ore", Supplier {
DropExperienceBlock( DropExperienceBlock(
UniformInt.of(2, 5),
quartsOreBlockBehavior quartsOreBlockBehavior
.mapColor(MapColor.DEEPSLATE) .mapColor(MapColor.DEEPSLATE)
.strength(4.5f, 3.0f) .strength(4.5f, 3.0f)
.sound(SoundType.DEEPSLATE), .sound(SoundType.DEEPSLATE)
UniformInt.of(2, 5)
) )
} })
} }

View File

@ -1,24 +1,18 @@
package ru.yurannnzzz.ae2quartz.registry package ru.yurannnzzz.ae2quartz.registry
import appeng.items.materials.MaterialItem import appeng.items.materials.MaterialItem
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.world.item.BlockItem import net.minecraft.world.item.BlockItem
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraftforge.registries.DeferredRegister import net.neoforged.neoforge.registries.DeferredRegister
import net.minecraftforge.registries.ForgeRegistries
import net.minecraftforge.registries.RegistryObject
import ru.yurannnzzz.ae2quartz.AE2QuartzMod import ru.yurannnzzz.ae2quartz.AE2QuartzMod
import java.util.function.Supplier
object ModItems { object ModItems {
val registry: DeferredRegister<Item> = DeferredRegister.create(ForgeRegistries.ITEMS, AE2QuartzMod.MOD_ID) val registry = DeferredRegister.create(BuiltInRegistries.ITEM, AE2QuartzMod.MOD_ID)
val NETHER_QUARTZ_DUST: RegistryObject<Item> = registry.register("nether_quartz_dust") { val NETHER_QUARTZ_DUST= registry.register("nether_quartz_dust", Supplier { MaterialItem(Item.Properties()) })
MaterialItem(Item.Properties())
}
val QUARTZ_ORE: RegistryObject<Item> = registry.register("quartz_ore") { val QUARTZ_ORE = registry.register("quartz_ore", Supplier { BlockItem(ModBlocks.QUARTZ_ORE.get(), Item.Properties()) })
BlockItem(ModBlocks.QUARTZ_ORE.get(), Item.Properties()) val DEEPSLATE_QUARTZ_ORE = registry.register("deepslate_quartz_ore", Supplier { BlockItem(ModBlocks.DEEPSLATE_QUARTZ_ORE.get(), Item.Properties()) })
}
val DEEPSLATE_QUARTZ_ORE: RegistryObject<Item> = registry.register("deepslate_quartz_ore") {
BlockItem(ModBlocks.DEEPSLATE_QUARTZ_ORE.get(), Item.Properties())
}
} }

View File

@ -11,20 +11,20 @@ authors="YuRaNnNzZZ"
description="This mod adds Certus Quartz Ore and Nether Quartz Dust from earlier versions of AE2." description="This mod adds Certus Quartz Ore and Nether Quartz Dust from earlier versions of AE2."
[[dependencies.${mod_id}]] [[dependencies.${mod_id}]]
modId="forge" modId="neoforge"
mandatory=true mandatory=true
versionRange="${forge_version_range}" versionRange="${neo_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
[[dependencies.${mod_id}]] [[dependencies.${mod_id}]]
modId="minecraft" modId="minecraft"
mandatory=true type="required"
versionRange="${minecraft_version_range}" versionRange="${minecraft_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"
[[dependencies.${mod_id}]] [[dependencies.${mod_id}]]
modId="ae2" modId="ae2"
mandatory=true type="required"
versionRange="${ae2_version_range}" versionRange="${ae2_version_range}"
ordering="NONE" ordering="NONE"
side="BOTH" side="BOTH"