Skip to content

Commit c5636af

Browse files
committed
Cleanup and add for 1.21
1 parent 9024018 commit c5636af

File tree

9 files changed

+29
-43
lines changed

9 files changed

+29
-43
lines changed

worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R2/PaperweightAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
651651
= CacheBuilder.newBuilder().weakKeys().softValues().build(CacheLoader.from(PaperweightFakePlayer::new));
652652

653653
@Override
654-
public boolean simulateItemUse(org.bukkit.World world, BlockVector3 position, BaseItem item, Direction face) {
654+
public boolean simulateItemUse(World world, BlockVector3 position, BaseItem item, Direction face) {
655655
CraftWorld craftWorld = (CraftWorld) world;
656656
ServerLevel worldServer = craftWorld.getHandle();
657657
ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack

worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightFaweAdapter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public Set<SideEffect> getSupportedSideEffects() {
313313
}
314314

315315
@Override
316-
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
316+
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
317317
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
318318
}
319319

@@ -462,7 +462,7 @@ public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockSt
462462
}
463463

464464
@Override
465-
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) {
465+
public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
466466
ServerLevel nmsWorld = getServerLevel(world);
467467
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
468468
if (map != null && wasAccessibleSinceLastSave(map)) {
@@ -497,7 +497,7 @@ public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chu
497497
}
498498

499499
@Override
500-
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) {
500+
public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
501501
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
502502
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
503503
return blockState1.hasPostProcess(
@@ -725,12 +725,12 @@ public net.minecraft.nbt.Tag fromNative(Tag foreign) {
725725
}
726726

727727
@Override
728-
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
728+
public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
729729
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
730730
}
731731

732732
@Override
733-
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) {
733+
public IChunkGet get(World world, int chunkX, int chunkZ) {
734734
return new PaperweightGetBlocks(world, chunkX, chunkZ);
735735
}
736736

worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightPlatformAdapter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import net.minecraft.world.level.block.Block;
4646
import net.minecraft.world.level.block.Blocks;
4747
import net.minecraft.world.level.block.entity.BlockEntity;
48-
import net.minecraft.world.level.block.state.StateHolder;
4948
import net.minecraft.world.level.chunk.ChunkAccess;
5049
import net.minecraft.world.level.chunk.ChunkStatus;
5150
import net.minecraft.world.level.chunk.GlobalPalette;
@@ -100,8 +99,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
10099
private static final Field fieldTickingFluidCount;
101100
private static final Field fieldTickingBlockCount;
102101

103-
private static final Field fieldPropertiesCodec;
104-
105102
private static final MethodHandle methodGetVisibleChunk;
106103

107104
private static final Field fieldThreadingDetector;
@@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
157154
fieldBiomes = tmpFieldBiomes;
158155
fieldBiomes.setAccessible(true);
159156

160-
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
161-
fieldPropertiesCodec.setAccessible(true);
162-
163157
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
164158
"getVisibleChunkIfPresent",
165159
"b"

worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightFaweAdapter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ public Set<SideEffect> getSupportedSideEffects() {
312312
}
313313

314314
@Override
315-
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
315+
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
316316
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
317317
}
318318

@@ -461,7 +461,7 @@ public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockSt
461461
}
462462

463463
@Override
464-
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) {
464+
public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
465465
ServerLevel nmsWorld = getServerLevel(world);
466466
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
467467
if (map != null && wasAccessibleSinceLastSave(map)) {
@@ -496,7 +496,7 @@ public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chu
496496
}
497497

498498
@Override
499-
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) {
499+
public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
500500
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(getOrdinalToIbdID()[blockState.getOrdinal()]);
501501
return blockState1.hasPostProcess(
502502
getServerLevel(world),
@@ -724,12 +724,12 @@ public net.minecraft.nbt.Tag fromNative(Tag foreign) {
724724
}
725725

726726
@Override
727-
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
727+
public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
728728
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
729729
}
730730

731731
@Override
732-
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) {
732+
public IChunkGet get(World world, int chunkX, int chunkZ) {
733733
return new PaperweightGetBlocks(world, chunkX, chunkZ);
734734
}
735735

worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightPlatformAdapter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import net.minecraft.world.level.block.Block;
4646
import net.minecraft.world.level.block.Blocks;
4747
import net.minecraft.world.level.block.entity.BlockEntity;
48-
import net.minecraft.world.level.block.state.StateHolder;
4948
import net.minecraft.world.level.chunk.ChunkAccess;
5049
import net.minecraft.world.level.chunk.ChunkStatus;
5150
import net.minecraft.world.level.chunk.GlobalPalette;
@@ -101,8 +100,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
101100
private static final Field fieldTickingBlockCount;
102101
private static final Field fieldBiomes;
103102

104-
private static final Field fieldPropertiesCodec;
105-
106103
private static final MethodHandle methodGetVisibleChunk;
107104

108105
private static final Field fieldThreadingDetector;
@@ -157,9 +154,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
157154
fieldBiomes = tmpFieldBiomes;
158155
fieldBiomes.setAccessible(true);
159156

160-
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
161-
fieldPropertiesCodec.setAccessible(true);
162-
163157
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
164158
"getVisibleChunkIfPresent",
165159
"b"

worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightFaweAdapter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public Set<SideEffect> getSupportedSideEffects() {
321321
}
322322

323323
@Override
324-
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
324+
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
325325
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
326326
}
327327

@@ -470,7 +470,7 @@ public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockSt
470470
}
471471

472472
@Override
473-
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) {
473+
public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
474474
ServerLevel nmsWorld = getServerLevel(world);
475475
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
476476
if (map != null && wasAccessibleSinceLastSave(map)) {
@@ -505,7 +505,7 @@ public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chu
505505
}
506506

507507
@Override
508-
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) {
508+
public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
509509
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
510510
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
511511
return blockState1.hasPostProcess(
@@ -746,12 +746,12 @@ public net.minecraft.nbt.Tag fromNative(Tag foreign) {
746746
}
747747

748748
@Override
749-
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
749+
public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
750750
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
751751
}
752752

753753
@Override
754-
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) {
754+
public IChunkGet get(World world, int chunkX, int chunkZ) {
755755
return new PaperweightGetBlocks(world, chunkX, chunkZ);
756756
}
757757

worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightPlatformAdapter.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import net.minecraft.world.level.block.Block;
4545
import net.minecraft.world.level.block.Blocks;
4646
import net.minecraft.world.level.block.entity.BlockEntity;
47-
import net.minecraft.world.level.block.state.StateHolder;
4847
import net.minecraft.world.level.chunk.ChunkAccess;
4948
import net.minecraft.world.level.chunk.GlobalPalette;
5049
import net.minecraft.world.level.chunk.HashMapPalette;
@@ -99,8 +98,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
9998
private static final Field fieldTickingBlockCount;
10099
private static final Field fieldBiomes;
101100

102-
private static final Field fieldPropertiesCodec;
103-
104101
private static final MethodHandle methodGetVisibleChunk;
105102

106103
private static final Field fieldThreadingDetector;
@@ -155,9 +152,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
155152
fieldBiomes = tmpFieldBiomes;
156153
fieldBiomes.setAccessible(true);
157154

158-
fieldPropertiesCodec = StateHolder.class.getDeclaredField(Refraction.pickName("propertiesCodec", "f"));
159-
fieldPropertiesCodec.setAccessible(true);
160-
161155
Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName(
162156
"getVisibleChunkIfPresent",
163157
"b"

worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/FaweBlockStateListPopulator.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_R1;
22

3-
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap;
43
import net.minecraft.core.BlockPos;
54
import net.minecraft.core.Direction;
65
import net.minecraft.core.Holder;
@@ -10,15 +9,16 @@
109
import net.minecraft.world.level.biome.Biome;
1110
import net.minecraft.world.level.biome.BiomeManager;
1211
import net.minecraft.world.level.block.state.BlockState;
13-
import net.minecraft.world.level.block.state.properties.Property;
12+
import net.minecraft.world.flag.FeatureFlagSet;
1413
import net.minecraft.world.level.border.WorldBorder;
1514
import net.minecraft.world.level.chunk.ChunkAccess;
1615
import net.minecraft.world.level.chunk.ChunkSource;
1716
import net.minecraft.world.level.chunk.status.ChunkStatus;
1817
import net.minecraft.world.level.lighting.LevelLightEngine;
1918
import net.minecraft.world.level.material.FluidState;
2019
import org.bukkit.craftbukkit.util.BlockStateListPopulator;
21-
import org.jetbrains.annotations.Nullable;
20+
21+
import javax.annotation.Nullable;
2222

2323
public class FaweBlockStateListPopulator extends BlockStateListPopulator {
2424

@@ -69,6 +69,11 @@ public int getSeaLevel() {
6969
return world.getSeaLevel();
7070
}
7171

72+
@Override
73+
public FeatureFlagSet enabledFeatures() {
74+
return world.enabledFeatures();
75+
}
76+
7277
@Override
7378
public float getShade(final Direction direction, final boolean shaded) {
7479
return world.getShade(direction, shaded);

worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightFaweAdapter.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ public Set<SideEffect> getSupportedSideEffects() {
321321
}
322322

323323
@Override
324-
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(org.bukkit.World world) {
324+
public WorldNativeAccess<?, ?, ?> createWorldNativeAccess(World world) {
325325
return new PaperweightFaweWorldNativeAccess(this, new WeakReference<>(getServerLevel(world)));
326326
}
327327

@@ -470,7 +470,7 @@ public net.minecraft.world.level.block.state.BlockState adapt(BlockState blockSt
470470
}
471471

472472
@Override
473-
public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) {
473+
public void sendFakeChunk(World world, Player player, ChunkPacket chunkPacket) {
474474
ServerLevel nmsWorld = getServerLevel(world);
475475
ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ());
476476
if (map != null && wasAccessibleSinceLastSave(map)) {
@@ -505,7 +505,7 @@ public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chu
505505
}
506506

507507
@Override
508-
public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) {
508+
public boolean canPlaceAt(World world, BlockVector3 blockVector3, BlockState blockState) {
509509
int internalId = BlockStateIdAccess.getBlockStateId(blockState);
510510
net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId);
511511
return blockState1.hasPostProcess(
@@ -598,7 +598,6 @@ public boolean generateFeature(ConfiguredFeatureType feature, World world, EditS
598598

599599
@Override
600600
public boolean generateStructure(StructureType type, World world, EditSession editSession, BlockVector3 pt) {
601-
//FAWE start
602601
ServerLevel serverLevel = ((CraftWorld) world).getHandle();
603602
Structure k = serverLevel
604603
.registryAccess()
@@ -748,12 +747,12 @@ public net.minecraft.nbt.Tag fromNative(Tag foreign) {
748747
}
749748

750749
@Override
751-
public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
750+
public boolean regenerate(World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception {
752751
return new PaperweightRegen(bukkitWorld, region, target, options).regenerate();
753752
}
754753

755754
@Override
756-
public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) {
755+
public IChunkGet get(World world, int chunkX, int chunkZ) {
757756
return new PaperweightGetBlocks(world, chunkX, chunkZ);
758757
}
759758

0 commit comments

Comments
 (0)