Merge branch 'master' into 1.17

This commit is contained in:
gnembon committed 2021-05-25 17:25:55 -03:00
commit b96a1b1216
23 files changed
+111 -81

No files matched your search

+1 -3
View File
@@ -117,9 +117,7 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
scriptServer.tick();
//in case something happens
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.currentTelepotingEntityBox = null;
CarpetSettings.fixedPosition = null;
CarpetSettings.impendingFillSkipUpdates.set(false);
extensions.forEach(e -> e.onTick(server));
}
+5 -4
View File
@@ -45,10 +45,8 @@ public class CarpetSettings
{
public static final String carpetVersion = "1.4.37+v210519";
public static final Logger LOG = LogManager.getLogger("carpet");
public static boolean skipGenerationChecks = false;
public static boolean impendingFillSkipUpdates = false;
public static Box currentTelepotingEntityBox = null;
public static Vec3d fixedPosition = null;
public static ThreadLocal<Boolean> skipGenerationChecks = ThreadLocal.withInitial(() -> false);
public static ThreadLocal<Boolean> impendingFillSkipUpdates = ThreadLocal.withInitial(() -> false);
public static int runPermissionLevel = 2;
public static boolean doChainStone = false;
public static boolean chainStoneStickToAll = false;
@@ -473,6 +471,9 @@ public class CarpetSettings
@Rule(desc = "Enables /player command to control/spawn players", category = COMMAND)
public static String commandPlayer = "ops";
@Rule(desc = "Spawn offline players in online mode if online-mode player with specified name does not exist", category = COMMAND)
public static boolean allowSpawningOfflinePlayers = true;
@Rule(desc = "Allows to track mobs AI via /track command", category = COMMAND)
public static String commandTrackAI = "ops";
@@ -224,7 +224,7 @@ public class DrawCommand
continue;
}
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);
for (int xmod = -1; xmod < 2; xmod += 2)
{
for (int ymod = -1; ymod < 2; ymod += 2)
@@ -238,7 +238,7 @@ public class DrawCommand
}
}
}
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
}
}
}
@@ -274,7 +274,7 @@ public class DrawCommand
ServerWorld world = source.getWorld();
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);
for (int r = 0; r < radius; ++r)
{
@@ -290,7 +290,7 @@ public class DrawCommand
}
}
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
if (CarpetSettings.fillUpdates)
{
@@ -377,7 +377,7 @@ public class DrawCommand
ServerWorld world = source.getWorld();
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);
boolean isSquare = base.equalsIgnoreCase("square");
@@ -387,7 +387,7 @@ public class DrawCommand
affected+= fillFlat(world, pos, i, r, isSquare, orientation, block, replacement, list, mbpos);
}
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
if (CarpetSettings.fillUpdates) {
@@ -429,7 +429,7 @@ public class DrawCommand
ServerWorld world = source.getWorld();
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);
boolean isSquare = base.equalsIgnoreCase("square");
@@ -438,7 +438,7 @@ public class DrawCommand
affected+= fillFlat(world, pos, i, radius, isSquare, orientation, block, replacement, list, mbpos);
}
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
if (CarpetSettings.fillUpdates) {
@@ -192,9 +192,14 @@ public class PlayerCommand
GameProfile profile = server.getUserCache().findByName(playerName);
if (profile == null)
{
Messenger.m(context.getSource(), "r Player "+playerName+" is either banned by Mojang, or auth servers are down. " +
"Banned players can only be summoned in Singleplayer and in servers in off-line mode.");
return true;
if (!CarpetSettings.allowSpawningOfflinePlayers)
{
Messenger.m(context.getSource(), "r Player "+playerName+" is either banned by Mojang, or auth servers are down. " +
"Banned players can only be summoned in Singleplayer and in servers in off-line mode.");
return true;
} else {
profile = new GameProfile(PlayerEntity.getOfflinePlayerUuid(playerName), playerName);
}
}
if (manager.getUserBanList().contains(profile))
{
@@ -508,7 +508,7 @@ public class ScriptCommand
return 1;
}
int successCount = 0;
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);
try
{
for (int x = area.getMinX(); x <= area.getMaxX(); x++)
@@ -535,7 +535,7 @@ public class ScriptCommand
}
finally
{
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
}
Messenger.m(source, "w Expression successful in " + successCount + " out of " + int_1 + " blocks");
return successCount;
@@ -618,7 +618,7 @@ public class ScriptCommand
}
int affected = 0;
CarpetSettings.impendingFillSkipUpdates = !CarpetSettings.fillUpdates;
CarpetSettings.impendingFillSkipUpdates.set(!CarpetSettings.fillUpdates);
for (int x = 0; x <= maxx; x++)
{
for (int y = 0; y <= maxy; y++)
@@ -643,7 +643,7 @@ public class ScriptCommand
}
}
}
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
if (CarpetSettings.fillUpdates && block != null)
{
@@ -53,9 +53,9 @@ public class BlockRotator
{
return false;
}
CarpetSettings.impendingFillSkipUpdates = true;
CarpetSettings.impendingFillSkipUpdates.set(true);
boolean retval = flip_block(state, world, player, hand, hit);
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
return retval;
}
@@ -61,14 +61,14 @@ public class FeatureGenerator
ConfiguredFeature<?, ?> feature = world.getRegistryManager().get(Registry.CONFIGURED_FEATURE_KEY).get(id);
if (feature != null)
{
CarpetSettings.skipGenerationChecks = true;
CarpetSettings.skipGenerationChecks.set(true);
try
{
return feature.generate(world, world.getChunkManager().getChunkGenerator(), world.random, pos);
}
finally
{
CarpetSettings.skipGenerationChecks = false;
CarpetSettings.skipGenerationChecks.set(false);
}
}
return null;
@@ -99,14 +99,14 @@ public class FeatureGenerator
private static Thing simplePlop(ConfiguredFeature feature)
{
return (w, p) -> {
CarpetSettings.skipGenerationChecks=true;
CarpetSettings.skipGenerationChecks.set(true);
try
{
return feature.generate(w, w.getChunkManager().getChunkGenerator(), w.random, p);
}
finally
{
CarpetSettings.skipGenerationChecks = false;
CarpetSettings.skipGenerationChecks.set(false);
}
};
}
@@ -20,7 +20,7 @@ public class BlockStateArgument_fillUpdatesMixin
))
private BlockState postProcessStateProxy(BlockState state, WorldAccess serverWorld, BlockPos blockPos)
{
if (CarpetSettings.impendingFillSkipUpdates)
if (CarpetSettings.impendingFillSkipUpdates.get())
{
return state;
}
+1 -1
View File
@@ -16,6 +16,6 @@ public abstract class ChunkMixin
at =@At("HEAD"), cancellable = true)
private void squashWarnings(BlockPos blockPos_1, CallbackInfo ci)
{
if (CarpetSettings.skipGenerationChecks) ci.cancel();
if (CarpetSettings.skipGenerationChecks.get()) ci.cancel();
}
}
@@ -11,9 +11,9 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(ChunkRegion.class)
public class ChunkRegion_scarpetPlopMixin
{
@Inject(method = "markBlockForPostProcessing", at = @At("HEAD"))
@Inject(method = "markBlockForPostProcessing", at = @At("HEAD"), cancellable = true)
private void markOrNot(BlockPos blockPos, CallbackInfo ci)
{
if (CarpetSettings.skipGenerationChecks) ci.cancel();
if (CarpetSettings.skipGenerationChecks.get()) ci.cancel();
}
}
@@ -33,13 +33,13 @@ public abstract class CommandManagerMixin
private void onExecuteBegin(ServerCommandSource serverCommandSource_1, String string_1, CallbackInfoReturnable<Integer> cir)
{
if (!CarpetSettings.fillUpdates)
CarpetSettings.impendingFillSkipUpdates = true;
CarpetSettings.impendingFillSkipUpdates.set(true);
}
@Inject(method = "execute", at = @At("RETURN"))
private void onExecuteEnd(ServerCommandSource serverCommandSource_1, String string_1, CallbackInfoReturnable<Integer> cir)
{
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
}
@SuppressWarnings("UnresolvedMixinReference")
@@ -21,7 +21,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
private void beforeBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci)
{
if (!CarpetSettings.interactionUpdates)
CarpetSettings.impendingFillSkipUpdates = true;
CarpetSettings.impendingFillSkipUpdates.set(true);
}
@Inject(method = "onPlayerInteractBlock", at = @At(
@@ -32,7 +32,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
private void afterBlockInteracted(PlayerInteractBlockC2SPacket playerInteractBlockC2SPacket_1, CallbackInfo ci)
{
if (!CarpetSettings.interactionUpdates)
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
}
@Inject(method = "onPlayerInteractItem", at = @At(
@@ -43,7 +43,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
private void beforeItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci)
{
if (!CarpetSettings.interactionUpdates)
CarpetSettings.impendingFillSkipUpdates = true;
CarpetSettings.impendingFillSkipUpdates.set(true);
}
@Inject(method = "onPlayerInteractItem", at = @At(
@@ -54,7 +54,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
private void afterItemInteracted(PlayerInteractItemC2SPacket packet, CallbackInfo ci)
{
if (!CarpetSettings.interactionUpdates)
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
}
@Inject(method = "onPlayerAction", at = @At(
value = "INVOKE",
@@ -64,7 +64,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
private void beforeBlockBroken(PlayerActionC2SPacket packet, CallbackInfo ci)
{
if (!CarpetSettings.interactionUpdates)
CarpetSettings.impendingFillSkipUpdates = true;
CarpetSettings.impendingFillSkipUpdates.set(true);
}
@Inject(method = "onPlayerAction", at = @At(
@@ -75,7 +75,7 @@ public class ServerPlayNetworkHandler_interactionUpdatesMixin
private void afterBlockBroken(PlayerActionC2SPacket packet, CallbackInfo ci)
{
if (!CarpetSettings.interactionUpdates)
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
}
}
@@ -22,14 +22,14 @@ public abstract class StructureBlockBlockEntity_fillUpdatesMixin
private boolean onStructurePlacen(Structure structure, ServerWorldAccess serverWorldAccess, BlockPos pos, BlockPos blockPos, StructurePlacementData placementData, Random random, int i)
{
if(!CarpetSettings.fillUpdates)
CarpetSettings.impendingFillSkipUpdates = true;
CarpetSettings.impendingFillSkipUpdates.set(true);
try
{
return structure.place(serverWorldAccess, pos, blockPos, placementData, random, i); // serverWorldAccess, pos, placementData, random);
}
finally
{
CarpetSettings.impendingFillSkipUpdates = false;
CarpetSettings.impendingFillSkipUpdates.set(false);
}
}
}
@@ -36,7 +36,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
{
if (world.isClient())
return false;
CarpetSettings.skipGenerationChecks = true;
CarpetSettings.skipGenerationChecks.set(true);
try
{
Random rand = new Random(world.getRandom().nextInt());
@@ -80,7 +80,7 @@ public abstract class StructureFeatureMixin<C extends FeatureConfig> implements
}
finally
{
CarpetSettings.skipGenerationChecks = false;
CarpetSettings.skipGenerationChecks.set(false);
}
return true;
}
@@ -17,6 +17,6 @@ public class StructurePiece_scarpetPlopMixin
))
private void markOrNot(Chunk chunk, BlockPos pos)
{
if (!CarpetSettings.skipGenerationChecks) chunk.markBlockForPostProcessing(pos);
if (!CarpetSettings.skipGenerationChecks.get()) chunk.markBlockForPostProcessing(pos);
}
}
@@ -19,7 +19,7 @@ public class Structure_fillUpdatesMixin
))
private void skipUpdateNeighbours(ServerWorldAccess serverWorldAccess, BlockPos pos, Block block)
{
if (!CarpetSettings.impendingFillSkipUpdates)
if (!CarpetSettings.impendingFillSkipUpdates.get())
serverWorldAccess.updateNeighbors(pos, block);
}
@@ -29,6 +29,6 @@ public class Structure_fillUpdatesMixin
))
private boolean skipPostprocess(StructurePlacementData structurePlacementData)
{
return structurePlacementData.shouldUpdateNeighbors() || CarpetSettings.impendingFillSkipUpdates;
return structurePlacementData.shouldUpdateNeighbors() || CarpetSettings.impendingFillSkipUpdates.get();
}
}
@@ -19,7 +19,7 @@ public class WorldChunk_fillUpdatesMixin
))
private void onAdded(BlockState blockState, World world_1, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1)
{
if (!CarpetSettings.impendingFillSkipUpdates)
if (!CarpetSettings.impendingFillSkipUpdates.get())
blockState.onBlockAdded(world_1, blockPos_1, blockState_1, boolean_1);
}
@@ -29,7 +29,7 @@ public class WorldChunk_fillUpdatesMixin
))
private void onRemovedBlock(BlockState blockState, World world, BlockPos pos, BlockState state, boolean moved)
{
if (CarpetSettings.impendingFillSkipUpdates) // doing due dilligence from AbstractBlock onStateReplaced
if (CarpetSettings.impendingFillSkipUpdates.get()) // doing due dilligence from AbstractBlock onStateReplaced
{
if (blockState.hasBlockEntity() && !blockState.isOf(state.getBlock()))
{
@@ -16,7 +16,7 @@ public abstract class World_fillUpdatesMixin
@ModifyConstant(method = "setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;II)Z", //setBlockState main
constant = @Constant(intValue = 16))
private int addFillUpdatesInt(int original) {
if (CarpetSettings.impendingFillSkipUpdates)
if (CarpetSettings.impendingFillSkipUpdates.get())
return -1;
return original;
}
@@ -27,7 +27,7 @@ public abstract class World_fillUpdatesMixin
))
private void updateNeighborsMaybe(World world, BlockPos blockPos, Block block)
{
if (!CarpetSettings.impendingFillSkipUpdates) world.updateNeighbors(blockPos, block);
if (!CarpetSettings.impendingFillSkipUpdates.get()) world.updateNeighbors(blockPos, block);
}
}
@@ -18,7 +18,7 @@ public class World_scarpetPlopMixin
))
private int fixSampleHeightmap(WorldChunk chunk, Heightmap.Type type, int x, int z)
{
if (CarpetSettings.skipGenerationChecks)
if (CarpetSettings.skipGenerationChecks.get())
{
Heightmap.Type newType = type;
if (type == Heightmap.Type.OCEAN_FLOOR_WG) newType = Heightmap.Type.OCEAN_FLOOR;
@@ -1,5 +1,6 @@
package carpet.patches;
import carpet.CarpetSettings;
import com.mojang.authlib.GameProfile;
import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.entity.Entity;
@@ -22,7 +23,6 @@ import net.minecraft.util.UserCache;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.GameMode;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import carpet.fakes.ServerPlayerEntityInterface;
import carpet.utils.Messenger;
@@ -44,7 +44,15 @@ public class EntityPlayerMPFake extends ServerPlayerEntity
finally {
UserCache.setUseRemote(server.isDedicated() && server.isOnlineMode());
}
if (gameprofile == null) return null;
if (gameprofile == null)
{
if (!CarpetSettings.allowSpawningOfflinePlayers)
{
return null;
} else {
gameprofile = new GameProfile(PlayerEntity.getOfflinePlayerUuid(username), username);
}
}
if (gameprofile.getProperties().containsKey("textures"))
{
gameprofile = SkullBlockEntity.loadProperties(gameprofile);
@@ -8,6 +8,7 @@ import java.util.Iterator;
import org.apache.commons.lang3.NotImplementedException;
import carpet.script.CarpetContext;
import carpet.script.Context;
import carpet.script.argument.Argument;
import carpet.script.argument.BlockArgument;
@@ -17,6 +18,8 @@ import carpet.script.bundled.Module;
import carpet.script.value.BlockValue;
import carpet.script.value.FunctionValue;
import carpet.script.value.Value;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
@@ -25,20 +28,18 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
* <p>Class that holds annotation for {@link Argument} locators to be used in Scarpet functions.</p>
*
* <p>Note: Nothing in this class has been implemented at this point in time, since it requires Carpet changes. There is an implementation for
* Locator.Block working, but not implemented.</p>
* <p>Note: Only {@link Block} locator is currently implemented.</p>
*/
public interface Locator
{
/**
* <p>Represents that the annotated argument must be gotten by passing the arguments in there into a {@link BlockArgument} locator.</p>
*
* <p>Must be used in either {@link BlockValue} or {@link BlockArgument} parameters</p>
* <p>Must be used in either {@link BlockArgument}, {@link BlockValue}, {@link BlockPos} or {@link BlockState} parameters</p>
*/
@Documented
@Retention(RUNTIME)
@Target({ PARAMETER, TYPE_USE })
@Deprecated // Not implemented, although implementation available
public @interface Block
{
/**
@@ -140,7 +141,7 @@ public interface Locator
private static class BlockLocator<R> extends AbstractLocator<R>
{
private final boolean returnBlockValue;
private final java.util.function.Function<BlockArgument, R> returnFunction;
private final boolean acceptString;
private final boolean anyString;
private final boolean optional;
@@ -150,11 +151,24 @@ public interface Locator
this.acceptString = annotation.acceptString();
this.anyString = annotation.anyString();
this.optional = annotation.optional();
this.returnBlockValue = type == BlockValue.class;
if (returnBlockValue && (anyString || optional))
if (type != BlockArgument.class && (anyString || optional))
throw new IllegalArgumentException("Can only use anyString or optional parameters of Locator.Block if targeting a BlockArgument");
if (!returnBlockValue && type != BlockArgument.class)
throw new IllegalArgumentException("Locator.Block can only be used against BlockArgument or BlockValue types!");
this.returnFunction = getReturnFunction(type);
if (returnFunction == null)
throw new IllegalArgumentException("Locator.Block can only be used against BlockArgument, BlockValue, BlockPos or BlockState types!");
}
@SuppressWarnings("unchecked")
private static <R> java.util.function.Function<BlockArgument, R> getReturnFunction(Class<R> type) {
if (type == BlockArgument.class)
return r -> (R) r;
if (type == BlockValue.class)
return r -> (R) r.block;
if (type == BlockPos.class)
return r -> (R) r.block.getPos();
if (type == BlockState.class)
return r -> (R) r.block.getBlockState();
return null;
}
@Override
@@ -166,10 +180,8 @@ public interface Locator
@Override
public R checkAndConvert(Iterator<Value> valueIterator, Context context, Context.Type theLazyT)
{
BlockArgument locator = null; // BlockArgument.findIn((CarpetContext)context, valueIterator (requires changing to Value), 0,
// acceptString, optional, anyString);
// return (R) (returnBlockValue ? locator.block : locator);
throw new NotImplementedException("Locator.Block still requires adapting BlockArgument to accept iterators (which is actually simple)");
BlockArgument locator = BlockArgument.findIn((CarpetContext) context, valueIterator, 0, acceptString, optional, anyString);
return returnFunction.apply(locator);
}
}
@@ -689,19 +689,19 @@ public class WorldAccess {
// lazy cause its parked execution
expression.addLazyFunction("without_updates", 1, (c, t, lv) ->
{
boolean previous = CarpetSettings.impendingFillSkipUpdates;
boolean previous = CarpetSettings.impendingFillSkipUpdates.get();
if (previous) return lv.get(0);
Value [] result = new Value[]{Value.NULL};
((CarpetContext)c).s.getMinecraftServer().submitAndJoin( () ->
{
try
{
CarpetSettings.impendingFillSkipUpdates = true;
CarpetSettings.impendingFillSkipUpdates.set(true);
result[0] = lv.get(0).evalValue(c, t);
}
finally
{
CarpetSettings.impendingFillSkipUpdates = previous;
CarpetSettings.impendingFillSkipUpdates.set(previous);
}
});
return (cc, tt) -> result[0];
@@ -1,7 +1,6 @@
package carpet.script.argument;
import carpet.script.CarpetContext;
import carpet.script.LazyValue;
import carpet.script.exception.InternalExpressionException;
import carpet.script.value.BlockValue;
import carpet.script.value.ListValue;
@@ -11,7 +10,9 @@ import carpet.script.value.StringValue;
import carpet.script.value.Value;
import net.minecraft.util.math.BlockPos;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
public class BlockArgument extends Argument
{
@@ -41,26 +42,31 @@ public class BlockArgument extends Argument
}
public static BlockArgument findIn(CarpetContext c, List<Value> params, int offset, boolean acceptString, boolean optional, boolean anyString)
{
return findIn(c, params.listIterator(offset), offset, acceptString, optional, anyString);
}
public static BlockArgument findIn(CarpetContext c, Iterator<Value> params, int offset, boolean acceptString, boolean optional, boolean anyString)
{
try
{
Value v1 = params.get(0 + offset);
Value v1 = params.next();
//add conditional from string name
if (optional && v1 instanceof NullValue)
{
return new BlockArgument(null, 1+offset);
return new BlockArgument(null, 1 + offset);
}
if (anyString && v1 instanceof StringValue)
{
return new BlockArgument(null, 1+offset, v1.getString());
return new BlockArgument(null, 1 + offset, v1.getString());
}
if (acceptString && v1 instanceof StringValue)
{
return new BlockArgument(BlockValue.fromString(v1.getString()), 1+offset);
return new BlockArgument(BlockValue.fromString(v1.getString()), 1 + offset);
}
if (v1 instanceof BlockValue)
{
return new BlockArgument(((BlockValue) v1), 1+offset);
return new BlockArgument(((BlockValue) v1), 1 + offset);
}
if (v1 instanceof ListValue)
{
@@ -74,21 +80,21 @@ public class BlockArgument extends Argument
c.s.getWorld(),
new BlockPos(c.origin.getX() + xpos, c.origin.getY() + ypos, c.origin.getZ() + zpos)
),
1+offset);
1 + offset);
}
int xpos = (int) NumericValue.asNumber(v1).getLong();
int ypos = (int) NumericValue.asNumber( params.get(1 + offset)).getLong();
int zpos = (int) NumericValue.asNumber( params.get(2 + offset)).getLong();
int ypos = (int) NumericValue.asNumber( params.next()).getLong();
int zpos = (int) NumericValue.asNumber( params.next()).getLong();
return new BlockArgument(
new BlockValue(
null,
c.s.getWorld(),
new BlockPos(c.origin.getX() + xpos, c.origin.getY() + ypos, c.origin.getZ() + zpos)
),
3+offset
3 + offset
);
}
catch (IndexOutOfBoundsException e)
catch (IndexOutOfBoundsException | NoSuchElementException e)
{
throw handleError(optional, acceptString);
}