я в ахуе
This commit is contained in:
parent
6ecf0dceb0
commit
2598a7fd97
4
.gitignore
vendored
4
.gitignore
vendored
@ -20,6 +20,7 @@ build
|
||||
# other
|
||||
eclipse
|
||||
run
|
||||
runs
|
||||
run-data
|
||||
|
||||
design/
|
||||
@ -27,6 +28,3 @@ libs/
|
||||
logs/
|
||||
|
||||
/src/generated/resources
|
||||
|
||||
# Files from Forge MDK
|
||||
forge*changelog.txt
|
||||
|
119
build.gradle
119
build.gradle
@ -1,10 +1,15 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.9.20'
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.20'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.145'
|
||||
id 'org.jetbrains.kotlin.jvm' version '1.9.22'
|
||||
id 'org.jetbrains.kotlin.plugin.serialization' version '1.9.22'
|
||||
}
|
||||
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
distributionType = Wrapper.DistributionType.BIN
|
||||
}
|
||||
|
||||
version = "${minecraft_version}-${mod_version}"
|
||||
@ -14,119 +19,88 @@ base {
|
||||
archivesName = mod_id
|
||||
}
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'official', version: minecraft_version
|
||||
runs {
|
||||
configureEach {
|
||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||
systemProperty 'forge.logging.console.level', 'debug'
|
||||
|
||||
copyIdeResources = true
|
||||
modSource project.sourceSets.main
|
||||
}
|
||||
|
||||
runs {
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
client {
|
||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
server {
|
||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||
programArgument '--nogui'
|
||||
}
|
||||
|
||||
property 'mixin.env.remapRefMap', 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
|
||||
gameTestServer {
|
||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
mods {
|
||||
"${mod_id}" {
|
||||
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/')
|
||||
}
|
||||
data {
|
||||
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom localRuntime
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
name = 'Kotlin for Forge'
|
||||
url = 'https://thedarkcolour.github.io/KotlinForForge/'
|
||||
}
|
||||
maven {
|
||||
name = 'Jared\'s maven'
|
||||
url = 'https://maven.blamejared.com/'
|
||||
content {
|
||||
includeGroup 'mezz.jei'
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = 'Modmaven'
|
||||
url = 'https://modmaven.dev/'
|
||||
content {
|
||||
includeGroup 'appeng'
|
||||
includeGroup 'mezz.jei'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"
|
||||
implementation "thedarkcolour:kotlinforforge:${kff_version}"
|
||||
implementation "net.neoforged:neoforge:${neo_version}"
|
||||
implementation "thedarkcolour:kotlinforforge-neoforge:${kff_version}"
|
||||
|
||||
implementation fg.deobf("appeng:appliedenergistics2-forge:${ae2_version}")
|
||||
|
||||
runtimeOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
|
||||
implementation "appeng:appliedenergistics2-neoforge:${ae2_version}"
|
||||
runtimeOnly "mezz.jei:jei-${minecraft_version}-neoforge:${jei_version}"
|
||||
}
|
||||
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
tasks.withType(ProcessResources).configureEach {
|
||||
var replaceProperties = [
|
||||
loader_name: loader_name, loader_version_range: loader_version_range,
|
||||
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,
|
||||
ae2_version_range: ae2_version_range,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
|
||||
expand replaceProperties + [project: project]
|
||||
filesMatching(['META-INF/neoforge.mods.toml']) {
|
||||
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 {
|
||||
publications {
|
||||
register('mavenJava', MavenPublication) {
|
||||
artifact jar
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/mcmodsrepo"
|
||||
url "file://${project.projectDir}/repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -134,3 +108,10 @@ publishing {
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
downloadSources = true
|
||||
downloadJavadoc = true
|
||||
}
|
||||
}
|
||||
|
@ -4,18 +4,18 @@ org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
mod_id=ae2quartz
|
||||
mod_version=1.0.0
|
||||
mod_version=1.1.0
|
||||
|
||||
minecraft_version=1.20.1
|
||||
minecraft_version_range=[1.20.1,1.21)
|
||||
forge_version=47.2.0
|
||||
forge_version_range=[47,)
|
||||
minecraft_version=1.21
|
||||
minecraft_version_range=[1.21,1.22)
|
||||
neo_version=21.0.167
|
||||
neo_version_range=[21.0.0-beta,)
|
||||
|
||||
loader_name=kotlinforforge
|
||||
loader_version_range=[4.10,)
|
||||
kff_version=4.10.0
|
||||
loader_version_range=[5.5,)
|
||||
kff_version=5.5.0
|
||||
|
||||
ae2_version=15.0.20
|
||||
ae2_version_range=[15,)
|
||||
ae2_version=19.0.4-alpha
|
||||
ae2_version_range=[19,)
|
||||
|
||||
jei_version=15.2.0.27
|
||||
jei_version=19.8.2.99
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
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
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
34
gradlew
vendored
34
gradlew
vendored
@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -83,10 +85,9 @@ 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 -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
|
||||
@ -133,10 +134,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 +148,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 +156,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 +201,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" \
|
||||
|
22
gradlew.bat
vendored
22
gradlew.bat
vendored
@ -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 ##########################################################################
|
||||
@ -43,11 +45,11 @@ 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.
|
||||
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
|
||||
|
||||
@ -57,11 +59,11 @@ 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.
|
||||
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
|
||||
|
||||
|
@ -1,13 +1,11 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
maven { url = 'https://maven.neoforged.net/releases' }
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
|
||||
}
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
||||
}
|
||||
|
@ -1,16 +1,19 @@
|
||||
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.event.addCreativeTabItems
|
||||
import ru.yurannnzzz.ae2quartz.registry.ModBlocks
|
||||
import ru.yurannnzzz.ae2quartz.registry.ModItems
|
||||
import thedarkcolour.kotlinforforge.forge.MOD_BUS
|
||||
import thedarkcolour.kotlinforforge.neoforge.forge.MOD_BUS
|
||||
|
||||
@Mod(AE2QuartzMod.MOD_ID)
|
||||
object AE2QuartzMod {
|
||||
const val MOD_ID = "ae2quartz"
|
||||
|
||||
fun loc(id: String): ResourceLocation = ResourceLocation.fromNamespaceAndPath(MOD_ID, id)
|
||||
|
||||
init {
|
||||
ModBlocks.registry.register(MOD_BUS)
|
||||
ModItems.registry.register(MOD_BUS)
|
||||
|
@ -4,12 +4,11 @@ import net.minecraft.core.RegistrySetBuilder
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.data.loot.LootTableProvider
|
||||
import net.minecraft.data.loot.LootTableProvider.SubProviderEntry
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
|
||||
import net.minecraftforge.common.data.BlockTagsProvider
|
||||
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
|
||||
import net.minecraftforge.data.event.GatherDataEvent
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import net.neoforged.neoforge.common.data.BlockTagsProvider
|
||||
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider
|
||||
import net.neoforged.neoforge.data.event.GatherDataEvent
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries
|
||||
import ru.yurannnzzz.ae2quartz.AE2QuartzMod.MOD_ID
|
||||
import ru.yurannnzzz.ae2quartz.data.client.English
|
||||
import ru.yurannnzzz.ae2quartz.data.client.ModBlockStateProvider
|
||||
@ -25,39 +24,38 @@ import ru.yurannnzzz.ae2quartz.data.server.registerPlacedFeatures
|
||||
|
||||
fun onDataGather(event: GatherDataEvent) {
|
||||
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(), ModItemModelProvider(out, MOD_ID, efh))
|
||||
gen.addProvider(event.includeClient(), English(out, MOD_ID))
|
||||
gen.addProvider(event.includeClient(), Russian(out, MOD_ID))
|
||||
gen.addProvider(event.includeClient(), ModBlockStateProvider(gen.packOutput, MOD_ID, event.existingFileHelper))
|
||||
gen.addProvider(event.includeClient(), ModItemModelProvider(gen.packOutput, MOD_ID, event.existingFileHelper))
|
||||
gen.addProvider(event.includeClient(), English(gen.packOutput, MOD_ID))
|
||||
gen.addProvider(event.includeClient(), Russian(gen.packOutput, MOD_ID))
|
||||
|
||||
gen.addProvider(
|
||||
event.includeServer(),
|
||||
ModRecipeProvider(out)
|
||||
ModRecipeProvider(gen.packOutput, event.lookupProvider)
|
||||
)
|
||||
val blockTagsProvider: BlockTagsProvider = gen.addProvider(
|
||||
event.includeServer(),
|
||||
ModBlockTagsProvider(out, event.lookupProvider, MOD_ID, efh)
|
||||
ModBlockTagsProvider(gen.packOutput, event.lookupProvider, MOD_ID, event.existingFileHelper)
|
||||
)
|
||||
gen.addProvider(
|
||||
event.includeServer(),
|
||||
ModItemTagsProvider(out, event.lookupProvider, blockTagsProvider.contentsGetter(), MOD_ID, efh)
|
||||
ModItemTagsProvider(gen.packOutput, event.lookupProvider, blockTagsProvider.contentsGetter(), MOD_ID, event.existingFileHelper)
|
||||
)
|
||||
gen.addProvider(
|
||||
event.includeServer(),
|
||||
LootTableProvider(
|
||||
out,
|
||||
emptySet<ResourceLocation>(),
|
||||
listOf(SubProviderEntry({ ModBlockLootProvider() }, LootContextParamSets.BLOCK))
|
||||
gen.packOutput,
|
||||
mutableSetOf(),
|
||||
listOf(SubProviderEntry({ ModBlockLootProvider(event.lookupProvider) }, LootContextParamSets.BLOCK)),
|
||||
event.lookupProvider
|
||||
)
|
||||
)
|
||||
|
||||
val registrySetBuilder = RegistrySetBuilder()
|
||||
.add(Registries.CONFIGURED_FEATURE, ::registerConfiguredFeatures)
|
||||
.add(Registries.PLACED_FEATURE, ::registerPlacedFeatures)
|
||||
.add(ForgeRegistries.Keys.BIOME_MODIFIERS, ::registerBiomeModifiers)
|
||||
.add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ::registerBiomeModifiers)
|
||||
event.generator.addProvider(
|
||||
event.includeServer(),
|
||||
DatapackBuiltinEntriesProvider(
|
||||
|
@ -1,9 +1,9 @@
|
||||
package ru.yurannnzzz.ae2quartz.data.client
|
||||
|
||||
import net.minecraft.data.PackOutput
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider
|
||||
import net.minecraftforge.client.model.generators.ConfiguredModel
|
||||
import net.minecraftforge.common.data.ExistingFileHelper
|
||||
import net.neoforged.neoforge.client.model.generators.BlockStateProvider
|
||||
import net.neoforged.neoforge.client.model.generators.ConfiguredModel
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper
|
||||
import ru.yurannnzzz.ae2quartz.registry.ModBlocks
|
||||
|
||||
class ModBlockStateProvider(output: PackOutput?, modid: String?, exFileHelper: ExistingFileHelper?) :
|
||||
|
@ -2,18 +2,18 @@ package ru.yurannnzzz.ae2quartz.data.client
|
||||
|
||||
import net.minecraft.data.PackOutput
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider
|
||||
import net.minecraftforge.client.model.generators.ModelFile.UncheckedModelFile
|
||||
import net.minecraftforge.common.data.ExistingFileHelper
|
||||
import net.neoforged.neoforge.client.model.generators.ItemModelProvider
|
||||
import net.neoforged.neoforge.client.model.generators.ModelFile
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper
|
||||
|
||||
class ModItemModelProvider(output: PackOutput?, modid: String?, existingFileHelper: ExistingFileHelper?) :
|
||||
ItemModelProvider(output, modid, existingFileHelper) {
|
||||
override fun registerModels() {
|
||||
val netherQuartzDustTexture = ResourceLocation("ae2", "item/nether_quartz_dust")
|
||||
val netherQuartzDustTexture = ResourceLocation.fromNamespaceAndPath("ae2", "item/nether_quartz_dust")
|
||||
existingFileHelper.trackGenerated(netherQuartzDustTexture, TEXTURE)
|
||||
|
||||
getBuilder(modLoc("item/nether_quartz_dust").toString())
|
||||
.parent(UncheckedModelFile("item/generated"))
|
||||
.parent(ModelFile.UncheckedModelFile("item/generated"))
|
||||
.texture("layer0", netherQuartzDustTexture)
|
||||
|
||||
withExistingParent(
|
||||
|
@ -1,7 +1,7 @@
|
||||
package ru.yurannnzzz.ae2quartz.data.client
|
||||
|
||||
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.ModItems
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ru.yurannnzzz.ae2quartz.data.server
|
||||
|
||||
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.world.flag.FeatureFlags
|
||||
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.SetItemCountFunction
|
||||
import net.minecraft.world.level.storage.loot.providers.number.UniformGenerator
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
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() {
|
||||
add(ModBlocks.QUARTZ_ORE.get(), this::createCertusQuartsOreDrops)
|
||||
add(ModBlocks.DEEPSLATE_QUARTZ_ORE.get(), this::createCertusQuartsOreDrops)
|
||||
}
|
||||
|
||||
override fun getKnownBlocks(): Iterable<Block> {
|
||||
return Iterable {
|
||||
ModBlocks.registry.entries
|
||||
.stream()
|
||||
.flatMap { obj: RegistryObject<Block> -> obj.stream() }
|
||||
.iterator()
|
||||
}
|
||||
return ModBlocks.registry.entries.stream().map { it.get() }.toList()
|
||||
}
|
||||
|
||||
private val enchantments = registries.lookupOrThrow(Registries.ENCHANTMENT)
|
||||
private fun createCertusQuartsOreDrops(block: Block): LootTable.Builder {
|
||||
return createSilkTouchDispatchTable(
|
||||
block,
|
||||
@ -35,7 +34,7 @@ class ModBlockLootProvider : BlockLootSubProvider(emptySet(), FeatureFlags.REGIS
|
||||
block,
|
||||
LootItem.lootTableItem(AEItems.CERTUS_QUARTZ_CRYSTAL)
|
||||
.apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0f, 3.0f)))
|
||||
.apply(ApplyBonusCount.addOreBonusCount(Enchantments.BLOCK_FORTUNE))
|
||||
.apply(ApplyBonusCount.addOreBonusCount(enchantments.getOrThrow(Enchantments.FORTUNE)))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ package ru.yurannnzzz.ae2quartz.data.server
|
||||
import net.minecraft.core.HolderLookup
|
||||
import net.minecraft.data.PackOutput
|
||||
import net.minecraft.tags.BlockTags
|
||||
import net.minecraftforge.common.Tags
|
||||
import net.minecraftforge.common.data.BlockTagsProvider
|
||||
import net.minecraftforge.common.data.ExistingFileHelper
|
||||
import net.neoforged.neoforge.common.Tags
|
||||
import net.neoforged.neoforge.common.data.BlockTagsProvider
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper
|
||||
import ru.yurannnzzz.ae2quartz.registry.ModBlocks
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
|
@ -5,8 +5,8 @@ import net.minecraft.core.HolderLookup
|
||||
import net.minecraft.data.PackOutput
|
||||
import net.minecraft.data.tags.ItemTagsProvider
|
||||
import net.minecraft.world.level.block.Block
|
||||
import net.minecraftforge.common.Tags
|
||||
import net.minecraftforge.common.data.ExistingFileHelper
|
||||
import net.neoforged.neoforge.common.Tags
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper
|
||||
import ru.yurannnzzz.ae2quartz.registry.ModItems
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
|
@ -4,35 +4,31 @@ import appeng.core.definitions.AEItems
|
||||
import appeng.datagen.providers.tags.ConventionTags
|
||||
import appeng.recipes.handlers.InscriberProcessType
|
||||
import appeng.recipes.handlers.InscriberRecipeBuilder
|
||||
import net.minecraft.core.HolderLookup
|
||||
import net.minecraft.data.PackOutput
|
||||
import net.minecraft.data.recipes.FinishedRecipe
|
||||
import net.minecraft.data.recipes.RecipeCategory
|
||||
import net.minecraft.data.recipes.RecipeOutput
|
||||
import net.minecraft.data.recipes.RecipeProvider
|
||||
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
|
||||
import net.minecraft.resources.ResourceLocation
|
||||
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 java.util.function.Consumer
|
||||
import java.util.concurrent.CompletableFuture
|
||||
|
||||
class ModRecipeProvider(output: PackOutput?) : RecipeProvider(output) {
|
||||
override fun buildRecipes(consumer: Consumer<FinishedRecipe>) {
|
||||
class ModRecipeProvider(output: PackOutput, provider: CompletableFuture<HolderLookup.Provider>) : RecipeProvider(output, provider) {
|
||||
override fun buildRecipes(recipeOutput: RecipeOutput) {
|
||||
InscriberRecipeBuilder
|
||||
.inscribe(ConventionTags.ALL_NETHER_QUARTZ, ModItems.NETHER_QUARTZ_DUST.get(), 1)
|
||||
.setMode(InscriberProcessType.INSCRIBE)
|
||||
.save(consumer, modLoc("inscriber/nether_quartz_dust"))
|
||||
.save(recipeOutput, loc("inscriber/nether_quartz_dust"))
|
||||
|
||||
SimpleCookingRecipeBuilder
|
||||
.smelting(Ingredient.of(ModTags.NETHER_QUARTZ_DUST), RecipeCategory.MISC, AEItems.SILICON, .35f, 200)
|
||||
.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
|
||||
.blasting(Ingredient.of(ModTags.NETHER_QUARTZ_DUST), RecipeCategory.MISC, AEItems.SILICON, .35f, 100)
|
||||
.unlockedBy("has_nether_quartz_dust", has(ModTags.NETHER_QUARTZ_DUST))
|
||||
.save(consumer, modLoc("blasting/silicon_from_nether_quartz_dust"))
|
||||
}
|
||||
|
||||
fun modLoc(path: String): ResourceLocation {
|
||||
return ResourceLocation(AE2QuartzMod.MOD_ID, path)
|
||||
.save(recipeOutput, loc("blasting/silicon_from_nether_quartz_dust"))
|
||||
}
|
||||
}
|
||||
|
@ -8,8 +8,8 @@ import net.minecraft.world.level.block.Block
|
||||
|
||||
object ModTags {
|
||||
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> =
|
||||
TagKey.create(Registries.ITEM, ResourceLocation("forge", "ores/certus_quartz"))
|
||||
val NETHER_QUARTZ_DUST: TagKey<Item> = TagKey.create(Registries.ITEM, ResourceLocation("forge", "dusts/quartz"))
|
||||
TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "ores/certus_quartz"))
|
||||
val NETHER_QUARTZ_DUST: TagKey<Item> = TagKey.create(Registries.ITEM, ResourceLocation.fromNamespaceAndPath("c", "dusts/quartz"))
|
||||
}
|
||||
|
@ -2,9 +2,8 @@ package ru.yurannnzzz.ae2quartz.data.server
|
||||
|
||||
import net.minecraft.core.HolderSet
|
||||
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.ResourceLocation
|
||||
import net.minecraft.tags.BiomeTags
|
||||
import net.minecraft.tags.BlockTags
|
||||
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.PlacedFeature
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest
|
||||
import net.minecraftforge.common.world.BiomeModifier
|
||||
import net.minecraftforge.common.world.ForgeBiomeModifiers.AddFeaturesBiomeModifier
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import ru.yurannnzzz.ae2quartz.AE2QuartzMod.MOD_ID
|
||||
import net.neoforged.neoforge.common.world.BiomeModifier
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries
|
||||
import ru.yurannnzzz.ae2quartz.AE2QuartzMod.loc
|
||||
import ru.yurannnzzz.ae2quartz.registry.ModBlocks
|
||||
|
||||
/*
|
||||
@ -32,11 +30,11 @@ private object ConfiguredFeatures {
|
||||
val QUARTZ_ORE = key("quartz_ore")
|
||||
|
||||
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(
|
||||
OreConfiguration.target(
|
||||
TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES),
|
||||
@ -58,11 +56,11 @@ private object PlacedFeatures {
|
||||
val QUARTZ_ORE = key("quartz_ore")
|
||||
|
||||
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)
|
||||
|
||||
context.register(
|
||||
@ -81,17 +79,17 @@ private object BiomeModifiers {
|
||||
val QUARTZ_ORE = key("quartz_ore")
|
||||
|
||||
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 biomes = context.lookup(Registries.BIOME)
|
||||
|
||||
context.register(
|
||||
BiomeModifiers.QUARTZ_ORE,
|
||||
AddFeaturesBiomeModifier(
|
||||
net.neoforged.neoforge.common.world.BiomeModifiers.AddFeaturesBiomeModifier(
|
||||
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
|
||||
HolderSet.direct(placed.getOrThrow(PlacedFeatures.QUARTZ_ORE)),
|
||||
GenerationStep.Decoration.UNDERGROUND_ORES
|
||||
|
@ -1,13 +1,13 @@
|
||||
package ru.yurannnzzz.ae2quartz.event
|
||||
|
||||
import appeng.api.ids.AECreativeTabIds
|
||||
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent
|
||||
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent
|
||||
import ru.yurannnzzz.ae2quartz.registry.ModItems
|
||||
|
||||
fun addCreativeTabItems(event: BuildCreativeModeTabContentsEvent) {
|
||||
if (event.tabKey === AECreativeTabIds.MAIN) {
|
||||
event.accept(ModItems.QUARTZ_ORE)
|
||||
event.accept(ModItems.DEEPSLATE_QUARTZ_ORE)
|
||||
event.accept(ModItems.NETHER_QUARTZ_DUST)
|
||||
event.accept(ModItems.QUARTZ_ORE.get())
|
||||
event.accept(ModItems.DEEPSLATE_QUARTZ_ORE.get())
|
||||
event.accept(ModItems.NETHER_QUARTZ_DUST.get())
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,17 @@
|
||||
package ru.yurannnzzz.ae2quartz.registry
|
||||
|
||||
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.SoundType
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour
|
||||
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument
|
||||
import net.minecraft.world.level.material.MapColor
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
import net.neoforged.neoforge.registries.DeferredRegister
|
||||
import ru.yurannnzzz.ae2quartz.AE2QuartzMod
|
||||
import java.util.function.Supplier
|
||||
|
||||
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()
|
||||
.mapColor(MapColor.STONE)
|
||||
@ -21,19 +19,20 @@ object ModBlocks {
|
||||
.requiresCorrectToolForDrops()
|
||||
.strength(3.0f, 3.0f)
|
||||
|
||||
val QUARTZ_ORE: RegistryObject<Block> = registry.register("quartz_ore") {
|
||||
val QUARTZ_ORE = registry.register("quartz_ore", Supplier {
|
||||
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(
|
||||
UniformInt.of(2, 5),
|
||||
quartsOreBlockBehavior
|
||||
.mapColor(MapColor.DEEPSLATE)
|
||||
.strength(4.5f, 3.0f)
|
||||
.sound(SoundType.DEEPSLATE),
|
||||
UniformInt.of(2, 5)
|
||||
.sound(SoundType.DEEPSLATE)
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -1,24 +1,18 @@
|
||||
package ru.yurannnzzz.ae2quartz.registry
|
||||
|
||||
import appeng.items.materials.MaterialItem
|
||||
import net.minecraft.core.registries.BuiltInRegistries
|
||||
import net.minecraft.world.item.BlockItem
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraftforge.registries.DeferredRegister
|
||||
import net.minecraftforge.registries.ForgeRegistries
|
||||
import net.minecraftforge.registries.RegistryObject
|
||||
import net.neoforged.neoforge.registries.DeferredRegister
|
||||
import ru.yurannnzzz.ae2quartz.AE2QuartzMod
|
||||
import java.util.function.Supplier
|
||||
|
||||
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") {
|
||||
MaterialItem(Item.Properties())
|
||||
}
|
||||
val NETHER_QUARTZ_DUST= registry.register("nether_quartz_dust", Supplier { MaterialItem(Item.Properties()) })
|
||||
|
||||
val QUARTZ_ORE: RegistryObject<Item> = registry.register("quartz_ore") {
|
||||
BlockItem(ModBlocks.QUARTZ_ORE.get(), Item.Properties())
|
||||
}
|
||||
val DEEPSLATE_QUARTZ_ORE: RegistryObject<Item> = registry.register("deepslate_quartz_ore") {
|
||||
BlockItem(ModBlocks.DEEPSLATE_QUARTZ_ORE.get(), Item.Properties())
|
||||
}
|
||||
val QUARTZ_ORE = registry.register("quartz_ore", Supplier { 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()) })
|
||||
}
|
||||
|
@ -11,20 +11,20 @@ authors="YuRaNnNzZZ"
|
||||
description="This mod adds Certus Quartz Ore and Nether Quartz Dust from earlier versions of AE2."
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="forge"
|
||||
modId="neoforge"
|
||||
mandatory=true
|
||||
versionRange="${forge_version_range}"
|
||||
versionRange="${neo_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
type="required"
|
||||
versionRange="${minecraft_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="ae2"
|
||||
mandatory=true
|
||||
type="required"
|
||||
versionRange="${ae2_version_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
Loading…
Reference in New Issue
Block a user