Skip to content

Commit

Permalink
Fix building over y255 on cubicchunks
Browse files Browse the repository at this point in the history
  • Loading branch information
BleachDev committed Apr 22, 2020
1 parent aa3794e commit 9a3e600
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# McOSM
A Minecraft OSM Generator fully compatible with the Build The Earth map projection

(Not a fully done mod, still in dev stage)
A Minecraft OSM Generator fully compatible with CubicChunks, Terra121 and the Build The Earth map projection

## Usage

Expand Down
2 changes: 1 addition & 1 deletion mcosm/src/main/java/bleach/mcosm/McOSM.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void onTick(TickEvent.WorldTickEvent event) {
World sw = Minecraft.getMinecraft().getIntegratedServer().getWorld(Minecraft.getMinecraft().player.dimension);
ChunkProviderServer cps = (ChunkProviderServer) sw.getChunkProvider();

int prevSize = cps.loadedChunks.size();
//int prevSize = cps.loadedChunks.size();
//int i = 0;
for (Entry<Long, Chunk> c: new HashMap<>(cps.loadedChunks).entrySet()) {
long lon = c.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,31 @@ public StretchBlocksOperation(List<BlockPos> poses, int height) {
for (BlockPos b: poses) {
ChunkPos c = new ChunkPos(b);
if (!chunks.contains(c)) chunks.add(c);
height = Math.min(height, 255 - b.getY());
}

int realHeight = height;
// FIXME: crashes on > 255 y on non-cubichunks worlds

this.thread = new OperationThread<Void>() {

public void run() {
if (poses.isEmpty() || realHeight == 0) return;
if (poses.isEmpty() || height == 0) return;

World world = Minecraft.getMinecraft().getIntegratedServer().getWorld(Minecraft.getMinecraft().player.dimension);

double i = 0;
for (BlockPos b: poses) {
IBlockState state = world.getBlockState(b);
for (int h = 1; h < realHeight; h++) {
for (int h = 1; h < height; h++) {
setBlock(b.up(h), world, state);
setProgress((i / (double) (poses.size() * (realHeight - 1) - 1)) / 2);
setProgress((i / (double) (poses.size() * (height - 1) - 1)) / 2);
i += 0.5;
}
}

World clWorld = Minecraft.getMinecraft().world;
while (reloaded.size() < chunks.size()) {
ChunkPos cp = chunks.get(reloaded.size());
int newReload = Math.min(3, realHeight - reloadH);
int newReload = Math.min(3, height - reloadH);

for (BlockPos b: poses) {
if (b.getX() >> 4 == cp.x && b.getZ() >> 4 == cp.z) {
Expand All @@ -59,7 +58,7 @@ public void run() {
}

reloadH += newReload + 1;
if (reloadH == realHeight + 1) {
if (reloadH == height + 1) {
reloaded.add(cp);
reloadH = 1;
}
Expand Down

0 comments on commit 9a3e600

Please sign in to comment.