geforkt von Mirrors/FastAsyncWorldEdit
Merge branch 'main' into feature/paper-chunk-system
Dieser Commit ist enthalten in:
Commit
701237bdbd
@ -23,7 +23,7 @@ logger.lifecycle("""
|
||||
*******************************************
|
||||
""")
|
||||
|
||||
var rootVersion by extra("2.4.2")
|
||||
var rootVersion by extra("2.4.3")
|
||||
var snapshot by extra("SNAPSHOT")
|
||||
var revision: String by extra("")
|
||||
var buildNumber by extra("")
|
||||
|
@ -99,7 +99,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
private static final Field fieldLock;
|
||||
private static final long fieldLockOffset;
|
||||
|
||||
private static final Field fieldGameEventDispatcherSections;
|
||||
private static final MethodHandle methodRemoveGameEventListener;
|
||||
private static final MethodHandle methodremoveTickingBlockEntity;
|
||||
|
||||
private static final Field fieldRemove;
|
||||
@ -148,9 +148,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
fieldLockOffset = -1;
|
||||
}
|
||||
|
||||
fieldGameEventDispatcherSections = LevelChunk.class.getDeclaredField(Refraction.pickName(
|
||||
"gameEventDispatcherSections", "t"));
|
||||
fieldGameEventDispatcherSections.setAccessible(true);
|
||||
Method removeGameEventListener = LevelChunk.class.getDeclaredMethod(
|
||||
Refraction.pickName("removeGameEventListener", "d"),
|
||||
BlockEntity.class
|
||||
);
|
||||
removeGameEventListener.setAccessible(true);
|
||||
methodRemoveGameEventListener = MethodHandles.lookup().unreflect(removeGameEventListener);
|
||||
Method removeBlockEntityTicker = LevelChunk.class.getDeclaredMethod(
|
||||
Refraction.pickName(
|
||||
"removeBlockEntityTicker",
|
||||
@ -573,23 +576,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
BlockEntity blockEntity = levelChunk.blockEntities.remove(beacon.getBlockPos());
|
||||
if (blockEntity != null) {
|
||||
if (!levelChunk.level.isClientSide) {
|
||||
Block block = beacon.getBlockState().getBlock();
|
||||
if (block instanceof EntityBlock) {
|
||||
GameEventListener gameEventListener = ((EntityBlock) block).getListener(levelChunk.level, beacon);
|
||||
if (gameEventListener != null) {
|
||||
int i = SectionPos.blockToSectionCoord(beacon.getBlockPos().getY());
|
||||
GameEventDispatcher gameEventDispatcher = levelChunk.getEventDispatcher(i);
|
||||
gameEventDispatcher.unregister(gameEventListener);
|
||||
if (gameEventDispatcher.isEmpty()) {
|
||||
try {
|
||||
((Int2ObjectMap<GameEventDispatcher>) fieldGameEventDispatcherSections.get(levelChunk))
|
||||
.remove(i);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
methodRemoveGameEventListener.invoke(levelChunk, beacon);
|
||||
}
|
||||
fieldRemove.set(beacon, true);
|
||||
}
|
||||
|
@ -183,8 +183,8 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
|
||||
CraftServer.class.cast(Bukkit.getServer());
|
||||
|
||||
int dataVersion = CraftMagicNumbers.INSTANCE.getDataVersion();
|
||||
if (dataVersion != 3105) {
|
||||
throw new UnsupportedClassVersionError("Not 1.19!");
|
||||
if (dataVersion != 3105 && dataVersion != 3117) {
|
||||
throw new UnsupportedClassVersionError("Not 1.19 or 1.19.1!");
|
||||
}
|
||||
|
||||
worldsField = CraftServer.class.getDeclaredField("worlds");
|
||||
|
@ -62,6 +62,8 @@ import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Parameter;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@ -99,7 +101,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
private static final Field fieldLock;
|
||||
private static final long fieldLockOffset;
|
||||
|
||||
private static final Field fieldGameEventDispatcherSections;
|
||||
private static final MethodHandle methodRemoveGameEventListener;
|
||||
private static final MethodHandle methodremoveTickingBlockEntity;
|
||||
|
||||
private static final Field fieldRemove;
|
||||
@ -148,9 +150,14 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
fieldLockOffset = -1;
|
||||
}
|
||||
|
||||
fieldGameEventDispatcherSections = LevelChunk.class.getDeclaredField(Refraction.pickName(
|
||||
"gameEventDispatcherSections", "t"));
|
||||
fieldGameEventDispatcherSections.setAccessible(true);
|
||||
Method removeGameEventListener = LevelChunk.class.getDeclaredMethod(
|
||||
Refraction.pickName("removeGameEventListener", "a"),
|
||||
BlockEntity.class,
|
||||
ServerLevel.class
|
||||
);
|
||||
removeGameEventListener.setAccessible(true);
|
||||
methodRemoveGameEventListener = MethodHandles.lookup().unreflect(removeGameEventListener);
|
||||
|
||||
Method removeBlockEntityTicker = LevelChunk.class.getDeclaredMethod(
|
||||
Refraction.pickName(
|
||||
"removeBlockEntityTicker",
|
||||
@ -565,32 +572,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
||||
return BiomeTypes.get(biome.unwrapKey().orElseThrow().location().toString());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
static void removeBeacon(BlockEntity beacon, LevelChunk levelChunk) {
|
||||
try {
|
||||
// Do the method ourselves to avoid trying to reflect generic method parameters
|
||||
// similar to removeGameEventListener
|
||||
if (levelChunk.loaded || levelChunk.level.isClientSide()) {
|
||||
BlockEntity blockEntity = levelChunk.blockEntities.remove(beacon.getBlockPos());
|
||||
if (blockEntity != null) {
|
||||
if (!levelChunk.level.isClientSide) {
|
||||
Block block = beacon.getBlockState().getBlock();
|
||||
if (block instanceof EntityBlock) {
|
||||
GameEventListener gameEventListener = ((EntityBlock) block).getListener(levelChunk.level, beacon);
|
||||
if (gameEventListener != null) {
|
||||
int i = SectionPos.blockToSectionCoord(beacon.getBlockPos().getY());
|
||||
GameEventDispatcher gameEventDispatcher = levelChunk.getEventDispatcher(i);
|
||||
gameEventDispatcher.unregister(gameEventListener);
|
||||
if (gameEventDispatcher.isEmpty()) {
|
||||
try {
|
||||
((Int2ObjectMap<GameEventDispatcher>) fieldGameEventDispatcherSections.get(levelChunk))
|
||||
.remove(i);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
methodRemoveGameEventListener.invoke(levelChunk, beacon, levelChunk.level);
|
||||
}
|
||||
fieldRemove.set(beacon, true);
|
||||
}
|
||||
|
@ -159,18 +159,6 @@ public class RegionCommands {
|
||||
actor.print(Caption.of("fawe.info.lighting.propagate.selection", count));
|
||||
}
|
||||
|
||||
// @Command(
|
||||
// name = "/getlighting",
|
||||
// desc = "Get the light at a position"
|
||||
// )
|
||||
// @CommandPermissions("worldedit.light.fix")
|
||||
// public void getLighting(Player player, EditSession editSession) throws WorldEditException {
|
||||
// final Location loc = player.getLocation();
|
||||
// int block = editSession.getBlockLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
// int sky = editSession.getSkyLight(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
|
||||
// player.print(TextComponent.of("Light: " + block + " | " + sky));
|
||||
// }
|
||||
|
||||
@Command(
|
||||
name = "/removelighting",
|
||||
aliases = "/removelight",
|
||||
@ -202,6 +190,7 @@ public class RegionCommands {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated(since = "2.4.2", forRemoval = true)
|
||||
@Command(
|
||||
name = "/setblocklight",
|
||||
aliases = "/setlight",
|
||||
@ -209,16 +198,17 @@ public class RegionCommands {
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setlighting(Actor actor, EditSession editSession, @Selection Region region) {
|
||||
actor.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
actor.print(Caption.of("fawe.info.light-blocks"));
|
||||
}
|
||||
|
||||
@Deprecated(since = "2.4.2", forRemoval = true)
|
||||
@Command(
|
||||
name = "/setskylight",
|
||||
desc = "Set sky lighting in a selection"
|
||||
)
|
||||
@CommandPermissions("worldedit.light.set")
|
||||
public void setskylighting(Actor actor, @Selection Region region) {
|
||||
actor.print(Caption.of("fawe.info.temporarily-not-working"));
|
||||
actor.print(Caption.of("fawe.info.light-blocks"));
|
||||
}
|
||||
|
||||
@Command(
|
||||
|
@ -4,7 +4,7 @@
|
||||
"fawe.worldedit.history.find.element.more": " - Changes: {0}\n - Bounds: {1} -> {2}\n - Extra: {3}\n - Size on Disk: {4}",
|
||||
"fawe.worldedit.history.find.hover": "{0} blocks changed, click for more info",
|
||||
"fawe.worldedit.history.distr.summary_null": "Could not find edit summary for inputs.",
|
||||
"fawe.info.lighting.propagate.selection": "Lighting has been propagated in {0} chunks. (Note: To remove light use //removelight)",
|
||||
"fawe.info.lighting.propagate.selection": "Lighting has been propagated in {0} chunks.",
|
||||
"fawe.info.updated.lighting.selection": "Lighting has been updated in {0} chunks. (It may take a second for the packets to send)",
|
||||
"fawe.info.set.region": "Selection set to your current allowed region",
|
||||
"fawe.info.worldedit.toggle.tips.on": "Disabled FAWE tips.",
|
||||
@ -13,6 +13,7 @@
|
||||
"fawe.info.worldedit.restricted": "Your FAWE edits are now restricted.",
|
||||
"fawe.info.worldedit.oom.admin": "Possible options:\n - //fast\n - Do smaller edits\n - Allocate more memory\n - Disable `max-memory-percent`",
|
||||
"fawe.info.temporarily-not-working": "Temporarily not working",
|
||||
"fawe.info.light-blocks": "Light blocks are more reliable than light sources, please use the blocks. This command is deprecated and will be removed in a future version.",
|
||||
"fawe.info.update-available": "An update for FastAsyncWorldEdit is available. You are {0} build(s) out of date.\nYou are running build {1}, the latest version is build {2}.\nUpdate at {3}",
|
||||
"fawe.web.generating.link": "Uploading {0}, please wait...",
|
||||
"fawe.web.generating.link.failed": "Failed to generate download link!",
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren