Skip to content

Commit

Permalink
fixed api dependency on main code
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Dec 5, 2024
1 parent 9f4a51d commit 95838ff
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

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;
Expand Down Expand Up @@ -152,12 +152,39 @@ static BlockPos getHighestSpot(Level level, BlockPos pos, int radius, BlockPos d
*/
int storeAura(BlockPos pos, int amount);

AuraChunk.DrainSpot getActualDrainSpot(BlockPos pos, boolean make);
DrainSpot getActualDrainSpot(BlockPos pos, boolean make);

int getDrainSpot(BlockPos pos);

IAuraType getType();

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;
}

}

}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,7 +10,7 @@

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);

Expand All @@ -28,4 +27,5 @@ default ItemStack getDisplayIcon() {
enum ActiveType {
INACTIVE, INHIBITED, ACTIVE
}

}
27 changes: 0 additions & 27 deletions src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,31 +278,4 @@ private void addOrRemoveAsActive() {
}
}

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;
}

}

}

0 comments on commit 95838ff

Please sign in to comment.