diff --git a/src/main/java/com/sammy/malum/client/screen/codex/screens/ArcanaProgressionScreen.java b/src/main/java/com/sammy/malum/client/screen/codex/screens/ArcanaProgressionScreen.java index cf5bb3ac4..aa28be808 100644 --- a/src/main/java/com/sammy/malum/client/screen/codex/screens/ArcanaProgressionScreen.java +++ b/src/main/java/com/sammy/malum/client/screen/codex/screens/ArcanaProgressionScreen.java @@ -7,8 +7,8 @@ import com.sammy.malum.client.screen.codex.pages.recipe.*; import com.sammy.malum.client.screen.codex.pages.recipe.vanilla.*; import com.sammy.malum.client.screen.codex.pages.text.*; -import com.sammy.malum.common.events.*; import com.sammy.malum.common.item.codex.*; +import com.sammy.malum.core.systems.events.*; import com.sammy.malum.registry.common.*; import net.minecraft.client.*; import net.minecraft.resources.*; diff --git a/src/main/java/com/sammy/malum/client/screen/codex/screens/VoidProgressionScreen.java b/src/main/java/com/sammy/malum/client/screen/codex/screens/VoidProgressionScreen.java index 4c6233e69..53c1be45e 100644 --- a/src/main/java/com/sammy/malum/client/screen/codex/screens/VoidProgressionScreen.java +++ b/src/main/java/com/sammy/malum/client/screen/codex/screens/VoidProgressionScreen.java @@ -16,7 +16,7 @@ import com.sammy.malum.client.screen.codex.pages.text.HeadlineTextPage; import com.sammy.malum.client.screen.codex.pages.text.TextPage; import com.sammy.malum.client.screen.codex.pages.text.WeepingWellTextPage; -import com.sammy.malum.common.events.SetupMalumCodexEntriesEvent; +import com.sammy.malum.core.systems.events.SetupMalumCodexEntriesEvent; import com.sammy.malum.common.item.codex.EncyclopediaEsotericaItem; import com.sammy.malum.registry.common.SoundRegistry; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/sammy/malum/common/capability/MalumItemDataCapability.java b/src/main/java/com/sammy/malum/common/capability/MalumItemDataCapability.java index 08b464a08..8f147602a 100644 --- a/src/main/java/com/sammy/malum/common/capability/MalumItemDataCapability.java +++ b/src/main/java/com/sammy/malum/common/capability/MalumItemDataCapability.java @@ -26,43 +26,31 @@ public class MalumItemDataCapability { public static final Codec CODEC = RecordCodecBuilder.create(obj -> obj.group( Codec.list(ItemStack.CODEC).fieldOf("soulsToDrop").forGetter(c -> c.soulsToDrop), - UUIDUtil.CODEC.fieldOf("attackerForSouls").forGetter(c -> c.attackerForSouls), - Codec.FLOAT.fieldOf("totalSoulCount").forGetter(c -> c.totalSoulCount) + UUIDUtil.CODEC.fieldOf("attackerForSouls").forGetter(c -> c.attackerForSouls) ).apply(obj, MalumItemDataCapability::new)); public List soulsToDrop; public UUID attackerForSouls; - public float totalSoulCount; - public MalumItemDataCapability() {} - - public MalumItemDataCapability(List soulsToDrop, UUID attackerForSouls, float totalSoulCount) { + public MalumItemDataCapability(List soulsToDrop, UUID attackerForSouls) { this.soulsToDrop = soulsToDrop; this.attackerForSouls = attackerForSouls; - this.totalSoulCount = totalSoulCount; } - public static void registerCapabilities(RegisterCapabilitiesEvent event) { - event.registerEntity(CAPABILITY, EntityType.ITEM, GET_CAPABILITY); + public static void registerItemDataCapability(RegisterCapabilitiesEvent event) { + event.registerEntity(CAPABILITY, EntityType.ITEM, (item, ctx) -> { + CompoundTag tag = item.getPersistentData(); + return CodecUtil.decodeNBT(MalumItemDataCapability.CODEC, tag); + }); } - public static ICapabilityProvider GET_CAPABILITY = (item, ctx) -> { - CompoundTag tag = item.getPersistentData(); - return CodecUtil.decodeNBT(MalumItemDataCapability.CODEC, tag); - }; - public static Optional getCapabilityOptional(ItemEntity entity) { return Optional.ofNullable(entity.getCapability(CAPABILITY)); } - public static MalumItemDataCapability getCapability(ItemEntity entity) { - return getCapabilityOptional(entity).orElse(new MalumItemDataCapability(null, null, 0)); - } - public void pullFromNBT(CompoundTag tag) { MalumItemDataCapability capability = CodecUtil.decodeNBT(CODEC, tag); this.soulsToDrop = capability.soulsToDrop; this.attackerForSouls = capability.attackerForSouls; - this.totalSoulCount = capability.totalSoulCount; } } diff --git a/src/main/java/com/sammy/malum/core/events/SetupEvents.java b/src/main/java/com/sammy/malum/core/events/SetupEvents.java index 7d30d4f0c..bf09d906d 100644 --- a/src/main/java/com/sammy/malum/core/events/SetupEvents.java +++ b/src/main/java/com/sammy/malum/core/events/SetupEvents.java @@ -14,6 +14,6 @@ public class SetupEvents { public static void registerCapabilities(RegisterCapabilitiesEvent event) { MalumPlayerDataCapability.registerCapabilities(event); MalumLivingEntityDataCapability.registerCapabilities(event); - MalumItemDataCapability.registerCapabilities(event); + MalumItemDataCapability.registerItemDataCapability(event); } } \ No newline at end of file diff --git a/src/main/java/com/sammy/malum/core/handlers/SpiritHarvestHandler.java b/src/main/java/com/sammy/malum/core/handlers/SpiritHarvestHandler.java index 2c7bfd742..4384bc179 100644 --- a/src/main/java/com/sammy/malum/core/handlers/SpiritHarvestHandler.java +++ b/src/main/java/com/sammy/malum/core/handlers/SpiritHarvestHandler.java @@ -210,8 +210,9 @@ private static void createSpiritEntities(Level level, Collection spir } boolean noFancySpirits = CommonConfig.NO_FANCY_SPIRITS.getConfigValue(); for (int j = 0; j < stack.getCount(); j++) { + final ItemStack droppedSpirit = ItemHelper.copyWithNewCount(stack, 1); if (noFancySpirits) { - ItemEntity itemEntity = new ItemEntity(level, position.x, position.y, position.z, stack); + ItemEntity itemEntity = new ItemEntity(level, position.x, position.y, position.z, droppedSpirit); itemEntity.setDefaultPickUpDelay(); itemEntity.setDeltaMovement( Mth.nextFloat(random, -0.1F, 0.1F), @@ -220,7 +221,7 @@ private static void createSpiritEntities(Level level, Collection spir level.addFreshEntity(itemEntity); continue; } - SpiritItemEntity entity = new SpiritItemEntity(level, attackerUUID, ItemHelper.copyWithNewCount(stack, 1), + SpiritItemEntity entity = new SpiritItemEntity(level, attackerUUID, droppedSpirit, position.x, position.y, position.z, diff --git a/src/main/java/com/sammy/malum/common/events/SetupMalumCodexEntriesEvent.java b/src/main/java/com/sammy/malum/core/systems/events/SetupMalumCodexEntriesEvent.java similarity index 88% rename from src/main/java/com/sammy/malum/common/events/SetupMalumCodexEntriesEvent.java rename to src/main/java/com/sammy/malum/core/systems/events/SetupMalumCodexEntriesEvent.java index d761b0ff8..72fda8256 100644 --- a/src/main/java/com/sammy/malum/common/events/SetupMalumCodexEntriesEvent.java +++ b/src/main/java/com/sammy/malum/core/systems/events/SetupMalumCodexEntriesEvent.java @@ -1,4 +1,4 @@ -package com.sammy.malum.common.events; +package com.sammy.malum.core.systems.events; import net.neoforged.bus.api.*; diff --git a/src/main/java/com/sammy/malum/data/recipe/builder/RunicWorkbenchRecipeBuilder.java b/src/main/java/com/sammy/malum/data/recipe/builder/RunicWorkbenchRecipeBuilder.java index 6301444da..e16727066 100644 --- a/src/main/java/com/sammy/malum/data/recipe/builder/RunicWorkbenchRecipeBuilder.java +++ b/src/main/java/com/sammy/malum/data/recipe/builder/RunicWorkbenchRecipeBuilder.java @@ -19,7 +19,6 @@ public class RunicWorkbenchRecipeBuilder implements AutonamedRecipeBuilder> criteria = new LinkedHashMap<>(); public RunicWorkbenchRecipeBuilder(ItemStack output) { this.output = output;