aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/level/chunk/LevelChunkSection.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/level/chunk/LevelChunkSection.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/level/chunk/LevelChunkSection.java.patch251
1 files changed, 251 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/level/chunk/LevelChunkSection.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/level/chunk/LevelChunkSection.java.patch
new file mode 100644
index 0000000000..62c90f4b18
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/level/chunk/LevelChunkSection.java.patch
@@ -0,0 +1,251 @@
+--- a/net/minecraft/world/level/chunk/LevelChunkSection.java
++++ b/net/minecraft/world/level/chunk/LevelChunkSection.java
+@@ -10,7 +10,7 @@
+ import net.minecraft.world.level.biome.Climate;
+ import net.minecraft.world.level.block.Block;
+ import net.minecraft.world.level.block.Blocks;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.material.FluidState;
+
+ public class LevelChunkSection {
+@@ -22,26 +22,28 @@
+ private short nonEmptyBlockCount;
+ private short tickingBlockCount;
+ private short tickingFluidCount;
+- private final PalettedContainer<BlockState> states;
+- private PalettedContainerRO<Holder<Biome>> biomes;
++ private final PalettedContainer<IBlockData> states;
++ // CraftBukkit start - read/write
++ private PalettedContainer<Holder<Biome>> biomes;
+
+- public LevelChunkSection(PalettedContainer<BlockState> palettedcontainer, PalettedContainerRO<Holder<Biome>> palettedcontainerro) {
+- this.states = palettedcontainer;
++ public LevelChunkSection(PalettedContainer<IBlockData> datapaletteblock, PalettedContainer<Holder<Biome>> palettedcontainerro) {
++ // CraftBukkit end
++ this.states = datapaletteblock;
+ this.biomes = palettedcontainerro;
+ this.recalcBlockCounts();
+ }
+
+- public LevelChunkSection(Registry<Biome> registry) {
++ public LevelChunkSection(Registry<Biome> biomeRegistry) {
+ this.states = new PalettedContainer<>(Block.BLOCK_STATE_REGISTRY, Blocks.AIR.defaultBlockState(), PalettedContainer.Strategy.SECTION_STATES);
+- this.biomes = new PalettedContainer<>(registry.asHolderIdMap(), registry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
++ this.biomes = new PalettedContainer<>(biomeRegistry.asHolderIdMap(), biomeRegistry.getHolderOrThrow(Biomes.PLAINS), PalettedContainer.Strategy.SECTION_BIOMES);
+ }
+
+- public BlockState getBlockState(int i, int j, int k) {
+- return (BlockState) this.states.get(i, j, k);
++ public IBlockData getBlockState(int x, int y, int z) {
++ return (IBlockData) this.states.get(x, y, z);
+ }
+
+- public FluidState getFluidState(int i, int j, int k) {
+- return ((BlockState) this.states.get(i, j, k)).getFluidState();
++ public FluidState getFluidState(int x, int y, int z) {
++ return ((IBlockData) this.states.get(x, y, z)).getFluidState();
+ }
+
+ public void acquire() {
+@@ -52,45 +54,45 @@
+ this.states.release();
+ }
+
+- public BlockState setBlockState(int i, int j, int k, BlockState blockstate) {
+- return this.setBlockState(i, j, k, blockstate, true);
++ public IBlockData setBlockState(int x, int y, int z, IBlockData state) {
++ return this.setBlockState(x, y, z, state, true);
+ }
+
+- public BlockState setBlockState(int i, int j, int k, BlockState blockstate, boolean flag) {
+- BlockState blockstate1;
++ public IBlockData setBlockState(int x, int y, int z, IBlockData state, boolean useLocks) {
++ IBlockData iblockdata1;
+
+- if (flag) {
+- blockstate1 = (BlockState) this.states.getAndSet(i, j, k, blockstate);
++ if (useLocks) {
++ iblockdata1 = (IBlockData) this.states.getAndSet(x, y, z, state);
+ } else {
+- blockstate1 = (BlockState) this.states.getAndSetUnchecked(i, j, k, blockstate);
++ iblockdata1 = (IBlockData) this.states.getAndSetUnchecked(x, y, z, state);
+ }
+
+- FluidState fluidstate = blockstate1.getFluidState();
+- FluidState fluidstate1 = blockstate.getFluidState();
++ FluidState fluid = iblockdata1.getFluidState();
++ FluidState fluid1 = state.getFluidState();
+
+- if (!blockstate1.isAir()) {
++ if (!iblockdata1.isAir()) {
+ --this.nonEmptyBlockCount;
+- if (blockstate1.isRandomlyTicking()) {
++ if (iblockdata1.isRandomlyTicking()) {
+ --this.tickingBlockCount;
+ }
+ }
+
+- if (!fluidstate.isEmpty()) {
++ if (!fluid.isEmpty()) {
+ --this.tickingFluidCount;
+ }
+
+- if (!blockstate.isAir()) {
++ if (!state.isAir()) {
+ ++this.nonEmptyBlockCount;
+- if (blockstate.isRandomlyTicking()) {
++ if (state.isRandomlyTicking()) {
+ ++this.tickingBlockCount;
+ }
+ }
+
+- if (!fluidstate1.isEmpty()) {
++ if (!fluid1.isEmpty()) {
+ ++this.tickingFluidCount;
+ }
+
+- return blockstate1;
++ return iblockdata1;
+ }
+
+ public boolean hasOnlyAir() {
+@@ -110,28 +112,27 @@
+ }
+
+ public void recalcBlockCounts() {
+- class BlockCounter implements PalettedContainer.CountConsumer<BlockState> {
++ class a implements PalettedContainer.CountConsumer<IBlockData> {
+
+ public int nonEmptyBlockCount;
+ public int tickingBlockCount;
+ public int tickingFluidCount;
+
+- BlockCounter() {}
++ a() {}
+
+- @Override
+- public void accept(BlockState blockstate, int i) {
+- FluidState fluidstate = blockstate.getFluidState();
++ public void accept(IBlockData iblockdata, int i) {
++ FluidState fluid = iblockdata.getFluidState();
+
+- if (!blockstate.isAir()) {
++ if (!iblockdata.isAir()) {
+ this.nonEmptyBlockCount += i;
+- if (blockstate.isRandomlyTicking()) {
++ if (iblockdata.isRandomlyTicking()) {
+ this.tickingBlockCount += i;
+ }
+ }
+
+- if (!fluidstate.isEmpty()) {
++ if (!fluid.isEmpty()) {
+ this.nonEmptyBlockCount += i;
+- if (fluidstate.isRandomlyTicking()) {
++ if (fluid.isRandomlyTicking()) {
+ this.tickingFluidCount += i;
+ }
+ }
+@@ -139,15 +140,15 @@
+ }
+ }
+
+- BlockCounter blockcounter = new BlockCounter();
++ a a0 = new a();
+
+- this.states.count(blockcounter);
+- this.nonEmptyBlockCount = (short) blockcounter.nonEmptyBlockCount;
+- this.tickingBlockCount = (short) blockcounter.tickingBlockCount;
+- this.tickingFluidCount = (short) blockcounter.tickingFluidCount;
++ this.states.count(a0);
++ this.nonEmptyBlockCount = (short) a0.nonEmptyBlockCount;
++ this.tickingBlockCount = (short) a0.tickingBlockCount;
++ this.tickingFluidCount = (short) a0.tickingFluidCount;
+ }
+
+- public PalettedContainer<BlockState> getStates() {
++ public PalettedContainer<IBlockData> getStates() {
+ return this.states;
+ }
+
+@@ -155,52 +156,58 @@
+ return this.biomes;
+ }
+
+- public void read(FriendlyByteBuf friendlybytebuf) {
+- this.nonEmptyBlockCount = friendlybytebuf.readShort();
+- this.states.read(friendlybytebuf);
+- PalettedContainer<Holder<Biome>> palettedcontainer = this.biomes.recreate();
++ public void read(FriendlyByteBuf buffer) {
++ this.nonEmptyBlockCount = buffer.readShort();
++ this.states.read(buffer);
++ PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
+
+- palettedcontainer.read(friendlybytebuf);
+- this.biomes = palettedcontainer;
++ datapaletteblock.read(buffer);
++ this.biomes = datapaletteblock;
+ }
+
+- public void readBiomes(FriendlyByteBuf friendlybytebuf) {
+- PalettedContainer<Holder<Biome>> palettedcontainer = this.biomes.recreate();
++ public void readBiomes(FriendlyByteBuf buffer) {
++ PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
+
+- palettedcontainer.read(friendlybytebuf);
+- this.biomes = palettedcontainer;
++ datapaletteblock.read(buffer);
++ this.biomes = datapaletteblock;
+ }
+
+- public void write(FriendlyByteBuf friendlybytebuf) {
+- friendlybytebuf.writeShort(this.nonEmptyBlockCount);
+- this.states.write(friendlybytebuf);
+- this.biomes.write(friendlybytebuf);
++ public void write(FriendlyByteBuf buffer) {
++ buffer.writeShort(this.nonEmptyBlockCount);
++ this.states.write(buffer);
++ this.biomes.write(buffer);
+ }
+
+ public int getSerializedSize() {
+ return 2 + this.states.getSerializedSize() + this.biomes.getSerializedSize();
+ }
+
+- public boolean maybeHas(Predicate<BlockState> predicate) {
++ public boolean maybeHas(Predicate<IBlockData> predicate) {
+ return this.states.maybeHas(predicate);
+ }
+
+- public Holder<Biome> getNoiseBiome(int i, int j, int k) {
+- return (Holder) this.biomes.get(i, j, k);
++ public Holder<Biome> getNoiseBiome(int x, int y, int z) {
++ return (Holder) this.biomes.get(x, y, z);
+ }
+
+- public void fillBiomesFromNoise(BiomeResolver biomeresolver, Climate.Sampler climate_sampler, int i, int j, int k) {
+- PalettedContainer<Holder<Biome>> palettedcontainer = this.biomes.recreate();
++ // CraftBukkit start
++ public void setBiome(int i, int j, int k, Holder<Biome> biome) {
++ this.biomes.set(i, j, k, biome);
++ }
++ // CraftBukkit end
++
++ public void fillBiomesFromNoise(BiomeResolver biomeResolver, Climate.Sampler climateSampler, int x, int y, int z) {
++ PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
+ boolean flag = true;
+
+ for (int l = 0; l < 4; ++l) {
+ for (int i1 = 0; i1 < 4; ++i1) {
+ for (int j1 = 0; j1 < 4; ++j1) {
+- palettedcontainer.getAndSetUnchecked(l, i1, j1, biomeresolver.getNoiseBiome(i + l, j + i1, k + j1, climate_sampler));
++ datapaletteblock.getAndSetUnchecked(l, i1, j1, biomeResolver.getNoiseBiome(x + l, y + i1, z + j1, climateSampler));
+ }
+ }
+ }
+
+- this.biomes = palettedcontainer;
++ this.biomes = datapaletteblock;
+ }
+ }