Port to 1.20.4 Neo
This commit is contained in:
parent
3b3f960768
commit
422232b4f6
182
build.gradle
182
build.gradle
|
@ -2,7 +2,7 @@ plugins {
|
|||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.gradle' version '[6.0,6.2)'
|
||||
id 'net.neoforged.gradle.userdev' version '7.0.72'
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
|
@ -12,126 +12,79 @@ base {
|
|||
archivesName = mod_id
|
||||
}
|
||||
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
// Include resources generated by data generators.
|
||||
sourceSets {
|
||||
data
|
||||
main.resources { srcDirs += data.resources.srcDirs }
|
||||
}
|
||||
|
||||
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
|
||||
minecraft {
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
mappings channel: mapping_channel, version: mapping_version
|
||||
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
||||
|
||||
// When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
|
||||
// In most cases, it is not necessary to enable.
|
||||
// enableEclipsePrepareRuns = true
|
||||
// enableIdeaPrepareRuns = true
|
||||
runs {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
|
||||
// It is REQUIRED to be set to true for this template to function.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
copyIdeResources = true
|
||||
systemProperty 'forge.logging.console.level', 'debug'
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
// applies to all the run configs below
|
||||
configureEach {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
// Recommended logging data for a userdev environment
|
||||
// The markers can be added/remove as needed separated by commas.
|
||||
// "SCAN": For mods scan.
|
||||
// "REGISTRIES": For firing of registry events.
|
||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
|
||||
// Recommended logging level for the console
|
||||
// You can set various levels here.
|
||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
client {
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
}
|
||||
|
||||
server {
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
args '--nogui'
|
||||
}
|
||||
|
||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||
// By default, the server will crash when no gametests are provided.
|
||||
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||
gameTestServer {
|
||||
property 'forge.enabledGameTestNamespaces', mod_id
|
||||
}
|
||||
|
||||
data {
|
||||
ideaModule "${project.name}.data"
|
||||
|
||||
// example of overriding the workingDirectory set in configureEach above
|
||||
workingDirectory project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
args '--mod', 'engage', '--all'
|
||||
args '--output', sourceSets.data.resources.srcDirs[0].toString()
|
||||
args '--existing', sourceSets.main.resources.srcDirs[0].toString()
|
||||
mods {
|
||||
"${mod_id}" {
|
||||
source sourceSets.main
|
||||
source sourceSets.data
|
||||
}
|
||||
}
|
||||
}
|
||||
modSource project.sourceSets.main
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://cubicinterpolation.net/maven/" }
|
||||
client {
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
server {
|
||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||
programArgument '--nogui'
|
||||
}
|
||||
|
||||
gameTestServer {
|
||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
data {
|
||||
// example of overriding the workingDirectory set in configureEach above
|
||||
workingDirectory project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
programArguments '--mod', 'engage', '--all'
|
||||
programArguments '--output', sourceSets.data.resources.srcDirs[0].toString()
|
||||
programArguments '--existing', sourceSets.main.resources.srcDirs[0].toString()
|
||||
|
||||
modSources = [sourceSets.main, sourceSets.data]
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
dataImplementation.extendsFrom implementation
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
// Specify the version of Minecraft to use.
|
||||
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
|
||||
// The "userdev" classifier will be requested and setup by ForgeGradle.
|
||||
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
|
||||
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
|
||||
minecraft "net.neoforged:forge:${minecraft_version}-${forge_version}"
|
||||
|
||||
implementation fg.deobf(group: "commoble.exmachina_engine", name: "exmachina_engine-${exmachina_engine_mc_version}", version: "${exmachina_engine_version}")
|
||||
jarJar(group: "commoble.exmachina_engine", name: "exmachina_engine-${exmachina_engine_mc_version}", version: "[${exmachina_engine_version}, ${exmachina_engine_next_version})")
|
||||
// Depending on the plugin applied there are several options. We will assume you applied the userdev plugin as shown above.
|
||||
// The group for userdev is net.neoforged, the module name is neoforge, and the version is the same as the neoforge version.
|
||||
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
|
||||
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
|
||||
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
|
||||
implementation "net.neoforged:neoforge:${neo_version}"
|
||||
|
||||
dataImplementation sourceSets.main.output
|
||||
}
|
||||
|
||||
// This block of code expands all declared replace properties in the specified resource targets.
|
||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
||||
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
|
||||
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||
tasks.named('processResources', ProcessResources).configure {
|
||||
}
|
||||
tasks.withType(ProcessResources).configureEach {
|
||||
var replaceProperties = [
|
||||
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
forge_version: forge_version, forge_version_range: forge_version_range,
|
||||
minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range,
|
||||
neo_version : neo_version, neo_version_range: neo_version_range,
|
||||
loader_version_range: loader_version_range,
|
||||
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors: mod_authors, mod_description: mod_description,
|
||||
mod_id : mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
|
||||
mod_authors : mod_authors, mod_description: mod_description, pack_format_number: pack_format_number,
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
|
||||
|
@ -140,47 +93,16 @@ tasks.named('processResources', ProcessResources).configure {
|
|||
}
|
||||
}
|
||||
|
||||
// Example for how to get properties into the manifest for reading at runtime.
|
||||
tasks.named('jar', Jar).configure {
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_id,
|
||||
'Specification-Vendor' : mod_authors,
|
||||
'Specification-Version' : '1', // We are version 1 of ourselves
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Vendor' : mod_authors,
|
||||
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
|
||||
// This is the preferred method to reobfuscate your jar file
|
||||
finalizedBy 'reobfJar'
|
||||
}
|
||||
|
||||
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing:
|
||||
// tasks.named('publish').configure {
|
||||
// dependsOn 'reobfJar'
|
||||
// }
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish plugin
|
||||
publishing {
|
||||
publications {
|
||||
register('mavenJava', MavenPublication) {
|
||||
artifact jar
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/mcmodsrepo"
|
||||
}
|
||||
|
||||
maven {
|
||||
url = 'https://maven.neoforged.net/releases'
|
||||
credentials {
|
||||
username = 'curle'
|
||||
password = 'zkniWrFTmXJUMEUQX/IZt4Vxt45lnmSQdplhHmhXNW4zFTZvWQg9Pe/nspx7a93a'
|
||||
}
|
||||
url "file://${project.projectDir}/repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,3 +110,5 @@ publishing {
|
|||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
|
||||
final var actualDateTime = OffsetDateTime.now(ZoneOffset.UTC).withNano(0)
|
||||
|
|
|
@ -7,17 +7,17 @@ org.gradle.daemon=false
|
|||
## Environment Properties
|
||||
|
||||
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||
minecraft_version=1.20.1
|
||||
minecraft_version=1.20.4
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.20.1,1.21)
|
||||
minecraft_version_range=[1.20.4,1.21)
|
||||
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||
forge_version=47.1.63
|
||||
neo_version=20.4.56-beta
|
||||
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||
forge_version_range=[47,)
|
||||
neo_version_range=[20.2,)
|
||||
# The loader version range can only use the major version of Forge/FML as bounds
|
||||
loader_version_range=[47,)
|
||||
loader_version_range=[1,)
|
||||
# The mapping channel to use for mappings.
|
||||
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||
|
@ -35,7 +35,7 @@ loader_version_range=[47,)
|
|||
mapping_channel=official
|
||||
# The mapping version to query from the mapping channel.
|
||||
# This must match the format required by the mapping channel.
|
||||
mapping_version=1.20.1
|
||||
mapping_version=1.20.4
|
||||
|
||||
|
||||
## Mod Properties
|
||||
|
@ -48,7 +48,7 @@ mod_name=Engage!
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=MIT
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.20-0.1.13
|
||||
mod_version=1.20.4-0.2.0
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
@ -57,7 +57,4 @@ mod_group_id=uk.gemwire.engage
|
|||
mod_authors=Curle
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=Create Warp Plasma, and find an advanced tech tree to play with!
|
||||
|
||||
exmachina_engine_version = 0.1.0.0
|
||||
exmachina_engine_mc_version = 1.20.1
|
||||
exmachina_engine_next_version = 0.2.0.0
|
||||
pack_format_number=18
|
|
@ -1,10 +1,9 @@
|
|||
package uk.gemwire.engage.data;
|
||||
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraftforge.common.data.BlockTagsProvider;
|
||||
import net.minecraftforge.data.event.GatherDataEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.data.event.GatherDataEvent;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
|
@ -36,7 +35,7 @@ public class Datagen {
|
|||
|
||||
LOGGER.info(DATAGEN, "Adding data providers for client assets");
|
||||
generator.addProvider(event.includeClient(), new EnglishProvider(event.getGenerator().getPackOutput()));
|
||||
generator.addProvider(event.includeClient(), new SpriteSourceProvider(event.getGenerator().getPackOutput(), event.getExistingFileHelper()));
|
||||
generator.addProvider(event.includeClient(), new SpriteSourceProvider(event.getGenerator().getPackOutput(), event.getLookupProvider(), event.getExistingFileHelper()));
|
||||
generator.addProvider(event.includeClient(), new ItemModelProvider(event.getGenerator().getPackOutput(), event.getExistingFileHelper()));
|
||||
generator.addProvider(event.includeClient(), new BlockModelProvider(event.getGenerator().getPackOutput(), event.getExistingFileHelper()));
|
||||
generator.addProvider(event.includeClient(), new BlockStateProvider(event.getGenerator().getPackOutput(), event.getExistingFileHelper()));
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
package uk.gemwire.engage.data.blockstate;
|
||||
|
||||
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraftforge.client.model.generators.BlockStateProvider;
|
||||
import net.minecraftforge.client.model.generators.ConfiguredModel;
|
||||
import net.minecraftforge.client.model.generators.ModelFile;
|
||||
import net.minecraftforge.client.model.generators.VariantBlockStateBuilder;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
|
||||
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
|
||||
import net.neoforged.neoforge.client.model.generators.ModelFile;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import uk.gemwire.engage.data.model.block.BaseBlockModelProvider;
|
||||
import uk.gemwire.engage.registries.fluid.FluidDeferredRegister;
|
||||
|
@ -47,8 +46,7 @@ public abstract class BaseBlockStateProvider<PROVIDER extends BaseBlockModelProv
|
|||
|
||||
protected void registerFluidBlockStates(List<FluidRegistryObject<? extends FluidDeferredRegister.MekanismFluidType, ?, ?, ?, ?>> fluidROs) {
|
||||
for (FluidRegistryObject<? extends FluidDeferredRegister.MekanismFluidType, ?, ?, ?, ?> fluidRO : fluidROs) {
|
||||
simpleBlock(fluidRO.getBlock(), models().getBuilder(ForgeRegistries.BLOCKS.getKey(fluidRO.getBlock()).getPath()).texture("particle",
|
||||
fluidRO.getFluidType().stillTexture));
|
||||
simpleBlock(fluidRO.getBlock(), models().getBuilder(BuiltInRegistries.BLOCK.getKey(fluidRO.getBlock()).getPath()).texture("particle", fluidRO.getFluidType().stillTexture));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package uk.gemwire.engage.data.blockstate;
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import uk.gemwire.engage.data.model.block.BlockModelProvider;
|
||||
import uk.gemwire.engage.registries.Blocks;
|
||||
import uk.gemwire.engage.registries.Fluids;
|
||||
|
@ -18,7 +19,7 @@ public class BlockStateProvider extends BaseBlockStateProvider<BlockModelProvide
|
|||
}
|
||||
|
||||
private ResourceLocation key(Block block) {
|
||||
return ForgeRegistries.BLOCKS.getKey(block);
|
||||
return BuiltInRegistries.BLOCK.getKey(block);
|
||||
}
|
||||
|
||||
private String name(Block block) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package uk.gemwire.engage.data.lang;
|
||||
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraftforge.common.data.LanguageProvider;
|
||||
import net.neoforged.neoforge.common.data.LanguageProvider;
|
||||
import uk.gemwire.engage.registries.Blocks;
|
||||
import uk.gemwire.engage.registries.Fluids;
|
||||
import uk.gemwire.engage.registries.Items;
|
||||
|
|
|
@ -4,9 +4,9 @@ package uk.gemwire.engage.data.model.block;
|
|||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraftforge.client.model.generators.BlockModelBuilder;
|
||||
import net.minecraftforge.client.model.generators.BlockModelProvider;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.client.model.generators.BlockModelBuilder;
|
||||
import net.neoforged.neoforge.client.model.generators.BlockModelProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class BaseBlockModelProvider extends BlockModelProvider {
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
package uk.gemwire.engage.data.model.block;
|
||||
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
|
||||
public class BlockModelProvider extends BaseBlockModelProvider {
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
package uk.gemwire.engage.data.model.item;
|
||||
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.client.model.generators.ItemModelBuilder;
|
||||
import net.minecraftforge.client.model.generators.ItemModelProvider;
|
||||
import net.minecraftforge.client.model.generators.loaders.DynamicFluidContainerModelBuilder;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.neoforge.client.model.generators.ItemModelBuilder;
|
||||
import net.neoforged.neoforge.client.model.generators.ItemModelProvider;
|
||||
import net.neoforged.neoforge.client.model.generators.loaders.DynamicFluidContainerModelBuilder;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import uk.gemwire.engage.registries.fluid.FluidDeferredRegister;
|
||||
import uk.gemwire.engage.registries.fluid.FluidRegistryObject;
|
||||
|
@ -23,11 +23,11 @@ public abstract class BaseItemModelProvider extends ItemModelProvider {
|
|||
}
|
||||
|
||||
private String blockPath(Block block) {
|
||||
return ForgeRegistries.BLOCKS.getKey(block).getPath();
|
||||
return BuiltInRegistries.BLOCK.getKey(block).getPath();
|
||||
}
|
||||
|
||||
private String itemPath(Item item) {
|
||||
return ForgeRegistries.ITEMS.getKey(item).getPath();
|
||||
return BuiltInRegistries.ITEM.getKey(item).getPath();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -93,7 +93,7 @@ public abstract class BaseItemModelProvider extends ItemModelProvider {
|
|||
|
||||
//Note: This isn't the best way to do this in terms of model file validation, but it works
|
||||
protected void registerBucket(FluidRegistryObject<?, ?, ?, ?, ?> fluidRO) {
|
||||
withExistingParent(ForgeRegistries.ITEMS.getKey(fluidRO.getBucket()).getPath(), new ResourceLocation("forge", "item/bucket"))
|
||||
withExistingParent(BuiltInRegistries.ITEM.getKey(fluidRO.getBucket()).getPath(), new ResourceLocation("item/bucket"))
|
||||
.customLoader(DynamicFluidContainerModelBuilder::begin)
|
||||
.fluid(fluidRO.getStillFluid());
|
||||
}
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package uk.gemwire.engage.data.model.item;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import uk.gemwire.engage.registries.Blocks;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import uk.gemwire.engage.registries.Fluids;
|
||||
import uk.gemwire.engage.registries.Items;
|
||||
|
||||
|
@ -18,7 +17,7 @@ public class ItemModelProvider extends BaseItemModelProvider {
|
|||
}
|
||||
|
||||
private ResourceLocation key(Block block) {
|
||||
return ForgeRegistries.BLOCKS.getKey(block);
|
||||
return BuiltInRegistries.BLOCK.getKey(block);
|
||||
}
|
||||
|
||||
private String name(Block block) {
|
||||
|
@ -26,7 +25,7 @@ public class ItemModelProvider extends BaseItemModelProvider {
|
|||
}
|
||||
|
||||
private ResourceLocation key(Item item) {
|
||||
return ForgeRegistries.ITEMS.getKey(item);
|
||||
return BuiltInRegistries.ITEM.getKey(item);
|
||||
}
|
||||
|
||||
private String name(Item item) {
|
||||
|
@ -39,7 +38,7 @@ public class ItemModelProvider extends BaseItemModelProvider {
|
|||
generated(Items.RAW_BERYLLITE_ITEM.get(), new ResourceLocation("engage:item/beryllite_raw"));
|
||||
}
|
||||
|
||||
void blockParent(RegistryObject<Item> item, RegistryObject<Block> block) {
|
||||
withExistingParent(name(item.get()), modLoc(BLOCK_FOLDER + name(block.get())));
|
||||
void blockParent(Holder<Item> item, Holder<Block> block) {
|
||||
withExistingParent(name(item.value()), modLoc(BLOCK_FOLDER + name(block.value())));
|
||||
}
|
||||
}
|
|
@ -2,23 +2,25 @@ package uk.gemwire.engage.data.sprites;
|
|||
|
||||
import net.minecraft.client.renderer.texture.atlas.sources.DirectoryLister;
|
||||
import net.minecraft.client.renderer.texture.atlas.sources.SingleFile;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.common.data.SpriteSourceProvider;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.common.data.SpriteSourceProvider;
|
||||
import uk.gemwire.engage.registries.fluid.FluidDeferredRegister;
|
||||
import uk.gemwire.engage.registries.fluid.FluidRegistryObject;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class BaseSpriteSourceProvider extends SpriteSourceProvider {
|
||||
|
||||
private final Set<ResourceLocation> trackedSingles = new HashSet<>();
|
||||
|
||||
protected BaseSpriteSourceProvider(PackOutput output, String modid, ExistingFileHelper fileHelper) {
|
||||
super(output, fileHelper, modid);
|
||||
protected BaseSpriteSourceProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, String modid, ExistingFileHelper fileHelper) {
|
||||
super(output, lookupProvider, modid, fileHelper);
|
||||
}
|
||||
|
||||
protected void addFiles(SourceList atlas, ResourceLocation... resourceLocations) {
|
||||
|
@ -42,7 +44,7 @@ public class BaseSpriteSourceProvider extends SpriteSourceProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void addSources() {
|
||||
protected void gather() {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
package uk.gemwire.engage.data.sprites;
|
||||
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import uk.gemwire.engage.registries.Fluids;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class SpriteSourceProvider extends BaseSpriteSourceProvider {
|
||||
|
||||
|
||||
public SpriteSourceProvider(PackOutput output, ExistingFileHelper fileHelper) {
|
||||
super(output, "engage", fileHelper);
|
||||
public SpriteSourceProvider(PackOutput output, CompletableFuture<HolderLookup.Provider> lookupProvider, ExistingFileHelper fileHelper) {
|
||||
super(output, lookupProvider, "engage", fileHelper);
|
||||
}
|
||||
@Override
|
||||
protected void addSources() {
|
||||
protected void gather() {
|
||||
SourceList atlas = atlas(BLOCKS_ATLAS);
|
||||
|
||||
addFluids(atlas, Fluids.FLUIDS_REGISTRY);
|
||||
|
|
|
@ -5,6 +5,7 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
|
|||
import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.CachedOutput;
|
||||
import net.minecraft.data.DataProvider;
|
||||
|
@ -22,9 +23,7 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import uk.gemwire.engage.registries.fluid.FluidRegistryObject;
|
||||
|
||||
|
@ -75,7 +74,7 @@ public abstract class BaseTagProvider implements DataProvider {
|
|||
}).thenCompose(registries -> {
|
||||
for (Block block : getAllBlocks()) {
|
||||
if (block.defaultBlockState().requiresCorrectToolForDrops() && !knownHarvestRequirements.contains(block)) {
|
||||
throw new IllegalStateException("Missing harvest tool type for block '" + ForgeRegistries.BLOCKS.getKey(block) + "' that requires the correct tool for drops.");
|
||||
throw new IllegalStateException("Missing harvest tool type for block '" + BuiltInRegistries.BLOCK.getKey(block) + "' that requires the correct tool for drops.");
|
||||
}
|
||||
}
|
||||
List<CompletableFuture<?>> futures = new ArrayList<>();
|
||||
|
@ -111,28 +110,28 @@ public abstract class BaseTagProvider implements DataProvider {
|
|||
return new IntrinsicEngageTagBuilder<>(keyExtractor, getTagBuilder(registry, tag), modid);
|
||||
}
|
||||
|
||||
protected <TYPE> IntrinsicEngageTagBuilder<TYPE> getBuilder(IForgeRegistry<TYPE> registry, TagKey<TYPE> tag) {
|
||||
return new IntrinsicEngageTagBuilder<>(element -> registry.getResourceKey(element).orElseThrow(), getTagBuilder(registry.getRegistryKey(), tag), modid);
|
||||
protected <TYPE> IntrinsicEngageTagBuilder<TYPE> getBuilder(Registry<TYPE> registry, TagKey<TYPE> tag) {
|
||||
return new IntrinsicEngageTagBuilder<>(element -> registry.getResourceKey(element).orElseThrow(), getTagBuilder(registry.key(), tag), modid);
|
||||
}
|
||||
|
||||
protected IntrinsicEngageTagBuilder<Item> getItemBuilder(TagKey<Item> tag) {
|
||||
return getBuilder(ForgeRegistries.ITEMS, tag);
|
||||
return getBuilder(BuiltInRegistries.ITEM, tag);
|
||||
}
|
||||
|
||||
protected IntrinsicEngageTagBuilder<Block> getBlockBuilder(TagKey<Block> tag) {
|
||||
return getBuilder(ForgeRegistries.BLOCKS, tag);
|
||||
return getBuilder(BuiltInRegistries.BLOCK, tag);
|
||||
}
|
||||
|
||||
protected IntrinsicEngageTagBuilder<EntityType<?>> getEntityTypeBuilder(TagKey<EntityType<?>> tag) {
|
||||
return getBuilder(ForgeRegistries.ENTITY_TYPES, tag);
|
||||
return getBuilder(BuiltInRegistries.ENTITY_TYPE, tag);
|
||||
}
|
||||
|
||||
protected IntrinsicEngageTagBuilder<Fluid> getFluidBuilder(TagKey<Fluid> tag) {
|
||||
return getBuilder(ForgeRegistries.FLUIDS, tag);
|
||||
return getBuilder(BuiltInRegistries.FLUID, tag);
|
||||
}
|
||||
|
||||
protected IntrinsicEngageTagBuilder<BlockEntityType<?>> getTileEntityTypeBuilder(TagKey<BlockEntityType<?>> tag) {
|
||||
return getBuilder(ForgeRegistries.BLOCK_ENTITY_TYPES, tag);
|
||||
return getBuilder(BuiltInRegistries.BLOCK_ENTITY_TYPE, tag);
|
||||
}
|
||||
|
||||
protected IntrinsicEngageTagBuilder<GameEvent> getGameEventBuilder(TagKey<GameEvent> tag) {
|
||||
|
@ -144,7 +143,7 @@ public abstract class BaseTagProvider implements DataProvider {
|
|||
}
|
||||
|
||||
protected IntrinsicEngageTagBuilder<MobEffect> getMobEffectBuilder(TagKey<MobEffect> tag) {
|
||||
return getBuilder(ForgeRegistries.MOB_EFFECTS, tag);
|
||||
return getBuilder(BuiltInRegistries.MOB_EFFECT, tag);
|
||||
}
|
||||
|
||||
protected void addToTag(TagKey<Item> tag, ItemLike... itemProviders) {
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package uk.gemwire.engage.data.tags.block;
|
||||
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.data.PackOutput;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
|
@ -9,10 +11,8 @@ import net.minecraft.tags.ItemTags;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.neoforge.common.Tags;
|
||||
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
||||
import uk.gemwire.engage.data.tags.BaseTagProvider;
|
||||
import uk.gemwire.engage.registries.Blocks;
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class BlockTagProvider extends BaseTagProvider {
|
|||
|
||||
@Override
|
||||
protected List<Block> getAllBlocks() {
|
||||
return Blocks.BLOCKS_REGISTRY.getEntries().stream().map(RegistryObject::get).toList();
|
||||
return Blocks.BLOCKS_REGISTRY.getEntries().stream().map(Holder::value).toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -40,8 +40,8 @@ public class BlockTagProvider extends BaseTagProvider {
|
|||
private void addOres() {
|
||||
List<Block> ores = List.of(Blocks.BERYLLITE_ORE_BLOCK.block().get());
|
||||
for (Block ore : ores) {
|
||||
TagKey<Item> itemTag = ItemTags.create(new ResourceLocation("forge:ores/" + ForgeRegistries.ITEMS.getKey(ore.asItem()).getPath()));
|
||||
TagKey<Block> blockTag = BlockTags.create(new ResourceLocation("forge:ores/" + ForgeRegistries.BLOCKS.getKey(ore).getPath()));
|
||||
TagKey<Item> itemTag = ItemTags.create(new ResourceLocation("forge:ores/" + BuiltInRegistries.ITEM.getKey(ore.asItem()).getPath()));
|
||||
TagKey<Block> blockTag = BlockTags.create(new ResourceLocation("forge:ores/" + BuiltInRegistries.BLOCK.getKey(ore).getPath()));
|
||||
addToTags(itemTag, blockTag, ore);
|
||||
getItemBuilder(Tags.Items.ORES).add(itemTag);
|
||||
getBlockBuilder(Tags.Blocks.ORES).add(blockTag);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
// 1.20.1 2023-08-06T18:06:42.586222 Item model provider: engage
|
||||
b3abd1796143a506e2c7f2ffdefeb61e235a8689 assets/engage/models/item/antideuterium_bucket.json
|
||||
// 1.20.4 2023-12-25T00:16:17.3389358 Item model provider: engage
|
||||
a4ad24b327f697af5ce768f763ba6b8f6229a05f assets/engage/models/item/antideuterium_bucket.json
|
||||
8b05e6a927ff10a8e07dd1d0632435d42b705ab6 assets/engage/models/item/beryllite_raw.json
|
||||
ca322f154c4d4ab99647bfa2ebb939b9284fad9a assets/engage/models/item/deuterium_bucket.json
|
||||
725bfdd287ed277d7b78d3a295ea5a71b63b40fa assets/engage/models/item/deuterium_slush_bucket.json
|
||||
50ee03ab71a0bc46941091c9c8cb8f9b516368c7 assets/engage/models/item/heavy_water_bucket.json
|
||||
226a78ddeaaecb840cb16d7b6236f62978adbb72 assets/engage/models/item/propane_bucket.json
|
||||
2537ffcc0380ed93e47909ce598b76ee501bb5f3 assets/engage/models/item/warp_plasma_bucket.json
|
||||
fd1a1dee42420fa9bd983568add5f7dd9cadd6cb assets/engage/models/item/deuterium_bucket.json
|
||||
2d8378928b331d16d9343144bdfa5ff027c735d7 assets/engage/models/item/deuterium_slush_bucket.json
|
||||
35f0abf2c94aaf072e9fde5f915602a22e724cb3 assets/engage/models/item/heavy_water_bucket.json
|
||||
310b2b21379c57680d8e43427d2c9781697645ea assets/engage/models/item/propane_bucket.json
|
||||
7690d775c03e917a6782457cf9b9eb066e85754a assets/engage/models/item/warp_plasma_bucket.json
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
// 1.20.1 2023-08-29T22:27:09.2602278 Loot Tables
|
||||
// 1.20.4 2023-12-25T00:16:17.3537196 Loot Tables
|
||||
22933ac7663f965e6fe3c560231b4bcb76c43bfa data/engage/loot_tables/blocks/beryllite_ore.json
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
// 1.20.1 2023-06-30T03:04:16.2664787 atlases generator for engage
|
||||
// 1.20.4 2023-12-25T00:16:17.3527194 atlases generator for engage
|
||||
11e6e1f83c37071af466a42d29a662f54c2253c8 assets/minecraft/atlases/blocks.json
|
||||
|
|
|
@ -1 +1 @@
|
|||
// 1.20.1 2023-06-30T03:19:18.0192671 Block model provider: engage
|
||||
// 1.20.4 2023-12-25T00:16:17.3507174 Block model provider: engage
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1.20.1 2023-08-06T18:06:42.5913045 Block state provider: engage
|
||||
// 1.20.4 2023-12-25T00:16:17.3507174 Block state provider: engage
|
||||
4af9c861d7727e9ee266ca6e10d9c78c9e4104ba assets/engage/blockstates/antideuterium.json
|
||||
163e87835e33814e2cad190c2265142f42e18ba9 assets/engage/blockstates/beryllite_ore.json
|
||||
1bb5f9aee9050675d6749ef05c6308e655a6e4ff assets/engage/blockstates/compressor.json
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// 1.20.1 2023-06-30T03:04:16.2714951 Tags: engage
|
||||
// 1.20.4 2023-12-25T00:16:17.3547194 Tags: engage
|
||||
36ddf7e815c8651764d9b434226769617f395c02 data/forge/tags/blocks/ores.json
|
||||
af866d91e488f4393cdfb764b61ac425837ec4a6 data/forge/tags/blocks/ores/beryllite_ore.json
|
||||
af866d91e488f4393cdfb764b61ac425837ec4a6 data/forge/tags/blocks/ores_in_ground/stone.json
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
// 1.20.1 2023-06-30T04:23:53.8939811 Languages: en_us
|
||||
bb27af69172d87ab45300a72da603a98b770a06e assets/engage/lang/en_us.json
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "forge:item/bucket",
|
||||
"parent": "minecraft:item/bucket",
|
||||
"fluid": "engage:antideuterium",
|
||||
"loader": "forge:fluid_container"
|
||||
"loader": "neoforge:fluid_container"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "forge:item/bucket",
|
||||
"parent": "minecraft:item/bucket",
|
||||
"fluid": "engage:deuterium",
|
||||
"loader": "forge:fluid_container"
|
||||
"loader": "neoforge:fluid_container"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "forge:item/bucket",
|
||||
"parent": "minecraft:item/bucket",
|
||||
"fluid": "engage:deuterium_slush",
|
||||
"loader": "forge:fluid_container"
|
||||
"loader": "neoforge:fluid_container"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "forge:item/bucket",
|
||||
"parent": "minecraft:item/bucket",
|
||||
"fluid": "engage:heavy_water",
|
||||
"loader": "forge:fluid_container"
|
||||
"loader": "neoforge:fluid_container"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "forge:item/bucket",
|
||||
"parent": "minecraft:item/bucket",
|
||||
"fluid": "engage:propane",
|
||||
"loader": "forge:fluid_container"
|
||||
"loader": "neoforge:fluid_container"
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"parent": "forge:item/bucket",
|
||||
"parent": "minecraft:item/bucket",
|
||||
"fluid": "engage:warp_plasma",
|
||||
"loader": "forge:fluid_container"
|
||||
"loader": "neoforge:fluid_container"
|
||||
}
|
|
@ -1,22 +1,21 @@
|
|||
package uk.gemwire.engage;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.server.ServerStartedEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import uk.gemwire.engage.block.coolant.CoolantBaseBlock;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
import net.minecraft.world.item.CreativeModeTabs;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.neoforged.neoforge.common.CreativeModeTabRegistry;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.server.ServerStartedEvent;
|
||||
import uk.gemwire.engage.registries.Blocks;
|
||||
import uk.gemwire.engage.registries.Fluids;
|
||||
import uk.gemwire.engage.registries.Items;
|
||||
import uk.gemwire.engage.registries.Worldgen;
|
||||
import uk.gemwire.engage.registries.fluid.FluidDeferredRegister;
|
||||
import uk.gemwire.engage.systems.coolant.CoolantNetworkGraph;
|
||||
import uk.gemwire.engage.systems.coolant.CoolantNetworksSavedData;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Engage adds four varieties of Warp Core for power generation, based on:
|
||||
|
@ -63,17 +62,19 @@ import java.util.Set;
|
|||
@Mod("engage")
|
||||
public class Engage {
|
||||
|
||||
public Engage() {
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
public Engage(IEventBus bus) {
|
||||
// registry classes
|
||||
Items.ITEMS_REGISTRY.register(bus);
|
||||
Items.CREATIVE_TABS_REGISTRY.register(bus);
|
||||
Blocks.BLOCKS_REGISTRY.register(bus);
|
||||
Fluids.FLUIDS_REGISTRY.register(bus);
|
||||
Worldgen.CARVER_REGISTRY.register(bus);
|
||||
Worldgen.BIOME_MODIFIER_SERIALIZERS.register(bus);
|
||||
|
||||
|
||||
|
||||
bus.addListener(this::commonSetup);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
||||
NeoForge.EVENT_BUS.addListener(this::serverStarted);
|
||||
}
|
||||
|
||||
public void commonSetup(FMLCommonSetupEvent e) { }
|
||||
|
|
|
@ -3,12 +3,12 @@ package uk.gemwire.engage.client;
|
|||
import net.minecraft.client.color.item.ItemColor;
|
||||
import net.minecraft.client.renderer.ItemBlockRenderTypes;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
|
||||
import net.minecraftforge.client.model.DynamicFluidContainerModel;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent;
|
||||
import net.neoforged.neoforge.client.model.DynamicFluidContainerModel;
|
||||
import uk.gemwire.engage.registries.Fluids;
|
||||
import uk.gemwire.engage.registries.fluid.FluidDeferredRegister;
|
||||
import uk.gemwire.engage.registries.fluid.FluidRegistryObject;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package uk.gemwire.engage.registries;
|
||||
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
|
@ -8,13 +9,10 @@ import net.minecraft.world.level.block.DropExperienceBlock;
|
|||
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.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import uk.gemwire.engage.block.coolant.CoolantBaseBlock;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.rmi.registry.Registry;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
|
@ -22,33 +20,32 @@ import java.util.function.Supplier;
|
|||
*/
|
||||
public class Blocks {
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS_REGISTRY = DeferredRegister.create(ForgeRegistries.BLOCKS, "engage");
|
||||
public static final DeferredRegister<Block> BLOCKS_REGISTRY = DeferredRegister.create(Registries.BLOCK, "engage");
|
||||
|
||||
// Beryllite Ore, the raw form of Beryllite - the reaction control substance.
|
||||
public static final BlockItemRegistryObject BERYLLITE_ORE_BLOCK = registerBlockItem("beryllite_ore", () -> new DropExperienceBlock(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F), UniformInt.of(0, 2)));
|
||||
public static final BlockItemHolder BERYLLITE_ORE_BLOCK = registerBlockItem("beryllite_ore", () -> new DropExperienceBlock(UniformInt.of(0, 2), BlockBehaviour.Properties.of().mapColor(MapColor.STONE).instrument(NoteBlockInstrument.BASEDRUM).requiresCorrectToolForDrops().strength(3.0F, 3.0F)));
|
||||
|
||||
// The Compressor, the source of pressure in a coolant system, and the Propane intake.
|
||||
public static final BlockItemRegistryObject COMPRESSOR_BLOCK = registerBlockItem("compressor", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
public static final BlockItemHolder COMPRESSOR_BLOCK = registerBlockItem("compressor", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
// Copper Tubes, connecting the components of the Coolant System
|
||||
public static final BlockItemRegistryObject COPPER_TUBE_BLOCK = registerBlockItem("copper_tube", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
public static final BlockItemHolder COPPER_TUBE_BLOCK = registerBlockItem("copper_tube", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
// Heat Spreaders, the parts that get hot and cold.
|
||||
public static final BlockItemRegistryObject COOLANT_HEAT_SPREADER_BLOCK = registerBlockItem("heat_spreader", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
public static final BlockItemHolder COOLANT_HEAT_SPREADER_BLOCK = registerBlockItem("heat_spreader", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
// Metering Device, creates a pressure gradient after the evaporator so that the coolant can condense
|
||||
public static final BlockItemRegistryObject COOLANT_METERING_BLOCK = registerBlockItem("coolant_meter", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
public static final BlockItemHolder COOLANT_METERING_BLOCK = registerBlockItem("coolant_meter", () -> new CoolantBaseBlock(BlockBehaviour.Properties.of()));
|
||||
|
||||
static BlockItemRegistryObject registerBlockItem(String name, Supplier<Block> block, Item.Properties properties) {
|
||||
RegistryObject<Block> b = BLOCKS_REGISTRY.register(name, block);
|
||||
RegistryObject<Item> i = Items.ITEMS_REGISTRY.register(name, () -> new BlockItem(b.get(), properties));
|
||||
return new BlockItemRegistryObject(b, i);
|
||||
static BlockItemHolder registerBlockItem(String name, Supplier<Block> block, Item.Properties properties) {
|
||||
DeferredHolder<Block, Block> b = BLOCKS_REGISTRY.register(name, block);
|
||||
DeferredHolder<Item, Item> i = Items.ITEMS_REGISTRY.register(name, () -> new BlockItem(b.get(), properties));
|
||||
return new BlockItemHolder(b, i);
|
||||
}
|
||||
|
||||
static BlockItemRegistryObject registerBlockItem(String name, Supplier<Block> block) {
|
||||
RegistryObject<Block> b = BLOCKS_REGISTRY.register(name, block);
|
||||
RegistryObject<Item> i = Items.ITEMS_REGISTRY.register(name, () -> new BlockItem(b.get(), new Item.Properties()));
|
||||
return new BlockItemRegistryObject(b, i);
|
||||
static BlockItemHolder registerBlockItem(String name, Supplier<Block> block) {
|
||||
DeferredHolder<Block, Block> b = BLOCKS_REGISTRY.register(name, block);
|
||||
DeferredHolder<Item, Item> i = Items.ITEMS_REGISTRY.register(name, () -> new BlockItem(b.get(), new Item.Properties()));
|
||||
return new BlockItemHolder(b, i);
|
||||
}
|
||||
|
||||
public record BlockItemRegistryObject(RegistryObject<Block> block, RegistryObject<Item> item) {
|
||||
|
||||
public record BlockItemHolder(DeferredHolder<Block, Block> block, DeferredHolder<Item, Item> item) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,42 @@
|
|||
package uk.gemwire.engage.registries;
|
||||
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.world.item.CreativeModeTab;
|
||||
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.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
/**
|
||||
* A utility class containing the registration and RegistryObjects of all the mods' items.
|
||||
*/
|
||||
public class Items {
|
||||
|
||||
public static final DeferredRegister<Item> ITEMS_REGISTRY = DeferredRegister.create(ForgeRegistries.ITEMS, "engage");
|
||||
public static final DeferredRegister<Item> ITEMS_REGISTRY = DeferredRegister.create(Registries.ITEM, "engage");
|
||||
public static final DeferredRegister<CreativeModeTab> CREATIVE_TABS_REGISTRY = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, "engage");
|
||||
|
||||
public static final Holder<CreativeModeTab> ENGAGE_TAB = CREATIVE_TABS_REGISTRY.register("engage", () ->
|
||||
CreativeModeTab.builder()
|
||||
.title(Component.literal("Engage!").withStyle(Style.EMPTY.withItalic(true)))
|
||||
.displayItems((a,b) -> {
|
||||
b.accept(Items.RAW_BERYLLITE_ITEM.get());
|
||||
b.accept(Blocks.BERYLLITE_ORE_BLOCK.item().get());
|
||||
b.accept(Blocks.COPPER_TUBE_BLOCK.item().get());
|
||||
b.accept(Blocks.COMPRESSOR_BLOCK.item().get());
|
||||
b.accept(Blocks.COOLANT_METERING_BLOCK.item().get());
|
||||
b.accept(Blocks.COOLANT_HEAT_SPREADER_BLOCK.item().get());
|
||||
b.accept(Fluids.PROPANE_FLUID.getBucket());
|
||||
b.accept(Fluids.HEAVY_WATER_FLUID.getBucket());
|
||||
b.accept(Fluids.DEUTERIUM_FLUID.getBucket());
|
||||
b.accept(Fluids.ANTIDEUTERIUM_FLUID.getBucket());
|
||||
b.accept(Fluids.DEUTERIUM_SLUSH_FLUID.getBucket());
|
||||
b.accept(Fluids.WARP_PLASMA_FLUID.getBucket());
|
||||
})
|
||||
.build()
|
||||
);
|
||||
|
||||
// Raw (Unprocessed) Beryllite - the reaction control substance.
|
||||
public static final RegistryObject<Item> RAW_BERYLLITE_ITEM = ITEMS_REGISTRY.register("beryllite_raw", () -> new Item(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, Item> RAW_BERYLLITE_ITEM = ITEMS_REGISTRY.register("beryllite_raw", () -> new Item(new Item.Properties()));
|
||||
}
|
||||
|
|
|
@ -2,29 +2,25 @@ package uk.gemwire.engage.registries;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraft.world.level.levelgen.carver.WorldCarver;
|
||||
import net.minecraftforge.common.world.BiomeModifier;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.neoforge.common.world.BiomeModifier;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||
import uk.gemwire.engage.worldgen.PropaneCaveCarver;
|
||||
import uk.gemwire.engage.worldgen.PropaneCaveCarverConfiguration;
|
||||
import uk.gemwire.engage.worldgen.modifiers.AddCarverBiomeModifier;
|
||||
|
||||
public class Worldgen {
|
||||
public static final DeferredRegister<WorldCarver<?>> CARVER_REGISTRY = DeferredRegister.create(ForgeRegistries.WORLD_CARVERS, "engage");
|
||||
public static final DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(ForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, "engage");
|
||||
public static final DeferredRegister<WorldCarver<?>> CARVER_REGISTRY = DeferredRegister.create(Registries.CARVER, "engage");
|
||||
public static final DeferredRegister<Codec<? extends BiomeModifier>> BIOME_MODIFIER_SERIALIZERS = DeferredRegister.create(NeoForgeRegistries.Keys.BIOME_MODIFIER_SERIALIZERS, "engage");
|
||||
|
||||
public static final RegistryObject<WorldCarver<?>> PROPANE_CARVER = CARVER_REGISTRY.register("propane_cave", () -> new PropaneCaveCarver(PropaneCaveCarverConfiguration.CODEC));
|
||||
public static final DeferredHolder<WorldCarver<?>, WorldCarver<?>> PROPANE_CARVER = CARVER_REGISTRY.register("propane_cave", () -> new PropaneCaveCarver(PropaneCaveCarverConfiguration.CODEC));
|
||||
|
||||
public static final RegistryObject<Codec<AddCarverBiomeModifier>> ADD_CARVERS_BIOME_MODIFIER_TYPE = Worldgen.BIOME_MODIFIER_SERIALIZERS.register("add_carvers", () ->
|
||||
RecordCodecBuilder.create(builder -> builder.group(
|
||||
Biome.LIST_CODEC.fieldOf("biomes").forGetter(AddCarverBiomeModifier::biomes),
|
||||
ConfiguredWorldCarver.LIST_CODEC.fieldOf("carvers").forGetter(AddCarverBiomeModifier::carvers),
|
||||
GenerationStep.Carving.CODEC.fieldOf("step").forGetter(AddCarverBiomeModifier::step)
|
||||
).apply(builder, AddCarverBiomeModifier::new))
|
||||
);
|
||||
public static final DeferredHolder<Codec<? extends BiomeModifier>, Codec<AddCarverBiomeModifier>> ADD_CARVERS_BIOME_MODIFIER_TYPE = Worldgen.BIOME_MODIFIER_SERIALIZERS.register("add_carvers", () -> AddCarverBiomeModifier.CODEC);
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@ package uk.gemwire.engage.registries.fluid;
|
|||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockSource;
|
||||
import net.minecraft.core.dispenser.BlockSource;
|
||||
import net.minecraft.core.dispenser.DefaultDispenseItemBehavior;
|
||||
import net.minecraft.core.dispenser.DispenseItemBehavior;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.item.*;
|
||||
|
@ -18,14 +19,14 @@ import net.minecraft.world.level.block.state.BlockBehaviour;
|
|||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.MapColor;
|
||||
import net.minecraft.world.level.material.PushReaction;
|
||||
import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.minecraftforge.common.SoundActions;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fluids.ForgeFlowingFluid;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.client.extensions.common.IClientFluidTypeExtensions;
|
||||
import net.neoforged.neoforge.common.SoundActions;
|
||||
import net.neoforged.neoforge.fluids.BaseFlowingFluid;
|
||||
import net.neoforged.neoforge.fluids.FluidStack;
|
||||
import net.neoforged.neoforge.fluids.FluidType;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -49,9 +50,9 @@ public class FluidDeferredRegister {
|
|||
@NotNull
|
||||
@Override
|
||||
public ItemStack execute(@NotNull BlockSource source, @NotNull ItemStack stack) {
|
||||
Level world = source.getLevel();
|
||||
Level world = source.level();
|
||||
DispensibleContainerItem bucket = (DispensibleContainerItem) stack.getItem();
|
||||
BlockPos pos = source.getPos().relative(source.getBlockState().getValue(DispenserBlock.FACING));
|
||||
BlockPos pos = source.pos().relative(source.state().getValue(DispenserBlock.FACING));
|
||||
if (bucket.emptyContents(null, world, pos, null)) {
|
||||
bucket.checkExtraContent(null, world, stack, pos);
|
||||
return new ItemStack(Items.BUCKET);
|
||||
|
@ -76,13 +77,13 @@ public class FluidDeferredRegister {
|
|||
|
||||
public FluidDeferredRegister(String modid) {
|
||||
this.modid = modid;
|
||||
blockRegister = DeferredRegister.create(ForgeRegistries.BLOCKS, modid);
|
||||
fluidRegister = DeferredRegister.create(ForgeRegistries.FLUIDS, modid);
|
||||
fluidTypeRegister = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, modid);
|
||||
itemRegister = DeferredRegister.create(ForgeRegistries.ITEMS, modid);
|
||||
blockRegister = DeferredRegister.create(Registries.BLOCK, modid);
|
||||
fluidRegister = DeferredRegister.create(Registries.FLUID, modid);
|
||||
fluidTypeRegister = DeferredRegister.create(NeoForgeRegistries.FLUID_TYPES, modid);
|
||||
itemRegister = DeferredRegister.create(Registries.ITEM, modid);
|
||||
}
|
||||
|
||||
public FluidRegistryObject<MekanismFluidType, ForgeFlowingFluid.Source, ForgeFlowingFluid.Flowing, LiquidBlock, BucketItem> registerLiquidChemical(IChemicalConstant constants) {
|
||||
public FluidRegistryObject<MekanismFluidType, BaseFlowingFluid.Source, BaseFlowingFluid.Flowing, LiquidBlock, BucketItem> registerLiquidChemical(IChemicalConstant constants) {
|
||||
int density = Math.round(constants.getDensity());
|
||||
return register(constants.getName(), properties -> properties
|
||||
.temperature(Math.round(constants.getTemperature()))
|
||||
|
@ -93,22 +94,22 @@ public class FluidDeferredRegister {
|
|||
);
|
||||
}
|
||||
|
||||
public FluidRegistryObject<MekanismFluidType, ForgeFlowingFluid.Source, ForgeFlowingFluid.Flowing, LiquidBlock, BucketItem> register(String name, UnaryOperator<FluidTypeRenderProperties> renderProperties) {
|
||||
public FluidRegistryObject<MekanismFluidType, BaseFlowingFluid.Source, BaseFlowingFluid.Flowing, LiquidBlock, BucketItem> register(String name, UnaryOperator<FluidTypeRenderProperties> renderProperties) {
|
||||
return register(name, UnaryOperator.identity(), renderProperties);
|
||||
}
|
||||
|
||||
public FluidRegistryObject<MekanismFluidType, ForgeFlowingFluid.Source, ForgeFlowingFluid.Flowing, LiquidBlock, BucketItem> register(String name, UnaryOperator<FluidType.Properties> properties,
|
||||
public FluidRegistryObject<MekanismFluidType, BaseFlowingFluid.Source, BaseFlowingFluid.Flowing, LiquidBlock, BucketItem> register(String name, UnaryOperator<FluidType.Properties> properties,
|
||||
UnaryOperator<FluidTypeRenderProperties> renderProperties) {
|
||||
return register(name, BucketItem::new, properties, renderProperties);
|
||||
}
|
||||
|
||||
public <BUCKET extends BucketItem> FluidRegistryObject<MekanismFluidType, ForgeFlowingFluid.Source, ForgeFlowingFluid.Flowing, LiquidBlock, BUCKET> register(String name, BucketCreator<BUCKET> bucketCreator,
|
||||
public <BUCKET extends BucketItem> FluidRegistryObject<MekanismFluidType, BaseFlowingFluid.Source, BaseFlowingFluid.Flowing, LiquidBlock, BUCKET> register(String name, BucketCreator<BUCKET> bucketCreator,
|
||||
UnaryOperator<FluidType.Properties> fluidProperties, UnaryOperator<FluidTypeRenderProperties> renderProperties) {
|
||||
return register(name, fluidProperties.apply(getMekBaseBuilder()), renderProperties.apply(FluidTypeRenderProperties.builder()), bucketCreator,
|
||||
MekanismFluidType::new);
|
||||
}
|
||||
|
||||
public <TYPE extends MekanismFluidType, BUCKET extends BucketItem> FluidRegistryObject<TYPE, ForgeFlowingFluid.Source, ForgeFlowingFluid.Flowing, LiquidBlock, BUCKET> register(String name,
|
||||
public <TYPE extends MekanismFluidType, BUCKET extends BucketItem> FluidRegistryObject<TYPE, BaseFlowingFluid.Source, BaseFlowingFluid.Flowing, LiquidBlock, BUCKET> register(String name,
|
||||
FluidType.Properties properties, FluidTypeRenderProperties renderProperties, BucketCreator<BUCKET> bucketCreator,
|
||||
BiFunction<FluidType.Properties, FluidTypeRenderProperties, TYPE> fluidTypeCreator) {
|
||||
String flowingName = "flowing_" + name;
|
||||
|
@ -116,15 +117,15 @@ public class FluidDeferredRegister {
|
|||
//Set the translation string to the same as the block
|
||||
properties.descriptionId(Util.makeDescriptionId("block", new ResourceLocation(modid, name)));
|
||||
//Create the registry object and let the values init to null as before we actually call get on them, we will update the backing values
|
||||
FluidRegistryObject<TYPE, ForgeFlowingFluid.Source, ForgeFlowingFluid.Flowing, LiquidBlock, BUCKET> fluidRegistryObject = new FluidRegistryObject<>();
|
||||
FluidRegistryObject<TYPE, BaseFlowingFluid.Source, BaseFlowingFluid.Flowing, LiquidBlock, BUCKET> fluidRegistryObject = new FluidRegistryObject<>();
|
||||
//Pass in suppliers that are wrapped instead of direct references to the registry objects, so that when we update the registry object to
|
||||
// point to a new object it gets updated properly.
|
||||
ForgeFlowingFluid.Properties fluidProperties = new ForgeFlowingFluid.Properties(fluidRegistryObject::getFluidType, fluidRegistryObject::getStillFluid,
|
||||
BaseFlowingFluid.Properties fluidProperties = new BaseFlowingFluid.Properties(fluidRegistryObject::getFluidType, fluidRegistryObject::getStillFluid,
|
||||
fluidRegistryObject::getFlowingFluid).bucket(fluidRegistryObject::getBucket).block(fluidRegistryObject::getBlock);
|
||||
//Update the references to objects that are retrieved from the deferred registers
|
||||
fluidRegistryObject.updateFluidType(fluidTypeRegister.register(name, () -> fluidTypeCreator.apply(properties, renderProperties)));
|
||||
fluidRegistryObject.updateStill(fluidRegister.register(name, () -> new ForgeFlowingFluid.Source(fluidProperties)));
|
||||
fluidRegistryObject.updateFlowing(fluidRegister.register(flowingName, () -> new ForgeFlowingFluid.Flowing(fluidProperties)));
|
||||
fluidRegistryObject.updateStill(fluidRegister.register(name, () -> new BaseFlowingFluid.Source(fluidProperties)));
|
||||
fluidRegistryObject.updateFlowing(fluidRegister.register(flowingName, () -> new BaseFlowingFluid.Flowing(fluidProperties)));
|
||||
fluidRegistryObject.updateBucket(itemRegister.register(bucketName, () -> bucketCreator.create(fluidRegistryObject::getStillFluid,
|
||||
new Item.Properties().stacksTo(1).craftRemainder(Items.BUCKET))));
|
||||
//Note: The block properties used here is a copy of the ones for water
|
||||
|
|
|
@ -1,22 +1,23 @@
|
|||
package uk.gemwire.engage.registries.fluid;
|
||||
|
||||
|
||||
import net.minecraft.world.item.BucketItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.LiquidBlock;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.neoforged.neoforge.fluids.FluidType;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
// Yoinked from https://github.com/mekanism/Mekanism/blob/1.20.x/src/main/java/mekanism/common/registration/impl/FluidRegistryObject.java
|
||||
public class FluidRegistryObject<TYPE extends FluidType, STILL extends Fluid, FLOWING extends Fluid, BLOCK extends LiquidBlock, BUCKET extends BucketItem> {
|
||||
|
||||
private RegistryObject<TYPE> fluidTypeRO;
|
||||
private RegistryObject<STILL> stillRO;
|
||||
private RegistryObject<FLOWING> flowingRO;
|
||||
private RegistryObject<BLOCK> blockRO;
|
||||
private RegistryObject<BUCKET> bucketRO;
|
||||
private DeferredHolder<FluidType, TYPE> fluidTypeRO;
|
||||
private DeferredHolder<Fluid, STILL> stillRO;
|
||||
private DeferredHolder<Fluid, FLOWING> flowingRO;
|
||||
private DeferredHolder<Block, BLOCK> blockRO;
|
||||
private DeferredHolder<Item, BUCKET> bucketRO;
|
||||
|
||||
public TYPE getFluidType() {
|
||||
return fluidTypeRO.get();
|
||||
|
@ -39,23 +40,23 @@ public class FluidRegistryObject<TYPE extends FluidType, STILL extends Fluid, FL
|
|||
}
|
||||
|
||||
//Make sure these update methods are package local as only the FluidDeferredRegister should be messing with them
|
||||
void updateFluidType(RegistryObject<TYPE> fluidTypeRO) {
|
||||
void updateFluidType(DeferredHolder<FluidType, TYPE> fluidTypeRO) {
|
||||
this.fluidTypeRO = Objects.requireNonNull(fluidTypeRO);
|
||||
}
|
||||
|
||||
void updateStill(RegistryObject<STILL> stillRO) {
|
||||
void updateStill(DeferredHolder<Fluid, STILL> stillRO) {
|
||||
this.stillRO = Objects.requireNonNull(stillRO);
|
||||
}
|
||||
|
||||
void updateFlowing(RegistryObject<FLOWING> flowingRO) {
|
||||
void updateFlowing(DeferredHolder<Fluid, FLOWING> flowingRO) {
|
||||
this.flowingRO = Objects.requireNonNull(flowingRO);
|
||||
}
|
||||
|
||||
void updateBlock(RegistryObject<BLOCK> blockRO) {
|
||||
void updateBlock(DeferredHolder<Block, BLOCK> blockRO) {
|
||||
this.blockRO = Objects.requireNonNull(blockRO);
|
||||
}
|
||||
|
||||
void updateBucket(RegistryObject<BUCKET> bucketRO) {
|
||||
void updateBucket(DeferredHolder<Item, BUCKET> bucketRO) {
|
||||
this.bucketRO = Objects.requireNonNull(bucketRO);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ public class CoolantNetworkGraph {
|
|||
public enum ValidBlocks {
|
||||
COPPER_PIPE("pipe", Blocks.COPPER_TUBE_BLOCK.block().get()),
|
||||
COMPRESSOR("compressor", Blocks.COMPRESSOR_BLOCK.block().get()),
|
||||
METERING("metering", Blocks.COMPRESSOR_BLOCK.block().get()),
|
||||
METERING("metering", Blocks.COOLANT_METERING_BLOCK.block().get()),
|
||||
SPREADER("spreader", Blocks.COOLANT_HEAT_SPREADER_BLOCK.block().get());
|
||||
|
||||
public final String name;
|
||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.saveddata.SavedData;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
import net.neoforged.neoforge.server.ServerLifecycleHooks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import uk.gemwire.engage.block.coolant.CoolantBaseBlock;
|
||||
|
||||
|
@ -112,6 +112,6 @@ public class CoolantNetworksSavedData extends SavedData {
|
|||
|
||||
|
||||
public static CoolantNetworksSavedData getOrCreate(ServerLevel level) {
|
||||
return level.getDataStorage().computeIfAbsent(CoolantNetworksSavedData::load, CoolantNetworksSavedData::new, "coolant_graphs");
|
||||
return level.getDataStorage().computeIfAbsent(new SavedData.Factory<>(CoolantNetworksSavedData::new, CoolantNetworksSavedData::load, null), "coolant_graphs");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,37 @@
|
|||
package uk.gemwire.engage.worldgen.modifiers;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraftforge.common.world.BiomeGenerationSettingsBuilder;
|
||||
import net.minecraftforge.common.world.BiomeModifier;
|
||||
import net.minecraftforge.common.world.ModifiableBiomeInfo;
|
||||
import uk.gemwire.engage.registries.Worldgen;
|
||||
import net.neoforged.neoforge.common.world.BiomeGenerationSettingsBuilder;
|
||||
import net.neoforged.neoforge.common.world.BiomeModifier;
|
||||
import net.neoforged.neoforge.common.world.ModifiableBiomeInfo;
|
||||
|
||||
public record AddCarverBiomeModifier(HolderSet<Biome> biomes, HolderSet<ConfiguredWorldCarver<?>> carvers, GenerationStep.Carving step) implements BiomeModifier {
|
||||
public record AddCarverBiomeModifier(HolderSet<Biome> biomes, HolderSet<ConfiguredWorldCarver<?>> carvers, GenerationStep.Carving step) implements BiomeModifier {
|
||||
|
||||
public static final Codec<AddCarverBiomeModifier> CODEC = RecordCodecBuilder.create(builder ->
|
||||
builder
|
||||
.group(
|
||||
Biome.LIST_CODEC.fieldOf("biomes").forGetter(AddCarverBiomeModifier::biomes),
|
||||
ConfiguredWorldCarver.LIST_CODEC.fieldOf("carvers").forGetter(AddCarverBiomeModifier::carvers),
|
||||
GenerationStep.Carving.CODEC.fieldOf("step").forGetter(AddCarverBiomeModifier::step)
|
||||
)
|
||||
.apply(builder, AddCarverBiomeModifier::new)
|
||||
);
|
||||
@Override
|
||||
public void modify(Holder<Biome> biome, Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder)
|
||||
{
|
||||
if (phase == Phase.ADD && this.biomes.contains(biome))
|
||||
{
|
||||
public void modify(Holder<Biome> biome, Phase phase, ModifiableBiomeInfo.BiomeInfo.Builder builder) {
|
||||
if (phase == Phase.ADD && this.biomes.contains(biome)) {
|
||||
BiomeGenerationSettingsBuilder generationSettings = builder.getGenerationSettings();
|
||||
this.carvers.forEach(holder -> generationSettings.addCarver(this.step, holder));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Codec<? extends BiomeModifier> codec()
|
||||
{
|
||||
return Worldgen.ADD_CARVERS_BIOME_MODIFIER_TYPE.get();
|
||||
public Codec<? extends BiomeModifier> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
# This is an example mods.toml file. It contains the data relating to the loading mods.
|
||||
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
|
||||
# The overall format is standard TOML format, v0.5.0.
|
||||
# Note that there are a couple of TOML lists in this file.
|
||||
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
|
||||
modLoader="javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion="${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
|
@ -20,34 +15,17 @@ modId="${mod_id}" #mandatory
|
|||
version="${mod_version}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName="${mod_name}" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
#logoFile="examplemod.png" #optional
|
||||
# A text field displayed in the mod UI
|
||||
#credits="" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors="${mod_authors}" #optional
|
||||
# Display Test controls the display for your mod in the server connection screen
|
||||
# MATCH_VERSION means that your mod will cause a red X if the versions on client and server differ. This is the default behaviour and should be what you choose if you have server and client elements to your mod.
|
||||
# IGNORE_SERVER_VERSION means that your mod will not cause a red X if it's present on the server but not on the client. This is what you should use if you're a server only mod.
|
||||
# IGNORE_ALL_VERSION means that your mod will not cause a red X if it's present on the client or the server. This is a special case and should only be used if your mod has no server component.
|
||||
# NONE means that no display test is set on your mod. You need to do this yourself, see IExtensionPoint.DisplayTest for more information. You can define any scheme you wish with this value.
|
||||
# IMPORTANT NOTE: this is NOT an instruction as to which environments (CLIENT or DEDICATED SERVER) your mod loads on. Your mod should load (and maybe do nothing!) whereever it finds itself.
|
||||
#displayTest="MATCH_VERSION" # MATCH_VERSION is the default if nothing is specified (#optional)
|
||||
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description='''${mod_description}'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
[[dependencies.${mod_id}]] #optional
|
||||
# the modid of the dependency
|
||||
modId="forge" #mandatory
|
||||
modId="neoforge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory=true #mandatory
|
||||
type="required"
|
||||
# The version range of the dependency
|
||||
versionRange="${forge_version_range}" #mandatory
|
||||
versionRange="${neo_version_range}" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
|
||||
# BEFORE - This mod is loaded BEFORE the dependency
|
||||
# AFTER - This mod is loaded AFTER the dependency
|
||||
|
@ -57,7 +35,7 @@ description='''${mod_description}'''
|
|||
# Here's another dependency
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
type="required"
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange="${minecraft_version_range}"
|
||||
ordering="NONE"
|
||||
|
|
Loading…
Reference in New Issue
Block a user