mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-12-22 06:59:22 +01:00
fixed api dependency on main code
This commit is contained in:
parent
9f4a51df18
commit
95838ff567
3 changed files with 31 additions and 31 deletions
|
@ -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<CompoundTag> {
|
|||
*/
|
||||
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<CompoundTag> {
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue