3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-02 17:40:09 +01:00

Fix CFI generation

Dieser Commit ist enthalten in:
Jesse Boyd 2019-11-08 22:30:39 +00:00
Ursprung 26f073faa2
Commit d61dac5aa5
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 59F1DE6293AF6E1F
10 geänderte Dateien mit 106 neuen und 107 gelöschten Zeilen

Datei anzeigen

@ -15,6 +15,7 @@ public class BlockMaterial_1_14 implements BlockMaterial {
private final Material material;
private final boolean isTranslucent;
private final CraftBlockData craftBlockData;
private final org.bukkit.Material craftMaterial;
public BlockMaterial_1_14(Block block) {
this(block, block.getBlockData());
@ -25,6 +26,7 @@ public class BlockMaterial_1_14 implements BlockMaterial {
this.defaultState = defaultState;
this.material = defaultState.getMaterial();
this.craftBlockData = CraftBlockData.fromData(defaultState);
this.craftMaterial = craftBlockData.getMaterial();
this.isTranslucent = ReflectionUtil.getField(Block.class, block, "v");
}
@ -51,7 +53,7 @@ public class BlockMaterial_1_14 implements BlockMaterial {
@Override
public boolean isFullCube() {
return defaultState.g();
return craftMaterial.isOccluding();
}
@Override

Datei anzeigen

@ -276,9 +276,6 @@ public class BukkitPlayer extends AbstractPlayerActor {
Player tmp = Bukkit.getPlayer(getUniqueId());
if (tmp != null) {
player = tmp;
} else {
System.out.println("Invalid player " + player.getName());
new Exception().printStackTrace();
}
}
return player;

Datei anzeigen

@ -156,7 +156,6 @@ public class CFICommands {
settings.setGenerator(generator).bind();
generator.setImageViewer(Fawe.imp().getImageViewer(player));
generator.update();
settings.bind();
mainMenu(player);
}
@ -398,26 +397,26 @@ public class CFICommands {
public void paletteblocks(Player player, LocalSession session, @Arg(name = "arg", desc = "String", def = "") String argOpt) throws EmptyClipboardException, InputParseException, FileNotFoundException {
if (argOpt == null) {
TextComponent build = TextComponent.builder("What blocks do you want to color with?")
.append(newline())
.append(TextComponent.of("[All]")
.clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks *")))
.append(" - All available blocks")
.append(newline())
.append(TextComponent.of("[Clipboard]")
.clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks #clipboard")))
.append(" - The blocks in your clipboard")
.append(newline())
.append(TextComponent.of("[List]")
.clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks stone,gravel")))
.append(" - A comma separated list of blocks")
.append(newline())
.append(TextComponent.of("[Complexity]")
.clickEvent(ClickEvent.runCommand("/cfi Complexity")))
.append(" - Block textures within a complexity range")
.append(newline())
.append(TextComponent.of("< [Back]").clickEvent(ClickEvent
.runCommand("/cfi coloring")))
.build();
.append(newline())
.append(TextComponent.of("[All]")
.clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks *")))
.append(" - All available blocks")
.append(newline())
.append(TextComponent.of("[Clipboard]")
.clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks #clipboard")))
.append(" - The blocks in your clipboard")
.append(newline())
.append(TextComponent.of("[List]")
.clickEvent(ClickEvent.runCommand("/cfi PaletteBlocks stone,gravel")))
.append(" - A comma separated list of blocks")
.append(newline())
.append(TextComponent.of("[Complexity]")
.clickEvent(ClickEvent.runCommand("/cfi Complexity")))
.append(" - Block textures within a complexity range")
.append(newline())
.append(TextComponent.of("< [Back]").clickEvent(ClickEvent
.runCommand("/cfi coloring")))
.build();
player.print(build);
return;
}
@ -881,19 +880,19 @@ public class CFICommands {
String s1 = "/cfi mask <mask>";
String s2 = "/cfi " + settings.getCategory();
TextComponent build = TextComponent.builder(">> Current Settings <<")
.append(newline())
.append("Image Mask ").append(
TextComponent.of("[" + settings.imageMaskArg + "]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s)))
.clickEvent(ClickEvent.suggestCommand("/cfi mask http://")))
.append(newline())
.append("WorldEdit Mask ").append(TextComponent.of("[" + settings.maskArg + "]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s1)))
.clickEvent(ClickEvent.suggestCommand(s1)))
.append(newline())
.append(
TextComponent.of("< [Back]").hoverEvent(HoverEvent.showText(TextComponent.of(s2)))
.clickEvent(ClickEvent.runCommand(s2))).build();
.append(newline())
.append("Image Mask ").append(
TextComponent.of("[" + settings.imageMaskArg + "]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s)))
.clickEvent(ClickEvent.suggestCommand("/cfi mask http://")))
.append(newline())
.append("WorldEdit Mask ").append(TextComponent.of("[" + settings.maskArg + "]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s1)))
.clickEvent(ClickEvent.suggestCommand(s1)))
.append(newline())
.append(
TextComponent.of("< [Back]").hoverEvent(HoverEvent.showText(TextComponent.of(s2)))
.clickEvent(ClickEvent.runCommand(s2))).build();
player.print(build);
}
@ -917,13 +916,13 @@ public class CFICommands {
String s = cmd + " stone";
String s1 = "/cfi " + settings.getCategory();
TextComponent build = TextComponent.builder(">> Current Settings <<").append(newline())
.append("Pattern ").append(TextComponent.of("[Click Here]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s)))
.clickEvent(ClickEvent.suggestCommand(s)))
.append(newline())
.append(TextComponent.of("< [Back]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s1)))
.clickEvent(ClickEvent.runCommand(s1))).build();
.append("Pattern ").append(TextComponent.of("[Click Here]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s)))
.clickEvent(ClickEvent.suggestCommand(s)))
.append(newline())
.append(TextComponent.of("< [Back]")
.hoverEvent(HoverEvent.showText(TextComponent.of(s1)))
.clickEvent(ClickEvent.runCommand(s1))).build();
player.print(build);
}
}
@ -964,11 +963,11 @@ public class CFICommands {
if (image == null) {
TextComponent build = TextComponent.builder("Please provide an image:")
.append(newline())
.append("From a URL: ").append(TextComponent.of("[Click Here]").clickEvent(ClickEvent.suggestCommand("/cfi image http://")))
.append(newline())
.append("From a file: ").append(TextComponent.of("[Click Here]").clickEvent(ClickEvent.suggestCommand("/cfi image file://")))
.build();
.append(newline())
.append("From a URL: ").append(TextComponent.of("[Click Here]").clickEvent(ClickEvent.suggestCommand("/cfi image http://")))
.append(newline())
.append("From a file: ").append(TextComponent.of("[Click Here]").clickEvent(ClickEvent.suggestCommand("/cfi image file://")))
.build();
player.print(build);
} else {
if (settings.hasGenerator()) {
@ -989,12 +988,12 @@ public class CFICommands {
settings.popMessages(player);
settings.setCategory(this::populate);
TextComponent build = TextComponent.builder("What would you like to populate?")
.append(newline())
.append("(You will need to type these commands)").append(newline())
//TODO .cmdOptions("/cfi ", "", "Ores", "Ore", "Caves", "Schematics", "Smooth")
.append(newline())
.append(TextComponent.of("< [Back]").clickEvent(ClickEvent.runCommand("/cfi")))
.build();
.append(newline())
.append("(You will need to type these commands)").append(newline())
//TODO .cmdOptions("/cfi ", "", "Ores", "Ore", "Caves", "Schematics", "Smooth")
.append(newline())
.append(TextComponent.of("< [Back]").clickEvent(ClickEvent.runCommand("/cfi")))
.build();
player.print(build);
}
@ -1038,32 +1037,32 @@ public class CFICommands {
//TODO
@NotNull Builder msg = TextComponent.builder(">> Current Settings <<").append(newline())
.append("Mask ").append(TextComponent.of("[" + mask + "]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi mask")))
.clickEvent(ClickEvent.runCommand("/cfi mask")))
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi mask")))
.clickEvent(ClickEvent.runCommand("/cfi mask")))
.append(newline())
.append("Pattern ").append(TextComponent.of("[" + pattern + "]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi pattern")))
.clickEvent(ClickEvent.runCommand("/cfi pattern")))
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi pattern")))
.clickEvent(ClickEvent.runCommand("/cfi pattern")))
.append(newline())
.append(newline())
.append(">> Components <<")
.append(newline())
.append(TextComponent.of("[Height]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi height 120")))
.clickEvent(ClickEvent.suggestCommand("/cfi height 120"))).append(" - Terrain height for whole map")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi height 120")))
.clickEvent(ClickEvent.suggestCommand("/cfi height 120"))).append(" - Terrain height for whole map")
.append(newline())
.append(TextComponent.of("[WaterHeight]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi waterheight 60")))
.clickEvent(ClickEvent.suggestCommand("/cfi waterheight 60"))).append(" - Sea level for whole map")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi waterheight 60")))
.clickEvent(ClickEvent.suggestCommand("/cfi waterheight 60"))).append(" - Sea level for whole map")
.append(newline())
.append(TextComponent.of("[FloorThickness]").hoverEvent(HoverEvent.showText(TextComponent.of("/cfi floorthickness 60")))
.clickEvent(ClickEvent.suggestCommand("/cfi floorthickness 60"))).append(" - Floor thickness of entire map")
.clickEvent(ClickEvent.suggestCommand("/cfi floorthickness 60"))).append(" - Floor thickness of entire map")
.append(newline())
.append(TextComponent.of("[WorldThickness]").hoverEvent(HoverEvent.showText(TextComponent.of("/cfi worldthickness 60")))
.clickEvent(ClickEvent.suggestCommand("/cfi worldthickness 60"))).append(" - World thickness of entire map")
.clickEvent(ClickEvent.suggestCommand("/cfi worldthickness 60"))).append(" - World thickness of entire map")
.append(newline())
.append(TextComponent.of("[Snow]").hoverEvent(HoverEvent.showText(TextComponent.of("/cfi snow" + maskArgs)))
.clickEvent(ClickEvent.suggestCommand("/cfi snow" + maskArgs))).append(" - Set snow in the masked areas")
.clickEvent(ClickEvent.suggestCommand("/cfi snow" + maskArgs))).append(" - Set snow in the masked areas")
.append(newline());
if (pattern != null) {
@ -1080,27 +1079,27 @@ public class CFICommands {
msg
.append(TextComponent.of("[WaterId]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi waterId " + pattern)))
.clickEvent(ClickEvent.runCommand("/cfi waterId " + pattern)))
.append(" - Water id for whole map")
.append(newline())
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi waterId " + pattern)))
.clickEvent(ClickEvent.runCommand("/cfi waterId " + pattern)))
.append(" - Water id for whole map")
.append(newline())
.append(TextComponent.of("[BedrockId]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi baseId " + pattern)))
.clickEvent(ClickEvent.runCommand("/cfi baseId " + pattern)))
.append(TextComponent.of(" - Bedrock id for whole map"))
.append(newline())
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi baseId " + pattern)))
.clickEvent(ClickEvent.runCommand("/cfi baseId " + pattern)))
.append(TextComponent.of(" - Bedrock id for whole map"))
.append(newline())
.append(TextComponent.of("[Floor]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi floor " + compArgs)))
.clickEvent(ClickEvent.runCommand("/cfi floor " + compArgs)))
.append(TextComponent.of(" - Set the floor in the masked areas")).append(newline())
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi floor " + compArgs)))
.clickEvent(ClickEvent.runCommand("/cfi floor " + compArgs)))
.append(TextComponent.of(" - Set the floor in the masked areas")).append(newline())
.append(TextComponent.of("[Main]")
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi main " + compArgs)))
.clickEvent(ClickEvent.runCommand("/cfi main " + compArgs)))
.append(TextComponent.of(" - Set the main block in the masked areas")).append(newline())
.hoverEvent(HoverEvent.showText(TextComponent.of("/cfi main " + compArgs)))
.clickEvent(ClickEvent.runCommand("/cfi main " + compArgs)))
.append(TextComponent.of(" - Set the main block in the masked areas")).append(newline())
.append(TextComponent.of("[Column]").hoverEvent(HoverEvent.showText(TextComponent.of("/cfi column" + compArgs)))
.clickEvent(ClickEvent.runCommand("/cfi column" + compArgs))).append(" - Set the columns in the masked areas").append(newline())
.clickEvent(ClickEvent.runCommand("/cfi column" + compArgs))).append(" - Set the columns in the masked areas").append(newline())
.append(TextComponent.of("[Overlay]").hoverEvent(HoverEvent.showText(TextComponent.of("/cfi overlay" + compArgs)))
.clickEvent(ClickEvent.runCommand("/cfi overlay" + compArgs))).append(" - Set the overlay in the masked areas").append(newline());
.clickEvent(ClickEvent.runCommand("/cfi overlay" + compArgs))).append(" - Set the overlay in the masked areas").append(newline());
}
msg.append(newline())
@ -1119,7 +1118,10 @@ public class CFICommands {
protected static CFISettings getSettings(Player player) {
CFISettings settings = player.getMeta("CFISettings");
return settings == null ? new CFISettings(player) : settings;
if (settings == null) {
settings = new CFISettings(player);
}
return settings;
}
public static class CFISettings {
@ -1257,8 +1259,8 @@ public class CFICommands {
String option = options[i];
String cmd = prefix + option;
producer.append(TextComponent.of(option, TextColor.GREEN)
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, cmd))
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(option))));
.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, cmd))
.hoverEvent(HoverEvent.of(HoverEvent.Action.SHOW_TEXT, TextComponent.of(option))));
}
producer.newline();
producer.newline().append(TextComponent.of("<> [View]", TextColor.DARK_AQUA)

Datei anzeigen

@ -36,8 +36,7 @@ public class PlotLoader {
() -> autoClaimFromDatabase(player, area, plot.getId(), whenDone));
}
public void load(Actor actor, CFISettings settings,
Function<File, Boolean> createTask) throws IOException {
public void load(Actor actor, CFISettings settings, Function<File, Boolean> createTask) throws IOException {
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) {
SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager;

Datei anzeigen

@ -80,6 +80,8 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
protected final DifferentialArray<char[]> floor;
protected final DifferentialArray<char[]> main;
protected DifferentialArray<char[]> overlay;
protected Metadatable metaData = new Metadatable();
protected TextureUtil textureUtil;
protected final CFIPrimitives primitives = new CFIPrimitives();
private CFIPrimitives oldPrimitives = new CFIPrimitives();
@ -115,10 +117,6 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
}
}
protected Metadatable metaData = new Metadatable();
protected TextureUtil textureUtil;
@Override
public void flushChanges(FaweOutputStream out) throws IOException {
heights.flushChanges(out);
@ -301,19 +299,17 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
for (int chunkZ = scz; chunkZ <= ecz; chunkZ++) {
for (int chunkX = scx; chunkX <= ecx; chunkX++) {
refreshChunk(world, chunkX, chunkZ);
}
}
}
}
public void refreshChunk(World world, int chunkX, int chunkZ) {
Supplier<IBlocks> blocksSupplier = () -> getChunk(chunkX, chunkZ);
int realChunkX = chunkX + chunkOffset.getBlockX();
int realChunkZ = chunkZ + chunkOffset.getBlockZ();
ChunkPacket packet = new ChunkPacket(realChunkX, realChunkZ, blocksSupplier, true);
world.sendFakeChunk(player, packet);
}

Datei anzeigen

@ -18,6 +18,8 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArraySet;
import it.unimi.dsi.fastutil.longs.LongArrayList;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;

Datei anzeigen

@ -716,6 +716,9 @@ public class LocalSession implements TextureHolder {
VirtualWorld tmp;
synchronized (dirty) {
tmp = this.virtual;
if (tmp == world) {
return;
}
this.virtual = world;
}
if (tmp != null) {

Datei anzeigen

@ -29,12 +29,14 @@ import static com.sk89q.worldedit.regions.Regions.asFlatRegion;
import static com.sk89q.worldedit.regions.Regions.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.implementation.processors.ChunkSendProcessor;
import com.boydti.fawe.beta.implementation.processors.NullProcessor;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.util.TextureUtil;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession;
@ -79,11 +81,14 @@ import com.sk89q.worldedit.util.formatting.text.serializer.legacy.LegacyComponen
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Stream;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
@ -150,13 +155,7 @@ public class RegionCommands {
)
@CommandPermissions("worldedit.region.test")
@Logging(REGION)
public void test(Player player, @Arg(desc = "hello there") String message) throws WorldEditException {
TextComponent test = LegacyComponentSerializer.legacy().deserialize(message, '&');
player.print(message);
player.print(test);
test = test.hoverEvent(HoverEvent.showText(TextComponent.of("Blah")));
player.print(test);
public void test(Player player, @Arg(desc = "hello there")BlockType type) throws WorldEditException {
}
@Command(

Datei anzeigen

@ -748,11 +748,9 @@ public final class PlatformCommandManager {
worldEdit.flushBlockBag(actor, editSession);
}
Optional<CFICommands.CFISettings> cfiOpt = context.injectedValue(Key.of(CFICommands.CFISettings.class));
if (cfiOpt.isPresent()) {
CFICommands.CFISettings settings = cfiOpt.get();
HeightMapMCAGenerator gen = settings.getGenerator();
CFICommands.CFISettings cfi = actor.getMeta("CFISettings");
if (cfi != null) {
HeightMapMCAGenerator gen = cfi.getGenerator();
if (gen != null && gen.isModified()) {
try {
gen.update();

Datei anzeigen

@ -56,6 +56,7 @@ public class PlayerProxy extends AbstractPlayerActor {
}
public PlayerProxy(Player basePlayer, Actor permActor, Actor cuiActor, World world) {
super(basePlayer.getRawMeta());
checkNotNull(basePlayer);
checkNotNull(permActor);
checkNotNull(cuiActor);