Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Telesphoreo committed Nov 3, 2024
2 parents 41fea18 + d959778 commit f054d29
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 38 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ logger.lifecycle("""
*******************************************
""")

var rootVersion by extra("2.11.3")
var rootVersion by extra("2.12.1")
var snapshot by extra("SNAPSHOT")
var revision: String by extra("")
var buildNumber by extra("")
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
implementation(gradleApi())
implementation("org.ajoberstar.grgit:grgit-gradle:5.3.0")
implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.3")
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.7.3")
implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.7.4")
constraints {
val asmVersion = "[9.7,)"
implementation("org.ow2.asm:asm:$asmVersion") {
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@ mapmanager = "1.8.0-SNAPSHOT"
griefprevention = "17.0.0"
griefdefender = "2.1.0-SNAPSHOT"
residence = "4.5._13.1"
towny = "0.100.4.4"
plotsquared = "7.3.11"
towny = "0.100.4.7"
plotsquared = "7.3.12"

# Third party
bstats = "3.1.0"
sparsebitset = "1.3"
parallelgzip = "1.0.5"
adventure = "4.17.0"
adventure-bukkit = "4.3.4"
checkerqual = "3.47.0"
checkerqual = "3.48.1"
truezip = "6.8.4"
auto-value = "1.11.0"
findbugs = "3.0.2"
Expand All @@ -40,14 +40,14 @@ paperlib = "1.0.8"
paster = "1.1.6"
vault = "1.7.1"
serverlib = "2.3.6"
linbus = "0.1.2"
linbus = "0.2.0"
## Internal
text-adapter = "3.0.6"
text = "3.0.4"
piston = "0.5.10"

# Tests
mockito = "5.14.1"
mockito = "5.14.2"

# Gradle plugins
pluginyml = "0.6.0"
Expand Down
2 changes: 1 addition & 1 deletion worldedit-bukkit/adapters/adapter-1_21/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ repositories {

dependencies {
// url=https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/1.21.1-R0.1-SNAPSHOT/
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.21.1-R0.1-20241012.212042-119")
the<PaperweightUserDependenciesExtension>().paperDevBundle("1.21.1-R0.1-20241021.162528-124")
compileOnly(libs.paperlib)
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.entity.EntityTypes;
import com.sk89q.worldedit.world.item.ItemType;
import net.minecraft.SharedConstants;
import net.minecraft.Util;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
Expand Down Expand Up @@ -124,7 +125,6 @@
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.entity.CraftPlayer;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
import org.bukkit.generator.ChunkGenerator;
Expand Down Expand Up @@ -194,7 +194,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
// A simple test
CraftServer.class.cast(Bukkit.getServer());

int dataVersion = CraftMagicNumbers.INSTANCE.getDataVersion();
int dataVersion = SharedConstants.getCurrentVersion().getDataVersion().getVersion();
if (dataVersion != 3953 && dataVersion != 3955) {
throw new UnsupportedClassVersionError("Not 1.21(.1)!");
}
Expand All @@ -213,7 +213,7 @@ public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException {
);
chunkProviderExecutorField.setAccessible(true);

this.dataFixer = new PaperweightDataConverters(CraftMagicNumbers.INSTANCE.getDataVersion(), this);
this.dataFixer = new PaperweightDataConverters(dataVersion, this);

Watchdog watchdog;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public void sendChunk(IChunkGet chunk, int mask, boolean lighting) {
* Utilises ConcurrentHashMap#compute for easy synchronisation for all of the above. Only tryWriteLock is used in blocks
* synchronised using ConcurrentHashMap methods.
*
* @since TODO
* @since 2.12.0
*/
protected static <LevelChunkSection> boolean setSectionAtomic(
String worldName,
Expand Down Expand Up @@ -212,7 +212,7 @@ protected static <LevelChunkSection> boolean setSectionAtomic(
* <p>
* Utilises ConcurrentHashMap#compute for easy synchronisation
*
* @since TODO
* @since 2.12.0
*/
protected static void beginChunkPacketSend(String worldName, IntPair pair, StampLockHolder stampedLock) {
ConcurrentHashMap<IntPair, ChunkSendLock> chunks = FaweBukkitWorld.getWorldSendingChunksMap(worldName);
Expand All @@ -233,7 +233,7 @@ protected static void beginChunkPacketSend(String worldName, IntPair pair, Stamp
/**
* Releases the read lock acquired when sending a chunk packet for a chunk
*
* @since TODO
* @since 2.12.0
*/
protected static void endChunkPacketSend(String worldName, IntPair pair, StampLockHolder lockHolder) {
ConcurrentHashMap<IntPair, ChunkSendLock> chunks = FaweBukkitWorld.getWorldSendingChunksMap(worldName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public class LimitExtent extends AbstractDelegateExtent implements IBatchProcess
* @param limit the limit
* @deprecated Use {@link LimitExtent#LimitExtent(Extent, FaweLimit, Consumer, boolean)}
*/
@Deprecated(forRemoval = true, since = "TODO")
@Deprecated(forRemoval = true, since = "2.12.0")
public LimitExtent(Extent extent, FaweLimit limit) {
this(extent, limit, c -> {
});
Expand All @@ -69,7 +69,7 @@ public LimitExtent(Extent extent, FaweLimit limit) {
* @param onErrorMessage consumer to handle a component generated by exceptions
* @deprecated Use {@link LimitExtent#LimitExtent(Extent, FaweLimit, Consumer, boolean)}
*/
@Deprecated(forRemoval = true, since = "TODO")
@Deprecated(forRemoval = true, since = "2.12.0")
public LimitExtent(Extent extent, FaweLimit limit, Consumer<Component> onErrorMessage) {
this(extent, limit, onErrorMessage, false);
}
Expand All @@ -81,7 +81,7 @@ public LimitExtent(Extent extent, FaweLimit limit, Consumer<Component> onErrorMe
* @param limit the limit
* @param onErrorMessage consumer to handle a component generated by exceptions
* @param processing if this limit extent is expected to be processing
* @since TODO
* @since 2.12.0
*/
public LimitExtent(
Extent extent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public LinearClipboard(BlockVector3 dimensions, BlockVector3 offset) {
/**
* @deprecated will be removed as it is unused and uses outdated types
*/
@Deprecated(forRemoval = true, since = "TODO")
@Deprecated(forRemoval = true, since = "2.12.0")
public abstract Collection<CompoundTag> getTileEntities();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fastasyncworldedit.core.extent.filter.block.FilterBlock;
import com.fastasyncworldedit.core.internal.simd.VectorizedFilter;
import jdk.incubator.vector.ShortVector;
import jdk.incubator.vector.VectorMask;

public class CountFilter extends ForkedFilter<CountFilter> implements VectorizedFilter {

Expand Down Expand Up @@ -36,8 +37,8 @@ public int getTotal() {
}

@Override
public ShortVector applyVector(final ShortVector get, final ShortVector set) {
total += set.length();
public ShortVector applyVector(final ShortVector get, final ShortVector set, VectorMask<Short> mask) {
total += mask.trueCount();
return set;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.fastasyncworldedit.core.queue.IChunk;
import com.sk89q.worldedit.regions.Region;
import jdk.incubator.vector.ShortVector;
import jdk.incubator.vector.VectorMask;
import org.jetbrains.annotations.Nullable;

/**
Expand Down Expand Up @@ -77,9 +78,9 @@ public VectorizedLinkedFilter(final L left, final R right) {
}

@Override
public ShortVector applyVector(final ShortVector get, final ShortVector set) {
ShortVector res = getLeft().applyVector(get, set);
return getRight().applyVector(get, res);
public ShortVector applyVector(final ShortVector get, final ShortVector set, VectorMask<Short> mask) {
ShortVector res = getLeft().applyVector(get, set, mask);
return getRight().applyVector(get, res, mask);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ public VectorizedMaskFilter(final T other, final Mask root, AtomicInteger change
}

@Override
public ShortVector applyVector(final ShortVector get, final ShortVector set) {
public ShortVector applyVector(final ShortVector get, final ShortVector set, VectorMask<Short> mask) {
final T parent = getParent();
VectorMask<Short> masked = vectorizedMask.compareVector(set, get);
ShortVector res = parent.applyVector(get, set);
res = set.blend(res, masked);
ShortVector res = parent.applyVector(get, set, mask.and(masked));
VectorMask<Short> changed = res.compare(VectorOperators.NE, set);
changes.getAndAdd(changed.trueCount());
return res;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import jdk.incubator.vector.ShortVector;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorOperators;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -101,8 +102,9 @@ public VectorizedPattern(final T parent, char ordinal) {
}

@Override
public ShortVector applyVector(final ShortVector get, final ShortVector set) {
return ShortVector.broadcast(ShortVector.SPECIES_PREFERRED, ordinal);
public ShortVector applyVector(final ShortVector get, final ShortVector set, VectorMask<Short> mask) {
// only change the lanes the mask dictates us to change, keep the rest
return set.blend(ShortVector.broadcast(ShortVector.SPECIES_PREFERRED, ordinal), mask);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.fastasyncworldedit.core.queue.Filter;
import com.sk89q.worldedit.extent.Extent;
import jdk.incubator.vector.ShortVector;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorSpecies;

public class VectorizedCharFilterBlock extends CharFilterBlock {
Expand All @@ -18,15 +19,17 @@ public synchronized void filter(final Filter filter) {
throw new IllegalStateException("Unexpected VectorizedCharFilterBlock " + filter);
}
final VectorSpecies<Short> species = ShortVector.SPECIES_PREFERRED;
// TODO can we avoid eager initSet?
initSet(); // set array is null before
char[] setArr = this.setArr;
assert setArr != null;
char[] getArr = this.getArr;
// assume setArr.length == getArr.length == 4096
VectorMask<Short> affectAll = species.maskAll(true);
for (int i = 0; i < 4096; i += species.length()) {
ShortVector set = ShortVector.fromCharArray(species, setArr, i);
ShortVector get = ShortVector.fromCharArray(species, getArr, i);
ShortVector res = vecFilter.applyVector(get, set);
ShortVector res = vecFilter.applyVector(get, set, affectAll);
res.intoCharArray(setArr, i);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@

import com.fastasyncworldedit.core.queue.Filter;
import jdk.incubator.vector.ShortVector;
import jdk.incubator.vector.VectorMask;

public interface VectorizedFilter extends Filter {
ShortVector applyVector(ShortVector get, ShortVector set);

/**
* Applies a filter to a vector pair of get and set.
*
* @param get the get vector
* @param set the set vector
* @param mask the mask with the lanes set to true which should be affected by the filter
* @return the resulting set vector.
*/
ShortVector applyVector(ShortVector get, ShortVector set, VectorMask<Short> mask);

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.fastasyncworldedit.core.queue.IChunk;
import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.queue.IChunkSet;
import com.sk89q.worldedit.world.block.BlockTypesCache;
import jdk.incubator.vector.ShortVector;
import jdk.incubator.vector.VectorMask;
import jdk.incubator.vector.VectorSpecies;
Expand Down Expand Up @@ -31,10 +32,22 @@ default void processSection(int layer, char[] set, char[] get) {
}
}

/**
* {@return the set vector with all lanes that do not match this mask set to 0}
*
* @param set the set vector
* @param get the get vector
*/
default ShortVector processVector(ShortVector set, ShortVector get) {
return set.blend(0, compareVector(set, get).not());
return set.blend(BlockTypesCache.ReservedIDs.__RESERVED__, compareVector(set, get).not());
}

/**
* {@return a mask with all lanes set that match this mask}
*
* @param set the set vector
* @param get the get vector
*/
VectorMask<Short> compareVector(ShortVector set, ShortVector get);

}
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public boolean isUnlimited() {
/**
* Get an {@link FaweLimit} representing the amount of a limit used from a given "original" limit
*
* @since TODO
* @since 2.12.0
*/
public FaweLimit getLimitUsed(FaweLimit originalLimit) {
FaweLimit newLimit = new FaweLimit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ public boolean isEmpty() {

@Override
public boolean tile(final int x, final int y, final int z, final FaweCompoundTag tag) {
return false;
return delegate.set(this).tile(x, y, z, tag);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public static void addUUIDToMap(Map<String, LinTag<?>> map, UUID uuid) {
* {@return the position data of the given tag}
*
* @param compoundTag the tag to extract position information from
* @since TODO
* @since 2.12.0
*/
public static Vector3 entityPosition(FaweCompoundTag compoundTag) {
LinListTag<LinDoubleTag> pos = compoundTag.linTag().getListTag("Pos", LinTagType.doubleTag());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public interface Brush {
/**
* If this brush is expected to set blocks synchronously, i.e. from one thread (at a time)
*
* @since TODO
* @since 2.12.0
*/
default boolean setsSynchronously() {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Indicates it is expected that blocks will only be set synchronously, i.e. from one thread (at a time)
*
* @since TODO
* @since 2.12.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ private BaseBlock parseLogic(String input, ParserContext context) throws InputPa
if (state == null) {
throw new NoMatchException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input)));
}
nbt = state.getNbtData();
}
//FAWE end

Expand Down
2 changes: 1 addition & 1 deletion worldedit-fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ dependencies {
}

// No need for this at runtime
"modCompileOnly"("me.lucko:fabric-permissions-api:0.3.1")
"modCompileOnly"("me.lucko:fabric-permissions-api:0.3.2")

// Hook these up manually, because Fabric doesn't seem to quite do it properly.
"compileOnly"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
Expand Down
2 changes: 1 addition & 1 deletion worldedit-sponge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {
})
api("org.apache.logging.log4j:log4j-api")
api("org.bstats:bstats-sponge:1.7")
testImplementation("org.mockito:mockito-core:5.14.1")
testImplementation("org.mockito:mockito-core:5.14.2")
}

<<<<<<< HEAD
Expand Down

0 comments on commit f054d29

Please sign in to comment.