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

Datei anzeigen

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

Datei anzeigen

@ -156,7 +156,6 @@ public class CFICommands {
settings.setGenerator(generator).bind(); settings.setGenerator(generator).bind();
generator.setImageViewer(Fawe.imp().getImageViewer(player)); generator.setImageViewer(Fawe.imp().getImageViewer(player));
generator.update(); generator.update();
settings.bind();
mainMenu(player); mainMenu(player);
} }
@ -1119,7 +1118,10 @@ public class CFICommands {
protected static CFISettings getSettings(Player player) { protected static CFISettings getSettings(Player player) {
CFISettings settings = player.getMeta("CFISettings"); 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 { public static class CFISettings {

Datei anzeigen

@ -36,8 +36,7 @@ public class PlotLoader {
() -> autoClaimFromDatabase(player, area, plot.getId(), whenDone)); () -> autoClaimFromDatabase(player, area, plot.getId(), whenDone));
} }
public void load(Actor actor, CFISettings settings, public void load(Actor actor, CFISettings settings, Function<File, Boolean> createTask) throws IOException {
Function<File, Boolean> createTask) throws IOException {
PlotAreaManager manager = PlotSquared.get().getPlotAreaManager(); PlotAreaManager manager = PlotSquared.get().getPlotAreaManager();
if (manager instanceof SinglePlotAreaManager) { if (manager instanceof SinglePlotAreaManager) {
SinglePlotAreaManager sManager = (SinglePlotAreaManager) manager; 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[]> floor;
protected final DifferentialArray<char[]> main; protected final DifferentialArray<char[]> main;
protected DifferentialArray<char[]> overlay; protected DifferentialArray<char[]> overlay;
protected Metadatable metaData = new Metadatable();
protected TextureUtil textureUtil;
protected final CFIPrimitives primitives = new CFIPrimitives(); protected final CFIPrimitives primitives = new CFIPrimitives();
private CFIPrimitives oldPrimitives = 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 @Override
public void flushChanges(FaweOutputStream out) throws IOException { public void flushChanges(FaweOutputStream out) throws IOException {
heights.flushChanges(out); heights.flushChanges(out);
@ -301,19 +299,17 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
for (int chunkZ = scz; chunkZ <= ecz; chunkZ++) { for (int chunkZ = scz; chunkZ <= ecz; chunkZ++) {
for (int chunkX = scx; chunkX <= ecx; chunkX++) { for (int chunkX = scx; chunkX <= ecx; chunkX++) {
refreshChunk(world, chunkX, chunkZ); refreshChunk(world, chunkX, chunkZ);
} }
} }
} }
} }
public void refreshChunk(World world, int chunkX, int chunkZ) { public void refreshChunk(World world, int chunkX, int chunkZ) {
Supplier<IBlocks> blocksSupplier = () -> getChunk(chunkX, chunkZ); Supplier<IBlocks> blocksSupplier = () -> getChunk(chunkX, chunkZ);
int realChunkX = chunkX + chunkOffset.getBlockX(); int realChunkX = chunkX + chunkOffset.getBlockX();
int realChunkZ = chunkZ + chunkOffset.getBlockZ(); int realChunkZ = chunkZ + chunkOffset.getBlockZ();
ChunkPacket packet = new ChunkPacket(realChunkX, realChunkZ, blocksSupplier, true); ChunkPacket packet = new ChunkPacket(realChunkX, realChunkZ, blocksSupplier, true);
world.sendFakeChunk(player, packet); 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.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArraySet; import it.unimi.dsi.fastutil.ints.IntArraySet;
import it.unimi.dsi.fastutil.longs.LongArrayList; import it.unimi.dsi.fastutil.longs.LongArrayList;
import java.awt.Color;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;

Datei anzeigen

@ -716,6 +716,9 @@ public class LocalSession implements TextureHolder {
VirtualWorld tmp; VirtualWorld tmp;
synchronized (dirty) { synchronized (dirty) {
tmp = this.virtual; tmp = this.virtual;
if (tmp == world) {
return;
}
this.virtual = world; this.virtual = world;
} }
if (tmp != null) { 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.maximumBlockY;
import static com.sk89q.worldedit.regions.Regions.minimumBlockY; import static com.sk89q.worldedit.regions.Regions.minimumBlockY;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI; import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.FaweCache; import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.implementation.processors.ChunkSendProcessor; import com.boydti.fawe.beta.implementation.processors.ChunkSendProcessor;
import com.boydti.fawe.beta.implementation.processors.NullProcessor; import com.boydti.fawe.beta.implementation.processors.NullProcessor;
import com.boydti.fawe.config.BBC; import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweLimit; import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.util.TextureUtil;
import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.LocalSession; 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.World;
import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import java.awt.Color;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Stream; import java.util.stream.Stream;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import org.enginehub.piston.annotation.Command; import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer; import org.enginehub.piston.annotation.CommandContainer;
@ -150,13 +155,7 @@ public class RegionCommands {
) )
@CommandPermissions("worldedit.region.test") @CommandPermissions("worldedit.region.test")
@Logging(REGION) @Logging(REGION)
public void test(Player player, @Arg(desc = "hello there") String message) throws WorldEditException { public void test(Player player, @Arg(desc = "hello there")BlockType type) 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);
} }
@Command( @Command(

Datei anzeigen

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

Datei anzeigen

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