Skip to content

Commit

Permalink
Port
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePandaOliver committed Jan 24, 2025
1 parent d74241b commit bcc1a7f
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public TestMod() {
}

public static ResourceLocation resourceLocation(String path) {
return ResourceLocation.fromNamespaceAndPath(MOD_ID, path);
return new ResourceLocation(MOD_ID, path);
}

public static TestMod getInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ private DeferredRegister(String namespace, ResourceKey<? extends Registry<T>> re
}

public <R extends T> DeferredObject<R> register(String name, Function<ResourceKey<T>, R> registryFunc) {
return register(ResourceLocation.fromNamespaceAndPath(namespace, name), registryFunc);
return register(new ResourceLocation(namespace, name), registryFunc);
}

public <R extends T> DeferredObject<R> register(String name, Supplier<R> registrySup) {
return register(ResourceLocation.fromNamespaceAndPath(namespace, name), registrySup);
return register(new ResourceLocation(namespace, name), registrySup);
}

public <R extends T> DeferredObject<R> register(ResourceLocation name, Function<ResourceKey<T>, R> registryFunc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@

package me.pandamods.testmod.neoforge;

import dev.architectury.utils.Env;
import me.pandamods.pandalib.utils.EnvRunner;
import me.pandamods.test.TestMod;
import me.pandamods.testmod.neoforge.client.TestModClientNeoForge;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;

@Mod(TestMod.MOD_ID)
public class TestModNeoForge {
public TestModNeoForge(IEventBus eventBus) {
new TestMod();

EnvRunner.runIf(Env.CLIENT, () -> () -> new TestModClientNeoForge(eventBus));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;


@Mod(value = TestMod.MOD_ID, dist = Dist.CLIENT)
public class TestModClientNeoForge {
public TestModClientNeoForge(IEventBus eventBus) {
eventBus.addListener(TestModClientNeoForge::clientSetup);
}

public static void clientSetup(FMLClientSetupEvent event) {
new TestModClient();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,29 @@

package me.pandamods.pandalib.neoforge;

import dev.architectury.utils.Env;
import me.pandamods.pandalib.PandaLib;
import me.pandamods.pandalib.neoforge.client.PandaLibClientNeoForge;
import me.pandamods.pandalib.neoforge.platform.NetworkHelperImpl;
import me.pandamods.pandalib.neoforge.platform.RegistrationHelperImpl;
import me.pandamods.pandalib.platform.Services;
import me.pandamods.pandalib.utils.EnvRunner;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;

@Mod(PandaLib.MOD_ID)
public class PandaLibNeoForge {
public PandaLibNeoForge(IEventBus eventBus) {
new PandaLib(new PacketDistributorImpl());
new PandaLib();

eventBus.addListener(NetworkHelperImpl::registerPackets);
if (Services.REGISTRATION instanceof RegistrationHelperImpl helper) {
eventBus.addListener(helper::registerEvent);
eventBus.addListener(helper::registerNewRegistryEvent);
NeoForge.EVENT_BUS.addListener(helper::addReloadListenerEvent);
}

EnvRunner.runIf(Env.CLIENT, () -> () -> new PandaLibClientNeoForge(eventBus));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,4 @@ public class PandaLibClientNeoForge {
public PandaLibClientNeoForge(IEventBus eventBus) {
new PandaLibClient();
}

public static void clientSetup(FMLClientSetupEvent event) {
PandaLibClient.init();
}
}

0 comments on commit bcc1a7f

Please sign in to comment.