From 95838ff567fd93f274ca5a8eee50713123b64aa1 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 5 Dec 2024 22:15:34 +0100 Subject: [PATCH] fixed api dependency on main code --- .../api/aura/chunk/IAuraChunk.java | 31 +++++++++++++++++-- .../api/aura/chunk/IDrainSpotEffect.java | 4 +-- .../ellpeck/naturesaura/chunk/AuraChunk.java | 27 ---------------- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java index c6dccb60..38f76237 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java @@ -2,12 +2,12 @@ package de.ellpeck.naturesaura.api.aura.chunk; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import de.ellpeck.naturesaura.chunk.AuraChunk; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; import net.minecraft.world.level.chunk.LevelChunk; import net.neoforged.neoforge.common.util.INBTSerializable; +import org.apache.commons.lang3.mutable.MutableInt; import org.apache.commons.lang3.tuple.Pair; import java.util.function.BiConsumer; @@ -152,7 +152,7 @@ public interface IAuraChunk extends INBTSerializable { */ int storeAura(BlockPos pos, int amount); - AuraChunk.DrainSpot getActualDrainSpot(BlockPos pos, boolean make); + DrainSpot getActualDrainSpot(BlockPos pos, boolean make); int getDrainSpot(BlockPos pos); @@ -160,4 +160,31 @@ public interface IAuraChunk extends INBTSerializable { void markDirty(); + class DrainSpot extends MutableInt { + + public final BlockPos pos; + public BlockPos originalSpreadPos; + + public DrainSpot(BlockPos pos, int value) { + super(value); + this.pos = pos; + } + + public DrainSpot(CompoundTag tag) { + this(BlockPos.of(tag.getLong("pos")), tag.getInt("amount")); + if (tag.contains("original_spread_pos")) + this.originalSpreadPos = BlockPos.of(tag.getLong("original_spread_pos")); + } + + public CompoundTag serializeNBT() { + var ret = new CompoundTag(); + ret.putLong("pos", this.pos.asLong()); + ret.putInt("amount", this.intValue()); + if (this.originalSpreadPos != null) + ret.putLong("original_spread_pos", this.originalSpreadPos.asLong()); + return ret; + } + + } + } diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java index 66cb7cef..e3696066 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java @@ -1,7 +1,6 @@ package de.ellpeck.naturesaura.api.aura.chunk; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import de.ellpeck.naturesaura.chunk.AuraChunk; import net.minecraft.core.BlockPos; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; @@ -11,7 +10,7 @@ import net.minecraft.world.level.chunk.LevelChunk; public interface IDrainSpotEffect { - void update(Level level, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot, AuraChunk.DrainSpot actualSpot); + void update(Level level, LevelChunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot, IAuraChunk.DrainSpot actualSpot); boolean appliesHere(LevelChunk chunk, IAuraChunk auraChunk, IAuraType type); @@ -28,4 +27,5 @@ public interface IDrainSpotEffect { enum ActiveType { INACTIVE, INHIBITED, ACTIVE } + } diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java index 569e0668..9c30f33b 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java @@ -278,31 +278,4 @@ public class AuraChunk implements IAuraChunk { } } - public static class DrainSpot extends MutableInt { - - public final BlockPos pos; - public BlockPos originalSpreadPos; - - public DrainSpot(BlockPos pos, int value) { - super(value); - this.pos = pos; - } - - public DrainSpot(CompoundTag tag) { - this(BlockPos.of(tag.getLong("pos")), tag.getInt("amount")); - if (tag.contains("original_spread_pos")) - this.originalSpreadPos = BlockPos.of(tag.getLong("original_spread_pos")); - } - - public CompoundTag serializeNBT() { - var ret = new CompoundTag(); - ret.putLong("pos", this.pos.asLong()); - ret.putInt("amount", this.intValue()); - if (this.originalSpreadPos != null) - ret.putLong("original_spread_pos", this.originalSpreadPos.asLong()); - return ret; - } - - } - }