mirror of
https://github.com/Xiao-MoMi/Custom-Crops.git
synced 2025-12-23 08:59:28 +00:00
change name to BlockPos
This commit is contained in:
@@ -19,20 +19,20 @@ package net.momirealms.customcrops.api.mechanic.world;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class ChunkPos {
|
||||
public class BlockPos {
|
||||
|
||||
private final int position;
|
||||
|
||||
public ChunkPos(int position) {
|
||||
public BlockPos(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public ChunkPos(int x, int y, int z) {
|
||||
public BlockPos(int x, int y, int z) {
|
||||
this.position = ((x & 0xF) << 28) | ((z & 0xF) << 24) | (y & 0xFFFFFF);
|
||||
}
|
||||
|
||||
public static ChunkPos getByLocation(SimpleLocation location) {
|
||||
return new ChunkPos(location.getX() % 16, location.getY(), location.getZ() % 16);
|
||||
public static BlockPos getByLocation(SimpleLocation location) {
|
||||
return new BlockPos(location.getX() % 16, location.getY(), location.getZ() % 16);
|
||||
}
|
||||
|
||||
public SimpleLocation getLocation(String world, ChunkCoordinate coordinate) {
|
||||
@@ -67,8 +67,8 @@ public class ChunkPos {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
ChunkPos chunkPos = (ChunkPos) o;
|
||||
return position == chunkPos.position;
|
||||
BlockPos blockPos = (BlockPos) o;
|
||||
return position == blockPos.position;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.api.mechanic.world.level;
|
||||
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.BlockPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.CustomCropsBlock;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -26,15 +26,15 @@ public interface CustomCropsSection {
|
||||
|
||||
int getSectionID();
|
||||
|
||||
CustomCropsBlock getBlockAt(ChunkPos pos);
|
||||
CustomCropsBlock getBlockAt(BlockPos pos);
|
||||
|
||||
CustomCropsBlock removeBlockAt(ChunkPos pos);
|
||||
CustomCropsBlock removeBlockAt(BlockPos pos);
|
||||
|
||||
CustomCropsBlock addBlockAt(ChunkPos pos, CustomCropsBlock block);
|
||||
CustomCropsBlock addBlockAt(BlockPos pos, CustomCropsBlock block);
|
||||
|
||||
boolean canPrune();
|
||||
|
||||
CustomCropsBlock[] getBlocks();
|
||||
|
||||
Map<ChunkPos, CustomCropsBlock> getBlockMap();
|
||||
Map<BlockPos, CustomCropsBlock> getBlockMap();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import net.momirealms.customcrops.api.mechanic.item.Sprinkler;
|
||||
import net.momirealms.customcrops.api.mechanic.misc.CRotation;
|
||||
import net.momirealms.customcrops.api.mechanic.requirement.State;
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkCoordinate;
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.BlockPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.mechanic.world.SimpleLocation;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.*;
|
||||
@@ -47,7 +47,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
private final ChunkCoordinate chunkCoordinate;
|
||||
private final ConcurrentHashMap<Integer, CSection> loadedSections;
|
||||
private final PriorityQueue<TickTask> queue;
|
||||
private final Set<ChunkPos> tickedBlocks;
|
||||
private final Set<BlockPos> tickedBlocks;
|
||||
private long lastLoadedTime;
|
||||
private int loadedSeconds;
|
||||
private int unloadedSeconds;
|
||||
@@ -69,7 +69,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
long lastLoadedTime,
|
||||
ConcurrentHashMap<Integer, CSection> loadedSections,
|
||||
PriorityQueue<TickTask> queue,
|
||||
HashSet<ChunkPos> tickedBlocks
|
||||
HashSet<BlockPos> tickedBlocks
|
||||
) {
|
||||
this.cWorld = cWorld;
|
||||
this.chunkCoordinate = chunkCoordinate;
|
||||
@@ -124,7 +124,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
while (!queue.isEmpty() && queue.peek().getTime() <= loadedSeconds) {
|
||||
TickTask task = queue.poll();
|
||||
if (task != null) {
|
||||
ChunkPos pos = task.getChunkPos();
|
||||
BlockPos pos = task.getChunkPos();
|
||||
CSection section = loadedSections.get(pos.getSectionID());
|
||||
if (section != null) {
|
||||
CustomCropsBlock block = section.getBlockAt(pos);
|
||||
@@ -161,7 +161,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
int x = random.nextInt(16);
|
||||
int y = random.nextInt(16) + baseY;
|
||||
int z = random.nextInt(16);
|
||||
CustomCropsBlock block = section.getBlockAt(new ChunkPos(x,y,z));
|
||||
CustomCropsBlock block = section.getBlockAt(new BlockPos(x,y,z));
|
||||
if (block != null) {
|
||||
switch (block.getType()) {
|
||||
case CROP -> {
|
||||
@@ -199,7 +199,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
public void arrangeTasks(int unit) {
|
||||
ThreadLocalRandom random = ThreadLocalRandom.current();
|
||||
for (CustomCropsSection section : getSections()) {
|
||||
for (Map.Entry<ChunkPos, CustomCropsBlock> entry : section.getBlockMap().entrySet()) {
|
||||
for (Map.Entry<BlockPos, CustomCropsBlock> entry : section.getBlockMap().entrySet()) {
|
||||
this.queue.add(new TickTask(
|
||||
random.nextInt(0, unit),
|
||||
entry.getKey()
|
||||
@@ -209,7 +209,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
}
|
||||
}
|
||||
|
||||
public void tryCreatingTaskForNewBlock(ChunkPos pos) {
|
||||
public void tryCreatingTaskForNewBlock(BlockPos pos) {
|
||||
WorldSetting setting = cWorld.getWorldSetting();
|
||||
if (setting.isScheduledTick() && !tickedBlocks.contains(pos)) {
|
||||
tickedBlocks.add(pos);
|
||||
@@ -433,7 +433,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
|
||||
@Override
|
||||
public CustomCropsBlock removeBlockAt(SimpleLocation location) {
|
||||
ChunkPos pos = ChunkPos.getByLocation(location);
|
||||
BlockPos pos = BlockPos.getByLocation(location);
|
||||
CSection section = loadedSections.get(pos.getSectionID());
|
||||
if (section == null) return null;
|
||||
return section.removeBlockAt(pos);
|
||||
@@ -441,7 +441,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
|
||||
@Override
|
||||
public CustomCropsBlock addBlockAt(CustomCropsBlock block, SimpleLocation location) {
|
||||
ChunkPos pos = ChunkPos.getByLocation(location);
|
||||
BlockPos pos = BlockPos.getByLocation(location);
|
||||
CSection section = loadedSections.get(pos.getSectionID());
|
||||
if (section == null) {
|
||||
section = new CSection(pos.getSectionID());
|
||||
@@ -453,7 +453,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
|
||||
@Override
|
||||
public Optional<CustomCropsBlock> getBlockAt(SimpleLocation location) {
|
||||
ChunkPos pos = ChunkPos.getByLocation(location);
|
||||
BlockPos pos = BlockPos.getByLocation(location);
|
||||
CSection section = loadedSections.get(pos.getSectionID());
|
||||
if (section == null) {
|
||||
return Optional.empty();
|
||||
@@ -539,7 +539,7 @@ public class CChunk implements CustomCropsChunk {
|
||||
return queue;
|
||||
}
|
||||
|
||||
public Set<ChunkPos> getTickedBlocks() {
|
||||
public Set<BlockPos> getTickedBlocks() {
|
||||
return tickedBlocks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
package net.momirealms.customcrops.mechanic.world;
|
||||
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.BlockPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsSection;
|
||||
|
||||
@@ -27,14 +27,14 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class CSection implements CustomCropsSection {
|
||||
|
||||
private final int sectionID;
|
||||
private final ConcurrentHashMap<ChunkPos, CustomCropsBlock> blocks;
|
||||
private final ConcurrentHashMap<BlockPos, CustomCropsBlock> blocks;
|
||||
|
||||
public CSection(int sectionID) {
|
||||
this.sectionID = sectionID;
|
||||
this.blocks = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
public CSection(int sectionID, ConcurrentHashMap<ChunkPos, CustomCropsBlock> blocks) {
|
||||
public CSection(int sectionID, ConcurrentHashMap<BlockPos, CustomCropsBlock> blocks) {
|
||||
this.blocks = blocks;
|
||||
this.sectionID = sectionID;
|
||||
}
|
||||
@@ -45,17 +45,17 @@ public class CSection implements CustomCropsSection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCropsBlock getBlockAt(ChunkPos pos) {
|
||||
public CustomCropsBlock getBlockAt(BlockPos pos) {
|
||||
return blocks.get(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCropsBlock removeBlockAt(ChunkPos pos) {
|
||||
public CustomCropsBlock removeBlockAt(BlockPos pos) {
|
||||
return blocks.remove(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomCropsBlock addBlockAt(ChunkPos pos, CustomCropsBlock block) {
|
||||
public CustomCropsBlock addBlockAt(BlockPos pos, CustomCropsBlock block) {
|
||||
return blocks.put(pos, block);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class CSection implements CustomCropsSection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ChunkPos, CustomCropsBlock> getBlockMap() {
|
||||
public Map<BlockPos, CustomCropsBlock> getBlockMap() {
|
||||
return blocks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import com.google.gson.Gson;
|
||||
import net.momirealms.customcrops.api.CustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.manager.ConfigManager;
|
||||
import net.momirealms.customcrops.api.manager.WorldManager;
|
||||
import net.momirealms.customcrops.api.mechanic.item.ItemType;
|
||||
import net.momirealms.customcrops.api.mechanic.world.*;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsChunk;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsWorld;
|
||||
@@ -241,21 +240,21 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor {
|
||||
PriorityQueue<TickTask> queue = new PriorityQueue<>(Math.max(11, tasksSize));
|
||||
for (int i = 0; i < tasksSize; i++) {
|
||||
int time = chunkData.readInt();
|
||||
ChunkPos pos = new ChunkPos(chunkData.readInt());
|
||||
BlockPos pos = new BlockPos(chunkData.readInt());
|
||||
queue.add(new TickTask(time, pos));
|
||||
}
|
||||
// read ticked blocks
|
||||
int tickedSize = chunkData.readInt();
|
||||
HashSet<ChunkPos> tickedSet = new HashSet<>(Math.max(11, tickedSize));
|
||||
HashSet<BlockPos> tickedSet = new HashSet<>(Math.max(11, tickedSize));
|
||||
for (int i = 0; i < tickedSize; i++) {
|
||||
tickedSet.add(new ChunkPos(chunkData.readInt()));
|
||||
tickedSet.add(new BlockPos(chunkData.readInt()));
|
||||
}
|
||||
// read block data
|
||||
ConcurrentHashMap<Integer, CSection> sectionMap = new ConcurrentHashMap<>();
|
||||
int sections = chunkData.readInt();
|
||||
// read sections
|
||||
for (int i = 0; i < sections; i++) {
|
||||
ConcurrentHashMap<ChunkPos, CustomCropsBlock> blockMap = new ConcurrentHashMap<>();
|
||||
ConcurrentHashMap<BlockPos, CustomCropsBlock> blockMap = new ConcurrentHashMap<>();
|
||||
int sectionID = chunkData.readInt();
|
||||
byte[] sectionBytes = new byte[chunkData.readInt()];
|
||||
chunkData.read(sectionBytes);
|
||||
@@ -271,32 +270,32 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor {
|
||||
switch (type) {
|
||||
case "CROP" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryCrop(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryCrop(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "POT" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryPot(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryPot(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "SPRINKLER" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemorySprinkler(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemorySprinkler(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "SCARECROW" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryScarecrow(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryScarecrow(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "GREENHOUSE" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryGlass(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryGlass(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,10 +374,10 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor {
|
||||
);
|
||||
}
|
||||
|
||||
private int[] tickedBlocksToArray(Set<ChunkPos> set) {
|
||||
private int[] tickedBlocksToArray(Set<BlockPos> set) {
|
||||
int[] ticked = new int[set.size()];
|
||||
int i = 0;
|
||||
for (ChunkPos pos : set) {
|
||||
for (BlockPos pos : set) {
|
||||
ticked[i] = pos.getPosition();
|
||||
i++;
|
||||
}
|
||||
@@ -401,11 +400,11 @@ public class BukkitWorldAdaptor extends AbstractWorldAdaptor {
|
||||
return new SerializableSection(section.getSectionID(), toCompoundTags(section.getBlockMap()));
|
||||
}
|
||||
|
||||
private List<CompoundTag> toCompoundTags(Map<ChunkPos, CustomCropsBlock> blocks) {
|
||||
private List<CompoundTag> toCompoundTags(Map<BlockPos, CustomCropsBlock> blocks) {
|
||||
ArrayList<CompoundTag> tags = new ArrayList<>(blocks.size());
|
||||
Map<CustomCropsBlock, List<Integer>> blockToPosMap = new HashMap<>();
|
||||
for (Map.Entry<ChunkPos, CustomCropsBlock> entry : blocks.entrySet()) {
|
||||
ChunkPos coordinate = entry.getKey();
|
||||
for (Map.Entry<BlockPos, CustomCropsBlock> entry : blocks.entrySet()) {
|
||||
BlockPos coordinate = entry.getKey();
|
||||
CustomCropsBlock block = entry.getValue();
|
||||
List<Integer> coordinates = blockToPosMap.computeIfAbsent(block, k -> new ArrayList<>());
|
||||
coordinates.add(coordinate.getPosition());
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.infernalsuite.aswm.api.world.SlimeWorld;
|
||||
import net.momirealms.customcrops.api.CustomCropsPlugin;
|
||||
import net.momirealms.customcrops.api.manager.WorldManager;
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkCoordinate;
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.BlockPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.CustomCropsBlock;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsChunk;
|
||||
import net.momirealms.customcrops.api.mechanic.world.level.CustomCropsWorld;
|
||||
@@ -194,13 +194,13 @@ public class SlimeWorldAdaptor extends BukkitWorldAdaptor {
|
||||
|
||||
PriorityQueue<TickTask> queue = new PriorityQueue<>(Math.max(11, queued.length / 2));
|
||||
for (int i = 0, size = queued.length / 2; i < size; i++) {
|
||||
ChunkPos pos = new ChunkPos(queued[2*i+1]);
|
||||
BlockPos pos = new BlockPos(queued[2*i+1]);
|
||||
queue.add(new TickTask(queued[2*i], pos));
|
||||
}
|
||||
|
||||
HashSet<ChunkPos> tickedSet = new HashSet<>(Math.max(11, ticked.length));
|
||||
HashSet<BlockPos> tickedSet = new HashSet<>(Math.max(11, ticked.length));
|
||||
for (int tick : ticked) {
|
||||
tickedSet.add(new ChunkPos(tick));
|
||||
tickedSet.add(new BlockPos(tick));
|
||||
}
|
||||
|
||||
ConcurrentHashMap<Integer, CSection> sectionMap = new ConcurrentHashMap<>();
|
||||
@@ -208,7 +208,7 @@ public class SlimeWorldAdaptor extends BukkitWorldAdaptor {
|
||||
for (Map.Entry<String, Tag<?>> entry : sectionCompoundMap.entrySet()) {
|
||||
if (entry.getValue() instanceof ListTag<?> listTag) {
|
||||
int id = Integer.parseInt(entry.getKey());
|
||||
ConcurrentHashMap<ChunkPos, CustomCropsBlock> blockMap = new ConcurrentHashMap<>();
|
||||
ConcurrentHashMap<BlockPos, CustomCropsBlock> blockMap = new ConcurrentHashMap<>();
|
||||
ListTag<CompoundTag> blocks = (ListTag<CompoundTag>) listTag;
|
||||
for (CompoundTag blockTag : blocks.getValue()) {
|
||||
CompoundMap block = blockTag.getValue();
|
||||
@@ -217,32 +217,32 @@ public class SlimeWorldAdaptor extends BukkitWorldAdaptor {
|
||||
switch (type) {
|
||||
case "CROP" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryCrop(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryCrop(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "POT" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryPot(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryPot(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "SPRINKLER" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemorySprinkler(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemorySprinkler(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "SCARECROW" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryScarecrow(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryScarecrow(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
case "GLASS" -> {
|
||||
for (int pos : (int[]) block.get("pos").getValue()) {
|
||||
ChunkPos chunkPos = new ChunkPos(pos);
|
||||
blockMap.put(chunkPos, new MemoryGlass(chunkPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
BlockPos blockPos = new BlockPos(pos);
|
||||
blockMap.put(blockPos, new MemoryGlass(blockPos.getLocation(world, coordinate), new CompoundMap(data)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,24 +17,24 @@
|
||||
|
||||
package net.momirealms.customcrops.scheduler.task;
|
||||
|
||||
import net.momirealms.customcrops.api.mechanic.world.ChunkPos;
|
||||
import net.momirealms.customcrops.api.mechanic.world.BlockPos;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class TickTask implements Comparable<TickTask> {
|
||||
|
||||
private static int taskID;
|
||||
private final int time;
|
||||
private final ChunkPos chunkPos;
|
||||
private final BlockPos blockPos;
|
||||
private final int id;
|
||||
|
||||
public TickTask(int time, ChunkPos chunkPos) {
|
||||
public TickTask(int time, BlockPos blockPos) {
|
||||
this.time = time;
|
||||
this.chunkPos = chunkPos;
|
||||
this.blockPos = blockPos;
|
||||
this.id = taskID++;
|
||||
}
|
||||
|
||||
public ChunkPos getChunkPos() {
|
||||
return chunkPos;
|
||||
public BlockPos getChunkPos() {
|
||||
return blockPos;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
|
||||
Reference in New Issue
Block a user