diff --git a/gradle.properties b/gradle.properties index 47d0d42d..39750c55 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,8 +5,8 @@ org.gradle.jvmargs=-Xmx1G # check these on https://fabricmc.net/use # or better: https://modmuss50.me/fabric.html minecraft_version=20w28a - yarn_mappings=20w28a+build.17 - loader_version=0.8.9+build.203 + yarn_mappings=20w28a+build.22 + loader_version=0.9.0+build.204 # Mod Properties mod_version = 1.4.2+v200712 diff --git a/src/main/java/carpet/fakes/ChunkLightProviderInterface.java b/src/main/java/carpet/fakes/ChunkLightProviderInterface.java index af46235c..10ae0277 100644 --- a/src/main/java/carpet/fakes/ChunkLightProviderInterface.java +++ b/src/main/java/carpet/fakes/ChunkLightProviderInterface.java @@ -4,5 +4,5 @@ import net.minecraft.world.chunk.ChunkNibbleArray; public interface ChunkLightProviderInterface { - int callGetCurrentLevelFromArray(ChunkNibbleArray array, long blockPos); + int callGetCurrentLevelFromSection(ChunkNibbleArray array, long blockPos); } diff --git a/src/main/java/carpet/helpers/FeatureGenerator.java b/src/main/java/carpet/helpers/FeatureGenerator.java index f069837a..f9527260 100644 --- a/src/main/java/carpet/helpers/FeatureGenerator.java +++ b/src/main/java/carpet/helpers/FeatureGenerator.java @@ -167,7 +167,7 @@ public class FeatureGenerator if (!computeBox) return StructureStart.DEFAULT; StructureManager manager = world.getStructureManager(); StructureStart structureStart3 = structure.getStructureStartFactory().create((StructureFeature) configuredFeature.feature, chunkPos.x, chunkPos.z, BlockBox.empty(), 0, seed); - structureStart3.init(world.method_30349(), generator, manager, chunkPos.x, chunkPos.z, biome, (T) configuredFeature.config); + structureStart3.init(world.getRegistryManager(), generator, manager, chunkPos.x, chunkPos.z, biome, (T) configuredFeature.config); if (!structureStart3.hasChildren()) return null; return structureStart3; } diff --git a/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java index 3b3b8e86..33c94881 100644 --- a/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/BlockLightStorage_scarpetChunkCreationMixin.java @@ -31,14 +31,14 @@ public abstract class BlockLightStorage_scarpetChunkCreationMixin extends LightS for (int y = -1; y < 17; ++y) { final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); - final long pos = BlockPos.asLong(ChunkSectionPos.getWorldCoord(ChunkSectionPos.getX(sectionPos)), ChunkSectionPos.getWorldCoord(y), ChunkSectionPos.getWorldCoord(ChunkSectionPos.getZ(sectionPos))); + final long pos = BlockPos.asLong(ChunkSectionPos.getBlockCoord(ChunkSectionPos.getX(sectionPos)), ChunkSectionPos.getBlockCoord(y), ChunkSectionPos.getBlockCoord(ChunkSectionPos.getZ(sectionPos))); - if (!this.hasLight(sectionPos)) + if (!this.hasSection(sectionPos)) continue; for (final Direction dir : Direction.Type.HORIZONTAL) { - final ChunkNibbleArray neighborLightArray = this.getLightArray(ChunkSectionPos.offset(sectionPos, dir)); + final ChunkNibbleArray neighborLightArray = this.getLightSection(ChunkSectionPos.offset(sectionPos, dir)); if (neighborLightArray == null) continue; @@ -55,7 +55,7 @@ public abstract class BlockLightStorage_scarpetChunkCreationMixin extends LightS final long dst = BlockPos.add(pos, ox + t * dx, dy, oz + t * dz); final long src = BlockPos.offset(dst, dir); - final int srcLevel = ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromArray(neighborLightArray, src); + final int srcLevel = ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromSection(neighborLightArray, src); levelPropagator.invokeUpdateLevel(src, dst, levelPropagator.callGetPropagatedLevel(src, dst, srcLevel), true); } diff --git a/src/main/java/carpet/mixins/ChunkLightProvider_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ChunkLightProvider_scarpetChunkCreationMixin.java index 7af3a279..37728338 100644 --- a/src/main/java/carpet/mixins/ChunkLightProvider_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ChunkLightProvider_scarpetChunkCreationMixin.java @@ -31,6 +31,6 @@ public abstract class ChunkLightProvider_scarpetChunkCreationMixin implements Li } @Override - @Invoker("getCurrentLevelFromArray") - public abstract int callGetCurrentLevelFromArray(ChunkNibbleArray array, long blockPos); + @Invoker("getCurrentLevelFromSection") + public abstract int callGetCurrentLevelFromSection(ChunkNibbleArray array, long blockPos); } diff --git a/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java index b4a0c2c0..18e5738d 100644 --- a/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/LightStorage_scarpetChunkCreationMixin.java @@ -24,26 +24,26 @@ import net.minecraft.world.chunk.light.LightStorage; public abstract class LightStorage_scarpetChunkCreationMixin implements LightStorageInterface { @Shadow - protected abstract ChunkNibbleArray getLightArray(final long sectionPos, final boolean cached); + protected abstract ChunkNibbleArray getLightSection(final long sectionPos, final boolean cached); @Shadow - protected abstract void removeChunkData(final ChunkLightProvider storage, final long blockChunkPos); + protected abstract void removeSection(final ChunkLightProvider storage, final long blockChunkPos); @Shadow @Final - protected LongSet field_15802; + protected LongSet dirtySections; @Shadow @Final - protected ChunkToNibbleArrayMap lightArrays; + protected ChunkToNibbleArrayMap storage; - @Shadow protected abstract boolean hasLight(final long sectionPos); + @Shadow protected abstract boolean hasSection(final long sectionPos); @Shadow @Final - protected Long2ObjectMap lightArraysToAdd; + protected Long2ObjectMap queuedSections; - @Shadow protected abstract void setLightEnabled(final long l, final boolean bl); + @Shadow protected abstract void setColumnEnabled(final long l, final boolean bl); @Unique private final LongSet removedChunks = new LongOpenHashSet(); @@ -64,7 +64,7 @@ public abstract class LightStorage_scarpetChunkCreationMixin implements LightSto } @Inject( - method = "updateLightArrays(Lnet/minecraft/world/chunk/light/ChunkLightProvider;ZZ)V", + method = "updateLight(Lnet/minecraft/world/chunk/light/ChunkLightProvider;ZZ)V", at = @At("HEAD") ) private void processData(final ChunkLightProvider lightProvider, final boolean doSkylight, final boolean skipEdgeLightPropagation, final CallbackInfo ci) @@ -77,16 +77,16 @@ public abstract class LightStorage_scarpetChunkCreationMixin implements LightSto { final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); - this.lightArraysToAdd.remove(sectionPos); + this.queuedSections.remove(sectionPos); - if (this.hasLight(sectionPos)) + if (this.hasSection(sectionPos)) { - this.removeChunkData(lightProvider, sectionPos); + this.removeSection(lightProvider, sectionPos); - if (this.field_15802.add(sectionPos)) - this.lightArrays.replaceWithCopy(sectionPos); + if (this.dirtySections.add(sectionPos)) + this.storage.replaceWithCopy(sectionPos); - Arrays.fill(this.getLightArray(sectionPos, true).asByteArray(), (byte) 0); + Arrays.fill(this.getLightSection(sectionPos, true).asByteArray(), (byte) 0); } } diff --git a/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java index 4bfcedf6..c7a41ac8 100644 --- a/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/ServerLightingProvider_scarpetChunkCreationMixin.java @@ -47,7 +47,7 @@ public abstract class ServerLightingProvider_scarpetChunkCreationMixin extends L chunk.setLightOn(false); this.enqueue(pos.x, pos.z, () -> 0, ServerLightingProvider.Stage.PRE_UPDATE, Util.debugRunnable(() -> { - super.setLightEnabled(pos, false); + super.setColumnEnabled(pos, false); ((Lighting_scarpetChunkCreationInterface) this).removeLightData(ChunkSectionPos.withZeroZ(ChunkSectionPos.asLong(pos.x, 0, pos.z))); }, () -> "Remove light data " + pos @@ -60,7 +60,7 @@ public abstract class ServerLightingProvider_scarpetChunkCreationMixin extends L final ChunkPos pos = chunk.getPos(); this.enqueue(pos.x, pos.z, () -> 0, ServerLightingProvider.Stage.PRE_UPDATE, Util.debugRunnable(() -> { - super.setLightEnabled(pos, true); + super.setColumnEnabled(pos, true); chunk.getLightSourcesStream().forEach( blockPos -> super.addLightSource(blockPos, chunk.getLuminance(blockPos)) diff --git a/src/main/java/carpet/mixins/ServerLightingProvider_scarpetMixin.java b/src/main/java/carpet/mixins/ServerLightingProvider_scarpetMixin.java index 611cdff5..a55cb899 100644 --- a/src/main/java/carpet/mixins/ServerLightingProvider_scarpetMixin.java +++ b/src/main/java/carpet/mixins/ServerLightingProvider_scarpetMixin.java @@ -38,14 +38,14 @@ public abstract class ServerLightingProvider_scarpetMixin extends LightingProvid //ChunkPos pos = new ChunkPos(x, z); int j; for(j = -1; j < 17; ++j) { // skip some recomp - super.queueData(LightType.BLOCK, ChunkSectionPos.from(pos, j), new ChunkNibbleArray(), false); - super.queueData(LightType.SKY, ChunkSectionPos.from(pos, j), new ChunkNibbleArray(), false); + super.enqueueSectionData(LightType.BLOCK, ChunkSectionPos.from(pos, j), new ChunkNibbleArray(), false); + super.enqueueSectionData(LightType.SKY, ChunkSectionPos.from(pos, j), new ChunkNibbleArray(), false); } for(j = 0; j < 16; ++j) { - super.updateSectionStatus(ChunkSectionPos.from(pos, j), true); + super.setSectionStatus(ChunkSectionPos.from(pos, j), true); } - super.setLightEnabled(pos, true); + super.setColumnEnabled(pos, true); chunk.getLightSourcesStream().forEach((blockPos) -> { super.addLightSource(blockPos, chunk.getLuminance(blockPos)); diff --git a/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java b/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java index 8e926022..d6e2a168 100644 --- a/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java +++ b/src/main/java/carpet/mixins/SkyLightStorage_scarpetChunkCreationMixin.java @@ -28,19 +28,19 @@ public abstract class SkyLightStorage_scarpetChunkCreationMixin extends LightSto @Shadow @Final - private LongSet pendingSkylightUpdates; + private LongSet sectionsToUpdate; @Shadow @Final - private LongSet field_15816; + private LongSet sectionsToRemove; @Shadow @Final private LongSet field_15820; - @Shadow protected abstract boolean isAboveTopmostLightArray(final long pos); + @Shadow protected abstract boolean isAtOrAboveTopmostSection(final long pos); - @Shadow protected abstract boolean isLightEnabled(final long sectionPos); + @Shadow protected abstract boolean isSectionEnabled(final long sectionPos); @Override public void processRemoveLightData(final long cPos) @@ -49,8 +49,8 @@ public abstract class SkyLightStorage_scarpetChunkCreationMixin extends LightSto { final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); - this.pendingSkylightUpdates.remove(sectionPos); - this.field_15816.remove(sectionPos); + this.sectionsToUpdate.remove(sectionPos); + this.sectionsToRemove.remove(sectionPos); this.field_15820.remove(sectionPos); } @@ -64,22 +64,22 @@ public abstract class SkyLightStorage_scarpetChunkCreationMixin extends LightSto for (int y = -1; y < 17; ++y) { final long sectionPos = ChunkSectionPos.asLong(ChunkSectionPos.getX(cPos), y, ChunkSectionPos.getZ(cPos)); - final long pos = BlockPos.asLong(ChunkSectionPos.getWorldCoord(ChunkSectionPos.getX(sectionPos)), ChunkSectionPos.getWorldCoord(y), ChunkSectionPos.getWorldCoord(ChunkSectionPos.getZ(sectionPos))); + final long pos = BlockPos.asLong(ChunkSectionPos.getBlockCoord(ChunkSectionPos.getX(sectionPos)), ChunkSectionPos.getBlockCoord(y), ChunkSectionPos.getBlockCoord(ChunkSectionPos.getZ(sectionPos))); - if (!this.hasLight(sectionPos)) + if (!this.hasSection(sectionPos)) continue; for (final Direction dir : Direction.Type.HORIZONTAL) { long neighborCeilingSectionPos = ChunkSectionPos.offset(sectionPos, dir); - final ChunkNibbleArray neighborLightArray = this.getLightArray(neighborCeilingSectionPos); + final ChunkNibbleArray neighborLightArray = this.getLightSection(neighborCeilingSectionPos); ChunkNibbleArray neighborCeilingLightArray = neighborLightArray; - while (neighborCeilingLightArray == null && !this.isAboveTopmostLightArray(neighborCeilingSectionPos)) + while (neighborCeilingLightArray == null && !this.isAtOrAboveTopmostSection(neighborCeilingSectionPos)) { neighborCeilingSectionPos = ChunkSectionPos.offset(neighborCeilingSectionPos, Direction.UP); - neighborCeilingLightArray = this.getLightArray(neighborCeilingSectionPos); + neighborCeilingLightArray = this.getLightSection(neighborCeilingSectionPos); } final int ox = 15 * Math.max(dir.getOffsetX(), 0); @@ -95,11 +95,11 @@ public abstract class SkyLightStorage_scarpetChunkCreationMixin extends LightSto long src = BlockPos.offset(dst, dir); if (neighborLightArray == null) - src = BlockPos.asLong(BlockPos.unpackLongX(src), ChunkSectionPos.getWorldCoord(ChunkSectionPos.getY(neighborCeilingSectionPos)), BlockPos.unpackLongZ(src)); + src = BlockPos.asLong(BlockPos.unpackLongX(src), ChunkSectionPos.getBlockCoord(ChunkSectionPos.getY(neighborCeilingSectionPos)), BlockPos.unpackLongZ(src)); final int srcLevel = neighborCeilingLightArray != null ? - ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromArray(neighborCeilingLightArray, src) - : this.isLightEnabled(ChunkSectionPos.withZeroZ(neighborCeilingSectionPos)) ? 0 : 15; + ((ChunkLightProviderInterface) lightProvider).callGetCurrentLevelFromSection(neighborCeilingLightArray, src) + : this.isSectionEnabled(ChunkSectionPos.withZeroZ(neighborCeilingSectionPos)) ? 0 : 15; levelPropagator.invokeUpdateLevel(src, dst, levelPropagator.callGetPropagatedLevel(src, dst, srcLevel), true); } diff --git a/src/main/java/carpet/mixins/StructureFeatureMixin.java b/src/main/java/carpet/mixins/StructureFeatureMixin.java index ab707594..9784cc9a 100644 --- a/src/main/java/carpet/mixins/StructureFeatureMixin.java +++ b/src/main/java/carpet/mixins/StructureFeatureMixin.java @@ -135,7 +135,7 @@ public abstract class StructureFeatureMixin implements StructureStart structurestart1 = getStructureStartFactory().create((StructureFeature)(Object)this, chunkpos.x, chunkpos.z, BlockBox.empty(),0,worldIn.getSeed()); if (config == null) config = new DefaultFeatureConfig(); - structurestart1.init(worldIn.method_30349(), generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1, config); + structurestart1.init(worldIn.getRegistryManager(), generator, worldIn.getStructureManager() , chunkpos.x, chunkpos.z, biome_1, config); structurestart = structurestart1.hasChildren() ? structurestart1 : StructureStart.DEFAULT; if (structurestart.hasChildren()) diff --git a/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java b/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java index 08e98750..5778f729 100644 --- a/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java +++ b/src/main/java/carpet/mixins/WorldChunk_movableTEMixin.java @@ -101,7 +101,7 @@ public abstract class WorldChunk_movableTEMixin implements WorldChunkInterface boolean boolean_3 = chunkSection.isEmpty(); if (boolean_2 != boolean_3) { - this.world.getChunkManager().getLightingProvider().updateSectionStatus(blockPos_1, boolean_3); + this.world.getChunkManager().getLightingProvider().setSectionStatus(blockPos_1, boolean_3); } if (!this.world.isClient) diff --git a/src/main/java/carpet/script/CarpetExpression.java b/src/main/java/carpet/script/CarpetExpression.java index d65f3215..87edea50 100644 --- a/src/main/java/carpet/script/CarpetExpression.java +++ b/src/main/java/carpet/script/CarpetExpression.java @@ -1088,7 +1088,7 @@ public class CarpetExpression BlockPos pos = locator.block.getPos(); Biome biome = world.getBiome(pos); // in locatebiome - Identifier biomeId = cc.s.getMinecraftServer().method_30611().method_30530(Registry.BIOME_KEY).getId(biome); + Identifier biomeId = cc.s.getMinecraftServer().getRegistryManager().get(Registry.BIOME_KEY).getId(biome); Value res = new StringValue(NBTSerializableValue.nameFromRegistryId(biomeId)); return (_c, _t) -> res; }); @@ -1101,7 +1101,7 @@ public class CarpetExpression throw new InternalExpressionException("'set_biome' needs a biome name as an argument"); String biomeName = lv.get(locator.offset+0).evalValue(c).getString(); // from locatebiome command code - Biome biome = cc.s.getMinecraftServer().method_30611().method_30530(Registry.BIOME_KEY).get(new Identifier(biomeName)); + Biome biome = cc.s.getMinecraftServer().getRegistryManager().get(Registry.BIOME_KEY).get(new Identifier(biomeName)); if (biome == null) throw new InternalExpressionException("Unknown biome: "+biomeName); boolean doImmediateUpdate = true;