From 578ac6a313d2635dcc5a551ec41bb2489dca2317 Mon Sep 17 00:00:00 2001 From: EpicSquid Date: Thu, 6 Jul 2023 07:59:50 +1000 Subject: [PATCH] WIP on 1.19 --- gradle.properties | 7 +- src/main/java/com/sammy/malum/MalumMod.java | 99 +++++++++-------- .../sammy/malum/client/ParticleEffects.java | 9 +- .../ultrakill/UltrakillMachineArmorModel.java | 2 +- .../spiritflame/SpiritFlameParticle.java | 4 +- .../spiritflame/SpiritFlameParticleType.java | 22 ++-- .../renderer/block/MoteOfManaRenderer.java | 2 +- .../spirit_altar/SpiritAltarBlockEntity.java | 18 ++-- .../block/storage/SoulVialBlockEntity.java | 6 +- .../com/sammy/malum/config/CommonConfig.java | 102 +++++++++--------- .../malum/core/events/ClientSetupEvents.java | 14 ++- .../malum/core/handlers/SoulWardHandler.java | 14 +-- .../registry/client/ParticleRegistry.java | 14 ++- 13 files changed, 160 insertions(+), 153 deletions(-) diff --git a/gradle.properties b/gradle.properties index 7f100909c..a114afa33 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,11 +3,14 @@ org.gradle.jvmargs=-Xmx4G org.gradle.daemon=false # Dependency Version minecraftVersion=1.19.2 -lodestoneVersion=2.0.0.82 +lodestoneVersion=1.4.78 forgeVersion=43.1.52 # Build Dependencies Versions -mixinVersion=0.8.5 +forgegradleVersion=5.1.+ +mixingradleVersion=0.7-SNAPSHOT +librarianVersion=1.+ parchmentVersion=2022.11.20 +mixinVersion=0.8.5 # Mod Meta modName=Malum modId=malum diff --git a/src/main/java/com/sammy/malum/MalumMod.java b/src/main/java/com/sammy/malum/MalumMod.java index 0d5c9bd65..c9eccb216 100644 --- a/src/main/java/com/sammy/malum/MalumMod.java +++ b/src/main/java/com/sammy/malum/MalumMod.java @@ -1,45 +1,52 @@ package com.sammy.malum; -import com.sammy.malum.compability.create.*; -import com.sammy.malum.compability.farmersdelight.*; -import com.sammy.malum.compability.tetra.*; -import com.sammy.malum.config.*; -import com.sammy.malum.data.*; -import com.sammy.malum.data.block.*; -import com.sammy.malum.data.item.*; +import com.sammy.malum.compability.create.CreateCompat; +import com.sammy.malum.compability.farmersdelight.FarmersDelightCompat; +import com.sammy.malum.compability.tetra.TetraCompat; +import com.sammy.malum.config.ClientConfig; +import com.sammy.malum.config.CommonConfig; +import com.sammy.malum.data.MalumLang; +import com.sammy.malum.data.MalumRecipes; +import com.sammy.malum.data.block.MalumBlockLootTables; +import com.sammy.malum.data.block.MalumBlockStates; +import com.sammy.malum.data.block.MalumBlockTags; +import com.sammy.malum.data.item.MalumItemModels; +import com.sammy.malum.data.item.MalumItemTags; import com.sammy.malum.data.recipe.*; -import net.minecraft.data.*; -import net.minecraft.data.tags.*; -import net.minecraft.resources.*; -import net.minecraftforge.eventbus.api.*; -import net.minecraftforge.fml.*; -import net.minecraftforge.fml.common.*; -import net.minecraftforge.fml.config.*; -import net.minecraftforge.fml.javafmlmod.*; -import net.minecraftforge.forge.event.lifecycle.*; -import org.apache.logging.log4j.*; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.tags.BlockTagsProvider; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.RandomSource; +import net.minecraftforge.data.event.GatherDataEvent; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.ModLoadingContext; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import team.lodestar.lodestone.systems.config.ConfigGroup; -import java.util.*; - -import static com.sammy.malum.registry.client.ParticleRegistry.*; -import static com.sammy.malum.registry.common.AttributeRegistry.*; -import static com.sammy.malum.registry.common.ContainerRegistry.*; -import static com.sammy.malum.registry.common.MobEffectRegistry.*; -import static com.sammy.malum.registry.common.SoundRegistry.*; -import static com.sammy.malum.registry.common.block.BlockEntityRegistry.*; -import static com.sammy.malum.registry.common.block.BlockRegistry.*; -import static com.sammy.malum.registry.common.entity.EntityRegistry.*; -import static com.sammy.malum.registry.common.item.EnchantmentRegistry.*; -import static com.sammy.malum.registry.common.item.ItemRegistry.*; -import static com.sammy.malum.registry.common.recipe.RecipeSerializerRegistry.*; -import static com.sammy.malum.registry.common.recipe.RecipeTypeRegistry.*; -import static com.sammy.malum.registry.common.worldgen.FeatureRegistry.*; +import static com.sammy.malum.registry.client.ParticleRegistry.PARTICLES; +import static com.sammy.malum.registry.common.AttributeRegistry.ATTRIBUTES; +import static com.sammy.malum.registry.common.ContainerRegistry.CONTAINERS; +import static com.sammy.malum.registry.common.MobEffectRegistry.EFFECTS; +import static com.sammy.malum.registry.common.SoundRegistry.SOUNDS; +import static com.sammy.malum.registry.common.block.BlockEntityRegistry.BLOCK_ENTITY_TYPES; +import static com.sammy.malum.registry.common.block.BlockRegistry.BLOCKS; +import static com.sammy.malum.registry.common.entity.EntityRegistry.ENTITY_TYPES; +import static com.sammy.malum.registry.common.item.EnchantmentRegistry.ENCHANTMENTS; +import static com.sammy.malum.registry.common.item.ItemRegistry.ITEMS; +import static com.sammy.malum.registry.common.recipe.RecipeSerializerRegistry.RECIPE_SERIALIZERS; +import static com.sammy.malum.registry.common.recipe.RecipeTypeRegistry.RECIPE_TYPES; +import static com.sammy.malum.registry.common.worldgen.FeatureRegistry.FEATURE_TYPES; @SuppressWarnings("unused") @Mod(MalumMod.MALUM) public class MalumMod { public static final Logger LOGGER = LogManager.getLogger(); public static final String MALUM = "malum"; + public static final ConfigGroup MALUM_CONFIG_GROUP = new ConfigGroup(MALUM, "common"); public static final RandomSource RANDOM = RandomSource.create(); public MalumMod() { @@ -61,8 +68,8 @@ public MalumMod() { RECIPE_TYPES.register(modBus); RECIPE_SERIALIZERS.register(modBus); FEATURE_TYPES.register(modBus); - CONFIGURED_FEATURES.register(modBus); - PLACED_FEATURES.register(modBus); +// CONFIGURED_FEATURES.register(modBus); +// PLACED_FEATURES.register(modBus); TetraCompat.init(); FarmersDelightCompat.init(); @@ -82,18 +89,18 @@ public static void gatherData(GatherDataEvent event) { BlockTagsProvider provider = new MalumBlockTags(generator, event.getExistingFileHelper()); MalumItemModels itemProvider = new MalumItemModels(generator, event.getExistingFileHelper()); MalumBlockStates blockStateProvider = new MalumBlockStates(generator, event.getExistingFileHelper(), itemProvider); - generator.addProvider(blockStateProvider); - generator.addProvider(itemProvider); - generator.addProvider(new MalumLang(generator)); - generator.addProvider(provider); - generator.addProvider(new MalumBlockLootTables(generator)); - generator.addProvider(new MalumItemTags(generator, provider, event.getExistingFileHelper())); - generator.addProvider(new MalumRecipes(generator)); - generator.addProvider(new MalumVanillaRecipeReplacements(generator)); - generator.addProvider(new MalumSpiritInfusionRecipes(generator)); - generator.addProvider(new MalumSpiritFocusingRecipes(generator)); - generator.addProvider(new MalumSpiritTransmutationRecipes(generator)); - generator.addProvider(new MalumVoidFavorRecipes(generator)); + generator.addProvider(event.includeServer(), blockStateProvider); + generator.addProvider(event.includeServer(), itemProvider); + generator.addProvider(event.includeClient(), new MalumLang(generator)); + generator.addProvider(event.includeServer(), provider); + generator.addProvider(event.includeServer(), new MalumBlockLootTables(generator)); + generator.addProvider(event.includeServer(), new MalumItemTags(generator, provider, event.getExistingFileHelper())); + generator.addProvider(event.includeServer(), new MalumRecipes(generator)); + generator.addProvider(event.includeServer(), new MalumVanillaRecipeReplacements(generator)); + generator.addProvider(event.includeServer(), new MalumSpiritInfusionRecipes(generator)); + generator.addProvider(event.includeServer(), new MalumSpiritFocusingRecipes(generator)); + generator.addProvider(event.includeServer(), new MalumSpiritTransmutationRecipes(generator)); + generator.addProvider(event.includeServer(), new MalumVoidFavorRecipes(generator)); } } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/client/ParticleEffects.java b/src/main/java/com/sammy/malum/client/ParticleEffects.java index 77ecfabe7..b2b5fcf33 100644 --- a/src/main/java/com/sammy/malum/client/ParticleEffects.java +++ b/src/main/java/com/sammy/malum/client/ParticleEffects.java @@ -1,8 +1,9 @@ package com.sammy.malum.client; +import net.minecraft.util.RandomSource; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; -import team.lodestar.lodestone.setup.LodestoneParticleRegistry; +import team.lodestar.lodestone.registry.common.particle.LodestoneParticleRegistry; import team.lodestar.lodestone.systems.easing.Easing; import team.lodestar.lodestone.systems.particle.SimpleParticleOptions; import team.lodestar.lodestone.systems.particle.WorldParticleBuilder; @@ -21,7 +22,7 @@ public static void spawnSpiritGlimmerParticles(Level level, double x, double y, } public static void spawnSpiritGlimmerParticles(Level level, double x, double y, double z, float alphaMultiplier, Vec3 extraVelocity, Color color, Color endColor) { - Random rand = level.getRandom(); + RandomSource rand = level.getRandom(); WorldParticleBuilder.create(LodestoneParticleRegistry.TWINKLE_PARTICLE) .setTransparencyData(GenericParticleData.create(0.4f * alphaMultiplier, 0f).build()) .setScaleData(GenericParticleData.create(0.25f + rand.nextFloat() * 0.1f, 0).build()) @@ -42,7 +43,7 @@ public static void spawnSpiritParticles(Level level, double x, double y, double } public static void spawnSpiritParticles(Level level, double x, double y, double z, float alphaMultiplier, Vec3 extraVelocity, Color color, Color endColor) { - Random rand = level.getRandom(); + RandomSource rand = level.getRandom(); WorldParticleBuilder.create(LodestoneParticleRegistry.WISP_PARTICLE) .setTransparencyData(GenericParticleData.create(0.275f * alphaMultiplier, 0f).build()) .setLifetime(15 + rand.nextInt(4)) @@ -64,7 +65,7 @@ public static void spawnSpiritParticles(Level level, double x, double y, double } public static void spawnSoulParticles(Level level, double x, double y, double z, float alphaMultiplier, float scaleMultiplier, Vec3 extraVelocity, Color color, Color endColor) { - Random rand = level.getRandom(); + RandomSource rand = level.getRandom(); WorldParticleBuilder.create(LodestoneParticleRegistry.WISP_PARTICLE) .setTransparencyData(GenericParticleData.create(0.1f * alphaMultiplier, 0).build()) .setScaleData(GenericParticleData.create((0.2f + rand.nextFloat() * 0.2f) * scaleMultiplier, 0).setEasing(Easing.QUINTIC_IN).build()) diff --git a/src/main/java/com/sammy/malum/client/model/cosmetic/ultrakill/UltrakillMachineArmorModel.java b/src/main/java/com/sammy/malum/client/model/cosmetic/ultrakill/UltrakillMachineArmorModel.java index 4e4589dc7..3a6ab2c07 100644 --- a/src/main/java/com/sammy/malum/client/model/cosmetic/ultrakill/UltrakillMachineArmorModel.java +++ b/src/main/java/com/sammy/malum/client/model/cosmetic/ultrakill/UltrakillMachineArmorModel.java @@ -14,7 +14,7 @@ import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.builders.*; import net.minecraft.world.entity.EquipmentSlot; -import team.lodestar.lodestone.helpers.RenderHelper; +import team.lodestar.lodestone.helpers.render.RenderHelper; import team.lodestar.lodestone.systems.model.LodestoneArmorModel; public class UltrakillMachineArmorModel extends LodestoneArmorModel { diff --git a/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticle.java b/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticle.java index 3da1a823e..7c9a7e78b 100644 --- a/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticle.java +++ b/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticle.java @@ -7,8 +7,8 @@ import net.minecraft.client.particle.SpriteSet; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import team.lodestar.lodestone.systems.rendering.particle.world.FrameSetParticle; -import team.lodestar.lodestone.systems.rendering.particle.world.WorldParticleOptions; +import team.lodestar.lodestone.systems.particle.world.FrameSetParticle; +import team.lodestar.lodestone.systems.particle.world.WorldParticleOptions; import javax.annotation.Nullable; diff --git a/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticleType.java b/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticleType.java index 8ebb5bfb8..31a538518 100644 --- a/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticleType.java +++ b/src/main/java/com/sammy/malum/client/particles/spiritflame/SpiritFlameParticleType.java @@ -1,9 +1,17 @@ package com.sammy.malum.client.particles.spiritflame; import com.mojang.serialization.Codec; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.particle.ParticleEngine; +import net.minecraft.client.particle.SpriteSet; import net.minecraft.core.particles.ParticleType; +import team.lodestar.lodestone.systems.particle.screen.ScreenParticleType; +import team.lodestar.lodestone.systems.particle.screen.base.ScreenParticle; import team.lodestar.lodestone.systems.particle.world.WorldParticleOptions; +import javax.annotation.Nullable; + public class SpiritFlameParticleType extends ParticleType { public SpiritFlameParticleType() { super(false, WorldParticleOptions.DESERIALIZER); @@ -13,18 +21,4 @@ public SpiritFlameParticleType() { public Codec codec() { return WorldParticleOptions.codecFor(this); } - - public static class Factory implements ParticleProvider { - private final SpriteSet sprite; - - public Factory(SpriteSet sprite) { - this.sprite = sprite; - } - - @Nullable - @Override - public Particle createParticle(WorldParticleOptions data, ClientLevel world, double x, double y, double z, double mx, double my, double mz) { - return new SpiritFlameParticle(world, data, (ParticleEngine.MutableSpriteSet) sprite, x, y, z, mx, my, mz); - } - } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/client/renderer/block/MoteOfManaRenderer.java b/src/main/java/com/sammy/malum/client/renderer/block/MoteOfManaRenderer.java index a43a51559..229743452 100644 --- a/src/main/java/com/sammy/malum/client/renderer/block/MoteOfManaRenderer.java +++ b/src/main/java/com/sammy/malum/client/renderer/block/MoteOfManaRenderer.java @@ -11,7 +11,7 @@ import net.minecraft.resources.*; import net.minecraft.util.*; import team.lodestar.lodestone.handlers.*; -import team.lodestar.lodestone.setup.*; +import team.lodestar.lodestone.registry.client.LodestoneRenderTypeRegistry; import team.lodestar.lodestone.systems.rendering.*; import java.awt.*; diff --git a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java index 0fe1c3a51..8f07791ff 100644 --- a/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/curiosities/spirit_altar/SpiritAltarBlockEntity.java @@ -8,6 +8,7 @@ import com.sammy.malum.core.systems.spirit.*; import com.sammy.malum.registry.common.*; import com.sammy.malum.registry.common.block.*; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.core.*; import net.minecraft.nbt.*; import net.minecraft.sounds.*; @@ -26,7 +27,10 @@ import net.minecraftforge.network.*; import org.jetbrains.annotations.*; import team.lodestar.lodestone.helpers.*; -import team.lodestar.lodestone.setup.*; +import team.lodestar.lodestone.helpers.block.BlockEntityHelper; +import team.lodestar.lodestone.helpers.block.BlockPosHelper; +import team.lodestar.lodestone.helpers.block.BlockStateHelper; +import team.lodestar.lodestone.registry.common.particle.LodestoneParticleRegistry; import team.lodestar.lodestone.systems.blockentity.*; import team.lodestar.lodestone.systems.easing.*; import team.lodestar.lodestone.systems.particle.*; @@ -246,7 +250,7 @@ public void tick() { } public static Vec3 getItemPos(SpiritAltarBlockEntity blockEntity) { - return BlockHelper.fromBlockPos(blockEntity.getBlockPos()).add(blockEntity.itemOffset()); + return BlockPosHelper.fromBlockPos(blockEntity.getBlockPos()).add(blockEntity.itemOffset()); } public Vec3 itemOffset() { @@ -274,7 +278,7 @@ public boolean consume() { int extras = extrasInventory.nonEmptyItemAmount; if (extras < recipe.extraItems.size()) { progress *= 0.8f; - Collection altarProviders = BlockHelper.getBlockEntities(IAltarProvider.class, level, worldPosition, HORIZONTAL_RANGE, VERTICAL_RANGE, HORIZONTAL_RANGE); + Collection altarProviders = BlockEntityHelper.getBlockEntities(IAltarProvider.class, level, worldPosition, HORIZONTAL_RANGE, VERTICAL_RANGE, HORIZONTAL_RANGE); for (IAltarProvider provider : altarProviders) { LodestoneBlockEntityInventory inventoryForAltar = provider.getInventoryForAltar(); ItemStack providedStack = inventoryForAltar.getStackInSlot(0); @@ -296,7 +300,7 @@ public boolean consume() { MALUM_CHANNEL.send(PacketDistributor.TRACKING_CHUNK.with(() -> level.getChunkAt(provider.getBlockPosForAltar())), new AltarConsumeParticlePacket(providedStack, recipe.spirits.stream().map(s -> s.type.identifier).collect(Collectors.toList()), providedItemPos.x, providedItemPos.y, providedItemPos.z, itemPos.x, itemPos.y, itemPos.z)); extrasInventory.insertItem(level, providedStack.split(requestedItem.count)); inventoryForAltar.updateData(); - BlockHelper.updateAndNotifyState(level, provider.getBlockPosForAltar()); + BlockStateHelper.updateAndNotifyState(level, provider.getBlockPosForAltar()); break; } } @@ -331,14 +335,14 @@ public void craft() { level.addFreshEntity(new ItemEntity(level, itemPos.x, itemPos.y, itemPos.z, outputStack)); init(); recalibrateAccelerators(); - BlockHelper.updateAndNotifyState(level, worldPosition); + BlockStateHelper.updateAndNotifyState(level, worldPosition); } public void recalibrateAccelerators() { speed = 1f; accelerators.clear(); acceleratorPositions.clear(); - Collection nearbyAccelerators = BlockHelper.getBlockEntities(IAltarAccelerator.class, level, worldPosition, HORIZONTAL_RANGE, VERTICAL_RANGE, HORIZONTAL_RANGE); + Collection nearbyAccelerators = BlockEntityHelper.getBlockEntities(IAltarAccelerator.class, level, worldPosition, HORIZONTAL_RANGE, VERTICAL_RANGE, HORIZONTAL_RANGE); Map entries = new HashMap<>(); for (IAltarAccelerator accelerator : nearbyAccelerators) { if (accelerator.canAccelerate()) { @@ -445,7 +449,7 @@ public void passiveParticles() { @Nonnull @Override public LazyOptional getCapability(@Nonnull Capability cap, Direction side) { - if (cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { + if (cap == ForgeCapabilities.ITEM_HANDLER) { if (side == null) return internalInventory.cast(); return exposedInventory.cast(); diff --git a/src/main/java/com/sammy/malum/common/block/storage/SoulVialBlockEntity.java b/src/main/java/com/sammy/malum/common/block/storage/SoulVialBlockEntity.java index e3468e10a..e16150c22 100644 --- a/src/main/java/com/sammy/malum/common/block/storage/SoulVialBlockEntity.java +++ b/src/main/java/com/sammy/malum/common/block/storage/SoulVialBlockEntity.java @@ -4,6 +4,7 @@ import com.sammy.malum.core.systems.item.ISoulContainerItem; import com.sammy.malum.core.systems.spirit.MalumEntitySpiritData; import com.sammy.malum.registry.common.block.BlockEntityRegistry; +import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.InteractionHand; @@ -14,7 +15,6 @@ import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.Vec3; -import team.lodestar.lodestone.helpers.BlockHelper; import team.lodestar.lodestone.helpers.ItemHelper; import team.lodestar.lodestone.systems.blockentity.LodestoneBlockEntity; @@ -59,7 +59,7 @@ public InteractionResult onUse(Player player, InteractionHand hand) { if (stack.getCount() > 1) { ItemStack split = stack.split(1); split.getOrCreateTag().remove(MalumEntitySpiritData.SOUL_DATA); - ItemHelper.giveItemToEntity(player, split); + ItemHelper.giveItemToEntity(split, player); } else { stack.getOrCreateTag().remove(MalumEntitySpiritData.SOUL_DATA); } @@ -70,7 +70,7 @@ public InteractionResult onUse(Player player, InteractionHand hand) { ItemStack split = stack.split(1); data.saveTo(split.getOrCreateTag()); data = null; - ItemHelper.giveItemToEntity(player, split); + ItemHelper.giveItemToEntity(split, player); } else { data.saveTo(stack.getOrCreateTag()); data = null; diff --git a/src/main/java/com/sammy/malum/config/CommonConfig.java b/src/main/java/com/sammy/malum/config/CommonConfig.java index 3c6b61fbd..6f8a5242e 100644 --- a/src/main/java/com/sammy/malum/config/CommonConfig.java +++ b/src/main/java/com/sammy/malum/config/CommonConfig.java @@ -2,162 +2,164 @@ import net.minecraftforge.common.ForgeConfigSpec; import org.apache.commons.lang3.tuple.Pair; +import team.lodestar.lodestone.systems.config.ConfigValueHolder; import team.lodestar.lodestone.systems.config.LodestoneConfig; import java.util.ArrayList; import java.util.List; -import static com.sammy.malum.MalumMod.MALUM; +import static com.sammy.malum.MalumMod.MALUM_CONFIG_GROUP; public class CommonConfig extends LodestoneConfig { //worldgen - public static ConfigValueHolder GENERATE_RUNEWOOD_TREES = new ConfigValueHolder<>(MALUM,"common/worldgen/runewood", (builder -> + public static ConfigValueHolder GENERATE_RUNEWOOD_TREES = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/runewood", (builder -> builder.comment("Should runewood trees naturally generate?") .define("generateRunewood", true))); - public static ConfigValueHolder COMMON_RUNEWOOD_CHANCE = new ConfigValueHolder<>(MALUM,"common/worldgen/runewood", (builder -> + public static ConfigValueHolder COMMON_RUNEWOOD_CHANCE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/runewood", (builder -> builder.comment("Chance for runewood trees to generate in open biomes such as plains.") .defineInRange("runewoodCommonChance", 0.02d, 0, 1))); - public static ConfigValueHolder RARE_RUNEWOOD_CHANCE = new ConfigValueHolder<>(MALUM,"common/worldgen/runewood", (builder -> + public static ConfigValueHolder RARE_RUNEWOOD_CHANCE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/runewood", (builder -> builder.comment("Chance for runewood trees to generate in forest biomes.") .defineInRange("runewoodRareChance", 0.01d, 0, 1))); - public static ConfigValueHolder GENERATE_WEEPING_WELLS = new ConfigValueHolder<>(MALUM,"common/worldgen/weeping_well", (builder -> + public static ConfigValueHolder GENERATE_WEEPING_WELLS = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/weeping_well", (builder -> builder.comment("Should the void be curious?") .define("generateTheUnknown", true))); - public static final ConfigValueHolder> WEEPING_WELL_ALLOWED_DIMENSIONS = new ConfigValueHolder<>(MALUM,"common/worldgen/weeping_well", (builder) -> + public static final ConfigValueHolder> WEEPING_WELL_ALLOWED_DIMENSIONS = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/weeping_well", (builder) -> builder.comment("Which dimensions is the void interested in?") .defineList("markedDimensions", new ArrayList<>(List.of("minecraft:overworld")), s -> s instanceof String)); - public static ConfigValueHolder GENERATE_BLAZE_QUARTZ = new ConfigValueHolder<>(MALUM,"common/worldgen/blazing_quartz", (builder -> + public static ConfigValueHolder GENERATE_BLAZE_QUARTZ = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/blazing_quartz", (builder -> builder.comment("Should blaze quartz ore generate?") .define("generateBlazeQuartz", true))); - public static ConfigValueHolder BLAZE_QUARTZ_SIZE = new ConfigValueHolder<>(MALUM,"common/worldgen/blazing_quartz", (builder -> + public static ConfigValueHolder BLAZE_QUARTZ_SIZE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/blazing_quartz", (builder -> builder.comment("Size of blaze quartz ore veins.") .define("blazeQuartzSize", 14))); - public static ConfigValueHolder BLAZE_QUARTZ_AMOUNT = new ConfigValueHolder<>(MALUM,"common/worldgen/blazing_quartz", (builder -> + public static ConfigValueHolder BLAZE_QUARTZ_AMOUNT = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/blazing_quartz", (builder -> builder.comment("Amount of blaze quartz ore veins.") .define("blazeQuartzAmount", 16))); - public static ConfigValueHolder GENERATE_BRILLIANT_STONE = new ConfigValueHolder<>(MALUM,"common/worldgen/brilliance", (builder -> + public static ConfigValueHolder GENERATE_BRILLIANT_STONE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/brilliance", (builder -> builder.comment("Should brilliant stone generate?") .define("generateBrilliantStone", true))); - public static ConfigValueHolder BRILLIANT_STONE_SIZE = new ConfigValueHolder<>(MALUM,"common/worldgen/brilliance", (builder -> + public static ConfigValueHolder BRILLIANT_STONE_SIZE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/brilliance", (builder -> builder.comment("Size of brilliant stone veins.") .define("brilliantStoneSize", 4))); - public static ConfigValueHolder BRILLIANT_STONE_AMOUNT = new ConfigValueHolder<>(MALUM,"common/worldgen/brilliance", (builder -> + public static ConfigValueHolder BRILLIANT_STONE_AMOUNT = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/brilliance", (builder -> builder.comment("Amount of brilliant stone veins.") .define("brilliantStoneAmount", 3))); - public static ConfigValueHolder BRILLIANT_STONE_MIN_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/brilliance", (builder -> + public static ConfigValueHolder BRILLIANT_STONE_MIN_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/brilliance", (builder -> builder.comment("Minimum height at which brilliant stone can spawn.") .define("brilliantStoneMinY", -64))); - public static ConfigValueHolder BRILLIANT_STONE_MAX_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/brilliance", (builder -> + public static ConfigValueHolder BRILLIANT_STONE_MAX_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/brilliance", (builder -> builder.comment("Maximum height at which brilliant stone can spawn.") .define("brilliantStoneMaxY", 40))); - public static ConfigValueHolder GENERATE_SOULSTONE = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder GENERATE_SOULSTONE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Should soulstone ore generate underground?") .define("generateSoulstone", true))); - public static ConfigValueHolder SOULSTONE_SIZE = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SOULSTONE_SIZE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Size of soulstone ore veins underground.") .define("soulstoneSize", 8))); - public static ConfigValueHolder SOULSTONE_AMOUNT = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SOULSTONE_AMOUNT = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Amount of soulstone ore veins.") .define("soulstoneAmount", 3))); - public static ConfigValueHolder SOULSTONE_MIN_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SOULSTONE_MIN_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Minimum height at which soulstone ore can spawn.") .define("soulstoneMinY", -64))); - public static ConfigValueHolder SOULSTONE_MAX_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SOULSTONE_MAX_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Maximum height at which soulstone ore can spawn.") .define("soulstoneMaxY", 30))); - public static ConfigValueHolder GENERATE_SURFACE_SOULSTONE = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder GENERATE_SURFACE_SOULSTONE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Should soulstone ore generate on the surface?") .define("generateSurfaceSoulstone", true))); - public static ConfigValueHolder SURFACE_SOULSTONE_SIZE = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SURFACE_SOULSTONE_SIZE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Size of soulstone ore veins on the surface.") .define("surfaceSoulstoneSize", 4))); - public static ConfigValueHolder SURFACE_SOULSTONE_AMOUNT = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SURFACE_SOULSTONE_AMOUNT = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Amount of soulstone ore veins on the surface.") .define("surfaceSoulstoneAmount", 4))); - public static ConfigValueHolder SURFACE_SOULSTONE_MIN_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SURFACE_SOULSTONE_MIN_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Minimum height at which surface soulstone ore can spawn.") .define("surfaceSoulstoneMinY", 60))); - public static ConfigValueHolder SURFACE_SOULSTONE_MAX_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/soulstone", (builder -> + public static ConfigValueHolder SURFACE_SOULSTONE_MAX_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/soulstone", (builder -> builder.comment("Maximum height at which surface soulstone ore can spawn.") .define("surfaceSoulstoneMaxY", 100))); - public static ConfigValueHolder GENERATE_NATURAL_QUARTZ = new ConfigValueHolder<>(MALUM,"common/worldgen/natural_quartz", (builder -> + public static ConfigValueHolder GENERATE_NATURAL_QUARTZ = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/natural_quartz", (builder -> builder.comment("Should natural quartz ore generate?") .define("generateNaturalQuartz", true))); - public static ConfigValueHolder NATURAL_QUARTZ_SIZE = new ConfigValueHolder<>(MALUM,"common/worldgen/natural_quartz", (builder -> + public static ConfigValueHolder NATURAL_QUARTZ_SIZE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/natural_quartz", (builder -> builder.comment("Size of natural quartz ore veins.") .define("naturalQuartzSize", 5))); - public static ConfigValueHolder NATURAL_QUARTZ_AMOUNT = new ConfigValueHolder<>(MALUM,"common/worldgen/natural_quartz", (builder -> + public static ConfigValueHolder NATURAL_QUARTZ_AMOUNT = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/natural_quartz", (builder -> builder.comment("Amount of natural quartz ore veins.") .define("naturalQuartzAmount", 2))); - public static ConfigValueHolder NATURAL_QUARTZ_MIN_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/natural_quartz", (builder -> + public static ConfigValueHolder NATURAL_QUARTZ_MIN_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/natural_quartz", (builder -> builder.comment("Minimum height at which natural quartz ore can spawn.") .define("naturalQuartzMinY", -64))); - public static ConfigValueHolder NATURAL_QUARTZ_MAX_Y = new ConfigValueHolder<>(MALUM,"common/worldgen/natural_quartz", (builder -> + public static ConfigValueHolder NATURAL_QUARTZ_MAX_Y = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/natural_quartz", (builder -> builder.comment("Maximum height at which natural quartz ore can spawn.") .define("naturalQuartzMaxY", 10))); - public static ConfigValueHolder GENERATE_QUARTZ_GEODES = new ConfigValueHolder<>(MALUM,"common/worldgen/natural_quartz_geode", (builder -> + public static ConfigValueHolder GENERATE_QUARTZ_GEODES = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/natural_quartz_geode", (builder -> builder.comment("Should quartz geodes generate?") .define("generateQuartzGeodes", true))); - public static final ConfigValueHolder> QUARTZ_GEODE_ALLOWED_DIMENSIONS = new ConfigValueHolder<>(MALUM,"common/worldgen/natural_quartz_geode", (builder) -> - builder.comment("Which dimensions can quartz geodes generate in?") - .defineList("quartzGeodeDimensions", new ArrayList<>(List.of("minecraft:overworld")), s -> s instanceof String)); + public static final ConfigValueHolder> QUARTZ_GEODE_ALLOWED_DIMENSIONS = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/natural_quartz_geode", (builder) -> + builder.comment("Which dimensions can quartz geodes generate in?") + .defineList("quartzGeodeDimensions", new ArrayList<>(List.of("minecraft:overworld")), s -> s instanceof String)); - public static ConfigValueHolder GENERATE_CTHONIC_GOLD = new ConfigValueHolder<>(MALUM,"common/worldgen/cthonic_gold", (builder -> + public static ConfigValueHolder GENERATE_CTHONIC_GOLD = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/cthonic_gold", (builder -> builder.comment("Should cthonic gold generate?") .define("generateCthonicGold", true))); - public static final ConfigValueHolder> CTHONIC_GOLD_ALLOWED_DIMENSIONS = new ConfigValueHolder<>(MALUM,"common/worldgen/cthonic_gold", (builder) -> - builder.comment("Which dimensions can cthonic gold generate in?") - .defineList("cthonicGoldDimensions", new ArrayList<>(List.of("minecraft:overworld")), s -> s instanceof String)); + public static final ConfigValueHolder> CTHONIC_GOLD_ALLOWED_DIMENSIONS = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/worldgen/cthonic_gold", (builder) -> + builder.comment("Which dimensions can cthonic gold generate in?") + .defineList("cthonicGoldDimensions", new ArrayList<>(List.of("minecraft:overworld")), s -> s instanceof String)); - public static ConfigValueHolder ULTIMATE_REBOUND = new ConfigValueHolder<>(MALUM,"common/item/rebound", (builder -> + public static ConfigValueHolder ULTIMATE_REBOUND = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/item/rebound", (builder -> builder.comment("If set to true, you may put rebound on any weapon in the game.") .define("enableUltimateRebound", false))); - public static ConfigValueHolder AWARD_CODEX_ON_KILL = new ConfigValueHolder<>(MALUM,"common/codex", (builder -> + public static ConfigValueHolder AWARD_CODEX_ON_KILL = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/codex", (builder -> builder.comment("If set to true, the first undead enemy a player slays will drop the encyclopedia arcana.") .define("enableCodexDrop", true))); - public static ConfigValueHolder NO_FANCY_SPIRITS = new ConfigValueHolder<>(MALUM,"common/spirit", (builder -> - builder.comment("If set to true, any spirits dropped will simply take the form of an item.") - .define("noFancySpirits", false))); + public static ConfigValueHolder NO_FANCY_SPIRITS = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/spirit", (builder -> + builder.comment("If set to true, any spirits dropped will simply take the form of an item.") + .define("noFancySpirits", false))); - public static ConfigValueHolder SOULLESS_SPAWNERS = new ConfigValueHolder<>(MALUM,"common/spirit/spawner", (builder -> + public static ConfigValueHolder SOULLESS_SPAWNERS = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/spirit/spawner", (builder -> builder.comment("If set to true, mob spawners will create soulless mobs instead.") .define("lameSpawners", false))); - public static ConfigValueHolder USE_DEFAULT_SPIRIT_VALUES = new ConfigValueHolder<>(MALUM,"common/spirit/defaults", (builder -> - builder.comment("Whether entities without spirit jsons will use the default spirit data for their category.") - .define("defaultSpiritValues", true))); + public static ConfigValueHolder USE_DEFAULT_SPIRIT_VALUES = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/spirit/defaults", (builder -> + builder.comment("Whether entities without spirit jsons will use the default spirit data for their category.") + .define("defaultSpiritValues", true))); - public static ConfigValueHolder SOUL_WARD_PHYSICAL = new ConfigValueHolder<>(MALUM,"common/spirit/affinity/soul_ward", (builder -> + public static ConfigValueHolder SOUL_WARD_PHYSICAL = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/spirit/affinity/soul_ward", (builder -> builder.comment("Multiplier for physical damage taken while soul ward is active.") .defineInRange("soulWardPhysical", 0.7f, 0, 1))); - public static ConfigValueHolder SOUL_WARD_MAGIC = new ConfigValueHolder<>(MALUM,"common/spirit/affinity/soul_ward", (builder -> + public static ConfigValueHolder SOUL_WARD_MAGIC = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/spirit/affinity/soul_ward", (builder -> builder.comment("Multiplier for magic damage taken while soul ward is active.") .defineInRange("soulWardMagic", 0.1f, 0, 1))); - public static ConfigValueHolder SOUL_WARD_RATE = new ConfigValueHolder<>(MALUM,"common/spirit/affinity/soul_ward", (builder -> + public static ConfigValueHolder SOUL_WARD_RATE = new ConfigValueHolder<>(MALUM_CONFIG_GROUP, "common/spirit/affinity/soul_ward", (builder -> builder.comment("Base time in ticks it takes for one point of soul ward to recover.") .define("soulWardRate", 60))); public CommonConfig(ForgeConfigSpec.Builder builder) { - super(MALUM, "common", builder); + super(MALUM_CONFIG_GROUP, builder); } public static final CommonConfig INSTANCE; public static final ForgeConfigSpec SPEC; static { + final Pair specPair = new ForgeConfigSpec.Builder().configure(CommonConfig::new); SPEC = specPair.getRight(); INSTANCE = specPair.getLeft(); diff --git a/src/main/java/com/sammy/malum/core/events/ClientSetupEvents.java b/src/main/java/com/sammy/malum/core/events/ClientSetupEvents.java index e5cd1737a..ff58548c1 100644 --- a/src/main/java/com/sammy/malum/core/events/ClientSetupEvents.java +++ b/src/main/java/com/sammy/malum/core/events/ClientSetupEvents.java @@ -1,7 +1,9 @@ package com.sammy.malum.core.events; import com.sammy.malum.core.handlers.SoulHarvestHandler; -import com.sammy.malum.core.setup.client.ParticleRegistry; +import com.sammy.malum.core.handlers.SoulWardHandler; +import com.sammy.malum.core.handlers.TouchOfDarknessHandler; +import com.sammy.malum.registry.client.ParticleRegistry; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.world.entity.EntityType; @@ -28,13 +30,9 @@ public static void addRenderLayers(EntityRenderersEvent.AddLayers event) { @SubscribeEvent public static void registerOverlays(RegisterGuiOverlaysEvent event) { event.registerAbove(VanillaGuiOverlay.ARMOR_LEVEL.id(), "soul_ward", (gui, poseStack, partialTick, width, height) -> - ArcaneAffinity.ClientOnly.renderSoulWard(gui, poseStack, width, height)); - @SubscribeEvent(priority = EventPriority.LOWEST) - public static void registerOverlays(FMLClientSetupEvent event) { - OverlayRegistry.registerOverlayAbove(ForgeIngameGui.ARMOR_LEVEL_ELEMENT, "Soul Ward", (gui, poseStack, partialTick, width, height) -> - SoulWardHandler.ClientOnly.renderSoulWard(gui, poseStack, width, height)); - OverlayRegistry.registerOverlayAbove(ForgeIngameGui.SLEEP_FADE_ELEMENT, "Touch of Darkness", (gui, poseStack, partialTick, width, height) -> - TouchOfDarknessHandler.ClientOnly.renderDarknessVignette(poseStack)); + SoulWardHandler.ClientOnly.renderSoulWard(gui, poseStack, width, height)); + event.registerAbove(VanillaGuiOverlay.SLEEP_FADE.id(), "touch_of_darkness", (gui, poseStack, partialTick, width, height) -> + TouchOfDarknessHandler.ClientOnly.renderDarknessVignette(poseStack)); } @SubscribeEvent diff --git a/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java b/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java index 1b1a1e8db..6bbddfd39 100644 --- a/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java +++ b/src/main/java/com/sammy/malum/core/handlers/SoulWardHandler.java @@ -21,19 +21,19 @@ import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; -import net.minecraftforge.client.gui.ForgeIngameGui; +import net.minecraftforge.client.gui.overlay.ForgeGui; import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent; import team.lodestar.lodestone.handlers.screenparticle.ScreenParticleHandler; import team.lodestar.lodestone.helpers.ItemHelper; -import team.lodestar.lodestone.setup.LodestoneScreenParticleRegistry; -import team.lodestar.lodestone.setup.LodestoneShaderRegistry; +import team.lodestar.lodestone.registry.client.LodestoneShaderRegistry; +import team.lodestar.lodestone.registry.common.particle.LodestoneScreenParticleRegistry; import team.lodestar.lodestone.systems.particle.ScreenParticleBuilder; import team.lodestar.lodestone.systems.particle.data.ColorParticleData; import team.lodestar.lodestone.systems.particle.data.GenericParticleData; import team.lodestar.lodestone.systems.particle.data.SpinParticleData; import team.lodestar.lodestone.systems.rendering.VFXBuilders; -import team.lodestar.lodestone.systems.rendering.shader.*; +import team.lodestar.lodestone.systems.rendering.shader.ExtendedShaderInstance; public class SoulWardHandler { @@ -76,7 +76,7 @@ public static void shieldPlayer(LivingHurtEvent event) { if (event.isCanceled() || event.getAmount() <= 0) { return; } - if (event.getEntityLiving() instanceof Player player) { + if (event.getEntity() instanceof Player player) { if (!player.level.isClientSide) { SoulWardHandler soulWardHandler = MalumPlayerDataCapability.getCapability(player).soulWardHandler; soulWardHandler.soulWardProgress = getSoulWardCooldown(0) + getSoulWardCooldown(player); @@ -131,7 +131,7 @@ public static int getSoulWardCooldown(double recoverySpeed) { } public static class ClientOnly { - public static void renderSoulWard(ForgeIngameGui gui, PoseStack poseStack, int width, int height) { + public static void renderSoulWard(ForgeGui gui, PoseStack poseStack, int width, int height) { Minecraft minecraft = Minecraft.getInstance(); if (!minecraft.options.hideGui && gui.shouldDrawSurvivalElements()) { gui.setupOverlayRenderState(true, false); @@ -144,7 +144,7 @@ public static void renderSoulWard(ForgeIngameGui gui, PoseStack poseStack, int w float armor = (float) player.getAttribute(Attributes.ARMOR).getValue(); int left = width / 2 - 91; - int top = height - gui.left_height; + int top = height - gui.leftHeight; if (armor == 0) { top += 4; diff --git a/src/main/java/com/sammy/malum/registry/client/ParticleRegistry.java b/src/main/java/com/sammy/malum/registry/client/ParticleRegistry.java index 27d567d14..56e3ef9db 100644 --- a/src/main/java/com/sammy/malum/registry/client/ParticleRegistry.java +++ b/src/main/java/com/sammy/malum/registry/client/ParticleRegistry.java @@ -2,11 +2,11 @@ import com.sammy.malum.MalumMod; import com.sammy.malum.client.particles.cut.ScytheAttackParticle; +import com.sammy.malum.client.particles.spiritflame.SpiritFlameParticle; import com.sammy.malum.client.particles.spiritflame.SpiritFlameParticleType; -import net.minecraft.client.Minecraft; import net.minecraft.core.particles.ParticleType; import net.minecraft.core.particles.SimpleParticleType; -import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; +import net.minecraftforge.client.event.RegisterParticleProvidersEvent; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; @@ -16,14 +16,12 @@ public class ParticleRegistry { public static DeferredRegister> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, MalumMod.MALUM); public static RegistryObject SPIRIT_FLAME_PARTICLE = PARTICLES.register("spirit_flame", SpiritFlameParticleType::new); - public static RegistryObject SCYTHE_CUT_ATTACK_PARTICLE = PARTICLES.register("scythe_cut_attack", () -> new SimpleParticleType(true)); public static RegistryObject SCYTHE_SWEEP_ATTACK_PARTICLE = PARTICLES.register("scythe_sweep_attack", () -> new SimpleParticleType(true)); - public static void registerParticleFactory(ParticleFactoryRegisterEvent event) { - Minecraft.getInstance().particleEngine.register(SPIRIT_FLAME_PARTICLE.get(), SpiritFlameParticleType.Factory::new); - - Minecraft.getInstance().particleEngine.register(SCYTHE_CUT_ATTACK_PARTICLE.get(), ScytheAttackParticle.Factory::new); - Minecraft.getInstance().particleEngine.register(SCYTHE_SWEEP_ATTACK_PARTICLE.get(), ScytheAttackParticle.Factory::new); + public static void registerParticleFactory(RegisterParticleProvidersEvent event) { + event.register(SPIRIT_FLAME_PARTICLE.get(), SpiritFlameParticle.Factory::new); + event.register(SCYTHE_CUT_ATTACK_PARTICLE.get(), ScytheAttackParticle.Factory::new); + event.register(SCYTHE_SWEEP_ATTACK_PARTICLE.get(), ScytheAttackParticle.Factory::new); } } \ No newline at end of file