diff --git a/src/main/java/me/cortex/voxy/common/voxelization/WorldConversionFactory.java b/src/main/java/me/cortex/voxy/common/voxelization/WorldConversionFactory.java index c7d9a80e..ec02a8a0 100644 --- a/src/main/java/me/cortex/voxy/common/voxelization/WorldConversionFactory.java +++ b/src/main/java/me/cortex/voxy/common/voxelization/WorldConversionFactory.java @@ -183,59 +183,6 @@ public class WorldConversionFactory { return section; } - public static VoxelizedSection convertOld(VoxelizedSection section, - Mapper stateMapper, - PalettedContainer blockContainer, - ReadableContainer> biomeContainer, - ILightingSupplier lightSupplier) { - - //Cheat by creating a local pallet then read the data directly - - - var cache = THREAD_LOCAL.get(); - var blockCache = cache.getLocalMapping(stateMapper); - - var biomes = cache.biomeCache; - var data = section.section; - - var vp = blockContainer.data.palette; - var pc = cache.getPaletteCache(vp.getSize()); - - setupLocalPalette(vp, blockCache, stateMapper, pc); - - - { - int i = 0; - for (int y = 0; y < 4; y++) { - for (int z = 0; z < 4; z++) { - for (int x = 0; x < 4; x++) { - biomes[i++] = stateMapper.getIdForBiome(biomeContainer.get(x, y, z)); - } - } - } - } - - var bDat = blockContainer.data; - var bStor = bDat.storage; - int i = 0; - for (int y = 0; y < 16; y++) { - for (int z = 0; z < 16; z++) { - for (int x = 0; x < 16; x++) { - //TODO: replace .get with a raw enumeration - int bId = pc[bStor.get(i++)]; - - byte light = lightSupplier.supply(x,y,z); - if (!(bId==0 && (light==0))) { - data[G(x, y, z)] = Mapper.composeMappingId(light, bId, biomes[((y&0b1100)<<2)|(z&0b1100)|(x>>2)]); - } else { - data[G(x, y, z)] = Mapper.AIR; - } - } - } - } - return section; - } - private static int G(int x, int y, int z) { return ((y<<8)|(z<<4)|x); } diff --git a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java index 9386922e..55496344 100644 --- a/src/main/java/me/cortex/voxy/common/world/WorldEngine.java +++ b/src/main/java/me/cortex/voxy/common/world/WorldEngine.java @@ -155,19 +155,6 @@ public class WorldEngine { didStateChange |= newId != oldId; } } - /* - //This loop can be heavily optimized, the get and set can be extracted and manually done - // the 3 for loops can be replaced by a single loop that iterates over a bitmask - for (int y = by; y < (16>>lvl)+by; y++) { - for (int z = bz; z < (16>>lvl)+bz; z++) { - for (int x = bx; x < (16>>lvl)+bx; x++) { - long newId = section.get(lvl, x-bx, y-by, z-bz); - long oldId = worldSection.set(x, y, z, newId); - nonAirCountDelta += Mapper.isAir(oldId)==Mapper.isAir(newId)?0:(Mapper.isAir(newId)?-1:1 ); - didStateChange |= newId != oldId; - } - } - }*/ if (nonAirCountDelta != 0) { worldSection.addNonEmptyBlockCount(nonAirCountDelta);