Compare commits

..

No commits in common. "5d02e4e750bbc5b181feea1965267d104aa8b2ff" and "fcd12352fc04ccd706d219711c77834779c0d153" have entirely different histories.

9 changed files with 26 additions and 42 deletions

View file

@ -31,7 +31,7 @@ mod_name=NaturesAura
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT mod_license=MIT
# The mod version. See https://semver.org/ # The mod version. See https://semver.org/
mod_version=41.1 mod_version=41.0
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # 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. # This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html # See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View file

@ -34,6 +34,7 @@ public final class NaturesAura {
NaturesAura.proxy = FMLEnvironment.dist.isClient() ? new ClientProxy() : new ServerProxy(); NaturesAura.proxy = FMLEnvironment.dist.isClient() ? new ClientProxy() : new ServerProxy();
container.getEventBus().addListener(this::setup); container.getEventBus().addListener(this::setup);
container.getEventBus().register(NaturesAura.proxy);
var builder = new ModConfigSpec.Builder(); var builder = new ModConfigSpec.Builder();
ModConfig.instance = new ModConfig(builder); ModConfig.instance = new ModConfig(builder);

View file

@ -13,8 +13,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext; import net.neoforged.neoforge.network.handling.IPayloadContext;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,7 +32,6 @@ public record PacketAuraChunk(int chunkX, int chunkZ, Collection<CompoundTag> dr
return PacketAuraChunk.TYPE; return PacketAuraChunk.TYPE;
} }
@OnlyIn(Dist.CLIENT)
public static void onMessage(PacketAuraChunk message, IPayloadContext ctx) { public static void onMessage(PacketAuraChunk message, IPayloadContext ctx) {
ClientEvents.PENDING_AURA_CHUNKS.add(message); ClientEvents.PENDING_AURA_CHUNKS.add(message);
} }

View file

@ -15,8 +15,6 @@ import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext; import net.neoforged.neoforge.network.handling.IPayloadContext;
import java.util.ArrayList; import java.util.ArrayList;
@ -34,7 +32,6 @@ public record PacketClient(int packetType, CompoundTag data) implements CustomPa
return PacketClient.TYPE; return PacketClient.TYPE;
} }
@OnlyIn(Dist.CLIENT)
public static void onMessage(PacketClient message, IPayloadContext ctx) { public static void onMessage(PacketClient message, IPayloadContext ctx) {
var mc = Minecraft.getInstance(); var mc = Minecraft.getInstance();
if (mc.level != null) { if (mc.level != null) {

View file

@ -17,13 +17,12 @@ import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
public final class PacketHandler { public final class PacketHandler {
@SubscribeEvent @SubscribeEvent
@SuppressWarnings("Convert2MethodRef")
public static void onPayloadRegister(RegisterPayloadHandlersEvent event) { public static void onPayloadRegister(RegisterPayloadHandlersEvent event) {
var registrar = event.registrar(NaturesAura.MOD_ID); var registrar = event.registrar(NaturesAura.MOD_ID);
registrar.playToClient(PacketAuraChunk.TYPE, PacketAuraChunk.CODEC, (m, c) -> PacketAuraChunk.onMessage(m, c)); registrar.playBidirectional(PacketAuraChunk.TYPE, PacketAuraChunk.CODEC, PacketAuraChunk::onMessage);
registrar.playToClient(PacketClient.TYPE, PacketClient.CODEC, (m, c) -> PacketClient.onMessage(m, c)); registrar.playBidirectional(PacketClient.TYPE, PacketClient.CODEC, PacketClient::onMessage);
registrar.playToClient(PacketParticles.TYPE, PacketParticles.CODEC, (m, c) -> PacketParticles.onMessage(m, c)); registrar.playBidirectional(PacketParticles.TYPE, PacketParticles.CODEC, PacketParticles::onMessage);
registrar.playToClient(PacketParticleStream.TYPE, PacketParticleStream.CODEC, (m, c) -> PacketParticleStream.onMessage(m, c)); registrar.playBidirectional(PacketParticleStream.TYPE, PacketParticleStream.CODEC, PacketParticleStream::onMessage);
} }
public static void sendToAllLoaded(Level level, BlockPos pos, CustomPacketPayload message) { public static void sendToAllLoaded(Level level, BlockPos pos, CustomPacketPayload message) {

View file

@ -7,8 +7,6 @@ import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext; import net.neoforged.neoforge.network.handling.IPayloadContext;
import org.joml.Vector3f; import org.joml.Vector3f;
@ -32,7 +30,6 @@ public record PacketParticleStream(Vector3f start, Vector3f end, float speed, in
return PacketParticleStream.TYPE; return PacketParticleStream.TYPE;
} }
@OnlyIn(Dist.CLIENT)
public static void onMessage(PacketParticleStream message, IPayloadContext ctx) { public static void onMessage(PacketParticleStream message, IPayloadContext ctx) {
NaturesAuraAPI.instance().spawnParticleStream( NaturesAuraAPI.instance().spawnParticleStream(
message.start.x, message.start.y, message.start.z, message.start.x, message.start.y, message.start.z,

View file

@ -17,8 +17,6 @@ import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
import net.neoforged.neoforge.network.handling.IPayloadContext; import net.neoforged.neoforge.network.handling.IPayloadContext;
import java.util.ArrayList; import java.util.ArrayList;
@ -46,7 +44,6 @@ public record PacketParticles(float posX, float posY, float posZ, int particleTy
return PacketParticles.TYPE; return PacketParticles.TYPE;
} }
@OnlyIn(Dist.CLIENT)
public static void onMessage(PacketParticles message, IPayloadContext ctx) { public static void onMessage(PacketParticles message, IPayloadContext ctx) {
var level = Minecraft.getInstance().level; var level = Minecraft.getInstance().level;
if (level != null) if (level != null)

View file

@ -9,6 +9,8 @@ import de.ellpeck.naturesaura.entities.render.RenderEffectInhibitor;
import de.ellpeck.naturesaura.entities.render.RenderMoverMinecart; import de.ellpeck.naturesaura.entities.render.RenderMoverMinecart;
import de.ellpeck.naturesaura.entities.render.RenderStub; import de.ellpeck.naturesaura.entities.render.RenderStub;
import de.ellpeck.naturesaura.events.ClientEvents; import de.ellpeck.naturesaura.events.ClientEvents;
import de.ellpeck.naturesaura.gui.GuiEnderCrate;
import de.ellpeck.naturesaura.gui.ModContainers;
import de.ellpeck.naturesaura.items.ItemColorChanger; import de.ellpeck.naturesaura.items.ItemColorChanger;
import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.items.ModItems;
import de.ellpeck.naturesaura.particles.ParticleHandler; import de.ellpeck.naturesaura.particles.ParticleHandler;
@ -17,21 +19,39 @@ import de.ellpeck.naturesaura.reg.IColorProvidingBlock;
import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.IColorProvidingItem;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
import de.ellpeck.naturesaura.reg.ModRegistry; import de.ellpeck.naturesaura.reg.ModRegistry;
import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets;
import de.ellpeck.naturesaura.renderers.SupporterFancyHandler; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemBlockRenderTypes; import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.client.renderer.entity.ThrownItemRenderer; import net.minecraft.client.renderer.entity.ThrownItemRenderer;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.client.renderer.item.ItemProperties;
import net.minecraft.client.resources.PlayerSkin;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent; import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.common.NeoForge; import net.neoforged.neoforge.common.NeoForge;
public class ClientProxy implements IProxy { public class ClientProxy implements IProxy {
@SubscribeEvent
public void registerMenuScreens(RegisterMenuScreensEvent event) {
event.register(ModContainers.ENDER_CRATE, GuiEnderCrate::new);
event.register(ModContainers.ENDER_ACCESS, GuiEnderCrate::new);
}
@SubscribeEvent
public void registerRenderLayers(EntityRenderersEvent.AddLayers event) {
for (var render : new PlayerRenderer[]{event.getSkin(PlayerSkin.Model.WIDE), event.getSkin(PlayerSkin.Model.SLIM)})
render.addLayer(new PlayerLayerTrinkets(render));
}
@Override @Override
public void preInit(FMLCommonSetupEvent event) { public void preInit(FMLCommonSetupEvent event) {
NeoForge.EVENT_BUS.register(new ClientEvents()); NeoForge.EVENT_BUS.register(new ClientEvents());

View file

@ -19,16 +19,12 @@ import de.ellpeck.naturesaura.gen.LevelGenAuraBloom;
import de.ellpeck.naturesaura.gen.LevelGenNetherWartMushroom; import de.ellpeck.naturesaura.gen.LevelGenNetherWartMushroom;
import de.ellpeck.naturesaura.gen.ModFeatures; import de.ellpeck.naturesaura.gen.ModFeatures;
import de.ellpeck.naturesaura.gui.ContainerEnderCrate; import de.ellpeck.naturesaura.gui.ContainerEnderCrate;
import de.ellpeck.naturesaura.gui.GuiEnderCrate;
import de.ellpeck.naturesaura.gui.ModContainers; import de.ellpeck.naturesaura.gui.ModContainers;
import de.ellpeck.naturesaura.items.*; import de.ellpeck.naturesaura.items.*;
import de.ellpeck.naturesaura.items.tools.*; import de.ellpeck.naturesaura.items.tools.*;
import de.ellpeck.naturesaura.potion.ModPotions; import de.ellpeck.naturesaura.potion.ModPotions;
import de.ellpeck.naturesaura.potion.PotionBreathless; import de.ellpeck.naturesaura.potion.PotionBreathless;
import de.ellpeck.naturesaura.recipes.ModRecipes; import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets;
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.client.resources.PlayerSkin;
import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
@ -43,15 +39,12 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.FlowerPotBlock; import net.minecraft.world.level.block.FlowerPotBlock;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.levelgen.structure.BuiltinStructures; import net.minecraft.world.level.levelgen.structure.BuiltinStructures;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent; import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber; import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.capabilities.Capabilities.EnergyStorage; import net.neoforged.neoforge.capabilities.Capabilities.EnergyStorage;
import net.neoforged.neoforge.capabilities.Capabilities.FluidHandler; import net.neoforged.neoforge.capabilities.Capabilities.FluidHandler;
import net.neoforged.neoforge.capabilities.Capabilities.ItemHandler; import net.neoforged.neoforge.capabilities.Capabilities.ItemHandler;
import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent; import net.neoforged.neoforge.capabilities.RegisterCapabilitiesEvent;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.common.extensions.IMenuTypeExtension; import net.neoforged.neoforge.common.extensions.IMenuTypeExtension;
import net.neoforged.neoforge.items.IItemHandler; import net.neoforged.neoforge.items.IItemHandler;
import net.neoforged.neoforge.registries.NeoForgeRegistries; import net.neoforged.neoforge.registries.NeoForgeRegistries;
@ -397,21 +390,4 @@ public final class ModRegistry {
helper.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, ((IModItem) item).getBaseName()), item); helper.register(ResourceLocation.fromNamespaceAndPath(NaturesAura.MOD_ID, ((IModItem) item).getBaseName()), item);
} }
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
public static final class Client {
@SubscribeEvent
public static void registerMenuScreens(RegisterMenuScreensEvent event) {
event.register(ModContainers.ENDER_CRATE, GuiEnderCrate::new);
event.register(ModContainers.ENDER_ACCESS, GuiEnderCrate::new);
}
@SubscribeEvent
public static void registerRenderLayers(EntityRenderersEvent.AddLayers event) {
for (var render : new PlayerRenderer[]{event.getSkin(PlayerSkin.Model.WIDE), event.getSkin(PlayerSkin.Model.SLIM)})
render.addLayer(new PlayerLayerTrinkets(render));
}
}
} }