Fix registry lists being randomized (#1774)

This commit is contained in:
manyrandomthings authored and GitHub committed 2023-07-28 14:23:59 +02:00
1 parent a05776a576
commit b1cc289a49
3 files changed
+7 -5

No files matched your search

@@ -133,7 +133,7 @@ public class Auxiliary
CarpetContext cc = (CarpetContext) c;
if (lv.isEmpty())
{
return ListValue.wrap(cc.registry(Registries.SOUND_EVENT).keySet().stream().map(ValueConversions::of));
return ListValue.wrap(cc.registry(Registries.SOUND_EVENT).holders().map(soundEventReference -> ValueConversions.of(soundEventReference.key().location())));
}
String rawString = lv.get(0).getString();
ResourceLocation soundName = InputValidator.identifierOf(rawString);
@@ -181,7 +181,7 @@ public class Auxiliary
CarpetContext cc = (CarpetContext) c;
if (lv.isEmpty())
{
return ListValue.wrap(cc.registry(Registries.PARTICLE_TYPE).keySet().stream().map(ValueConversions::of));
return ListValue.wrap(cc.registry(Registries.PARTICLE_TYPE).holders().map(particleTypeReference -> ValueConversions.of(particleTypeReference.key().location())));
}
MinecraftServer ms = cc.server();
ServerLevel world = cc.level();
@@ -29,6 +29,7 @@ import java.util.Optional;
import java.util.Set;
import net.minecraft.commands.arguments.item.ItemInput;
import net.minecraft.core.Holder;
import net.minecraft.core.HolderSet;
import net.minecraft.core.Registry;
import net.minecraft.core.RegistryAccess;
@@ -36,6 +37,7 @@ import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.tags.TagKey;
@@ -71,7 +73,7 @@ public class Inventories
Registry<Item> items = cc.registry(Registries.ITEM);
if (lv.isEmpty())
{
return ListValue.wrap(items.keySet().stream().map(ValueConversions::of));
return ListValue.wrap(items.holders().map(itemReference -> ValueConversions.of(itemReference.key().location())));
}
String tag = lv.get(0).getString();
Optional<HolderSet.Named<Item>> itemTag = items.getTag(TagKey.create(Registries.ITEM, InputValidator.identifierOf(tag)));
@@ -1225,7 +1225,7 @@ public class WorldAccess
Registry<Block> blocks = cc.registry(Registries.BLOCK);
if (lv.isEmpty())
{
return ListValue.wrap(blocks.keySet().stream().map(ValueConversions::of));
return ListValue.wrap(blocks.holders().map(blockReference -> ValueConversions.of(blockReference.key().location())));
}
ResourceLocation tag = InputValidator.identifierOf(lv.get(0).getString());
Optional<HolderSet.Named<Block>> tagset = blocks.getTag(TagKey.create(Registries.BLOCK, tag));
@@ -1256,7 +1256,7 @@ public class WorldAccess
ServerLevel world = cc.level();
if (lv.isEmpty())
{
return ListValue.wrap(world.registryAccess().registryOrThrow(Registries.BIOME).keySet().stream().map(ValueConversions::of));
return ListValue.wrap(cc.registry(Registries.BIOME).holders().map(biomeReference -> ValueConversions.of(biomeReference.key().location())));
}
Biome biome;