fixes for 22w11a
This commit is contained in:
1 parent
3e419d1557
commit
302a7b4817
39 files changed
+410
-305
No files matched your search
@@ -18,6 +18,7 @@ import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Direction.Axis;
|
||||
import net.minecraft.core.GlobalPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
@@ -59,13 +60,13 @@ public class BlockValue extends Value
|
||||
{
|
||||
BlockValue bv = bvCache.get(str);
|
||||
if (bv != null) return bv;
|
||||
BlockStateParser blockstateparser = (new BlockStateParser(new StringReader(str), false)).parse(true);
|
||||
if (blockstateparser.getState() != null)
|
||||
BlockStateParser.BlockResult foo = BlockStateParser.parseForBlock(HolderLookup.forRegistry(Registry.BLOCK), new StringReader(str), true );
|
||||
if (foo.blockState() != null)
|
||||
{
|
||||
CompoundTag bd = blockstateparser.getNbt();
|
||||
CompoundTag bd = foo.nbt();
|
||||
if (bd == null)
|
||||
bd = new CompoundTag();
|
||||
bv = new BlockValue(blockstateparser.getState(), null, null, bd );
|
||||
bv = new BlockValue(foo.blockState(), null, null, bd );
|
||||
if (bvCache.size()>10000)
|
||||
bvCache.clear();
|
||||
bvCache.put(str, bv);
|
||||
|
||||
@@ -22,6 +22,9 @@ import net.minecraft.commands.arguments.NbtPathArgument;
|
||||
import net.minecraft.commands.arguments.item.ItemInput;
|
||||
import net.minecraft.commands.arguments.item.ItemParser;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CollectionTag;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.EndTag;
|
||||
@@ -301,17 +304,17 @@ public class NBTSerializableValue extends Value implements ContainerValueInterfa
|
||||
if (customTag == null)
|
||||
return res;
|
||||
else
|
||||
return new ItemInput(res.getItem(), customTag);
|
||||
return new ItemInput(Holder.direct(res.getItem()), customTag);
|
||||
ItemParser.ItemResult parser = ItemParser.parseForItem(HolderLookup.forRegistry(Registry.ITEM), new StringReader(itemString));
|
||||
res = new ItemInput(parser.item(), parser.nbt());
|
||||
|
||||
ItemParser parser = (new ItemParser(new StringReader(itemString), false)).parse();
|
||||
res = new ItemInput(parser.getItem(), parser.getNbt());
|
||||
itemCache.put(itemString, res);
|
||||
if (itemCache.size()>64000)
|
||||
itemCache.clear();
|
||||
if (customTag == null)
|
||||
return res;
|
||||
else
|
||||
return new ItemInput(res.getItem(), customTag);
|
||||
return new ItemInput(Holder.direct(res.getItem()), customTag);
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user