9
0
mirror of https://github.com/Xiao-MoMi/Custom-Crops.git synced 2025-12-27 10:59:20 +00:00

change name to BlockPos

This commit is contained in:
XiaoMoMi
2024-03-17 18:05:39 +08:00
parent db8d1e1ce8
commit 0ce4d5a836
7 changed files with 70 additions and 71 deletions

View File

@@ -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

View File

@@ -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();
}