mappings
This commit is contained in:
1 parent
3e39548337
commit
b14cf288a1
15 files changed
+97
-95
No files matched your search
@@ -73,7 +73,7 @@ public class Inventories {
|
||||
CarpetContext cc = (CarpetContext)c;
|
||||
TagManager tagManager = cc.s.getMinecraftServer().getTagManager();
|
||||
String tag = lv.get(0).evalValue(c).getString();
|
||||
net.minecraft.tag.Tag<Item> itemTag = tagManager.method_33164(Registry.ITEM_KEY).getTag(new Identifier(tag));
|
||||
net.minecraft.tag.Tag<Item> itemTag = tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTag(new Identifier(tag));
|
||||
if (itemTag == null) return LazyValue.NULL;
|
||||
Value ret = ListValue.wrap(itemTag.values().stream().map(b -> ValueConversions.of(Registry.ITEM.getId(b))).collect(Collectors.toList()));
|
||||
return (_c, _t) -> ret;
|
||||
@@ -85,17 +85,17 @@ public class Inventories {
|
||||
TagManager tagManager = cc.s.getMinecraftServer().getTagManager();
|
||||
if (lv.size() == 0)
|
||||
{
|
||||
Value ret = ListValue.wrap(tagManager.method_33164(Registry.ITEM_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
return (_c, _t) -> ret;
|
||||
}
|
||||
Item item = NBTSerializableValue.parseItem(lv.get(0).evalValue(c).getString()).getItem();
|
||||
if (lv.size() == 1)
|
||||
{
|
||||
Value ret = ListValue.wrap(tagManager.method_33164(Registry.ITEM_KEY).getTagsFor(item).stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTagsFor(item).stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
return (_c, _t) -> ret;
|
||||
}
|
||||
String tag = lv.get(1).evalValue(c).getString();
|
||||
net.minecraft.tag.Tag<Item> itemTag = tagManager.method_33164(Registry.ITEM_KEY).getTag(new Identifier(tag));
|
||||
net.minecraft.tag.Tag<Item> itemTag = tagManager.getOrCreateTagGroup(Registry.ITEM_KEY).getTag(new Identifier(tag));
|
||||
if (itemTag == null) return LazyValue.NULL;
|
||||
return itemTag.contains(item)?LazyValue.TRUE:LazyValue.FALSE;
|
||||
});
|
||||
|
||||
@@ -245,7 +245,7 @@ public class WorldAccess {
|
||||
return true;
|
||||
} else {
|
||||
ItemStack itemStack_1 = player.getMainHandStack();
|
||||
boolean boolean_2 = player.isUsingEffectiveTool(blockState_1);
|
||||
boolean boolean_2 = player.canHarvest(blockState_1);
|
||||
itemStack_1.postMine(player.world, blockState_1, blockPos_1, player);
|
||||
if (boolean_1 && boolean_2) {
|
||||
ItemStack itemStack_2 = itemStack_1.isEmpty() ? ItemStack.EMPTY : itemStack_1.copy();
|
||||
@@ -905,7 +905,7 @@ public class WorldAccess {
|
||||
boolean dropLoot = true;
|
||||
if (playerBreak)
|
||||
{
|
||||
boolean isUsingEffectiveTool = !state.isToolRequired() || tool.isEffectiveOn(state);
|
||||
boolean isUsingEffectiveTool = !state.isToolRequired() || tool.isSuitableFor(state);
|
||||
//postMine() durability from item classes
|
||||
float hardness = state.getHardness(world, where);
|
||||
int damageAmount = 0;
|
||||
@@ -1109,7 +1109,7 @@ public class WorldAccess {
|
||||
CarpetContext cc = (CarpetContext)c;
|
||||
TagManager tagManager = cc.s.getMinecraftServer().getTagManager();
|
||||
String tag = lv.get(0).evalValue(c).getString();
|
||||
net.minecraft.tag.Tag<Block> blockTag = tagManager.method_33164(Registry.BLOCK_KEY).getTag(new Identifier(tag));
|
||||
net.minecraft.tag.Tag<Block> blockTag = tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTag(new Identifier(tag));
|
||||
if (blockTag == null) return LazyValue.NULL;
|
||||
Value ret = ListValue.wrap(blockTag.values().stream().map(b -> ValueConversions.of(Registry.BLOCK.getId(b))).collect(Collectors.toList()));
|
||||
return (_c, _t) -> ret;
|
||||
@@ -1121,17 +1121,17 @@ public class WorldAccess {
|
||||
TagManager tagManager = cc.s.getMinecraftServer().getTagManager();
|
||||
if (lv.size() == 0)
|
||||
{
|
||||
Value ret = ListValue.wrap(tagManager.method_33164(Registry.BLOCK_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTagIds().stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
return (_c, _t) -> ret;
|
||||
}
|
||||
BlockArgument blockLocator = BlockArgument.findIn(cc, lv, 0, true);
|
||||
if (blockLocator.offset == lv.size())
|
||||
{
|
||||
Value ret = ListValue.wrap(tagManager.method_33164(Registry.BLOCK_KEY).getTagsFor(blockLocator.block.getBlockState().getBlock()).stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
Value ret = ListValue.wrap(tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTagsFor(blockLocator.block.getBlockState().getBlock()).stream().map(ValueConversions::of).collect(Collectors.toList()));
|
||||
return (_c, _t) -> ret;
|
||||
}
|
||||
String tag = lv.get(blockLocator.offset).evalValue(c).getString();
|
||||
net.minecraft.tag.Tag<Block> blockTag = tagManager.method_33164(Registry.BLOCK_KEY).getTag(new Identifier(tag));
|
||||
net.minecraft.tag.Tag<Block> blockTag = tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getTag(new Identifier(tag));
|
||||
if (blockTag == null) return LazyValue.NULL;
|
||||
return blockLocator.block.getBlockState().isIn(blockTag)?LazyValue.TRUE:LazyValue.FALSE;
|
||||
});
|
||||
|
||||
@@ -47,18 +47,18 @@ import net.minecraft.command.argument.EntityArgumentType;
|
||||
import net.minecraft.command.argument.EntitySummonArgumentType;
|
||||
import net.minecraft.command.argument.GameProfileArgumentType;
|
||||
import net.minecraft.command.argument.IdentifierArgumentType;
|
||||
import net.minecraft.command.argument.ItemEnchantmentArgumentType;
|
||||
import net.minecraft.command.argument.EnchantmentArgumentType;
|
||||
import net.minecraft.command.argument.ItemSlotArgumentType;
|
||||
import net.minecraft.command.argument.ItemStackArgumentType;
|
||||
import net.minecraft.command.argument.MessageArgumentType;
|
||||
import net.minecraft.command.argument.MobEffectArgumentType;
|
||||
import net.minecraft.command.argument.StatusEffectArgumentType;
|
||||
import net.minecraft.command.argument.NbtCompoundTagArgumentType;
|
||||
import net.minecraft.command.argument.NbtPathArgumentType;
|
||||
import net.minecraft.command.argument.NbtTagArgumentType;
|
||||
import net.minecraft.command.argument.NumberRangeArgumentType;
|
||||
import net.minecraft.command.argument.ObjectiveArgumentType;
|
||||
import net.minecraft.command.argument.ObjectiveCriteriaArgumentType;
|
||||
import net.minecraft.command.argument.ParticleArgumentType;
|
||||
import net.minecraft.command.argument.ScoreboardObjectiveArgumentType;
|
||||
import net.minecraft.command.argument.ScoreboardCriterionArgumentType;
|
||||
import net.minecraft.command.argument.ParticleEffectArgumentType;
|
||||
import net.minecraft.command.argument.RotationArgumentType;
|
||||
import net.minecraft.command.argument.ScoreHolderArgumentType;
|
||||
import net.minecraft.command.argument.ScoreboardSlotArgumentType;
|
||||
@@ -152,17 +152,17 @@ public abstract class CommandArgument
|
||||
new VanillaUnconfigurableArgument("entitytype", EntitySummonArgumentType::entitySummon,
|
||||
(c, p) -> ValueConversions.of(EntitySummonArgumentType.getEntitySummon(c, p)), SuggestionProviders.SUMMONABLE_ENTITIES
|
||||
),
|
||||
new VanillaUnconfigurableArgument("floatrange", NumberRangeArgumentType::method_30918,
|
||||
new VanillaUnconfigurableArgument("floatrange", NumberRangeArgumentType::floatRange,
|
||||
(c, p) -> ValueConversions.of(c.getArgument(p, NumberRange.FloatRange.class)), true
|
||||
),
|
||||
// function??
|
||||
|
||||
new PlayerProfileArgument(),
|
||||
new VanillaUnconfigurableArgument("intrange", NumberRangeArgumentType::numberRange,
|
||||
new VanillaUnconfigurableArgument("intrange", NumberRangeArgumentType::intRange,
|
||||
(c, p) -> ValueConversions.of(NumberRangeArgumentType.IntRangeArgumentType.getRangeArgument(c, p)), true
|
||||
),
|
||||
new VanillaUnconfigurableArgument("enchantment", ItemEnchantmentArgumentType::itemEnchantment,
|
||||
(c, p) -> ValueConversions.of(Registry.ENCHANTMENT.getId(ItemEnchantmentArgumentType.getEnchantment(c, p))), false
|
||||
new VanillaUnconfigurableArgument("enchantment", EnchantmentArgumentType::enchantment,
|
||||
(c, p) -> ValueConversions.of(Registry.ENCHANTMENT.getId(EnchantmentArgumentType.getEnchantment(c, p))), false
|
||||
),
|
||||
// item_predicate ?? //same as item but accepts tags, not sure right now
|
||||
new SlotArgument(),
|
||||
@@ -172,22 +172,22 @@ public abstract class CommandArgument
|
||||
new VanillaUnconfigurableArgument("message", MessageArgumentType::message,
|
||||
(c, p) -> new FormattedTextValue(MessageArgumentType.getMessage(c, p)), true
|
||||
),
|
||||
new VanillaUnconfigurableArgument("effect", MobEffectArgumentType::mobEffect,
|
||||
(c, p) -> ValueConversions.of(Registry.STATUS_EFFECT.getId(MobEffectArgumentType.getMobEffect(c, p))),false
|
||||
new VanillaUnconfigurableArgument("effect", StatusEffectArgumentType::statusEffect,
|
||||
(c, p) -> ValueConversions.of(Registry.STATUS_EFFECT.getId(StatusEffectArgumentType.getStatusEffect(c, p))),false
|
||||
),
|
||||
new TagArgument(), // for nbt_compound_tag and nbt_tag
|
||||
new VanillaUnconfigurableArgument("path", NbtPathArgumentType::nbtPath,
|
||||
(c, p) -> StringValue.of(NbtPathArgumentType.getNbtPath(c, p).toString()), true
|
||||
),
|
||||
new VanillaUnconfigurableArgument("objective", ObjectiveArgumentType::objective,
|
||||
(c, p) -> ValueConversions.of(ObjectiveArgumentType.getObjective(c, p)), false
|
||||
new VanillaUnconfigurableArgument("objective", ScoreboardObjectiveArgumentType::scoreboardObjective,
|
||||
(c, p) -> ValueConversions.of(ScoreboardObjectiveArgumentType.getObjective(c, p)), false
|
||||
),
|
||||
new VanillaUnconfigurableArgument("criterion", ObjectiveCriteriaArgumentType::objectiveCriteria,
|
||||
(c, p) -> StringValue.of(ObjectiveCriteriaArgumentType.getCriteria(c, p).getName()), false
|
||||
new VanillaUnconfigurableArgument("criterion", ScoreboardCriterionArgumentType::scoreboardCriterion,
|
||||
(c, p) -> StringValue.of(ScoreboardCriterionArgumentType.getCriterion(c, p).getName()), false
|
||||
),
|
||||
// operation // not sure if we need it, you have scarpet for that
|
||||
new VanillaUnconfigurableArgument("particle", ParticleArgumentType::particle,
|
||||
(c, p) -> ValueConversions.of(ParticleArgumentType.getParticle(c, p)), false
|
||||
new VanillaUnconfigurableArgument("particle", ParticleEffectArgumentType::particleEffect,
|
||||
(c, p) -> ValueConversions.of(ParticleEffectArgumentType.getParticle(c, p)), false
|
||||
),
|
||||
|
||||
// resource / identifier section
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import net.minecraft.command.argument.ParticleArgumentType;
|
||||
import net.minecraft.command.argument.ParticleEffectArgumentType;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.ByteTag;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -152,7 +152,7 @@ public class ShapeDispatcher
|
||||
return particle;
|
||||
try
|
||||
{
|
||||
particle = ParticleArgumentType.readParameters(new StringReader(name));
|
||||
particle = ParticleEffectArgumentType.readParameters(new StringReader(name));
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
{
|
||||
@@ -1225,11 +1225,11 @@ public class ShapeDispatcher
|
||||
@Override
|
||||
public Value validate(Map<String, Value> options, CarpetContext cc, Value value)
|
||||
{
|
||||
if (value instanceof EntityValue) return new NumericValue(((EntityValue) value).getEntity().getEntityId());
|
||||
if (value instanceof EntityValue) return new NumericValue(((EntityValue) value).getEntity().getId());
|
||||
ServerPlayerEntity player = EntityValue.getPlayerByValue(cc.s.getMinecraftServer(), value);
|
||||
if (player == null)
|
||||
throw new InternalExpressionException(id+" parameter needs to represent an entity or player");
|
||||
return new NumericValue(player.getEntityId());
|
||||
return new NumericValue(player.getId());
|
||||
}
|
||||
|
||||
public Value decode(Tag tag) { return new NumericValue(((IntTag)tag).getInt()); }
|
||||
|
||||
@@ -97,7 +97,7 @@ public class WorldTools
|
||||
ChunkGenerator chunkGenerator2;
|
||||
DimensionType dimensionType2;
|
||||
if (dimensionOptions == null) {
|
||||
dimensionType2 = (DimensionType)server.getRegistryManager().method_33309(Registry.DIMENSION_TYPE_KEY).getOrThrow(DimensionType.OVERWORLD_REGISTRY_KEY);
|
||||
dimensionType2 = server.getRegistryManager().getMutable(Registry.DIMENSION_TYPE_KEY).getOrThrow(DimensionType.OVERWORLD_REGISTRY_KEY);
|
||||
chunkGenerator2 = GeneratorOptions.createOverworldGenerator(server.getRegistryManager().get(Registry.BIOME_KEY), server.getRegistryManager().get(Registry.NOISE_SETTINGS_WORLDGEN), (new Random()).nextLong());
|
||||
} else {
|
||||
dimensionType2 = dimensionOptions.getDimensionType();
|
||||
|
||||
@@ -191,7 +191,7 @@ public class EntityValue extends Value
|
||||
{
|
||||
if (v instanceof EntityValue)
|
||||
{
|
||||
return getEntity().getEntityId()==((EntityValue) v).getEntity().getEntityId();
|
||||
return getEntity().getId()==((EntityValue) v).getEntity().getId();
|
||||
}
|
||||
return super.equals((Value)v);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ public class EntityValue extends Value
|
||||
positive = false;
|
||||
who = who.substring(1);
|
||||
}
|
||||
net.minecraft.tag.Tag<EntityType<?>> eTag = server.getTagManager().method_33164(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(who));
|
||||
net.minecraft.tag.Tag<EntityType<?>> eTag = server.getTagManager().getOrCreateTagGroup(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(who));
|
||||
if (eTag == null) throw new InternalExpressionException(who+" is not a valid entity descriptor");
|
||||
if (positive)
|
||||
{
|
||||
@@ -415,7 +415,7 @@ public class EntityValue extends Value
|
||||
//put("test", (e, a) -> a == null ? Value.NULL : new StringValue(a.getString()));
|
||||
put("removed", (entity, arg) -> new NumericValue(entity.isRemoved()));
|
||||
put("uuid",(e, a) -> new StringValue(e.getUuidAsString()));
|
||||
put("id",(e, a) -> new NumericValue(e.getEntityId()));
|
||||
put("id",(e, a) -> new NumericValue(e.getId()));
|
||||
put("pos", (e, a) -> ListValue.of(new NumericValue(e.getX()), new NumericValue(e.getY()), new NumericValue(e.getZ())));
|
||||
put("location", (e, a) -> ListValue.of(new NumericValue(e.getX()), new NumericValue(e.getY()), new NumericValue(e.getZ()), new NumericValue(e.yaw), new NumericValue(e.pitch)));
|
||||
put("x", (e, a) -> new NumericValue(e.getX()));
|
||||
@@ -444,13 +444,13 @@ public class EntityValue extends Value
|
||||
put("tags", (e, a) -> ListValue.wrap(e.getScoreboardTags().stream().map(StringValue::new).collect(Collectors.toList())));
|
||||
|
||||
put("scoreboard_tags", (e, a) -> ListValue.wrap(e.getScoreboardTags().stream().map(StringValue::new).collect(Collectors.toList())));
|
||||
put("entity_tags", (e, a) -> ListValue.wrap(e.getServer().getTagManager().method_33164(Registry.ENTITY_TYPE_KEY).getTagsFor(e.getType()).stream().map(ValueConversions::of).collect(Collectors.toList())));
|
||||
put("entity_tags", (e, a) -> ListValue.wrap(e.getServer().getTagManager().getOrCreateTagGroup(Registry.ENTITY_TYPE_KEY).getTagsFor(e.getType()).stream().map(ValueConversions::of).collect(Collectors.toList())));
|
||||
// deprecated
|
||||
put("has_tag", (e, a) -> new NumericValue(e.getScoreboardTags().contains(a.getString())));
|
||||
|
||||
put("has_scoreboard_tag", (e, a) -> new NumericValue(e.getScoreboardTags().contains(a.getString())));
|
||||
put("has_entity_tag", (e, a) -> {
|
||||
net.minecraft.tag.Tag<EntityType<?>> tag = e.getServer().getTagManager().method_33164(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(a.getString()));
|
||||
net.minecraft.tag.Tag<EntityType<?>> tag = e.getServer().getTagManager().getOrCreateTagGroup(Registry.ENTITY_TYPE_KEY).getTag(new Identifier(a.getString()));
|
||||
if (tag == null) return Value.NULL;
|
||||
return new NumericValue(e.getType().isIn(tag));
|
||||
});
|
||||
|
||||
@@ -389,7 +389,7 @@ public class ValueConversions
|
||||
BlockPredicateInterface predicateData = (BlockPredicateInterface) blockPredicate;
|
||||
return ListValue.of(
|
||||
predicateData.getCMBlockState()==null?Value.NULL:of(Registry.BLOCK.getId(predicateData.getCMBlockState().getBlock())),
|
||||
predicateData.getCMBlockTag()==null?Value.NULL:of(tagManager.method_33164(Registry.BLOCK_KEY).getUncheckedTagId(predicateData.getCMBlockTag())),
|
||||
predicateData.getCMBlockTag()==null?Value.NULL:of(tagManager.getOrCreateTagGroup(Registry.BLOCK_KEY).getUncheckedTagId(predicateData.getCMBlockTag())),
|
||||
MapValue.wrap(predicateData.getCMProperties()),
|
||||
predicateData.getCMDataTag() == null?Value.NULL:new NBTSerializableValue(predicateData.getCMDataTag())
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user