added in_dimension to the API
This commit is contained in:
1 parent
7e2a001be5
commit
8b7e9143da
4 files changed
+66
-18
No files matched your search
@@ -12,6 +12,7 @@ import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -32,7 +33,7 @@ public class BlockValue extends Value
|
||||
public static final BlockValue NULL = new BlockValue(null, null, null);
|
||||
private BlockState blockState;
|
||||
private BlockPos pos;
|
||||
private World world;
|
||||
private ServerWorld world;
|
||||
private CompoundTag data;
|
||||
|
||||
public static BlockValue fromCoords(CarpetContext c, int x, int y, int z)
|
||||
@@ -212,7 +213,7 @@ public class BlockValue extends Value
|
||||
}
|
||||
|
||||
|
||||
public BlockValue(BlockState state, World world, BlockPos position)
|
||||
public BlockValue(BlockState state, ServerWorld world, BlockPos position)
|
||||
{
|
||||
this.world = world;
|
||||
blockState = state;
|
||||
@@ -220,7 +221,7 @@ public class BlockValue extends Value
|
||||
data = null;
|
||||
}
|
||||
|
||||
public BlockValue(BlockState state, World world, BlockPos position, CompoundTag nbt)
|
||||
public BlockValue(BlockState state, ServerWorld world, BlockPos position, CompoundTag nbt)
|
||||
{
|
||||
this.world = world;
|
||||
blockState = state;
|
||||
@@ -258,6 +259,8 @@ public class BlockValue extends Value
|
||||
return pos;
|
||||
}
|
||||
|
||||
public ServerWorld getWorld() { return world;}
|
||||
|
||||
|
||||
public static class LocatorResult
|
||||
{
|
||||
|
||||
@@ -7,12 +7,10 @@ import carpet.helpers.Tracer;
|
||||
import carpet.script.CarpetContext;
|
||||
import carpet.script.Fluff;
|
||||
import carpet.script.exception.InternalExpressionException;
|
||||
import carpet.settings.CarpetSettings;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.client.network.packet.EntityPassengersSetS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityPositionS2CPacket;
|
||||
import net.minecraft.client.network.packet.EntityVelocityUpdateS2CPacket;
|
||||
import net.minecraft.command.EntitySelector;
|
||||
import net.minecraft.command.EntitySelectorReader;
|
||||
import net.minecraft.command.arguments.NbtPathArgumentType;
|
||||
@@ -234,7 +232,7 @@ public class EntityValue extends Value
|
||||
put("home", (e, a) -> {
|
||||
if (e instanceof MobEntity)
|
||||
{
|
||||
return (((MobEntity) e).getWalkTargetRange () > 0)?new BlockValue(null, e.getEntityWorld(), ((MobEntityWithAi) e).getWalkTarget()):Value.FALSE;
|
||||
return (((MobEntity) e).getWalkTargetRange () > 0)?new BlockValue(null, (ServerWorld) e.getEntityWorld(), ((MobEntityWithAi) e).getWalkTarget()):Value.FALSE;
|
||||
}
|
||||
return Value.NULL;
|
||||
});
|
||||
@@ -379,7 +377,7 @@ public class EntityValue extends Value
|
||||
switch (hitres.getType())
|
||||
{
|
||||
case MISS: return Value.NULL;
|
||||
case BLOCK: return new BlockValue(null, e.getEntityWorld(), ((BlockHitResult)hitres).getBlockPos() );
|
||||
case BLOCK: return new BlockValue(null, (ServerWorld) e.getEntityWorld(), ((BlockHitResult)hitres).getBlockPos() );
|
||||
case ENTITY: return new EntityValue(((EntityHitResult)hitres).getEntity());
|
||||
}
|
||||
return Value.NULL;
|
||||
|
||||
Reference in new issue
Block a user