mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-29 14:28:33 +01:00
Compare commits
2 commits
fcd12352fc
...
5d02e4e750
Author | SHA1 | Date | |
---|---|---|---|
5d02e4e750 | |||
2ad1cc9090 |
9 changed files with 42 additions and 26 deletions
|
@ -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.0
|
mod_version=41.1
|
||||||
# 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
|
||||||
|
|
|
@ -34,7 +34,6 @@ 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);
|
||||||
|
|
|
@ -13,6 +13,8 @@ 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;
|
||||||
|
@ -32,6 +34,7 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ 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;
|
||||||
|
@ -32,6 +34,7 @@ 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) {
|
||||||
|
|
|
@ -17,12 +17,13 @@ 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.playBidirectional(PacketAuraChunk.TYPE, PacketAuraChunk.CODEC, PacketAuraChunk::onMessage);
|
registrar.playToClient(PacketAuraChunk.TYPE, PacketAuraChunk.CODEC, (m, c) -> PacketAuraChunk.onMessage(m, c));
|
||||||
registrar.playBidirectional(PacketClient.TYPE, PacketClient.CODEC, PacketClient::onMessage);
|
registrar.playToClient(PacketClient.TYPE, PacketClient.CODEC, (m, c) -> PacketClient.onMessage(m, c));
|
||||||
registrar.playBidirectional(PacketParticles.TYPE, PacketParticles.CODEC, PacketParticles::onMessage);
|
registrar.playToClient(PacketParticles.TYPE, PacketParticles.CODEC, (m, c) -> PacketParticles.onMessage(m, c));
|
||||||
registrar.playBidirectional(PacketParticleStream.TYPE, PacketParticleStream.CODEC, PacketParticleStream::onMessage);
|
registrar.playToClient(PacketParticleStream.TYPE, PacketParticleStream.CODEC, (m, c) -> PacketParticleStream.onMessage(m, c));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendToAllLoaded(Level level, BlockPos pos, CustomPacketPayload message) {
|
public static void sendToAllLoaded(Level level, BlockPos pos, CustomPacketPayload message) {
|
||||||
|
|
|
@ -7,6 +7,8 @@ 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;
|
||||||
|
|
||||||
|
@ -30,6 +32,7 @@ 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,
|
||||||
|
|
|
@ -17,6 +17,8 @@ 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;
|
||||||
|
@ -44,6 +46,7 @@ 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)
|
||||||
|
|
|
@ -9,8 +9,6 @@ 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;
|
||||||
|
@ -19,39 +17,21 @@ 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());
|
||||||
|
|
|
@ -19,12 +19,16 @@ 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;
|
||||||
|
@ -39,12 +43,15 @@ 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;
|
||||||
|
@ -390,4 +397,21 @@ 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue