Changes to be committed:
modified: build.gradle modified: gradle.properties modified: gradle/wrapper/gradle-wrapper.properties modified: src/main/java/net/montoyo/wd/SharedProxy.java modified: src/main/java/net/montoyo/wd/WebDisplays.java modified: src/main/java/net/montoyo/wd/registry/ItemRegistry.java
This commit is contained in:
parent
594c4decf3
commit
364285d99f
267
build.gradle
267
build.gradle
|
|
@ -1,78 +1,21 @@
|
|||
plugins {
|
||||
id 'eclipse'
|
||||
id 'idea'
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id 'net.neoforged.gradle' version '[6.0.18,6.2)'
|
||||
id 'org.spongepowered.mixin' version '0.7.+'
|
||||
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
|
||||
id 'net.neoforged.moddev' version '1.0.24'
|
||||
}
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
tasks.named('wrapper', Wrapper).configure {
|
||||
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
|
||||
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
|
||||
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
|
||||
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
|
||||
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
|
||||
distributionType = Wrapper.DistributionType.BIN
|
||||
}
|
||||
|
||||
version = mod_version
|
||||
group = maven_group // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = archives_base_name
|
||||
|
||||
// set java version
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
// required for making a functional mod
|
||||
sourceSets.main.resources.srcDirs += 'src/generated/resources'
|
||||
mixin.add sourceSets.main, "webdisplays.refmap.json"
|
||||
|
||||
// neoforge gradle
|
||||
minecraft {
|
||||
mappings channel: 'parchment', version: '2023.06.26-1.20.1'
|
||||
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
copyIdeResources = true
|
||||
|
||||
runs {
|
||||
client {
|
||||
properties 'mixin.env.remapRefMap': 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||
workingDirectory project.file('run')
|
||||
arg "-mixin.config=webdisplays.mixins.json"
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
webdisplays {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
properties 'mixin.env.remapRefMap': 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||
workingDirectory project.file('run')
|
||||
arg "-mixin.config=webdisplays.mixins.json"
|
||||
|
||||
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
mods {
|
||||
webdisplays {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data {
|
||||
workingDirectory project.file('run')
|
||||
properties 'mixin.env.remapRefMap': 'true'
|
||||
property 'mixin.env.refMapRemappingFile', "${project.projectDir}/build/createSrgToMcp/output.srg"
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
args '--mod', 'webdisplays', '--all', '--output', file('src/generated/resources/'), '--existing', sourceSets.main.resources.srcDirs[0]
|
||||
mods {
|
||||
webdisplays {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
group = mod_group_id
|
||||
|
||||
repositories{
|
||||
maven {
|
||||
|
|
@ -82,32 +25,176 @@ repositories{
|
|||
maven { url 'https://mcef-download.cinemamod.com/repositories/releases/' }
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName = mod_id
|
||||
}
|
||||
|
||||
// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||
|
||||
neoForge {
|
||||
// Specify the version of NeoForge to use.
|
||||
version = project.neo_version
|
||||
|
||||
parchment {
|
||||
mappingsVersion = project.parchment_mappings_version
|
||||
minecraftVersion = project.parchment_minecraft_version
|
||||
}
|
||||
|
||||
// This line is optional. Access Transformers are automatically detected
|
||||
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
// Default run configurations.
|
||||
// These can be tweaked, removed, or duplicated as needed.
|
||||
runs {
|
||||
client {
|
||||
client()
|
||||
|
||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
server {
|
||||
server()
|
||||
programArgument '--nogui'
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
// 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 {
|
||||
type = "gameTestServer"
|
||||
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
||||
}
|
||||
|
||||
data {
|
||||
data()
|
||||
|
||||
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||
// gameDirectory = project.file('run-data')
|
||||
|
||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
||||
}
|
||||
|
||||
// applies to all the run configs above
|
||||
configureEach {
|
||||
// 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.
|
||||
systemProperty '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
|
||||
logLevel = org.slf4j.event.Level.DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
mods {
|
||||
// define mod <-> source bindings
|
||||
// these are used to tell the game which sources are for which mod
|
||||
// mostly optional in a single mod project
|
||||
// but multi mod projects should define one per mod
|
||||
"${mod_id}" {
|
||||
sourceSet(sourceSets.main)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Include resources generated by data generators.
|
||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
||||
|
||||
// Sets up a dependency configuration called 'localRuntime'.
|
||||
// This configuration should be used instead of 'runtimeOnly' to declare
|
||||
// a dependency that will be present for runtime testing but that is
|
||||
// "optional", meaning it will not be pulled by dependents of this mod.
|
||||
configurations {
|
||||
runtimeClasspath.extendsFrom localRuntime
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.neoforged:forge:1.20.1-47.1.65'
|
||||
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
|
||||
|
||||
// useful for debugging performance problems
|
||||
implementation fg.deobf("curse.maven:spark-361579:4381167")
|
||||
implementation "curse.maven:spark-361579:4381167"
|
||||
// here because we need to manually open the VR keyboard
|
||||
compileOnly fg.deobf("curse.maven:vivecraft-667903:4794431")
|
||||
compileOnly "curse.maven:vivecraft-667903:4794431"
|
||||
|
||||
implementation fg.deobf("com.cinemamod:mcef-forge:2.1.1-1.20.1") {
|
||||
transitive = false
|
||||
implementation "com.cinemamod:mcef-neoforge:2.1.6-1.21.1"
|
||||
// Example optional mod dependency with JEI
|
||||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
|
||||
// compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
|
||||
// We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
|
||||
// localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
|
||||
|
||||
// Example mod dependency using a mod jar from ./libs with a flat dir repository
|
||||
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
|
||||
// The group id is ignored when searching -- in this case, it is "blank"
|
||||
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"
|
||||
|
||||
// Example mod dependency using a file as dependency
|
||||
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
|
||||
|
||||
// Example project dependency using a sister or child project:
|
||||
// implementation project(":myproject")
|
||||
|
||||
// For more info:
|
||||
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
// 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.
|
||||
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
|
||||
var replaceProperties = [
|
||||
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
|
||||
]
|
||||
inputs.properties replaceProperties
|
||||
expand replaceProperties
|
||||
from "src/main/templates"
|
||||
into "build/generated/sources/modMetadata"
|
||||
}
|
||||
// Include the output of "generateModMetadata" as an input directory for the build
|
||||
// this works with both building through Gradle and the IDE.
|
||||
sourceSets.main.resources.srcDir generateModMetadata
|
||||
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
|
||||
neoForge.ideSyncTask generateModMetadata
|
||||
|
||||
// Example configuration to allow publishing using the maven-publish plugin
|
||||
publishing {
|
||||
publications {
|
||||
register('mavenJava', MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
maven {
|
||||
url "file://${project.projectDir}/repo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// jar meta-info
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title": "WebDisplays",
|
||||
"Specification-Vendor": "CinemaMod Group",
|
||||
"Specification-Version": "1", // We are version 1 of ourselves
|
||||
"Implementation-Title": project.name,
|
||||
"Implementation-Version": project.version,
|
||||
"Implementation-Vendor": "CinemaMod Group",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
|
||||
"MixinConfigs": "webdisplays.mixins.json"
|
||||
])
|
||||
}
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
|
||||
}
|
||||
|
||||
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
||||
idea {
|
||||
module {
|
||||
downloadSources = true
|
||||
downloadJavadoc = true
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,49 @@
|
|||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs = -Xmx3G
|
||||
mod_version = 2.0.2-1.20.1
|
||||
mod_version = 3.0.2-1.21.1
|
||||
maven_group = com.cinemamod
|
||||
archives_base_name = webdisplays
|
||||
archives_base_name = webdisplays
|
||||
|
||||
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
|
||||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.configuration-cache=true
|
||||
|
||||
#read more on this at https://github.com/neoforged/ModDevGradle?tab=readme-ov-file#better-minecraft-parameter-names--javadoc-parchment
|
||||
# you can also find the latest versions at: https://parchmentmc.org/docs/getting-started
|
||||
parchment_minecraft_version=1.21.1
|
||||
parchment_mappings_version=2024.11.17
|
||||
# Environment Properties
|
||||
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
||||
# The Minecraft version must agree with the Neo version to get a valid artifact
|
||||
minecraft_version=1.21.1
|
||||
# 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.21.1, 1.22)
|
||||
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||
neo_version=21.1.92
|
||||
# The Neo version range can use any version of Neo as bounds
|
||||
neo_version_range=[21.1.0,)
|
||||
# The loader version range can only use the major version of FML as bounds
|
||||
loader_version_range=[4,)
|
||||
|
||||
## Mod Properties
|
||||
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=examplemod
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=Example Mod
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
# 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
|
||||
mod_group_id=com.example.examplemod
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=YourNameHere, OtherNameHere
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=Example mod description.\nNewline characters can be used and will be replaced properly.
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ import net.minecraft.world.item.ItemStack;
|
|||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
import net.montoyo.wd.core.HasAdvancement;
|
||||
import net.montoyo.wd.core.JSServerRequest;
|
||||
import net.montoyo.wd.data.GuiData;
|
||||
|
|
@ -28,6 +26,8 @@ import net.montoyo.wd.utilities.math.Vector3i;
|
|||
import net.montoyo.wd.utilities.data.BlockSide;
|
||||
import net.montoyo.wd.utilities.data.Rotation;
|
||||
import net.montoyo.wd.utilities.serialization.NameUUIDPair;
|
||||
import net.neoforged.neoforge.network.handling.IPayloadContext;
|
||||
import net.neoforged.neoforge.server.ServerLifecycleHooks;
|
||||
import org.joml.Vector3d;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
|
@ -52,8 +52,8 @@ public class SharedProxy {
|
|||
return getServer().getLevel(dim);
|
||||
}
|
||||
|
||||
public BlockGetter getWorld(NetworkEvent.Context context) {
|
||||
if (context.getSender() != null) return context.getSender().level();
|
||||
public BlockGetter getWorld(IPayloadContext context) {
|
||||
if (context.player().level() != null) return context.player().level();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import net.minecraft.advancements.Advancement;
|
|||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
|
|
@ -20,23 +19,17 @@ import net.minecraft.world.entity.Entity;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.client.event.ClientChatEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.ServerChatEvent;
|
||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.level.LevelEvent;
|
||||
import net.minecraftforge.event.server.ServerStoppingEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.network.PacketDistributor;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.neoforged.fml.ModLoadingContext;
|
||||
import net.neoforged.neoforge.client.event.ClientChatEvent;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.ServerChatEvent;
|
||||
import net.neoforged.neoforge.event.entity.item.ItemTossEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
import net.neoforged.neoforge.event.level.LevelEvent;
|
||||
import net.neoforged.neoforge.event.server.ServerStoppingEvent;
|
||||
import net.neoforged.neoforge.network.PacketDistributor;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
import net.neoforged.neoforge.registries.NeoForgeRegistries;
|
||||
import net.montoyo.wd.client.ClientProxy;
|
||||
import net.montoyo.wd.client.gui.camera.KeyboardCamera;
|
||||
import net.montoyo.wd.config.ClientConfig;
|
||||
|
|
@ -53,13 +46,18 @@ import net.montoyo.wd.registry.WDTabs;
|
|||
import net.montoyo.wd.utilities.DistSafety;
|
||||
import net.montoyo.wd.utilities.Log;
|
||||
import net.montoyo.wd.utilities.serialization.Util;
|
||||
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.fml.loading.FMLEnvironment;
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
@Mod("webdisplays")
|
||||
public class WebDisplays {
|
||||
|
|
@ -113,10 +111,10 @@ public class WebDisplays {
|
|||
|
||||
if (FMLEnvironment.dist.isClient()) {
|
||||
// proxies are annoying, so from now on, I'mma be just registering stuff in here
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(ClientProxy::onKeybindRegistry);
|
||||
MinecraftForge.EVENT_BUS.addListener(ClientProxy::onDrawSelection);
|
||||
MinecraftForge.EVENT_BUS.addListener(KeyboardCamera::updateCamera);
|
||||
MinecraftForge.EVENT_BUS.addListener(KeyboardCamera::gameTick);
|
||||
ModLoadingContext.get().getActiveContainer().getEventBus().addListener(ClientProxy::onKeybindRegistry);
|
||||
NeoForge.EVENT_BUS.addListener(ClientProxy::onDrawSelection);
|
||||
NeoForge.EVENT_BUS.addListener(KeyboardCamera::updateCamera);
|
||||
NeoForge.EVENT_BUS.addListener(KeyboardCamera::gameTick);
|
||||
ClientConfig.init();
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +127,9 @@ public class WebDisplays {
|
|||
criterionKeyboardCat = new Criterion("keyboard_cat");
|
||||
registerTrigger(criterionPadBreak, criterionUpgradeScreen, criterionLinkPeripheral, criterionKeyboardCat);
|
||||
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
IEventBus bus = ModLoadingContext.get().getActiveContainer().getEventBus();
|
||||
WDNetworkRegistry.init();
|
||||
assert bus != null;
|
||||
SOUNDS.register(bus);
|
||||
onRegisterSounds();
|
||||
WDTabs.init(bus);
|
||||
|
|
@ -139,8 +138,8 @@ public class WebDisplays {
|
|||
TileRegistry.init(bus);
|
||||
|
||||
PROXY.preInit();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
NeoForge.EVENT_BUS.register(this);
|
||||
|
||||
//Other things
|
||||
PROXY.init();
|
||||
|
|
@ -188,7 +187,7 @@ public class WebDisplays {
|
|||
if (ev.getLevel().isClientSide() || level.dimension() != Level.OVERWORLD)
|
||||
return;
|
||||
|
||||
File worldDir = Objects.requireNonNull(ev.getLevel().getServer()).getServerDirectory();
|
||||
File worldDir = Objects.requireNonNull(ev.getLevel().getServer()).getServerDirectory().toFile();
|
||||
File f = new File(worldDir, "wd_next.txt");
|
||||
|
||||
if (f.exists()) {
|
||||
|
|
@ -239,7 +238,7 @@ public class WebDisplays {
|
|||
if(ev.getLevel() instanceof Level level) {
|
||||
if (ev.getLevel().isClientSide() || level.dimension() != Level.OVERWORLD)
|
||||
return;
|
||||
File f = new File(Objects.requireNonNull(ev.getLevel().getServer()).getServerDirectory(), "wd_next.txt");
|
||||
File f = new File(String.valueOf(Objects.requireNonNull(ev.getLevel().getServer()).getServerDirectory()), "wd_next.txt");
|
||||
|
||||
try {
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(f));
|
||||
|
|
@ -374,7 +373,7 @@ public class WebDisplays {
|
|||
if(server == null)
|
||||
return false;
|
||||
|
||||
Advancement adv = server.getAdvancements().getAdvancement(rl);
|
||||
Advancement adv = server.getAdvancements().getAdvancemen(rl);
|
||||
return adv != null && ply.getAdvancements().getOrStartProgress(adv).isDone();
|
||||
}
|
||||
|
||||
|
|
@ -382,7 +381,7 @@ public class WebDisplays {
|
|||
return new WebDisplays().lastPadId++;
|
||||
}
|
||||
|
||||
public static DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, "webdisplays");
|
||||
public static DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(NeoForgeRegistries.SOUND_EVENTS, "webdisplays");
|
||||
|
||||
private static SoundEvent registerSound(String resName) {
|
||||
ResourceLocation resLoc = new ResourceLocation("webdisplays", resName);
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@ package net.montoyo.wd.registry;
|
|||
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.montoyo.wd.block.item.KeyboardItem;
|
||||
import net.montoyo.wd.core.CraftComponent;
|
||||
import net.montoyo.wd.core.DefaultUpgrade;
|
||||
import net.montoyo.wd.item.*;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredItem;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
|
@ -19,16 +19,16 @@ public class ItemRegistry {
|
|||
ITEMS.register(bus);
|
||||
}
|
||||
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "webdisplays");
|
||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.createItems("webdisplays");
|
||||
|
||||
protected static final RegistryObject<Item>[] COMP_CRAFT_ITEMS = new RegistryObject[CraftComponent.values().length];
|
||||
protected static final RegistryObject<Item>[] UPGRADE_ITEMS = new RegistryObject[DefaultUpgrade.values().length];
|
||||
protected static final DeferredItem<Item>[] COMP_CRAFT_ITEMS = new DeferredItem[CraftComponent.values().length];
|
||||
protected static final DeferredItem<Item>[] UPGRADE_ITEMS = new DeferredItem[DefaultUpgrade.values().length];
|
||||
|
||||
public static final RegistryObject<Item> CONFIGURATOR = ITEMS.register("screencfg", () -> new ItemScreenConfigurator(new Item.Properties()));
|
||||
public static final RegistryObject<Item> OWNERSHIP_THEIF = ITEMS.register("ownerthief", () -> new ItemOwnershipThief(new Item.Properties()));
|
||||
public static final RegistryObject<Item> LINKER = ITEMS.register("linker", () -> new ItemLinker(new Item.Properties()));
|
||||
public static final RegistryObject<Item> MINEPAD = ITEMS.register("minepad", () -> new ItemMinePad2(new Item.Properties()));
|
||||
public static final RegistryObject<Item> LASER_POINTER = ITEMS.register("laserpointer", () -> new ItemLaserPointer(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, ItemScreenConfigurator> CONFIGURATOR = ITEMS.register("screencfg", () -> new ItemScreenConfigurator(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, ItemOwnershipThief> OWNERSHIP_THEIF = ITEMS.register("ownerthief", () -> new ItemOwnershipThief(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, ItemLinker> LINKER = ITEMS.register("linker", () -> new ItemLinker(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, ItemMinePad2> MINEPAD = ITEMS.register("minepad", () -> new ItemMinePad2(new Item.Properties()));
|
||||
public static final DeferredHolder<Item, ItemLaserPointer> LASER_POINTER = ITEMS.register("laserpointer", () -> new ItemLaserPointer(new Item.Properties()));
|
||||
|
||||
static {
|
||||
DefaultUpgrade[] defaultUpgrades = DefaultUpgrade.values();
|
||||
|
|
@ -44,18 +44,18 @@ public class ItemRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
public static final RegistryObject<Item> SCREEN = ITEMS.register("screen", () -> new BlockItem(BlockRegistry.SCREEN_BLOCk.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final DeferredItem<Item> SCREEN = ITEMS.register("screen", () -> new BlockItem(BlockRegistry.SCREEN_BLOCk.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
|
||||
public static final RegistryObject<Item> KEYBOARD = ITEMS.register("keyboard", () -> new KeyboardItem(BlockRegistry.KEYBOARD_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final RegistryObject<Item> REDSTONE_CONTROLLER = ITEMS.register("redctrl", () -> new BlockItem(BlockRegistry.REDSTONE_CONTROL_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final RegistryObject<Item> REMOTE_CONTROLLER = ITEMS.register("rctrl", () -> new BlockItem(BlockRegistry.REMOTE_CONTROLLER_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final RegistryObject<Item> SERVER = ITEMS.register("server", () -> new BlockItem(BlockRegistry.SERVER_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final DeferredItem<Item> KEYBOARD = ITEMS.register("keyboard", () -> new KeyboardItem(BlockRegistry.KEYBOARD_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final DeferredItem<Item> REDSTONE_CONTROLLER = ITEMS.register("redctrl", () -> new BlockItem(BlockRegistry.REDSTONE_CONTROL_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final DeferredItem<Item> REMOTE_CONTROLLER = ITEMS.register("rctrl", () -> new BlockItem(BlockRegistry.REMOTE_CONTROLLER_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
public static final DeferredItem<Item> SERVER = ITEMS.register("server", () -> new BlockItem(BlockRegistry.SERVER_BLOCK.get(), new Item.Properties()/*.tab(WebDisplays.CREATIVE_TAB)*/));
|
||||
|
||||
public static RegistryObject<Item> getComputerCraftItem(int index) {
|
||||
public static DeferredItem<Item> getComputerCraftItem(int index) {
|
||||
return COMP_CRAFT_ITEMS[index];
|
||||
}
|
||||
|
||||
public static RegistryObject<Item> getUpgradeItem(int index) {
|
||||
public static DeferredItem<Item> getUpgradeItem(int index) {
|
||||
return UPGRADE_ITEMS[index];
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public class ItemRegistry {
|
|||
}
|
||||
|
||||
public static boolean isCompCraftItem(Item item) {
|
||||
for (RegistryObject<Item> itemRegistryObject : COMP_CRAFT_ITEMS)
|
||||
for (DeferredItem<Item> itemRegistryObject : COMP_CRAFT_ITEMS)
|
||||
if (item == itemRegistryObject.get())
|
||||
return true;
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user