-
-
Notifications
You must be signed in to change notification settings - Fork 365
Introduce 26.2 support #3566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SirYwell
wants to merge
6
commits into
main
Choose a base branch
from
feat/mc-26.2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+11,667
−10
Open
Introduce 26.2 support #3566
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8d8be38
Introduce 26.2 support
SirYwell 01803fa
Delegate to correct method
SirYwell 91a811d
Fix wrong method call in PaperweightChunkAccessProxy (#3567)
Copilot 22edea6
Merge branch 'main' into feat/mc-26.2
NotMyFault 56319dd
Add 26.2 issue template entry
SirYwell 612b51d
leafpile snakeyaml workaround (??)
SirYwell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension | ||
|
|
||
| plugins { | ||
| id("buildlogic.adapter") | ||
| } | ||
|
|
||
| // workaround LeafPile providing wrong snakeyaml version | ||
| configurations.named("testRuntimeClasspath") { | ||
| exclude(group = "org.yaml", module = "snakeyaml") | ||
| } | ||
|
|
||
| dependencies { | ||
| // https://artifactory.papermc.io/ui/native/universe/io/papermc/paper/dev-bundle/ | ||
| the<PaperweightUserDependenciesExtension>().paperDevBundle("26.2.build.+") | ||
| compileOnly(libs.paperLib) | ||
| testRuntimeOnly(libs.snakeyaml) { | ||
| because("Keep adapter tests on Bukkit's SnakeYaml while excluding LeafPile's conflicting transitive version") | ||
| } | ||
| } |
229 changes: 229 additions & 0 deletions
229
.../java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v26_2/FaweBlockStateListPopulator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,229 @@ | ||
| package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v26_2; | ||
|
|
||
| import com.fastasyncworldedit.core.util.MathMan; | ||
| import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; | ||
| import net.minecraft.core.BlockPos; | ||
| import net.minecraft.core.Holder; | ||
| import net.minecraft.core.SectionPos; | ||
| import net.minecraft.core.particles.ParticleOptions; | ||
| import net.minecraft.server.MinecraftServer; | ||
| import net.minecraft.server.level.ServerLevel; | ||
| import net.minecraft.sounds.SoundEvent; | ||
| import net.minecraft.sounds.SoundSource; | ||
| import net.minecraft.util.RandomSource; | ||
| import net.minecraft.world.DifficultyInstance; | ||
| import net.minecraft.world.entity.Entity; | ||
| import net.minecraft.world.entity.player.Player; | ||
| import net.minecraft.world.flag.FeatureFlagSet; | ||
| import net.minecraft.world.level.biome.Biome; | ||
| import net.minecraft.world.level.biome.BiomeManager; | ||
| import net.minecraft.world.level.block.state.BlockState; | ||
| import net.minecraft.world.level.border.WorldBorder; | ||
| import net.minecraft.world.level.chunk.ChunkAccess; | ||
| import net.minecraft.world.level.chunk.ChunkSource; | ||
| import net.minecraft.world.level.chunk.status.ChunkStatus; | ||
| import net.minecraft.world.level.lighting.LevelLightEngine; | ||
| import net.minecraft.world.level.material.FluidState; | ||
| import org.bukkit.craftbukkit.util.BlockStateListPopulator; | ||
| import org.jetbrains.annotations.NotNull; | ||
|
|
||
| import javax.annotation.Nonnull; | ||
| import javax.annotation.Nullable; | ||
| import java.util.List; | ||
|
|
||
| public class FaweBlockStateListPopulator extends BlockStateListPopulator { | ||
|
|
||
| private final Long2ObjectOpenHashMap<PaperweightChunkAccessProxy> chunkProxies = new Long2ObjectOpenHashMap<>(); | ||
| private final ServerLevel world; | ||
|
|
||
| public FaweBlockStateListPopulator(ServerLevel world) { | ||
| super(world); | ||
| this.world = world; | ||
| } | ||
|
|
||
| @Override | ||
| public long getSeed() { | ||
| return world.getSeed(); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public ServerLevel getLevel() { | ||
| return world.getLevel(); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public DifficultyInstance getCurrentDifficultyAt(final BlockPos pos) { | ||
| return world.getCurrentDifficultyAt(pos); | ||
| } | ||
|
|
||
| @Override | ||
| public MinecraftServer getServer() { | ||
| return world.getServer(); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public ChunkSource getChunkSource() { | ||
| return world.getChunkSource(); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public RandomSource getRandom() { | ||
| return world.getRandom(); | ||
| } | ||
|
|
||
| @Override | ||
| public void playSound( | ||
| final Entity source, | ||
| final BlockPos pos, | ||
| final SoundEvent sound, | ||
| final SoundSource category, | ||
| final float volume, | ||
| final float pitch | ||
| ) { | ||
| // don't for now | ||
| } | ||
|
|
||
| @Override | ||
| public void addParticle( | ||
| final ParticleOptions parameters, | ||
| final double x, | ||
| final double y, | ||
| final double z, | ||
| final double velocityX, | ||
| final double velocityY, | ||
| final double velocityZ | ||
| ) { | ||
| // definitely don't | ||
| } | ||
|
|
||
| @Override | ||
| public @NotNull List<? extends Player> players() { | ||
| return world.players(); | ||
| } | ||
|
|
||
| @Override | ||
| public ChunkAccess getChunk(final int chunkX, final int chunkZ, final ChunkStatus leastStatus, final boolean create) { | ||
| ChunkAccess worldChunk = world.getChunk(chunkX, chunkZ, leastStatus, create); | ||
| PaperweightChunkAccessProxy proxy = chunkProxies.compute( | ||
| MathMan.pairInt(chunkX, chunkZ), | ||
| (k, v) -> v == null ? PaperweightChunkAccessProxy.getInstance() : v | ||
| ); | ||
| proxy.parent = worldChunk; | ||
| return proxy; | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public BiomeManager getBiomeManager() { | ||
| return world.getBiomeManager(); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public Holder<Biome> getUncachedNoiseBiome(final int biomeX, final int biomeY, final int biomeZ) { | ||
| return world.getUncachedNoiseBiome(biomeX, biomeY, biomeZ); | ||
| } | ||
|
|
||
| @Override | ||
| public int getSeaLevel() { | ||
| return world.getSeaLevel(); | ||
| } | ||
|
|
||
| @Override | ||
| public @Nonnull ChunkAccess getChunk(final @Nonnull BlockPos pos) { | ||
| ChunkAccess worldChunk = world.getChunk(pos); | ||
| PaperweightChunkAccessProxy proxy = chunkProxies.compute( | ||
| MathMan.pairInt(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ())), | ||
| (k, v) -> v == null ? PaperweightChunkAccessProxy.getInstance() : v | ||
| ); | ||
| proxy.parent = worldChunk; | ||
| return proxy; | ||
| } | ||
|
|
||
| @Override | ||
| public @Nonnull ChunkAccess getChunk(final int chunkX, final int chunkZ) { | ||
| ChunkAccess worldChunk = world.getChunk(chunkX, chunkZ); | ||
| PaperweightChunkAccessProxy proxy = chunkProxies.compute( | ||
| MathMan.pairInt(chunkX, chunkZ), | ||
| (k, v) -> v == null ? PaperweightChunkAccessProxy.getInstance() : v | ||
| ); | ||
| proxy.parent = worldChunk; | ||
| return proxy; | ||
| } | ||
|
|
||
| @Override | ||
| public @Nonnull ChunkAccess getChunk(final int chunkX, final int chunkZ, final @Nonnull ChunkStatus chunkStatus) { | ||
| ChunkAccess worldChunk = world.getChunk(chunkX, chunkZ, chunkStatus); | ||
| PaperweightChunkAccessProxy proxy = chunkProxies.compute( | ||
| MathMan.pairInt(chunkX, chunkZ), | ||
| (k, v) -> v == null ? PaperweightChunkAccessProxy.getInstance() : v | ||
| ); | ||
| proxy.parent = worldChunk; | ||
| return proxy; | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public FeatureFlagSet enabledFeatures() { | ||
| return world.enabledFeatures(); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public LevelLightEngine getLightEngine() { | ||
| return world.getLightEngine(); | ||
| } | ||
|
|
||
| @Nullable | ||
| @Override | ||
| public ChunkAccess getChunkIfLoadedImmediately(final int x, final int z) { | ||
| return world.getChunkIfLoadedImmediately(x, z); | ||
| } | ||
|
|
||
| @Override | ||
| public BlockState getBlockStateIfLoaded(final BlockPos blockposition) { | ||
| return world.getBlockStateIfLoaded(blockposition); | ||
| } | ||
|
|
||
| @Override | ||
| public FluidState getFluidIfLoaded(final BlockPos blockposition) { | ||
| return world.getFluidIfLoaded(blockposition); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public WorldBorder getWorldBorder() { | ||
| return world.getWorldBorder(); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean setBlock(final BlockPos pos, final BlockState state, final int flags, final int maxUpdateDepth) { | ||
| return world.setBlock(pos, state, flags, maxUpdateDepth); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean removeBlock(final BlockPos pos, final boolean move) { | ||
| return world.removeBlock(pos, move); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean destroyBlock(final BlockPos pos, final boolean drop, final Entity breakingEntity, final int maxUpdateDepth) { | ||
| return world.destroyBlock(pos, drop, breakingEntity, maxUpdateDepth); | ||
| } | ||
|
|
||
| @Override | ||
| @Nonnull | ||
| public BlockState getBlockState(final BlockPos pos) { | ||
| return world.getBlockState(pos); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean setBlock(final BlockPos pos, final BlockState state, final int flags) { | ||
| return world.setBlock(pos, state, flags); | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks sane to me.