inevntories finished
This commit is contained in:
1 parent
4b1a1d41dc
commit
2979924f24
4 files changed
+51
-51
No files matched your search
@@ -8,8 +8,6 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.arguments.BlockArgumentParser;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.AutomaticItemPlacementContext;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
@@ -260,17 +258,17 @@ public class BlockValue extends Value
|
||||
public enum SpecificDirection {
|
||||
UP("up",0.5, 0.0, 0.5, Direction.UP),
|
||||
|
||||
UPNORTH ("upnorth", 0.5, 0.0, 0.4, Direction.UP),
|
||||
UPSOUTH ("upsouth", 0.5, 0.0, 0.6, Direction.UP),
|
||||
UPEAST("upeast", 0.6, 0.0, 0.5, Direction.UP),
|
||||
UPWEST("upwest", 0.4, 0.0, 0.5, Direction.UP),
|
||||
UPNORTH ("up-north", 0.5, 0.0, 0.4, Direction.UP),
|
||||
UPSOUTH ("up-south", 0.5, 0.0, 0.6, Direction.UP),
|
||||
UPEAST("up-east", 0.6, 0.0, 0.5, Direction.UP),
|
||||
UPWEST("up-west", 0.4, 0.0, 0.5, Direction.UP),
|
||||
|
||||
DOWN("down", 0.5, 1.0, 0.5, Direction.DOWN),
|
||||
|
||||
DOWNNORTH ("downnorth", 0.5, 1.0, 0.4, Direction.DOWN),
|
||||
DOWNSOUTH ("downsouth", 0.5, 1.0, 0.6, Direction.DOWN),
|
||||
DOWNEAST("downeast", 0.6, 1.0, 0.5, Direction.DOWN),
|
||||
DOWNWEST("downwest", 0.4, 1.0, 0.5, Direction.DOWN),
|
||||
DOWNNORTH ("down-north", 0.5, 1.0, 0.4, Direction.DOWN),
|
||||
DOWNSOUTH ("down-south", 0.5, 1.0, 0.6, Direction.DOWN),
|
||||
DOWNEAST("dow-neast", 0.6, 1.0, 0.5, Direction.DOWN),
|
||||
DOWNWEST("down-west", 0.4, 1.0, 0.5, Direction.DOWN),
|
||||
|
||||
|
||||
NORTH ("north", 0.5, 0.4, 1.0, Direction.NORTH),
|
||||
@@ -278,10 +276,10 @@ public class BlockValue extends Value
|
||||
EAST("east", 0.0, 0.4, 0.5, Direction.EAST),
|
||||
WEST("west", 1.0, 0.4, 0.5, Direction.WEST),
|
||||
|
||||
NORTHUP ("northup", 0.5, 0.6, 1.0, Direction.NORTH),
|
||||
SOUTHUP ("southup", 0.5, 0.6, 0.0, Direction.SOUTH),
|
||||
EASTUP("eastup", 0.0, 0.6, 0.5, Direction.EAST),
|
||||
WESTUP("westup", 1.0, 0.6, 0.5, Direction.WEST);
|
||||
NORTHUP ("north-up", 0.5, 0.6, 1.0, Direction.NORTH),
|
||||
SOUTHUP ("south-up", 0.5, 0.6, 0.0, Direction.SOUTH),
|
||||
EASTUP("east-up", 0.0, 0.6, 0.5, Direction.EAST),
|
||||
WESTUP("west-up", 1.0, 0.6, 0.5, Direction.WEST);
|
||||
|
||||
public String name;
|
||||
public Vec3d hitOffset;
|
||||
@@ -290,7 +288,7 @@ public class BlockValue extends Value
|
||||
private static final Map<String, SpecificDirection> DIRECTION_MAP = Arrays.stream(values()).collect(Collectors.toMap(SpecificDirection::getName, d -> d));
|
||||
|
||||
|
||||
private SpecificDirection(String name, double hitx, double hity, double hitz, Direction blockFacing)
|
||||
SpecificDirection(String name, double hitx, double hity, double hitz, Direction blockFacing)
|
||||
{
|
||||
this.name = name;
|
||||
this.hitOffset = new Vec3d(hitx, hity, hitz);
|
||||
@@ -318,7 +316,7 @@ public class BlockValue extends Value
|
||||
false);
|
||||
return new PlacementContext(world, pos, dir.facing, sneakPlace, itemStack, hitres);
|
||||
}
|
||||
public PlacementContext(World world_1, BlockPos blockPos_1, Direction direction_1, boolean sneakPlace, ItemStack itemStack_1, BlockHitResult hitres) {
|
||||
private PlacementContext(World world_1, BlockPos blockPos_1, Direction direction_1, boolean sneakPlace, ItemStack itemStack_1, BlockHitResult hitres) {
|
||||
super(world_1, null, Hand.MAIN_HAND, itemStack_1, hitres);
|
||||
this.facing = direction_1;
|
||||
this.sneakPlace = sneakPlace;
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -297,6 +298,16 @@ public class EntityValue extends Value
|
||||
return null;
|
||||
});
|
||||
|
||||
put("facing", (e, a) -> {
|
||||
int index = 0;
|
||||
if (a != null)
|
||||
index = (6+(int)NumericValue.asNumber(a).getLong())%6;
|
||||
if (index < 0 || index > 5)
|
||||
throw new InternalExpressionException("facing order should be between -6 and 5");
|
||||
|
||||
return new StringValue(Direction.getEntityFacingOrder(e)[index].asString());
|
||||
});
|
||||
|
||||
put("nbt",(e, a) -> {
|
||||
CompoundTag nbttagcompound = e.toTag((new CompoundTag()));
|
||||
if (a==null)
|
||||
|
||||
Reference in new issue
Block a user