Skip to content

Commit

Permalink
feat: Update Forge and NeoForge to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Jun 14, 2024
1 parent 935c387 commit 139ad61
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private void registerCapabilities(RegisterCapabilitiesEvent event) {

private void attachEntityCapabilities(AttachCapabilitiesEvent<Entity> event) {
if (event.getObject() instanceof Player) {
event.addCapability(new ResourceLocation(HardcoreRevival.MOD_ID, "entity_data"), new ICapabilityProvider() {
event.addCapability(ResourceLocation.fromNamespaceAndPath(HardcoreRevival.MOD_ID, "entity_data"), new ICapabilityProvider() {
private LazyOptional<HardcoreRevivalData> revival;

private LazyOptional<HardcoreRevivalData> getRevivalCapabilityInstance() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.util.Objects;

public class MrCrayfishsGunModAddon {
private final ResourceLocation PISTOL = new ResourceLocation("cgm:pistol");
private final ResourceLocation PISTOL = ResourceLocation.fromNamespaceAndPath("cgm", "pistol");

public MrCrayfishsGunModAddon() {
MinecraftForge.EVENT_BUS.register(this);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
package net.blay09.mods.hardcorerevival;

import net.blay09.mods.balm.api.Balm;
import net.blay09.mods.balm.api.client.BalmClient;
import net.blay09.mods.balm.neoforge.NeoForgeLoadContext;
import net.blay09.mods.balm.neoforge.provider.NeoForgeBalmProviders;
import net.blay09.mods.hardcorerevival.capability.HardcoreRevivalData;
import net.blay09.mods.hardcorerevival.capability.HardcoreRevivalDataImpl;
import net.blay09.mods.hardcorerevival.client.HardcoreRevivalClient;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EntityType;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.DistExecutor;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.capabilities.EntityCapability;
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;

@Mod(HardcoreRevival.MOD_ID)
public class NeoForgeHardcoreRevival {

private final EntityCapability<HardcoreRevivalData, Void> hardcoreRevivalDataCapability = EntityCapability.createVoid(new ResourceLocation(HardcoreRevival.MOD_ID,
private final EntityCapability<HardcoreRevivalData, Void> hardcoreRevivalDataCapability = EntityCapability.createVoid(ResourceLocation.fromNamespaceAndPath(HardcoreRevival.MOD_ID,
"entity_data"), HardcoreRevivalData.class);

public NeoForgeHardcoreRevival(IEventBus eventBus) {
final var context = new NeoForgeLoadContext(eventBus);
Balm.initialize(HardcoreRevival.MOD_ID, context, HardcoreRevival::initialize);
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> BalmClient.initialize(HardcoreRevival.MOD_ID, context, HardcoreRevivalClient::initialize));

eventBus.addListener(this::registerCapabilities);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package net.blay09.mods.hardcorerevival.client;

import net.blay09.mods.balm.api.client.BalmClient;
import net.blay09.mods.balm.neoforge.NeoForgeLoadContext;
import net.blay09.mods.hardcorerevival.HardcoreRevival;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.common.Mod;

@Mod(value = HardcoreRevival.MOD_ID, dist = Dist.CLIENT)
public class NeoForgeHardcoreRevivalClient {

public NeoForgeHardcoreRevivalClient(IEventBus eventBus) {
final var context = new NeoForgeLoadContext(eventBus);
BalmClient.initialize(HardcoreRevival.MOD_ID, context, HardcoreRevivalClient::initialize);
}
}

0 comments on commit 139ad61

Please sign in to comment.