inevntories finished

This commit is contained in:
gnembon committed 2019-06-26 01:18:01 -03:00
1 parent 4b1a1d41dc
commit 2979924f24
4 files changed
+51 -51

No files matched your search

@@ -1,69 +1,64 @@
package carpet.script;
import carpet.CarpetServer;
import carpet.script.value.NBTSerializableValue;
import carpet.script.value.NullValue;
import carpet.settings.CarpetSettings;
import carpet.helpers.FeatureGenerator;
import carpet.fakes.MinecraftServerInterface;
import carpet.helpers.FeatureGenerator;
import carpet.script.Fluff.TriFunction;
import carpet.script.exception.CarpetExpressionException;
import carpet.script.exception.ExpressionException;
import carpet.script.exception.InternalExpressionException;
import carpet.script.Fluff.TriFunction;
import carpet.script.value.BlockValue;
import carpet.script.value.EntityValue;
import carpet.script.value.LazyListValue;
import carpet.script.value.ListValue;
import carpet.script.value.NBTSerializableValue;
import carpet.script.value.NullValue;
import carpet.script.value.NumericValue;
import carpet.script.value.StringValue;
import carpet.script.value.Value;
import carpet.settings.CarpetSettings;
import carpet.utils.BlockInfo;
import carpet.utils.Messenger;
import com.google.common.collect.Sets;
import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPlacementEnvironment;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.network.packet.PlaySoundIdS2CPacket;
import net.minecraft.command.arguments.ItemStackArgument;
import net.minecraft.command.arguments.ItemStringReader;
import net.minecraft.command.arguments.ParticleArgumentType;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.ItemEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.ai.brain.task.LookTargetUtil;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.entity.passive.AbstractTraderEntity;
import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.item.AutomaticItemPlacementContext;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemUsageContext;
import net.minecraft.item.Items;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.command.arguments.ParticleArgumentType;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.client.network.packet.PlaySoundIdS2CPacket;
import net.minecraft.item.Items;
import net.minecraft.particle.ParticleEffect;
import net.minecraft.block.BlockPlacementEnvironment;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.state.property.Property;
import net.minecraft.state.StateFactory;
import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Hand;
import net.minecraft.util.Identifier;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.math.*;
import net.minecraft.state.StateFactory;
import net.minecraft.state.property.Property;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.EulerRotation;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.Heightmap;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.Heightmap;
import net.minecraft.world.loot.context.LootContext;
import net.minecraft.world.loot.context.LootContextParameters;
import org.apache.commons.lang3.tuple.Pair;
@@ -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)
@@ -51,11 +51,7 @@ public class CarpetSettings
@Rule(desc = "Dropping entire stacks works also from on the crafting UI result slot", category = {BUGFIX, SURVIVAL})
public static boolean ctrlQCraftingFix = false;
@Rule(
desc = "Parrots don't get of your shoulders until you receive damage",
category = {SURVIVAL, FEATURE},
validate = Validator.WIP.class
)
@Rule(desc = "Parrots don't get of your shoulders until you receive proper damage", category = {SURVIVAL, FEATURE})
public static boolean persistentParrots = false;
/*@Rule(
@@ -208,7 +204,7 @@ public class CarpetSettings
@Rule(desc = "Enables /script command", extra = "An in-game scripting API for Scarpet programming language", category = COMMAND)
public static boolean commandScript = true;
@Rule(desc = "Enables /player command to control/spawn players", category = COMMAND, validate = Validator.WIP.class)
@Rule(desc = "Enables /player command to control/spawn players", category = COMMAND)
public static boolean commandPlayer = true;
@Rule(desc = "Placing carpets may issue carpet commands for non-op players", category = SURVIVAL)