Port first NeoForge API surface
Some checks failed
Build / build (push) Failing after 6m57s

This commit is contained in:
MrSphay
2026-05-04 13:06:40 +02:00
parent 215ab3b080
commit ee922ac831
30 changed files with 543 additions and 472 deletions

View File

@@ -11,15 +11,15 @@ import net.minecraft.client.resources.sounds.SimpleSoundInstance;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.util.RandomSource;
import net.neoforged.neoforge.registries.RegistryObject;
import net.neoforged.neoforge.registries.DeferredHolder;
public class AnimationSoundManager {
private static final RandomSource RANDOM = RandomSource.m_216327_();
private static final List<RegistryObject<SoundEvent>> ANIMATION_SOUNDS = new ArrayList<RegistryObject<SoundEvent>>();
private static final List<RegistryObject<SoundEvent>> FAR_POWER_2_SOUNDS = new ArrayList<RegistryObject<SoundEvent>>();
private static final List<RegistryObject<SoundEvent>> FAR_POWER_3_SOUNDS = new ArrayList<RegistryObject<SoundEvent>>();
private static final List<RegistryObject<SoundEvent>> MEDIUM_CAVE_POWER_4_SOUNDS = new ArrayList<RegistryObject<SoundEvent>>();
private static final List<RegistryObject<SoundEvent>> SUPERFAR_POWER_4_SOUNDS = new ArrayList<RegistryObject<SoundEvent>>();
private static final List<DeferredHolder<SoundEvent, SoundEvent>> ANIMATION_SOUNDS = new ArrayList<DeferredHolder<SoundEvent, SoundEvent>>();
private static final List<DeferredHolder<SoundEvent, SoundEvent>> FAR_POWER_2_SOUNDS = new ArrayList<DeferredHolder<SoundEvent, SoundEvent>>();
private static final List<DeferredHolder<SoundEvent, SoundEvent>> FAR_POWER_3_SOUNDS = new ArrayList<DeferredHolder<SoundEvent, SoundEvent>>();
private static final List<DeferredHolder<SoundEvent, SoundEvent>> MEDIUM_CAVE_POWER_4_SOUNDS = new ArrayList<DeferredHolder<SoundEvent, SoundEvent>>();
private static final List<DeferredHolder<SoundEvent, SoundEvent>> SUPERFAR_POWER_4_SOUNDS = new ArrayList<DeferredHolder<SoundEvent, SoundEvent>>();
private static int lastAnimationSoundIndex = -1;
private static int lastFarPower2SoundIndex = -1;
private static int lastFarPower3SoundIndex = -1;

View File

@@ -3,6 +3,7 @@
*/
package com.vinlanx.explosionoverhaul.client;
import net.minecraft.core.registries.BuiltInRegistries;
import com.vinlanx.explosionoverhaul.BlockIndexManager;
import com.vinlanx.explosionoverhaul.ExplosionOverhaul;
import java.util.ArrayList;
@@ -35,7 +36,6 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.neoforged.neoforge.registries.ForgeRegistries;
public class BlacklistScreen
extends Screen {
@@ -150,11 +150,11 @@ extends Screen {
LinkedHashSet<String> uniqueRegistry = new LinkedHashSet<String>();
if (this.currentCategory == BlacklistCategory.SOURCES) {
uniqueRegistry.add("generic");
ForgeRegistries.ENTITY_TYPES.getKeys().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
ForgeRegistries.BLOCKS.getKeys().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
ForgeRegistries.ITEMS.getKeys().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
BuiltInRegistries.ENTITY_TYPE.keySet().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
BuiltInRegistries.BLOCK.keySet().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
BuiltInRegistries.ITEM.keySet().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
} else {
ForgeRegistries.BLOCKS.getKeys().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
BuiltInRegistries.BLOCK.keySet().stream().map(ResourceLocation::toString).forEach(uniqueRegistry::add);
}
this.registryCache = new ArrayList<String>(uniqueRegistry);
}
@@ -420,11 +420,11 @@ extends Screen {
ItemStack stack = ItemStack.f_41583_;
if (rl != null) {
Block b2;
stack = new ItemStack((ItemLike)ForgeRegistries.ITEMS.getValue(rl));
stack = new ItemStack((ItemLike)BuiltInRegistries.ITEM.getValue(rl));
if (stack.m_41619_()) {
stack = new ItemStack((ItemLike)ForgeRegistries.ITEMS.getValue(new ResourceLocation(rl.m_135827_(), rl.m_135815_() + "_spawn_egg")));
stack = new ItemStack((ItemLike)BuiltInRegistries.ITEM.getValue(new ResourceLocation(rl.m_135827_(), rl.m_135815_() + "_spawn_egg")));
}
if (stack.m_41619_() && (b2 = (Block)ForgeRegistries.BLOCKS.getValue(rl)) != Blocks.f_50016_) {
if (stack.m_41619_() && (b2 = (Block)BuiltInRegistries.BLOCK.getValue(rl)) != Blocks.f_50016_) {
stack = new ItemStack((ItemLike)b2.m_5456_());
}
}
@@ -438,7 +438,7 @@ extends Screen {
});
} else {
ItemStack stack;
Block block = (Block)ForgeRegistries.BLOCKS.getValue(ResourceLocation.m_135820_((String)id));
Block block = (Block)BuiltInRegistries.BLOCK.getValue(ResourceLocation.m_135820_((String)id));
ItemStack itemStack = stack = block == null || block == Blocks.f_50016_ ? ItemStack.f_41583_ : new ItemStack((ItemLike)block.m_5456_());
if (stack.m_41619_()) {
stack = new ItemStack((ItemLike)Items.f_42127_);

View File

@@ -3,6 +3,7 @@
*/
package com.vinlanx.explosionoverhaul.client;
import net.minecraft.core.registries.BuiltInRegistries;
import com.mojang.blaze3d.systems.RenderSystem;
import com.vinlanx.explosionoverhaul.Config;
import com.vinlanx.explosionoverhaul.ModParticles;
@@ -43,8 +44,7 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3;
import net.neoforged.neoforge.client.event.RenderGuiOverlayEvent;
import net.neoforged.neoforge.registries.ForgeRegistries;
import net.neoforged.neoforge.client.event.RenderGuiEvent;
public class ClientEffects {
private static float currentShakeIntensity = 0.0f;
@@ -62,7 +62,7 @@ public class ClientEffects {
private static final List<PendingShake> pendingShakes = new ArrayList<PendingShake>();
public static void addTrackedSound(PlayTrackedSoundPacket msg) {
SoundEvent sound = (SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(msg.getSoundId());
SoundEvent sound = (SoundEvent)BuiltInRegistries.SOUND_EVENT.getValue(msg.getSoundId());
if (sound != null) {
activeTrackedSounds.add(new TrackedSound(msg.getExplosionPos(), sound, msg.getVolume(), msg.getPitch(), msg.getDelayTicks(), msg.isPlayerInHouse()));
}
@@ -167,7 +167,7 @@ public class ClientEffects {
activeFlashEffects.removeIf(effect -> effect.isFinished());
}
public static void renderFlash(RenderGuiOverlayEvent.Post event) {
public static void renderFlash(RenderGuiEvent.Post event) {
if (!((Boolean)Config.CLIENT.enableFlashEffect.get()).booleanValue()) {
return;
}

View File

@@ -22,9 +22,10 @@ import net.neoforged.api.distmarker.Dist;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.loading.FMLEnvironment;
@Mod.EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
@EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
public class ConcussionAudioEffect {
public static boolean debugSendDebugMessage = false;
public static boolean TestingHudHeart = true;

View File

@@ -17,9 +17,10 @@ import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.common.EventBusSubscriber;
@OnlyIn(value=Dist.CLIENT)
@Mod.EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
@EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
public class ConcussionSoundManager {
private static FadingMusicInstance currentLowSound = null;

View File

@@ -16,10 +16,11 @@ import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.loading.FMLEnvironment;
@OnlyIn(value=Dist.CLIENT)
@Mod.EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
@EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
public class DeafnessConcussionEffect {
public static int DELAY_TICKS = 3;
public static int FADE_TO_SILENT_TICKS = 5;

View File

@@ -13,8 +13,9 @@ import net.neoforged.api.distmarker.Dist;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.common.EventBusSubscriber;
@Mod.EventBusSubscriber(modid="explosionoverhaul", bus=Mod.EventBusSubscriber.Bus.FORGE, value={Dist.CLIENT})
@EventBusSubscriber(modid="explosionoverhaul", bus=EventBusSubscriber.Bus.GAME, value={Dist.CLIENT})
public class FirstTimeSetupHandler {
private static boolean hasChecked = false;
private static boolean pendingShowIntro = false;

View File

@@ -8,8 +8,9 @@ import net.neoforged.api.distmarker.Dist;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.common.EventBusSubscriber;
@Mod.EventBusSubscriber(modid="explosionoverhaul", bus=Mod.EventBusSubscriber.Bus.FORGE, value={Dist.CLIENT})
@EventBusSubscriber(modid="explosionoverhaul", bus=EventBusSubscriber.Bus.GAME, value={Dist.CLIENT})
public class IntroMusicTickHandler {
private static long lastTickTime = System.currentTimeMillis();

View File

@@ -15,12 +15,13 @@ import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.common.EventBusSubscriber;
import org.lwjgl.openal.AL10;
import org.lwjgl.openal.ALC10;
import org.lwjgl.openal.EXTEfx;
@OnlyIn(value=Dist.CLIENT)
@Mod.EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
@EventBusSubscriber(modid="explosionoverhaul", value={Dist.CLIENT})
public class LowPassConcussionEffect {
private static final float HF_MIN = 0.01f;
private static final float HF_MAX = 1.0f;