New debugging to generate less console messages.

Dieser Commit ist enthalten in:
MattBDev 2020-01-03 12:30:46 -05:00
Ursprung fc4847745b
Commit dfa3f457d6
3 geänderte Dateien mit 37 neuen und 37 gelöschten Zeilen

Datei anzeigen

@ -104,10 +104,15 @@ public abstract class CharBlocks implements IBlocks {
}
public void set(int x, int y, int z, char value) {
Fawe.imp().debug("Setting Block at x:" + x + ", y:" + y + " , z:" + z);
final int layer = y >> 4;
final int index = (y & 15) << 8 | z << 4 | x;
set(layer, index, value);
try {
set(layer, index, value);
} catch (ArrayIndexOutOfBoundsException exception) {
Fawe.imp().debug("Tried Setting Block at x:" + x + ", y:" + y + " , z:" + z);
Fawe.imp().debug("Layer variable was = " + layer);
exception.printStackTrace();
}
}
/*
@ -118,7 +123,7 @@ public abstract class CharBlocks implements IBlocks {
return sections[layer].get(this, layer, index);
}
public final void set(@Range(from = 0, to = 15) int layer, int index, char value) {
public final void set(@Range(from = 0, to = 15) int layer, int index, char value) throws ArrayIndexOutOfBoundsException {
sections[layer].set(this, layer, index, value);
}

Datei anzeigen

@ -18,6 +18,7 @@
*/
package com.sk89q.worldedit.command;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.sk89q.worldedit.command.util.Logging.LogMode.ALL;
import static com.sk89q.worldedit.command.util.Logging.LogMode.PLACEMENT;
import static com.sk89q.worldedit.command.util.Logging.LogMode.POSITION;
@ -25,7 +26,6 @@ import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgum
import com.boydti.fawe.Fawe;
import com.boydti.fawe.config.Caption;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.boydti.fawe.util.MainUtil;
import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.TextureUtil;
@ -41,8 +41,6 @@ import com.sk89q.worldedit.command.util.annotation.Confirm;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.function.generator.CavesGen;
import java.util.List;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.function.operation.Operations;
import com.sk89q.worldedit.function.pattern.Pattern;
@ -53,23 +51,21 @@ import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.TreeGenerator.TreeType;
import com.sk89q.worldedit.util.formatting.text.TextComponent;
import com.sk89q.worldedit.util.formatting.text.TranslatableComponent;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockType;
import java.awt.RenderingHints;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.Switch;
import static com.google.common.base.Preconditions.checkNotNull;
import org.jetbrains.annotations.Range;
/**
@ -98,17 +94,17 @@ public class GenerationCommands {
@Logging(PLACEMENT)
@Confirm(Confirm.Processor.REGION)
public void caves(Actor actor, LocalSession session, EditSession editSession, @Selection Region region,
@Arg(name = "size", desc = "TODO", def = "8") int sizeOpt,
@Arg(name = "frequency", desc = "TODO", def = "40") int frequencyOpt,
@Arg(name = "rarity", desc = "TODO", def = "7") int rarityOpt,
@Arg(name = "minY", desc = "TODO", def = "8") int minYOpt,
@Arg(name = "maxY", desc = "TODO", def = "127") int maxYOpt,
@Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequencyOpt,
@Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarityOpt,
@Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChanceOpt,
@Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMinOpt,
@Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMaxOpt) throws WorldEditException {
CavesGen gen = new CavesGen(sizeOpt, frequencyOpt, rarityOpt, minYOpt, maxYOpt, systemFrequencyOpt, individualRarityOpt, pocketChanceOpt, pocketMinOpt, pocketMaxOpt);
@Arg(name = "size", desc = "TODO", def = "8") int size,
@Arg(name = "frequency", desc = "TODO", def = "40") int frequency,
@Arg(name = "rarity", desc = "TODO", def = "7") int rarity,
@Arg(name = "minY", desc = "TODO", def = "8") int minY,
@Arg(name = "maxY", desc = "TODO", def = "127") int maxY,
@Arg(name = "systemFrequency", desc = "TODO", def = "1") int systemFrequency,
@Arg(name = "individualRarity", desc = "TODO", def = "25") int individualRarity,
@Arg(name = "pocketChance", desc = "TODO", def = "0") int pocketChance,
@Arg(name = "pocketMin", desc = "TODO", def = "0") int pocketMin,
@Arg(name = "pocketMax", desc = "TODO", def = "3") int pocketMax) throws WorldEditException {
CavesGen gen = new CavesGen(size, frequency, rarity, minY, maxY, systemFrequency, individualRarity, pocketChance, pocketMin, pocketMax);
editSession.generate(region, gen);
actor.print(Caption.of("fawe.worldedit.visitor.visitor.block" , editSession.getBlockChangeCount()));
}

Datei anzeigen

@ -1,5 +1,7 @@
package com.sk89q.worldedit.command;
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
import com.boydti.fawe.Fawe;
import com.boydti.fawe.FaweAPI;
import com.boydti.fawe.config.Caption;
@ -37,14 +39,6 @@ import com.sk89q.worldedit.util.formatting.text.event.ClickEvent;
import com.sk89q.worldedit.util.formatting.text.event.HoverEvent;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockState;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import org.jetbrains.annotations.Range;
import javax.annotation.Nullable;
import java.io.File;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
@ -54,8 +48,14 @@ import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.LongAdder;
import java.util.function.Supplier;
import static com.sk89q.worldedit.internal.command.CommandUtil.checkCommandArgument;
import javax.annotation.Nullable;
import org.enginehub.piston.annotation.Command;
import org.enginehub.piston.annotation.CommandContainer;
import org.enginehub.piston.annotation.param.Arg;
import org.enginehub.piston.annotation.param.ArgFlag;
import org.enginehub.piston.annotation.param.Switch;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Range;
@CommandContainer(superTypes = CommandPermissionsConditionGenerator.Registration.class)
public class HistorySubCommands {
@ -79,7 +79,7 @@ public class HistorySubCommands {
@AllowedRegion Region[] allowedRegions,
@ArgFlag(name = 'u', desc = "String user", def="me") UUID other,
@ArgFlag(name = 'r', def = "0", desc = "radius")
@Range(from = 0, to=Integer.MAX_VALUE) int radius,
@Range(from = 0, to = Integer.MAX_VALUE) int radius,
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0")
@Time long timeDiff) throws WorldEditException {
rollback(player, world, database, allowedRegions, other, radius, timeDiff, true);
@ -96,7 +96,7 @@ public class HistorySubCommands {
@AllowedRegion Region[] allowedRegions,
@ArgFlag(name = 'u', desc = "String user", def = "") UUID other,
@ArgFlag(name = 'r', def = "0", desc = "radius")
@Range(from = 0, to=Integer.MAX_VALUE) int radius,
@Range(from = 0, to = Integer.MAX_VALUE) int radius,
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0") @Time long timeDiff,
@Switch(name = 'f', desc = "Restore instead of rollback") boolean restore) throws WorldEditException {
if (!Settings.IMP.HISTORY.USE_DATABASE) {
@ -277,8 +277,7 @@ public class HistorySubCommands {
@CommandPermissions("worldedit.history.find")
public synchronized void find(Player player, World world, RollbackDatabase database, Arguments arguments,
@ArgFlag(name = 'u', desc = "String user") UUID other,
@ArgFlag(name = 'r', def = "0", desc = "radius")
@Range(from = 0, to=Integer.MAX_VALUE) int radius,
@ArgFlag(name = 'r', def = "0", desc = "radius") int radius,
@ArgFlag(name = 't', desc = "Time e.g. 20s", def = "0")
@Time long timeDiff,
@ArgFlag(name = 'p', desc = "Page to view.", def = "1") int page) throws WorldEditException {
@ -318,7 +317,7 @@ public class HistorySubCommands {
}
PaginationBox pages = PaginationBox.fromStrings("Edits:", pageCommand, list, new Function<Supplier<RollbackOptimizedHistory>, Component>() {
@Nullable
@NotNull
@Override
public Component apply(@Nullable Supplier<RollbackOptimizedHistory> input) {
RollbackOptimizedHistory edit = input.get();