this doesn't compile yet, but have something to peek at
This commit is contained in:
parent
973f1019a5
commit
5fcdd978d7
329 changed files with 3247 additions and 2953 deletions
|
@ -1,17 +1,20 @@
|
|||
package WayofTime.bloodmagic.demonAura;
|
||||
|
||||
import lombok.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
@EqualsAndHashCode
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Setter
|
||||
public class PosXY implements Comparable<PosXY>
|
||||
{
|
||||
public int x;
|
||||
public int y;
|
||||
|
||||
public PosXY() {
|
||||
}
|
||||
|
||||
public PosXY(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(PosXY c)
|
||||
{
|
||||
|
@ -29,4 +32,38 @@ public class PosXY implements Comparable<PosXY>
|
|||
{
|
||||
return getDistanceSquared(c.x, c.y);
|
||||
}
|
||||
|
||||
public void setX(int x) {
|
||||
this.x = x;
|
||||
}
|
||||
|
||||
public void setY(int y) {
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this)
|
||||
.append("x", x)
|
||||
.append("y", y)
|
||||
.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof PosXY)) return false;
|
||||
|
||||
PosXY posXY = (PosXY) o;
|
||||
|
||||
if (x != posXY.x) return false;
|
||||
return y == posXY.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = x;
|
||||
result = 31 * result + y;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
package WayofTime.bloodmagic.demonAura;
|
||||
|
||||
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class WillChunk
|
||||
{
|
||||
PosXY loc;
|
||||
|
@ -23,7 +19,7 @@ public class WillChunk
|
|||
|
||||
public WillChunk(Chunk chunk, short base, DemonWillHolder currentWill)
|
||||
{
|
||||
this.loc = new PosXY(chunk.xPosition, chunk.zPosition);
|
||||
this.loc = new PosXY(chunk.x, chunk.z);
|
||||
this.chunkRef = new WeakReference(chunk);
|
||||
this.base = base;
|
||||
this.currentWill = currentWill;
|
||||
|
@ -32,4 +28,36 @@ public class WillChunk
|
|||
public boolean isModified() {
|
||||
return (this.chunkRef != null) && (this.chunkRef.get() != null) && this.chunkRef.get().needsSaving(false);
|
||||
}
|
||||
|
||||
public PosXY getLoc() {
|
||||
return loc;
|
||||
}
|
||||
|
||||
public void setLoc(PosXY loc) {
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public short getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
public void setBase(short base) {
|
||||
this.base = base;
|
||||
}
|
||||
|
||||
public DemonWillHolder getCurrentWill() {
|
||||
return currentWill;
|
||||
}
|
||||
|
||||
public void setCurrentWill(DemonWillHolder currentWill) {
|
||||
this.currentWill = currentWill;
|
||||
}
|
||||
|
||||
public WeakReference<Chunk> getChunkRef() {
|
||||
return chunkRef;
|
||||
}
|
||||
|
||||
public void setChunkRef(WeakReference<Chunk> chunkRef) {
|
||||
this.chunkRef = chunkRef;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,10 @@
|
|||
package WayofTime.bloodmagic.demonAura;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class WillWorld
|
||||
{
|
||||
int dim;
|
||||
@Getter
|
||||
@Setter
|
||||
ConcurrentHashMap<PosXY, WillChunk> willChunks = new ConcurrentHashMap<PosXY, WillChunk>();
|
||||
|
||||
// private static ConcurrentHashMap<PosXY, AspectList> nodeTickets = new ConcurrentHashMap();
|
||||
|
@ -29,6 +24,14 @@ public class WillWorld
|
|||
return this.willChunks.get(loc);
|
||||
}
|
||||
|
||||
public ConcurrentHashMap<PosXY, WillChunk> getWillChunks() {
|
||||
return willChunks;
|
||||
}
|
||||
|
||||
public void setWillChunks(ConcurrentHashMap<PosXY, WillChunk> willChunks) {
|
||||
this.willChunks = willChunks;
|
||||
}
|
||||
|
||||
// public static ConcurrentHashMap<PosXY, AspectList> getNodeTickets()
|
||||
// {
|
||||
// return nodeTickets;
|
||||
|
|
|
@ -54,14 +54,14 @@ public class WorldDemonWillHandler
|
|||
if (!containedWills.containsKey(dim))
|
||||
{
|
||||
containedWills.put(dim, new WillWorld(dim));
|
||||
BloodMagicAPI.getLogger().info("Creating demon will cache for world " + dim);
|
||||
BloodMagicAPI.logger.info("Creating demon will cache for world " + dim);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeWillWorld(int dim)
|
||||
{
|
||||
containedWills.remove(dim);
|
||||
BloodMagicAPI.getLogger().info("Removing demon will cache for world " + dim);
|
||||
BloodMagicAPI.logger.info("Removing demon will cache for world " + dim);
|
||||
}
|
||||
|
||||
public static void addWillChunk(int dim, Chunk chunk, short base, DemonWillHolder currentWill)
|
||||
|
@ -71,7 +71,7 @@ public class WorldDemonWillHandler
|
|||
{
|
||||
aw = new WillWorld(dim);
|
||||
}
|
||||
aw.getWillChunks().put(new PosXY(chunk.xPosition, chunk.zPosition), new WillChunk(chunk, base, currentWill));
|
||||
aw.getWillChunks().put(new PosXY(chunk.x, chunk.z), new WillChunk(chunk, base, currentWill));
|
||||
|
||||
containedWills.put(dim, aw);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue