Fix CFI generation

This commit is contained in:
Jesse Boyd 2019-11-08 22:30:39 +00:00
parent 26f073faa2
commit d61dac5aa5
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
10 changed files with 106 additions and 107 deletions

View File

@ -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

View File

@ -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;

View File

@ -156,7 +156,6 @@ public class CFICommands {
settings.setGenerator(generator).bind();
generator.setImageViewer(Fawe.imp().getImageViewer(player));
generator.update();
settings.bind();
mainMenu(player);
}
@ -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 {

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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) {

View File

@ -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(

View File

@ -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();

View File

@ -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);