mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Update to 1.18.2
Co-authored-by: sciwhiz12 <arnoldnunag12@gmail.com> Co-authored-by: Marc Hermans <marc.hermans@ldtteam.com> Co-authored-by: LexManos <LexManos@gmail.com> Co-authored-by: Curle <curle@gemwire.uk> Signed-off-by: SizableShrimp <sizableshrimp@sizableshrimp.me>
This commit is contained in:
1 parent
34291c1fb2
commit
425eff39ff
234 files changed
+2175
-3226
No files matched your search
@@ -89,7 +89,7 @@ public class ForgeWorldPresetScreens
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public WorldGenSettings create(@Nonnull RegistryAccess.RegistryHolder dynamicRegistries, long seed, boolean generateStructures, boolean bonusChest)
|
||||
public WorldGenSettings create(@Nonnull RegistryAccess dynamicRegistries, long seed, boolean generateStructures, boolean bonusChest)
|
||||
{
|
||||
return worldPreset.createSettings(dynamicRegistries, seed, generateStructures, bonusChest, "");
|
||||
}
|
||||
|
||||
@@ -46,7 +46,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
import it.unimi.dsi.fastutil.longs.LongSet;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.core.*;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
@@ -56,6 +58,7 @@ import net.minecraft.world.item.*;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
@@ -88,8 +91,6 @@ import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.item.alchemy.PotionUtils;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
@@ -101,7 +102,6 @@ import net.minecraft.world.level.block.entity.FurnaceBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
@@ -170,7 +170,6 @@ import org.apache.logging.log4j.Marker;
|
||||
import org.apache.logging.log4j.MarkerManager;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextColor;
|
||||
@@ -525,7 +524,7 @@ public class ForgeHooks
|
||||
|
||||
if (!entityPlayer.mayBuild())
|
||||
{
|
||||
if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(level.getTagManager(), new BlockInWorld(level, pos, false)))
|
||||
if (itemstack.isEmpty() || !itemstack.hasAdventureModeBreakTagForBlock(level.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY), new BlockInWorld(level, pos, false)))
|
||||
preCancelEvent = true;
|
||||
}
|
||||
}
|
||||
@@ -568,7 +567,7 @@ public class ForgeHooks
|
||||
Level level = context.getLevel();
|
||||
|
||||
Player player = context.getPlayer();
|
||||
if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(level.getTagManager(), new BlockInWorld(level, context.getClickedPos(), false)))
|
||||
if (player != null && !player.getAbilities().mayBuild && !itemstack.hasAdventureModePlaceTagForBlock(level.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY), new BlockInWorld(level, context.getClickedPos(), false)))
|
||||
return InteractionResult.PASS;
|
||||
|
||||
// handle all placement events here
|
||||
@@ -860,7 +859,7 @@ public class ForgeHooks
|
||||
return "default";
|
||||
}
|
||||
|
||||
public static Tag<Block> getTagFromVanillaTier(Tiers tier)
|
||||
public static TagKey<Block> getTagFromVanillaTier(Tiers tier)
|
||||
{
|
||||
return switch(tier)
|
||||
{
|
||||
@@ -1089,10 +1088,10 @@ public class ForgeHooks
|
||||
String s = GsonHelper.convertToString(entry, "value");
|
||||
Tag.Entry dummy;
|
||||
if (!s.startsWith("#"))
|
||||
dummy = new Tag.ElementEntry(new ResourceLocation(s));
|
||||
dummy = new Tag.OptionalElementEntry(new ResourceLocation(s));
|
||||
else
|
||||
dummy = new Tag.TagEntry(new ResourceLocation(s.substring(1)));
|
||||
allList.removeIf(e -> e.getEntry().equals(dummy));
|
||||
allList.removeIf(e -> e.entry().equals(dummy));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1217,7 +1216,7 @@ public class ForgeHooks
|
||||
* When a structure mod is removed, this map may contain null keys. This will make the world unable to save if this persists.
|
||||
* If we remove a structure from the save data in this way, we then mark the chunk for saving
|
||||
*/
|
||||
public static void fixNullStructureReferences(ChunkAccess chunk, Map<StructureFeature<?>, LongSet> structureReferences)
|
||||
public static void fixNullStructureReferences(ChunkAccess chunk, Map<ConfiguredStructureFeature<?, ?>, LongSet> structureReferences)
|
||||
{
|
||||
if (structureReferences.remove(null) != null)
|
||||
{
|
||||
@@ -1230,7 +1229,7 @@ public class ForgeHooks
|
||||
private static final String DIMENSIONS_KEY = "dimensions";
|
||||
private static final String SEED_KEY = "seed";
|
||||
//No to static init!
|
||||
private static final Supplier<Codec<MappedRegistry<LevelStem>>> CODEC = Suppliers.memoize(() -> MappedRegistry.dataPackCodec(Registry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), LevelStem.CODEC).xmap(LevelStem::sortMap, Function.identity()));
|
||||
private static final Supplier<Codec<Registry<LevelStem>>> CODEC = Suppliers.memoize(() -> RegistryCodecs.dataPackAwareCodec(Registry.LEVEL_STEM_REGISTRY, Lifecycle.stable(), LevelStem.CODEC).xmap(LevelStem::sortMap, Function.identity()));
|
||||
|
||||
private static final Map<EntityType<? extends LivingEntity>, AttributeSupplier> FORGE_ATTRIBUTES = new HashMap<>();
|
||||
/** FOR INTERNAL USE ONLY, DO NOT CALL DIRECTLY */
|
||||
@@ -1281,19 +1280,19 @@ public class ForgeHooks
|
||||
long seed = wgs.seed();
|
||||
boolean generateFeatures = wgs.generateFeatures();
|
||||
boolean generateBonusChest = wgs.generateBonusChest();
|
||||
MappedRegistry<LevelStem> originalRegistry = wgs.dimensions();
|
||||
Registry<LevelStem> originalRegistry = wgs.dimensions();
|
||||
Optional<String> legacyCustomOptions = wgs.legacyCustomOptions;
|
||||
|
||||
// make a copy of the dimension registry; for dimensions that specify that they should use the server seed instead
|
||||
// of the hardcoded json seed, recreate them with the correct seed
|
||||
MappedRegistry<LevelStem> seededRegistry = new MappedRegistry<>(Registry.LEVEL_STEM_REGISTRY, Lifecycle.experimental());
|
||||
MappedRegistry<LevelStem> seededRegistry = new MappedRegistry<>(Registry.LEVEL_STEM_REGISTRY, Lifecycle.experimental(), (Function<LevelStem, Holder.Reference<LevelStem>>)null);
|
||||
for (Entry<ResourceKey<LevelStem>, LevelStem> entry : originalRegistry.entrySet())
|
||||
{
|
||||
ResourceKey<LevelStem> key = entry.getKey();
|
||||
LevelStem dimension = entry.getValue();
|
||||
if (dimension.useServerSeed())
|
||||
{
|
||||
seededRegistry.register(key, new LevelStem(dimension.typeSupplier(), dimension.generator().withSeed(seed), true), originalRegistry.lifecycle(entry.getValue()));
|
||||
seededRegistry.register(key, new LevelStem(dimension.typeHolder(), dimension.generator().withSeed(seed), true), originalRegistry.lifecycle(entry.getValue()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1310,7 +1309,7 @@ public class ForgeHooks
|
||||
App<Mu<LevelStem>, LevelStem> vanillaFields = vanillaFieldsSupplier.get();
|
||||
return builder.group(vanillaFields).and(
|
||||
Codec.BOOL.optionalFieldOf("forge:use_server_seed", false).stable().forGetter(levelStem -> levelStem.useServerSeed()))
|
||||
.apply(builder, builder.stable((stem, useServerSeed) -> new LevelStem(stem.typeSupplier(), stem.generator(), useServerSeed)));
|
||||
.apply(builder, builder.stable((stem, useServerSeed) -> new LevelStem(stem.typeHolder(), stem.generator(), useServerSeed)));
|
||||
}
|
||||
|
||||
public static void writeAdditionalLevelSaveData(WorldData worldData, CompoundTag levelTag)
|
||||
|
||||
@@ -27,13 +27,13 @@ public class ForgeStatesProvider implements IModStateProvider {
|
||||
final ModLoadingState CREATE_REGISTRIES = ModLoadingState.withTransition("CREATE_REGISTRIES", "CONSTRUCT", ModLoadingPhase.GATHER, SerialTransition.of(()-> Stream.of(IModStateTransition.EventGenerator.fromFunction(RegistryEvent.NewRegistry::new))));
|
||||
final ModLoadingState OBJECT_HOLDERS = ModLoadingState.withInline("OBJECT_HOLDERS", "CREATE_REGISTRIES", ModLoadingPhase.GATHER, ml-> ObjectHolderRegistry.findObjectHolders());
|
||||
final ModLoadingState INJECT_CAPABILITIES = ModLoadingState.withInline("INJECT_CAPABILITIES", "OBJECT_HOLDERS", ModLoadingPhase.GATHER, ml-> CapabilityManager.INSTANCE.injectCapabilities(ml.getAllScanData()));
|
||||
final ModLoadingState CUSTOM_TAGS = ModLoadingState.withInline("CUSTOM_TAGS", "INJECT_CAPABILITIES", ModLoadingPhase.GATHER, ml-> GameData.setCustomTagTypesFromRegistries());
|
||||
final ModLoadingState LOAD_REGISTRIES = ModLoadingState.withTransition("LOAD_REGISTRIES", "CUSTOM_TAGS", ModLoadingPhase.GATHER, new SerialTransition<RegistryEvent.Register<?>>(GameData::generateRegistryEvents, GameData::preRegistryEventDispatch, GameData::postRegistryEventDispatch, GameData::checkForRevertToVanilla));
|
||||
final ModLoadingState UNFREEZE = ModLoadingState.withInline("UNFREEZE_DATA", "INJECT_CAPABILITIES", ModLoadingPhase.GATHER, ml->GameData.unfreezeData());
|
||||
final ModLoadingState LOAD_REGISTRIES = ModLoadingState.withTransition("LOAD_REGISTRIES", "UNFREEZE_DATA", ModLoadingPhase.GATHER, new SerialTransition<RegistryEvent.Register<?>>(GameData::generateRegistryEvents, GameData::preRegistryEventDispatch, GameData::postRegistryEventDispatch, GameData::checkForRevertToVanilla));
|
||||
final ModLoadingState FREEZE = ModLoadingState.withInline("FREEZE_DATA", "COMPLETE", ModLoadingPhase.COMPLETE, ml->GameData.freezeData());
|
||||
final ModLoadingState NETLOCK = ModLoadingState.withInline("NETWORK_LOCK", "FREEZE_DATA", ModLoadingPhase.COMPLETE, ml-> NetworkRegistry.lock());
|
||||
@Override
|
||||
public List<IModLoadingState> getAllStates() {
|
||||
return List.of(CREATE_REGISTRIES, OBJECT_HOLDERS, INJECT_CAPABILITIES, CUSTOM_TAGS, LOAD_REGISTRIES, FREEZE, NETLOCK);
|
||||
return List.of(CREATE_REGISTRIES, OBJECT_HOLDERS, INJECT_CAPABILITIES, UNFREEZE, LOAD_REGISTRIES, FREEZE, NETLOCK);
|
||||
}
|
||||
|
||||
static record SerialTransition<T extends Event & IModBusEvent>(Supplier<Stream<EventGenerator<?>>> eventStream, BiFunction<Executor, ? extends EventGenerator<T>, CompletableFuture<List<Throwable>>> preDispatchHook, BiFunction<Executor, ? extends EventGenerator<T>, CompletableFuture<List<Throwable>>> postDispatchHook, BiFunction<Executor, CompletableFuture<List<Throwable>>, CompletableFuture<List<Throwable>>> finalActivityGenerator) implements IModStateTransition {
|
||||
|
||||
@@ -17,13 +17,8 @@ import javax.annotation.Nullable;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.tags.StaticTagHelper;
|
||||
import net.minecraft.tags.StaticTags;
|
||||
import net.minecraft.tags.Tag.Named;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagContainer;
|
||||
import net.minecraft.tags.TagLoader;
|
||||
import net.minecraftforge.common.Tags.IOptionalNamedTag;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
@@ -38,135 +33,136 @@ public class ForgeTagHandler
|
||||
private static Set<ResourceLocation> customTagTypeNames = Collections.emptySet();
|
||||
private static boolean tagTypesSet = false;
|
||||
|
||||
@Nullable
|
||||
private static <T extends IForgeRegistryEntry<T>> StaticTagHelper<T> getTagHelper(IForgeRegistry<T> registry)
|
||||
{
|
||||
return (StaticTagHelper<T>) StaticTags.get(registry.getRegistryName());
|
||||
}
|
||||
|
||||
private static void validateRegistrySupportsTags(IForgeRegistry<?> registry)
|
||||
{
|
||||
//Note: We also check against getTagHelper in case someone decides to use the helpers for tag creation for types supported by vanilla
|
||||
if (getTagHelper(registry) == null && (!(registry instanceof ForgeRegistry) || ((ForgeRegistry<?>) registry).getTagFolder() == null))
|
||||
{
|
||||
throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method that creates a named tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types
|
||||
* have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically
|
||||
* initializing and referencing the tag.
|
||||
* @param registry Registry the tag is for
|
||||
* @param name Name of the tag
|
||||
* @param <T> Type of the registry
|
||||
* @return A named tag
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> Named<T> makeWrapperTag(IForgeRegistry<T> registry, ResourceLocation name)
|
||||
{
|
||||
validateRegistrySupportsTags(registry);
|
||||
if (tagTypesSet)
|
||||
{
|
||||
StaticTagHelper<T> tagRegistry = getTagHelper(registry);
|
||||
if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types.");
|
||||
return tagRegistry.bind(name.toString());
|
||||
}
|
||||
return StaticTagHelper.createDelayedTag(registry.getRegistryName(), name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types
|
||||
* have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically
|
||||
* initializing and referencing the tag.
|
||||
* @param registry Registry the tag is for
|
||||
* @param name Name of the tag
|
||||
* @param <T> Type of the registry
|
||||
* @return An optional tag
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(IForgeRegistry<T> registry, ResourceLocation name)
|
||||
{
|
||||
return createOptionalTag(registry, name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types
|
||||
* have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically
|
||||
* initializing and referencing the tag.
|
||||
* @param registry Registry the tag is for
|
||||
* @param name Name of the tag
|
||||
* @param defaults Default values for the optional tag
|
||||
* @param <T> Type of the registry
|
||||
* @return An optional tag
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(IForgeRegistry<T> registry, ResourceLocation name, @Nullable Set<Supplier<T>> defaults)
|
||||
{
|
||||
validateRegistrySupportsTags(registry);
|
||||
if (tagTypesSet)
|
||||
{
|
||||
StaticTagHelper<T> tagRegistry = getTagHelper(registry);
|
||||
if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types.");
|
||||
return tagRegistry.createOptional(name, defaults);
|
||||
}
|
||||
return StaticTagHelper.createDelayedOptional(registry.getRegistryName(), name, defaults);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for creating named tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates
|
||||
* the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag.
|
||||
* @param registryName Name of the registry the tag is for
|
||||
* @param name Name of the tag
|
||||
* @param <T> Type of the registry
|
||||
* @return A named tag
|
||||
* @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing
|
||||
* and we can validate if the custom registry really does support custom tags.
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> Named<T> makeWrapperTag(ResourceLocation registryName, ResourceLocation name)
|
||||
{
|
||||
if (tagTypesSet)
|
||||
{
|
||||
IForgeRegistry<T> registry = RegistryManager.ACTIVE.getRegistry(registryName);
|
||||
if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName);
|
||||
return makeWrapperTag(registry, name);
|
||||
}
|
||||
return StaticTagHelper.createDelayedTag(registryName, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates
|
||||
* the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag.
|
||||
* @param registryName Name of the registry the tag is for
|
||||
* @param name Name of the tag
|
||||
* @param <T> Type of the registry
|
||||
* @return An optional tag
|
||||
* @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing
|
||||
* and we can validate if the custom registry really does support custom tags.
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(ResourceLocation registryName, ResourceLocation name)
|
||||
{
|
||||
return createOptionalTag(registryName, name, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates
|
||||
* the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag.
|
||||
* @param registryName Name of the registry the tag is for
|
||||
* @param name Name of the tag
|
||||
* @param defaults Default values for the optional tag
|
||||
* @param <T> Type of the registry
|
||||
* @return An optional tag
|
||||
* @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing
|
||||
* and we can validate if the custom registry really does support custom tags.
|
||||
*/
|
||||
public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(ResourceLocation registryName, ResourceLocation name, @Nullable Set<Supplier<T>> defaults)
|
||||
{
|
||||
if (tagTypesSet)
|
||||
{
|
||||
IForgeRegistry<T> registry = RegistryManager.ACTIVE.getRegistry(registryName);
|
||||
if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName);
|
||||
return createOptionalTag(registry, name, defaults);
|
||||
}
|
||||
return StaticTagHelper.createDelayedOptional(registryName, name, defaults);
|
||||
}
|
||||
// TODO-PATCHING: remove the custom registry tags stuff (1.18.2 has universal tags) and rework how optional tags could work
|
||||
// @Nullable
|
||||
// private static <T extends IForgeRegistryEntry<T>> StaticTagHelper<T> getTagHelper(IForgeRegistry<T> registry)
|
||||
// {
|
||||
// return (StaticTagHelper<T>) StaticTags.get(registry.getRegistryName());
|
||||
// }
|
||||
//
|
||||
// private static void validateRegistrySupportsTags(IForgeRegistry<?> registry)
|
||||
// {
|
||||
// //Note: We also check against getTagHelper in case someone decides to use the helpers for tag creation for types supported by vanilla
|
||||
// if (getTagHelper(registry) == null && (!(registry instanceof ForgeRegistry) || ((ForgeRegistry<?>) registry).getTagFolder() == null))
|
||||
// {
|
||||
// throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types.");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Helper method that creates a named tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types
|
||||
// * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically
|
||||
// * initializing and referencing the tag.
|
||||
// * @param registry Registry the tag is for
|
||||
// * @param name Name of the tag
|
||||
// * @param <T> Type of the registry
|
||||
// * @return A named tag
|
||||
// */
|
||||
// public static <T extends IForgeRegistryEntry<T>> Named<T> makeWrapperTag(IForgeRegistry<T> registry, ResourceLocation name)
|
||||
// {
|
||||
// validateRegistrySupportsTags(registry);
|
||||
// if (tagTypesSet)
|
||||
// {
|
||||
// StaticTagHelper<T> tagRegistry = getTagHelper(registry);
|
||||
// if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types.");
|
||||
// return tagRegistry.bind(name.toString());
|
||||
// }
|
||||
// return StaticTagHelper.createDelayedTag(registry.getRegistryName(), name);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types
|
||||
// * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically
|
||||
// * initializing and referencing the tag.
|
||||
// * @param registry Registry the tag is for
|
||||
// * @param name Name of the tag
|
||||
// * @param <T> Type of the registry
|
||||
// * @return An optional tag
|
||||
// */
|
||||
// public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(IForgeRegistry<T> registry, ResourceLocation name)
|
||||
// {
|
||||
// return createOptionalTag(registry, name, null);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Helper method that creates an optional tag for a forge registry, erroring if the registry doesn't support custom tag types. If the custom tag types
|
||||
// * have not been set yet, this method falls back and creates the tag reference delaying adding it to the tag registry to allow for statically
|
||||
// * initializing and referencing the tag.
|
||||
// * @param registry Registry the tag is for
|
||||
// * @param name Name of the tag
|
||||
// * @param defaults Default values for the optional tag
|
||||
// * @param <T> Type of the registry
|
||||
// * @return An optional tag
|
||||
// */
|
||||
// public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(IForgeRegistry<T> registry, ResourceLocation name, @Nullable Set<Supplier<T>> defaults)
|
||||
// {
|
||||
// validateRegistrySupportsTags(registry);
|
||||
// if (tagTypesSet)
|
||||
// {
|
||||
// StaticTagHelper<T> tagRegistry = getTagHelper(registry);
|
||||
// if (tagRegistry == null) throw new IllegalArgumentException("Registry " + registry.getRegistryName() + " does not support tag types.");
|
||||
// return tagRegistry.createOptional(name, defaults);
|
||||
// }
|
||||
// return StaticTagHelper.createDelayedOptional(registry.getRegistryName(), name, defaults);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Helper method for creating named tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates
|
||||
// * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag.
|
||||
// * @param registryName Name of the registry the tag is for
|
||||
// * @param name Name of the tag
|
||||
// * @param <T> Type of the registry
|
||||
// * @return A named tag
|
||||
// * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing
|
||||
// * and we can validate if the custom registry really does support custom tags.
|
||||
// */
|
||||
// public static <T extends IForgeRegistryEntry<T>> Named<T> makeWrapperTag(ResourceLocation registryName, ResourceLocation name)
|
||||
// {
|
||||
// if (tagTypesSet)
|
||||
// {
|
||||
// IForgeRegistry<T> registry = RegistryManager.ACTIVE.getRegistry(registryName);
|
||||
// if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName);
|
||||
// return makeWrapperTag(registry, name);
|
||||
// }
|
||||
// return StaticTagHelper.createDelayedTag(registryName, name);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates
|
||||
// * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag.
|
||||
// * @param registryName Name of the registry the tag is for
|
||||
// * @param name Name of the tag
|
||||
// * @param <T> Type of the registry
|
||||
// * @return An optional tag
|
||||
// * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing
|
||||
// * and we can validate if the custom registry really does support custom tags.
|
||||
// */
|
||||
// public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(ResourceLocation registryName, ResourceLocation name)
|
||||
// {
|
||||
// return createOptionalTag(registryName, name, null);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Helper method for creating optional tags for custom forge registries. If the custom tag types have not been set yet, this method falls back and creates
|
||||
// * the tag reference delaying adding it to the tag registry to allow for statically initializing and referencing the tag.
|
||||
// * @param registryName Name of the registry the tag is for
|
||||
// * @param name Name of the tag
|
||||
// * @param defaults Default values for the optional tag
|
||||
// * @param <T> Type of the registry
|
||||
// * @return An optional tag
|
||||
// * @implNote This method only errors instantly if tag types have already been set, otherwise the error is delayed until after registries finish initializing
|
||||
// * and we can validate if the custom registry really does support custom tags.
|
||||
// */
|
||||
// public static <T extends IForgeRegistryEntry<T>> IOptionalNamedTag<T> createOptionalTag(ResourceLocation registryName, ResourceLocation name, @Nullable Set<Supplier<T>> defaults)
|
||||
// {
|
||||
// if (tagTypesSet)
|
||||
// {
|
||||
// IForgeRegistry<T> registry = RegistryManager.ACTIVE.getRegistry(registryName);
|
||||
// if (registry == null) throw new IllegalArgumentException("Could not find registry named: " + registryName);
|
||||
// return createOptionalTag(registry, name, defaults);
|
||||
// }
|
||||
// return StaticTagHelper.createDelayedOptional(registryName, name, defaults);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Gets the all the registry names of registries that support custom tag types.
|
||||
@@ -176,23 +172,23 @@ public class ForgeTagHandler
|
||||
return customTagTypeNames;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the set containing the resource locations representing the registry name of each forge registry that supports custom tag types.
|
||||
*
|
||||
* @apiNote Internal: Calling this manually <strong>WILL</strong> cause a crash to occur as it can only be called once, and is done so by
|
||||
* forge after all registries have been initialized.
|
||||
*/
|
||||
public static void setCustomTagTypes(Set<ResourceLocation> customTagTypesNames)
|
||||
{
|
||||
if (tagTypesSet) throw new RuntimeException("Custom tag types have already been set, this method should only be called by forge, and after registries are initialized");
|
||||
tagTypesSet = true;
|
||||
customTagTypeNames = ImmutableSet.copyOf(customTagTypesNames);
|
||||
//Add the static references for custom tag types to the proper tag registries
|
||||
// Note: If this ends up being a hotspot due to lots of mods having lots of statically registered tags
|
||||
// that get loaded/registered before the new registry event is fired/processed everywhere then this
|
||||
// potentially should end up being moved into an async processor.
|
||||
StaticTagHelper.performDelayedAdd();
|
||||
}
|
||||
// /**
|
||||
// * Sets the set containing the resource locations representing the registry name of each forge registry that supports custom tag types.
|
||||
// *
|
||||
// * @apiNote Internal: Calling this manually <strong>WILL</strong> cause a crash to occur as it can only be called once, and is done so by
|
||||
// * forge after all registries have been initialized.
|
||||
// */
|
||||
// public static void setCustomTagTypes(Set<ResourceLocation> customTagTypesNames)
|
||||
// {
|
||||
// if (tagTypesSet) throw new RuntimeException("Custom tag types have already been set, this method should only be called by forge, and after registries are initialized");
|
||||
// tagTypesSet = true;
|
||||
// customTagTypeNames = ImmutableSet.copyOf(customTagTypesNames);
|
||||
// //Add the static references for custom tag types to the proper tag registries
|
||||
// // Note: If this ends up being a hotspot due to lots of mods having lots of statically registered tags
|
||||
// // that get loaded/registered before the new registry event is fired/processed everywhere then this
|
||||
// // potentially should end up being moved into an async processor.
|
||||
// StaticTagHelper.performDelayedAdd();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Creates a map for custom tag type to tag reader
|
||||
@@ -214,36 +210,36 @@ public class ForgeTagHandler
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Wraps the forge registry if it supports tags into the internal registry for use in serialization
|
||||
*
|
||||
* @apiNote Internal: For use in TagContainer
|
||||
*/
|
||||
@SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unchecked"})
|
||||
public static <T> Optional<? extends Registry<T>> getWrapperRegistry(ResourceKey<? extends Registry<T>> key, Optional<? extends Registry<T>> vanillaReg)
|
||||
{
|
||||
if (vanillaReg.isPresent())
|
||||
return vanillaReg;
|
||||
|
||||
ForgeRegistry<?> reg = RegistryManager.ACTIVE.getRegistry(key.location());
|
||||
if (reg == null || reg.getTagFolder() == null)
|
||||
return Optional.empty();
|
||||
|
||||
if (reg.getDefaultKey() == null)
|
||||
return Optional.of((Registry<T>) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable()));
|
||||
return Optional.of((Registry<T>) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable(), "ignored"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to reinject missing optional tags.
|
||||
*
|
||||
* @apiNote Internal
|
||||
*/
|
||||
public static TagContainer reinjectOptionalTags(TagContainer tagCollectionSupplier)
|
||||
{
|
||||
TagContainer.Builder builder = new TagContainer.Builder();
|
||||
//noinspection unchecked,rawtypes
|
||||
StaticTags.visitHelpers(h -> builder.add(h.getKey(), h.reinjectOptionalTags(tagCollectionSupplier.getOrEmpty((ResourceKey) h.getKey()))));
|
||||
return builder.build();
|
||||
}
|
||||
// /**
|
||||
// * Wraps the forge registry if it supports tags into the internal registry for use in serialization
|
||||
// *
|
||||
// * @apiNote Internal: For use in TagContainer
|
||||
// */
|
||||
// @SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "unchecked"})
|
||||
// public static <T> Optional<? extends Registry<T>> getWrapperRegistry(ResourceKey<? extends Registry<T>> key, Optional<? extends Registry<T>> vanillaReg)
|
||||
// {
|
||||
// if (vanillaReg.isPresent())
|
||||
// return vanillaReg;
|
||||
//
|
||||
// ForgeRegistry<?> reg = RegistryManager.ACTIVE.getRegistry(key.location());
|
||||
// if (reg == null || reg.getTagFolder() == null)
|
||||
// return Optional.empty();
|
||||
//
|
||||
// if (reg.getDefaultKey() == null)
|
||||
// return Optional.of((Registry<T>) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable()));
|
||||
// return Optional.of((Registry<T>) GameData.getWrapper(reg.getRegistryKey(), Lifecycle.stable(), "ignored"));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Helper to reinject missing optional tags.
|
||||
// *
|
||||
// * @apiNote Internal
|
||||
// */
|
||||
// public static TagContainer reinjectOptionalTags(TagContainer tagCollectionSupplier)
|
||||
// {
|
||||
// TagContainer.Builder builder = new TagContainer.Builder();
|
||||
// //noinspection unchecked,rawtypes
|
||||
// StaticTags.visitHelpers(h -> builder.add(h.getKey(), h.reinjectOptionalTags(tagCollectionSupplier.getOrEmpty((ResourceKey) h.getKey()))));
|
||||
// return builder.build();
|
||||
// }
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Tier;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -26,12 +26,12 @@ public final class ForgeTier implements Tier
|
||||
private final float attackDamageBonus;
|
||||
private final int enchantmentValue;
|
||||
@Nonnull
|
||||
private final Tag<Block> tag;
|
||||
private final TagKey<Block> tag;
|
||||
@Nonnull
|
||||
private final Supplier<Ingredient> repairIngredient;
|
||||
|
||||
public ForgeTier(int level, int uses, float speed, float attackDamageBonus, int enchantmentValue,
|
||||
@Nonnull Tag<Block> tag, @Nonnull Supplier<Ingredient> repairIngredient)
|
||||
@Nonnull TagKey<Block> tag, @Nonnull Supplier<Ingredient> repairIngredient)
|
||||
{
|
||||
this.level = level;
|
||||
this.uses = uses;
|
||||
@@ -73,7 +73,7 @@ public final class ForgeTier implements Tier
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public Tag<Block> getTag()
|
||||
public TagKey<Block> getTag()
|
||||
{
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag.Named;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
@@ -32,150 +32,150 @@ public class Tags
|
||||
{
|
||||
private static void init(){}
|
||||
|
||||
public static final IOptionalNamedTag<Block> BARRELS = tag("barrels");
|
||||
public static final IOptionalNamedTag<Block> BARRELS_WOODEN = tag("barrels/wooden");
|
||||
public static final IOptionalNamedTag<Block> CHESTS = tag("chests");
|
||||
public static final IOptionalNamedTag<Block> CHESTS_ENDER = tag("chests/ender");
|
||||
public static final IOptionalNamedTag<Block> CHESTS_TRAPPED = tag("chests/trapped");
|
||||
public static final IOptionalNamedTag<Block> CHESTS_WOODEN = tag("chests/wooden");
|
||||
public static final IOptionalNamedTag<Block> COBBLESTONE = tag("cobblestone");
|
||||
public static final IOptionalNamedTag<Block> COBBLESTONE_NORMAL = tag("cobblestone/normal");
|
||||
public static final IOptionalNamedTag<Block> COBBLESTONE_INFESTED = tag("cobblestone/infested");
|
||||
public static final IOptionalNamedTag<Block> COBBLESTONE_MOSSY = tag("cobblestone/mossy");
|
||||
public static final IOptionalNamedTag<Block> COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate");
|
||||
public static final IOptionalNamedTag<Block> END_STONES = tag("end_stones");
|
||||
public static final IOptionalNamedTag<Block> ENDERMAN_PLACE_ON_BLACKLIST = tag("enderman_place_on_blacklist");
|
||||
public static final IOptionalNamedTag<Block> FENCE_GATES = tag("fence_gates");
|
||||
public static final IOptionalNamedTag<Block> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
|
||||
public static final IOptionalNamedTag<Block> FENCES = tag("fences");
|
||||
public static final IOptionalNamedTag<Block> FENCES_NETHER_BRICK = tag("fences/nether_brick");
|
||||
public static final IOptionalNamedTag<Block> FENCES_WOODEN = tag("fences/wooden");
|
||||
public static final TagKey<Block> BARRELS = tag("barrels");
|
||||
public static final TagKey<Block> BARRELS_WOODEN = tag("barrels/wooden");
|
||||
public static final TagKey<Block> CHESTS = tag("chests");
|
||||
public static final TagKey<Block> CHESTS_ENDER = tag("chests/ender");
|
||||
public static final TagKey<Block> CHESTS_TRAPPED = tag("chests/trapped");
|
||||
public static final TagKey<Block> CHESTS_WOODEN = tag("chests/wooden");
|
||||
public static final TagKey<Block> COBBLESTONE = tag("cobblestone");
|
||||
public static final TagKey<Block> COBBLESTONE_NORMAL = tag("cobblestone/normal");
|
||||
public static final TagKey<Block> COBBLESTONE_INFESTED = tag("cobblestone/infested");
|
||||
public static final TagKey<Block> COBBLESTONE_MOSSY = tag("cobblestone/mossy");
|
||||
public static final TagKey<Block> COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate");
|
||||
public static final TagKey<Block> END_STONES = tag("end_stones");
|
||||
public static final TagKey<Block> ENDERMAN_PLACE_ON_BLACKLIST = tag("enderman_place_on_blacklist");
|
||||
public static final TagKey<Block> FENCE_GATES = tag("fence_gates");
|
||||
public static final TagKey<Block> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
|
||||
public static final TagKey<Block> FENCES = tag("fences");
|
||||
public static final TagKey<Block> FENCES_NETHER_BRICK = tag("fences/nether_brick");
|
||||
public static final TagKey<Block> FENCES_WOODEN = tag("fences/wooden");
|
||||
|
||||
public static final IOptionalNamedTag<Block> GLASS = tag("glass");
|
||||
public static final IOptionalNamedTag<Block> GLASS_BLACK = tag("glass/black");
|
||||
public static final IOptionalNamedTag<Block> GLASS_BLUE = tag("glass/blue");
|
||||
public static final IOptionalNamedTag<Block> GLASS_BROWN = tag("glass/brown");
|
||||
public static final IOptionalNamedTag<Block> GLASS_COLORLESS = tag("glass/colorless");
|
||||
public static final IOptionalNamedTag<Block> GLASS_CYAN = tag("glass/cyan");
|
||||
public static final IOptionalNamedTag<Block> GLASS_GRAY = tag("glass/gray");
|
||||
public static final IOptionalNamedTag<Block> GLASS_GREEN = tag("glass/green");
|
||||
public static final IOptionalNamedTag<Block> GLASS_LIGHT_BLUE = tag("glass/light_blue");
|
||||
public static final IOptionalNamedTag<Block> GLASS_LIGHT_GRAY = tag("glass/light_gray");
|
||||
public static final IOptionalNamedTag<Block> GLASS_LIME = tag("glass/lime");
|
||||
public static final IOptionalNamedTag<Block> GLASS_MAGENTA = tag("glass/magenta");
|
||||
public static final IOptionalNamedTag<Block> GLASS_ORANGE = tag("glass/orange");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PINK = tag("glass/pink");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PURPLE = tag("glass/purple");
|
||||
public static final IOptionalNamedTag<Block> GLASS_RED = tag("glass/red");
|
||||
public static final TagKey<Block> GLASS = tag("glass");
|
||||
public static final TagKey<Block> GLASS_BLACK = tag("glass/black");
|
||||
public static final TagKey<Block> GLASS_BLUE = tag("glass/blue");
|
||||
public static final TagKey<Block> GLASS_BROWN = tag("glass/brown");
|
||||
public static final TagKey<Block> GLASS_COLORLESS = tag("glass/colorless");
|
||||
public static final TagKey<Block> GLASS_CYAN = tag("glass/cyan");
|
||||
public static final TagKey<Block> GLASS_GRAY = tag("glass/gray");
|
||||
public static final TagKey<Block> GLASS_GREEN = tag("glass/green");
|
||||
public static final TagKey<Block> GLASS_LIGHT_BLUE = tag("glass/light_blue");
|
||||
public static final TagKey<Block> GLASS_LIGHT_GRAY = tag("glass/light_gray");
|
||||
public static final TagKey<Block> GLASS_LIME = tag("glass/lime");
|
||||
public static final TagKey<Block> GLASS_MAGENTA = tag("glass/magenta");
|
||||
public static final TagKey<Block> GLASS_ORANGE = tag("glass/orange");
|
||||
public static final TagKey<Block> GLASS_PINK = tag("glass/pink");
|
||||
public static final TagKey<Block> GLASS_PURPLE = tag("glass/purple");
|
||||
public static final TagKey<Block> GLASS_RED = tag("glass/red");
|
||||
/**
|
||||
* Glass which is made from sand and only minor additional ingredients like dyes
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> GLASS_SILICA = tag("glass/silica");
|
||||
public static final IOptionalNamedTag<Block> GLASS_TINTED = tag("glass/tinted");
|
||||
public static final IOptionalNamedTag<Block> GLASS_WHITE = tag("glass/white");
|
||||
public static final IOptionalNamedTag<Block> GLASS_YELLOW = tag("glass/yellow");
|
||||
public static final TagKey<Block> GLASS_SILICA = tag("glass/silica");
|
||||
public static final TagKey<Block> GLASS_TINTED = tag("glass/tinted");
|
||||
public static final TagKey<Block> GLASS_WHITE = tag("glass/white");
|
||||
public static final TagKey<Block> GLASS_YELLOW = tag("glass/yellow");
|
||||
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES = tag("glass_panes");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_BLACK = tag("glass_panes/black");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_BLUE = tag("glass_panes/blue");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_BROWN = tag("glass_panes/brown");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_CYAN = tag("glass_panes/cyan");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_GRAY = tag("glass_panes/gray");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_GREEN = tag("glass_panes/green");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_LIME = tag("glass_panes/lime");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_ORANGE = tag("glass_panes/orange");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_PINK = tag("glass_panes/pink");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_PURPLE = tag("glass_panes/purple");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_RED = tag("glass_panes/red");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_WHITE = tag("glass_panes/white");
|
||||
public static final IOptionalNamedTag<Block> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
|
||||
public static final TagKey<Block> GLASS_PANES = tag("glass_panes");
|
||||
public static final TagKey<Block> GLASS_PANES_BLACK = tag("glass_panes/black");
|
||||
public static final TagKey<Block> GLASS_PANES_BLUE = tag("glass_panes/blue");
|
||||
public static final TagKey<Block> GLASS_PANES_BROWN = tag("glass_panes/brown");
|
||||
public static final TagKey<Block> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
|
||||
public static final TagKey<Block> GLASS_PANES_CYAN = tag("glass_panes/cyan");
|
||||
public static final TagKey<Block> GLASS_PANES_GRAY = tag("glass_panes/gray");
|
||||
public static final TagKey<Block> GLASS_PANES_GREEN = tag("glass_panes/green");
|
||||
public static final TagKey<Block> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
|
||||
public static final TagKey<Block> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
|
||||
public static final TagKey<Block> GLASS_PANES_LIME = tag("glass_panes/lime");
|
||||
public static final TagKey<Block> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
|
||||
public static final TagKey<Block> GLASS_PANES_ORANGE = tag("glass_panes/orange");
|
||||
public static final TagKey<Block> GLASS_PANES_PINK = tag("glass_panes/pink");
|
||||
public static final TagKey<Block> GLASS_PANES_PURPLE = tag("glass_panes/purple");
|
||||
public static final TagKey<Block> GLASS_PANES_RED = tag("glass_panes/red");
|
||||
public static final TagKey<Block> GLASS_PANES_WHITE = tag("glass_panes/white");
|
||||
public static final TagKey<Block> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
|
||||
|
||||
public static final IOptionalNamedTag<Block> GRAVEL = tag("gravel");
|
||||
public static final IOptionalNamedTag<Block> NETHERRACK = tag("netherrack");
|
||||
public static final IOptionalNamedTag<Block> OBSIDIAN = tag("obsidian");
|
||||
public static final TagKey<Block> GRAVEL = tag("gravel");
|
||||
public static final TagKey<Block> NETHERRACK = tag("netherrack");
|
||||
public static final TagKey<Block> OBSIDIAN = tag("obsidian");
|
||||
/**
|
||||
* Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate");
|
||||
public static final TagKey<Block> ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate");
|
||||
/**
|
||||
* Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack");
|
||||
public static final TagKey<Block> ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack");
|
||||
/**
|
||||
* Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone");
|
||||
public static final TagKey<Block> ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone");
|
||||
/**
|
||||
* Ores which on average result in more than one resource worth of materials
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORE_RATES_DENSE = tag("ore_rates/dense");
|
||||
public static final TagKey<Block> ORE_RATES_DENSE = tag("ore_rates/dense");
|
||||
/**
|
||||
* Ores which on average result in one resource worth of materials
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORE_RATES_SINGULAR = tag("ore_rates/singular");
|
||||
public static final TagKey<Block> ORE_RATES_SINGULAR = tag("ore_rates/singular");
|
||||
/**
|
||||
* Ores which on average result in less than one resource worth of materials
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORE_RATES_SPARSE = tag("ore_rates/sparse");
|
||||
public static final IOptionalNamedTag<Block> ORES = tag("ores");
|
||||
public static final IOptionalNamedTag<Block> ORES_COAL = tag("ores/coal");
|
||||
public static final IOptionalNamedTag<Block> ORES_COPPER = tag("ores/copper");
|
||||
public static final IOptionalNamedTag<Block> ORES_DIAMOND = tag("ores/diamond");
|
||||
public static final IOptionalNamedTag<Block> ORES_EMERALD = tag("ores/emerald");
|
||||
public static final IOptionalNamedTag<Block> ORES_GOLD = tag("ores/gold");
|
||||
public static final IOptionalNamedTag<Block> ORES_IRON = tag("ores/iron");
|
||||
public static final IOptionalNamedTag<Block> ORES_LAPIS = tag("ores/lapis");
|
||||
public static final IOptionalNamedTag<Block> ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap");
|
||||
public static final IOptionalNamedTag<Block> ORES_QUARTZ = tag("ores/quartz");
|
||||
public static final IOptionalNamedTag<Block> ORES_REDSTONE = tag("ores/redstone");
|
||||
public static final TagKey<Block> ORE_RATES_SPARSE = tag("ore_rates/sparse");
|
||||
public static final TagKey<Block> ORES = tag("ores");
|
||||
public static final TagKey<Block> ORES_COAL = tag("ores/coal");
|
||||
public static final TagKey<Block> ORES_COPPER = tag("ores/copper");
|
||||
public static final TagKey<Block> ORES_DIAMOND = tag("ores/diamond");
|
||||
public static final TagKey<Block> ORES_EMERALD = tag("ores/emerald");
|
||||
public static final TagKey<Block> ORES_GOLD = tag("ores/gold");
|
||||
public static final TagKey<Block> ORES_IRON = tag("ores/iron");
|
||||
public static final TagKey<Block> ORES_LAPIS = tag("ores/lapis");
|
||||
public static final TagKey<Block> ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap");
|
||||
public static final TagKey<Block> ORES_QUARTZ = tag("ores/quartz");
|
||||
public static final TagKey<Block> ORES_REDSTONE = tag("ores/redstone");
|
||||
/**
|
||||
* Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate");
|
||||
public static final TagKey<Block> ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate");
|
||||
/**
|
||||
* Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack");
|
||||
public static final TagKey<Block> ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack");
|
||||
/**
|
||||
* Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output
|
||||
*/
|
||||
public static final IOptionalNamedTag<Block> ORES_IN_GROUND_STONE = tag("ores_in_ground/stone");
|
||||
public static final TagKey<Block> ORES_IN_GROUND_STONE = tag("ores_in_ground/stone");
|
||||
|
||||
public static final IOptionalNamedTag<Block> SAND = tag("sand");
|
||||
public static final IOptionalNamedTag<Block> SAND_COLORLESS = tag("sand/colorless");
|
||||
public static final IOptionalNamedTag<Block> SAND_RED = tag("sand/red");
|
||||
public static final TagKey<Block> SAND = tag("sand");
|
||||
public static final TagKey<Block> SAND_COLORLESS = tag("sand/colorless");
|
||||
public static final TagKey<Block> SAND_RED = tag("sand/red");
|
||||
|
||||
public static final IOptionalNamedTag<Block> SANDSTONE = tag("sandstone");
|
||||
public static final IOptionalNamedTag<Block> STAINED_GLASS = tag("stained_glass");
|
||||
public static final IOptionalNamedTag<Block> STAINED_GLASS_PANES = tag("stained_glass_panes");
|
||||
public static final IOptionalNamedTag<Block> STONE = tag("stone");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS = tag("storage_blocks");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron");
|
||||
public static final IOptionalNamedTag<Block> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
|
||||
public static final TagKey<Block> SANDSTONE = tag("sandstone");
|
||||
public static final TagKey<Block> STAINED_GLASS = tag("stained_glass");
|
||||
public static final TagKey<Block> STAINED_GLASS_PANES = tag("stained_glass_panes");
|
||||
public static final TagKey<Block> STONE = tag("stone");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS = tag("storage_blocks");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
|
||||
|
||||
public static final IOptionalNamedTag<Block> NEEDS_WOOD_TOOL = tag("needs_wood_tool");
|
||||
public static final IOptionalNamedTag<Block> NEEDS_GOLD_TOOL = tag("needs_gold_tool");
|
||||
public static final IOptionalNamedTag<Block> NEEDS_NETHERITE_TOOL = tag("needs_netherite_tool");
|
||||
public static final TagKey<Block> NEEDS_WOOD_TOOL = tag("needs_wood_tool");
|
||||
public static final TagKey<Block> NEEDS_GOLD_TOOL = tag("needs_gold_tool");
|
||||
public static final TagKey<Block> NEEDS_NETHERITE_TOOL = tag("needs_netherite_tool");
|
||||
|
||||
private static IOptionalNamedTag<Block> tag(String name)
|
||||
private static TagKey<Block> tag(String name)
|
||||
{
|
||||
return BlockTags.createOptional(new ResourceLocation("forge", name));
|
||||
return BlockTags.create(new ResourceLocation("forge", name));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,220 +183,220 @@ public class Tags
|
||||
{
|
||||
private static void init(){}
|
||||
|
||||
public static final IOptionalNamedTag<Item> BARRELS = tag("barrels");
|
||||
public static final IOptionalNamedTag<Item> BARRELS_WOODEN = tag("barrels/wooden");
|
||||
public static final IOptionalNamedTag<Item> BONES = tag("bones");
|
||||
public static final IOptionalNamedTag<Item> BOOKSHELVES = tag("bookshelves");
|
||||
public static final IOptionalNamedTag<Item> CHESTS = tag("chests");
|
||||
public static final IOptionalNamedTag<Item> CHESTS_ENDER = tag("chests/ender");
|
||||
public static final IOptionalNamedTag<Item> CHESTS_TRAPPED = tag("chests/trapped");
|
||||
public static final IOptionalNamedTag<Item> CHESTS_WOODEN = tag("chests/wooden");
|
||||
public static final IOptionalNamedTag<Item> COBBLESTONE = tag("cobblestone");
|
||||
public static final IOptionalNamedTag<Item> COBBLESTONE_NORMAL = tag("cobblestone/normal");
|
||||
public static final IOptionalNamedTag<Item> COBBLESTONE_INFESTED = tag("cobblestone/infested");
|
||||
public static final IOptionalNamedTag<Item> COBBLESTONE_MOSSY = tag("cobblestone/mossy");
|
||||
public static final IOptionalNamedTag<Item> COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate");
|
||||
public static final IOptionalNamedTag<Item> CROPS = tag("crops");
|
||||
public static final IOptionalNamedTag<Item> CROPS_BEETROOT = tag("crops/beetroot");
|
||||
public static final IOptionalNamedTag<Item> CROPS_CARROT = tag("crops/carrot");
|
||||
public static final IOptionalNamedTag<Item> CROPS_NETHER_WART = tag("crops/nether_wart");
|
||||
public static final IOptionalNamedTag<Item> CROPS_POTATO = tag("crops/potato");
|
||||
public static final IOptionalNamedTag<Item> CROPS_WHEAT = tag("crops/wheat");
|
||||
public static final IOptionalNamedTag<Item> DUSTS = tag("dusts");
|
||||
public static final IOptionalNamedTag<Item> DUSTS_PRISMARINE = tag("dusts/prismarine");
|
||||
public static final IOptionalNamedTag<Item> DUSTS_REDSTONE = tag("dusts/redstone");
|
||||
public static final IOptionalNamedTag<Item> DUSTS_GLOWSTONE = tag("dusts/glowstone");
|
||||
public static final TagKey<Item> BARRELS = tag("barrels");
|
||||
public static final TagKey<Item> BARRELS_WOODEN = tag("barrels/wooden");
|
||||
public static final TagKey<Item> BONES = tag("bones");
|
||||
public static final TagKey<Item> BOOKSHELVES = tag("bookshelves");
|
||||
public static final TagKey<Item> CHESTS = tag("chests");
|
||||
public static final TagKey<Item> CHESTS_ENDER = tag("chests/ender");
|
||||
public static final TagKey<Item> CHESTS_TRAPPED = tag("chests/trapped");
|
||||
public static final TagKey<Item> CHESTS_WOODEN = tag("chests/wooden");
|
||||
public static final TagKey<Item> COBBLESTONE = tag("cobblestone");
|
||||
public static final TagKey<Item> COBBLESTONE_NORMAL = tag("cobblestone/normal");
|
||||
public static final TagKey<Item> COBBLESTONE_INFESTED = tag("cobblestone/infested");
|
||||
public static final TagKey<Item> COBBLESTONE_MOSSY = tag("cobblestone/mossy");
|
||||
public static final TagKey<Item> COBBLESTONE_DEEPSLATE = tag("cobblestone/deepslate");
|
||||
public static final TagKey<Item> CROPS = tag("crops");
|
||||
public static final TagKey<Item> CROPS_BEETROOT = tag("crops/beetroot");
|
||||
public static final TagKey<Item> CROPS_CARROT = tag("crops/carrot");
|
||||
public static final TagKey<Item> CROPS_NETHER_WART = tag("crops/nether_wart");
|
||||
public static final TagKey<Item> CROPS_POTATO = tag("crops/potato");
|
||||
public static final TagKey<Item> CROPS_WHEAT = tag("crops/wheat");
|
||||
public static final TagKey<Item> DUSTS = tag("dusts");
|
||||
public static final TagKey<Item> DUSTS_PRISMARINE = tag("dusts/prismarine");
|
||||
public static final TagKey<Item> DUSTS_REDSTONE = tag("dusts/redstone");
|
||||
public static final TagKey<Item> DUSTS_GLOWSTONE = tag("dusts/glowstone");
|
||||
|
||||
public static final IOptionalNamedTag<Item> DYES = tag("dyes");
|
||||
public static final IOptionalNamedTag<Item> DYES_BLACK = DyeColor.BLACK.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_RED = DyeColor.RED.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_GREEN = DyeColor.GREEN.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_BROWN = DyeColor.BROWN.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_BLUE = DyeColor.BLUE.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_PURPLE = DyeColor.PURPLE.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_CYAN = DyeColor.CYAN.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_LIGHT_GRAY = DyeColor.LIGHT_GRAY.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_GRAY = DyeColor.GRAY.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_PINK = DyeColor.PINK.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_LIME = DyeColor.LIME.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_YELLOW = DyeColor.YELLOW.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_LIGHT_BLUE = DyeColor.LIGHT_BLUE.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_MAGENTA = DyeColor.MAGENTA.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_ORANGE = DyeColor.ORANGE.getTag();
|
||||
public static final IOptionalNamedTag<Item> DYES_WHITE = DyeColor.WHITE.getTag();
|
||||
public static final TagKey<Item> DYES = tag("dyes");
|
||||
public static final TagKey<Item> DYES_BLACK = DyeColor.BLACK.getTag();
|
||||
public static final TagKey<Item> DYES_RED = DyeColor.RED.getTag();
|
||||
public static final TagKey<Item> DYES_GREEN = DyeColor.GREEN.getTag();
|
||||
public static final TagKey<Item> DYES_BROWN = DyeColor.BROWN.getTag();
|
||||
public static final TagKey<Item> DYES_BLUE = DyeColor.BLUE.getTag();
|
||||
public static final TagKey<Item> DYES_PURPLE = DyeColor.PURPLE.getTag();
|
||||
public static final TagKey<Item> DYES_CYAN = DyeColor.CYAN.getTag();
|
||||
public static final TagKey<Item> DYES_LIGHT_GRAY = DyeColor.LIGHT_GRAY.getTag();
|
||||
public static final TagKey<Item> DYES_GRAY = DyeColor.GRAY.getTag();
|
||||
public static final TagKey<Item> DYES_PINK = DyeColor.PINK.getTag();
|
||||
public static final TagKey<Item> DYES_LIME = DyeColor.LIME.getTag();
|
||||
public static final TagKey<Item> DYES_YELLOW = DyeColor.YELLOW.getTag();
|
||||
public static final TagKey<Item> DYES_LIGHT_BLUE = DyeColor.LIGHT_BLUE.getTag();
|
||||
public static final TagKey<Item> DYES_MAGENTA = DyeColor.MAGENTA.getTag();
|
||||
public static final TagKey<Item> DYES_ORANGE = DyeColor.ORANGE.getTag();
|
||||
public static final TagKey<Item> DYES_WHITE = DyeColor.WHITE.getTag();
|
||||
|
||||
public static final IOptionalNamedTag<Item> EGGS = tag("eggs");
|
||||
public static final IOptionalNamedTag<Item> ENCHANTING_FUELS = tag("enchanting_fuels", Set.of(() -> net.minecraft.world.item.Items.LAPIS_LAZULI));
|
||||
public static final IOptionalNamedTag<Item> END_STONES = tag("end_stones");
|
||||
public static final IOptionalNamedTag<Item> ENDER_PEARLS = tag("ender_pearls");
|
||||
public static final IOptionalNamedTag<Item> FEATHERS = tag("feathers");
|
||||
public static final IOptionalNamedTag<Item> FENCE_GATES = tag("fence_gates");
|
||||
public static final IOptionalNamedTag<Item> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
|
||||
public static final IOptionalNamedTag<Item> FENCES = tag("fences");
|
||||
public static final IOptionalNamedTag<Item> FENCES_NETHER_BRICK = tag("fences/nether_brick");
|
||||
public static final IOptionalNamedTag<Item> FENCES_WOODEN = tag("fences/wooden");
|
||||
public static final IOptionalNamedTag<Item> GEMS = tag("gems");
|
||||
public static final IOptionalNamedTag<Item> GEMS_DIAMOND = tag("gems/diamond");
|
||||
public static final IOptionalNamedTag<Item> GEMS_EMERALD = tag("gems/emerald");
|
||||
public static final IOptionalNamedTag<Item> GEMS_AMETHYST = tag("gems/amethyst");
|
||||
public static final IOptionalNamedTag<Item> GEMS_LAPIS = tag("gems/lapis");
|
||||
public static final IOptionalNamedTag<Item> GEMS_PRISMARINE = tag("gems/prismarine");
|
||||
public static final IOptionalNamedTag<Item> GEMS_QUARTZ = tag("gems/quartz");
|
||||
public static final TagKey<Item> EGGS = tag("eggs");
|
||||
public static final TagKey<Item> ENCHANTING_FUELS = tag("enchanting_fuels", Set.of(() -> net.minecraft.world.item.Items.LAPIS_LAZULI));
|
||||
public static final TagKey<Item> END_STONES = tag("end_stones");
|
||||
public static final TagKey<Item> ENDER_PEARLS = tag("ender_pearls");
|
||||
public static final TagKey<Item> FEATHERS = tag("feathers");
|
||||
public static final TagKey<Item> FENCE_GATES = tag("fence_gates");
|
||||
public static final TagKey<Item> FENCE_GATES_WOODEN = tag("fence_gates/wooden");
|
||||
public static final TagKey<Item> FENCES = tag("fences");
|
||||
public static final TagKey<Item> FENCES_NETHER_BRICK = tag("fences/nether_brick");
|
||||
public static final TagKey<Item> FENCES_WOODEN = tag("fences/wooden");
|
||||
public static final TagKey<Item> GEMS = tag("gems");
|
||||
public static final TagKey<Item> GEMS_DIAMOND = tag("gems/diamond");
|
||||
public static final TagKey<Item> GEMS_EMERALD = tag("gems/emerald");
|
||||
public static final TagKey<Item> GEMS_AMETHYST = tag("gems/amethyst");
|
||||
public static final TagKey<Item> GEMS_LAPIS = tag("gems/lapis");
|
||||
public static final TagKey<Item> GEMS_PRISMARINE = tag("gems/prismarine");
|
||||
public static final TagKey<Item> GEMS_QUARTZ = tag("gems/quartz");
|
||||
|
||||
public static final IOptionalNamedTag<Item> GLASS = tag("glass");
|
||||
public static final IOptionalNamedTag<Item> GLASS_BLACK = tag("glass/black");
|
||||
public static final IOptionalNamedTag<Item> GLASS_BLUE = tag("glass/blue");
|
||||
public static final IOptionalNamedTag<Item> GLASS_BROWN = tag("glass/brown");
|
||||
public static final IOptionalNamedTag<Item> GLASS_COLORLESS = tag("glass/colorless");
|
||||
public static final IOptionalNamedTag<Item> GLASS_CYAN = tag("glass/cyan");
|
||||
public static final IOptionalNamedTag<Item> GLASS_GRAY = tag("glass/gray");
|
||||
public static final IOptionalNamedTag<Item> GLASS_GREEN = tag("glass/green");
|
||||
public static final IOptionalNamedTag<Item> GLASS_LIGHT_BLUE = tag("glass/light_blue");
|
||||
public static final IOptionalNamedTag<Item> GLASS_LIGHT_GRAY = tag("glass/light_gray");
|
||||
public static final IOptionalNamedTag<Item> GLASS_LIME = tag("glass/lime");
|
||||
public static final IOptionalNamedTag<Item> GLASS_MAGENTA = tag("glass/magenta");
|
||||
public static final IOptionalNamedTag<Item> GLASS_ORANGE = tag("glass/orange");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PINK = tag("glass/pink");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PURPLE = tag("glass/purple");
|
||||
public static final IOptionalNamedTag<Item> GLASS_RED = tag("glass/red");
|
||||
public static final TagKey<Item> GLASS = tag("glass");
|
||||
public static final TagKey<Item> GLASS_BLACK = tag("glass/black");
|
||||
public static final TagKey<Item> GLASS_BLUE = tag("glass/blue");
|
||||
public static final TagKey<Item> GLASS_BROWN = tag("glass/brown");
|
||||
public static final TagKey<Item> GLASS_COLORLESS = tag("glass/colorless");
|
||||
public static final TagKey<Item> GLASS_CYAN = tag("glass/cyan");
|
||||
public static final TagKey<Item> GLASS_GRAY = tag("glass/gray");
|
||||
public static final TagKey<Item> GLASS_GREEN = tag("glass/green");
|
||||
public static final TagKey<Item> GLASS_LIGHT_BLUE = tag("glass/light_blue");
|
||||
public static final TagKey<Item> GLASS_LIGHT_GRAY = tag("glass/light_gray");
|
||||
public static final TagKey<Item> GLASS_LIME = tag("glass/lime");
|
||||
public static final TagKey<Item> GLASS_MAGENTA = tag("glass/magenta");
|
||||
public static final TagKey<Item> GLASS_ORANGE = tag("glass/orange");
|
||||
public static final TagKey<Item> GLASS_PINK = tag("glass/pink");
|
||||
public static final TagKey<Item> GLASS_PURPLE = tag("glass/purple");
|
||||
public static final TagKey<Item> GLASS_RED = tag("glass/red");
|
||||
/**
|
||||
* Glass which is made from sand and only minor additional ingredients like dyes
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> GLASS_SILICA = tag("glass/silica");
|
||||
public static final IOptionalNamedTag<Item> GLASS_TINTED = tag("glass/tinted");
|
||||
public static final IOptionalNamedTag<Item> GLASS_WHITE = tag("glass/white");
|
||||
public static final IOptionalNamedTag<Item> GLASS_YELLOW = tag("glass/yellow");
|
||||
public static final TagKey<Item> GLASS_SILICA = tag("glass/silica");
|
||||
public static final TagKey<Item> GLASS_TINTED = tag("glass/tinted");
|
||||
public static final TagKey<Item> GLASS_WHITE = tag("glass/white");
|
||||
public static final TagKey<Item> GLASS_YELLOW = tag("glass/yellow");
|
||||
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES = tag("glass_panes");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_BLACK = tag("glass_panes/black");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_BLUE = tag("glass_panes/blue");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_BROWN = tag("glass_panes/brown");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_CYAN = tag("glass_panes/cyan");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_GRAY = tag("glass_panes/gray");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_GREEN = tag("glass_panes/green");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_LIME = tag("glass_panes/lime");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_ORANGE = tag("glass_panes/orange");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_PINK = tag("glass_panes/pink");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_PURPLE = tag("glass_panes/purple");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_RED = tag("glass_panes/red");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_WHITE = tag("glass_panes/white");
|
||||
public static final IOptionalNamedTag<Item> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
|
||||
public static final TagKey<Item> GLASS_PANES = tag("glass_panes");
|
||||
public static final TagKey<Item> GLASS_PANES_BLACK = tag("glass_panes/black");
|
||||
public static final TagKey<Item> GLASS_PANES_BLUE = tag("glass_panes/blue");
|
||||
public static final TagKey<Item> GLASS_PANES_BROWN = tag("glass_panes/brown");
|
||||
public static final TagKey<Item> GLASS_PANES_COLORLESS = tag("glass_panes/colorless");
|
||||
public static final TagKey<Item> GLASS_PANES_CYAN = tag("glass_panes/cyan");
|
||||
public static final TagKey<Item> GLASS_PANES_GRAY = tag("glass_panes/gray");
|
||||
public static final TagKey<Item> GLASS_PANES_GREEN = tag("glass_panes/green");
|
||||
public static final TagKey<Item> GLASS_PANES_LIGHT_BLUE = tag("glass_panes/light_blue");
|
||||
public static final TagKey<Item> GLASS_PANES_LIGHT_GRAY = tag("glass_panes/light_gray");
|
||||
public static final TagKey<Item> GLASS_PANES_LIME = tag("glass_panes/lime");
|
||||
public static final TagKey<Item> GLASS_PANES_MAGENTA = tag("glass_panes/magenta");
|
||||
public static final TagKey<Item> GLASS_PANES_ORANGE = tag("glass_panes/orange");
|
||||
public static final TagKey<Item> GLASS_PANES_PINK = tag("glass_panes/pink");
|
||||
public static final TagKey<Item> GLASS_PANES_PURPLE = tag("glass_panes/purple");
|
||||
public static final TagKey<Item> GLASS_PANES_RED = tag("glass_panes/red");
|
||||
public static final TagKey<Item> GLASS_PANES_WHITE = tag("glass_panes/white");
|
||||
public static final TagKey<Item> GLASS_PANES_YELLOW = tag("glass_panes/yellow");
|
||||
|
||||
public static final IOptionalNamedTag<Item> GRAVEL = tag("gravel");
|
||||
public static final IOptionalNamedTag<Item> GUNPOWDER = tag("gunpowder");
|
||||
public static final IOptionalNamedTag<Item> HEADS = tag("heads");
|
||||
public static final IOptionalNamedTag<Item> INGOTS = tag("ingots");
|
||||
public static final IOptionalNamedTag<Item> INGOTS_BRICK = tag("ingots/brick");
|
||||
public static final IOptionalNamedTag<Item> INGOTS_COPPER = tag("ingots/copper");
|
||||
public static final IOptionalNamedTag<Item> INGOTS_GOLD = tag("ingots/gold");
|
||||
public static final IOptionalNamedTag<Item> INGOTS_IRON = tag("ingots/iron");
|
||||
public static final IOptionalNamedTag<Item> INGOTS_NETHERITE = tag("ingots/netherite");
|
||||
public static final IOptionalNamedTag<Item> INGOTS_NETHER_BRICK = tag("ingots/nether_brick");
|
||||
public static final IOptionalNamedTag<Item> LEATHER = tag("leather");
|
||||
public static final IOptionalNamedTag<Item> MUSHROOMS = tag("mushrooms");
|
||||
public static final IOptionalNamedTag<Item> NETHER_STARS = tag("nether_stars");
|
||||
public static final IOptionalNamedTag<Item> NETHERRACK = tag("netherrack");
|
||||
public static final IOptionalNamedTag<Item> NUGGETS = tag("nuggets");
|
||||
public static final IOptionalNamedTag<Item> NUGGETS_GOLD = tag("nuggets/gold");
|
||||
public static final IOptionalNamedTag<Item> NUGGETS_IRON = tag("nuggets/iron");
|
||||
public static final IOptionalNamedTag<Item> OBSIDIAN = tag("obsidian");
|
||||
public static final TagKey<Item> GRAVEL = tag("gravel");
|
||||
public static final TagKey<Item> GUNPOWDER = tag("gunpowder");
|
||||
public static final TagKey<Item> HEADS = tag("heads");
|
||||
public static final TagKey<Item> INGOTS = tag("ingots");
|
||||
public static final TagKey<Item> INGOTS_BRICK = tag("ingots/brick");
|
||||
public static final TagKey<Item> INGOTS_COPPER = tag("ingots/copper");
|
||||
public static final TagKey<Item> INGOTS_GOLD = tag("ingots/gold");
|
||||
public static final TagKey<Item> INGOTS_IRON = tag("ingots/iron");
|
||||
public static final TagKey<Item> INGOTS_NETHERITE = tag("ingots/netherite");
|
||||
public static final TagKey<Item> INGOTS_NETHER_BRICK = tag("ingots/nether_brick");
|
||||
public static final TagKey<Item> LEATHER = tag("leather");
|
||||
public static final TagKey<Item> MUSHROOMS = tag("mushrooms");
|
||||
public static final TagKey<Item> NETHER_STARS = tag("nether_stars");
|
||||
public static final TagKey<Item> NETHERRACK = tag("netherrack");
|
||||
public static final TagKey<Item> NUGGETS = tag("nuggets");
|
||||
public static final TagKey<Item> NUGGETS_GOLD = tag("nuggets/gold");
|
||||
public static final TagKey<Item> NUGGETS_IRON = tag("nuggets/iron");
|
||||
public static final TagKey<Item> OBSIDIAN = tag("obsidian");
|
||||
/**
|
||||
* Blocks which are often replaced by deepslate ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_DEEPSLATE}, during world generation
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate");
|
||||
public static final TagKey<Item> ORE_BEARING_GROUND_DEEPSLATE = tag("ore_bearing_ground/deepslate");
|
||||
/**
|
||||
* Blocks which are often replaced by netherrack ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_NETHERRACK}, during world generation
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack");
|
||||
public static final TagKey<Item> ORE_BEARING_GROUND_NETHERRACK = tag("ore_bearing_ground/netherrack");
|
||||
/**
|
||||
* Blocks which are often replaced by stone ores, i.e. the ores in the tag {@link #ORES_IN_GROUND_STONE}, during world generation
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone");
|
||||
public static final TagKey<Item> ORE_BEARING_GROUND_STONE = tag("ore_bearing_ground/stone");
|
||||
/**
|
||||
* Ores which on average result in more than one resource worth of materials
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORE_RATES_DENSE = tag("ore_rates/dense");
|
||||
public static final TagKey<Item> ORE_RATES_DENSE = tag("ore_rates/dense");
|
||||
/**
|
||||
* Ores which on average result in one resource worth of materials
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORE_RATES_SINGULAR = tag("ore_rates/singular");
|
||||
public static final TagKey<Item> ORE_RATES_SINGULAR = tag("ore_rates/singular");
|
||||
/**
|
||||
* Ores which on average result in less than one resource worth of materials
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORE_RATES_SPARSE = tag("ore_rates/sparse");
|
||||
public static final IOptionalNamedTag<Item> ORES = tag("ores");
|
||||
public static final IOptionalNamedTag<Item> ORES_COAL = tag("ores/coal");
|
||||
public static final IOptionalNamedTag<Item> ORES_COPPER = tag("ores/copper");
|
||||
public static final IOptionalNamedTag<Item> ORES_DIAMOND = tag("ores/diamond");
|
||||
public static final IOptionalNamedTag<Item> ORES_EMERALD = tag("ores/emerald");
|
||||
public static final IOptionalNamedTag<Item> ORES_GOLD = tag("ores/gold");
|
||||
public static final IOptionalNamedTag<Item> ORES_IRON = tag("ores/iron");
|
||||
public static final IOptionalNamedTag<Item> ORES_LAPIS = tag("ores/lapis");
|
||||
public static final IOptionalNamedTag<Item> ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap");
|
||||
public static final IOptionalNamedTag<Item> ORES_QUARTZ = tag("ores/quartz");
|
||||
public static final IOptionalNamedTag<Item> ORES_REDSTONE = tag("ores/redstone");
|
||||
public static final TagKey<Item> ORE_RATES_SPARSE = tag("ore_rates/sparse");
|
||||
public static final TagKey<Item> ORES = tag("ores");
|
||||
public static final TagKey<Item> ORES_COAL = tag("ores/coal");
|
||||
public static final TagKey<Item> ORES_COPPER = tag("ores/copper");
|
||||
public static final TagKey<Item> ORES_DIAMOND = tag("ores/diamond");
|
||||
public static final TagKey<Item> ORES_EMERALD = tag("ores/emerald");
|
||||
public static final TagKey<Item> ORES_GOLD = tag("ores/gold");
|
||||
public static final TagKey<Item> ORES_IRON = tag("ores/iron");
|
||||
public static final TagKey<Item> ORES_LAPIS = tag("ores/lapis");
|
||||
public static final TagKey<Item> ORES_NETHERITE_SCRAP = tag("ores/netherite_scrap");
|
||||
public static final TagKey<Item> ORES_QUARTZ = tag("ores/quartz");
|
||||
public static final TagKey<Item> ORES_REDSTONE = tag("ores/redstone");
|
||||
/**
|
||||
* Ores in deepslate (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_DEEPSLATE}) which could logically use deepslate as recipe input or output
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate");
|
||||
public static final TagKey<Item> ORES_IN_GROUND_DEEPSLATE = tag("ores_in_ground/deepslate");
|
||||
/**
|
||||
* Ores in netherrack (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_NETHERRACK}) which could logically use netherrack as recipe input or output
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack");
|
||||
public static final TagKey<Item> ORES_IN_GROUND_NETHERRACK = tag("ores_in_ground/netherrack");
|
||||
/**
|
||||
* Ores in stone (or in equivalent blocks in the tag {@link #ORE_BEARING_GROUND_STONE}) which could logically use stone as recipe input or output
|
||||
*/
|
||||
public static final IOptionalNamedTag<Item> ORES_IN_GROUND_STONE = tag("ores_in_ground/stone");
|
||||
public static final IOptionalNamedTag<Item> RAW_MATERIALS = tag("raw_materials");
|
||||
public static final IOptionalNamedTag<Item> RAW_MATERIALS_COPPER = tag("raw_materials/copper");
|
||||
public static final IOptionalNamedTag<Item> RAW_MATERIALS_GOLD = tag("raw_materials/gold");
|
||||
public static final IOptionalNamedTag<Item> RAW_MATERIALS_IRON = tag("raw_materials/iron");
|
||||
public static final IOptionalNamedTag<Item> RODS = tag("rods");
|
||||
public static final IOptionalNamedTag<Item> RODS_BLAZE = tag("rods/blaze");
|
||||
public static final IOptionalNamedTag<Item> RODS_WOODEN = tag("rods/wooden");
|
||||
public static final TagKey<Item> ORES_IN_GROUND_STONE = tag("ores_in_ground/stone");
|
||||
public static final TagKey<Item> RAW_MATERIALS = tag("raw_materials");
|
||||
public static final TagKey<Item> RAW_MATERIALS_COPPER = tag("raw_materials/copper");
|
||||
public static final TagKey<Item> RAW_MATERIALS_GOLD = tag("raw_materials/gold");
|
||||
public static final TagKey<Item> RAW_MATERIALS_IRON = tag("raw_materials/iron");
|
||||
public static final TagKey<Item> RODS = tag("rods");
|
||||
public static final TagKey<Item> RODS_BLAZE = tag("rods/blaze");
|
||||
public static final TagKey<Item> RODS_WOODEN = tag("rods/wooden");
|
||||
|
||||
public static final IOptionalNamedTag<Item> SAND = tag("sand");
|
||||
public static final IOptionalNamedTag<Item> SAND_COLORLESS = tag("sand/colorless");
|
||||
public static final IOptionalNamedTag<Item> SAND_RED = tag("sand/red");
|
||||
public static final TagKey<Item> SAND = tag("sand");
|
||||
public static final TagKey<Item> SAND_COLORLESS = tag("sand/colorless");
|
||||
public static final TagKey<Item> SAND_RED = tag("sand/red");
|
||||
|
||||
public static final IOptionalNamedTag<Item> SANDSTONE = tag("sandstone");
|
||||
public static final IOptionalNamedTag<Item> SEEDS = tag("seeds");
|
||||
public static final IOptionalNamedTag<Item> SEEDS_BEETROOT = tag("seeds/beetroot");
|
||||
public static final IOptionalNamedTag<Item> SEEDS_MELON = tag("seeds/melon");
|
||||
public static final IOptionalNamedTag<Item> SEEDS_PUMPKIN = tag("seeds/pumpkin");
|
||||
public static final IOptionalNamedTag<Item> SEEDS_WHEAT = tag("seeds/wheat");
|
||||
public static final IOptionalNamedTag<Item> SHEARS = tag("shears");
|
||||
public static final IOptionalNamedTag<Item> SLIMEBALLS = tag("slimeballs");
|
||||
public static final IOptionalNamedTag<Item> STAINED_GLASS = tag("stained_glass");
|
||||
public static final IOptionalNamedTag<Item> STAINED_GLASS_PANES = tag("stained_glass_panes");
|
||||
public static final IOptionalNamedTag<Item> STONE = tag("stone");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS = tag("storage_blocks");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron");
|
||||
public static final IOptionalNamedTag<Item> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
|
||||
public static final IOptionalNamedTag<Item> STRING = tag("string");
|
||||
public static final TagKey<Item> SANDSTONE = tag("sandstone");
|
||||
public static final TagKey<Item> SEEDS = tag("seeds");
|
||||
public static final TagKey<Item> SEEDS_BEETROOT = tag("seeds/beetroot");
|
||||
public static final TagKey<Item> SEEDS_MELON = tag("seeds/melon");
|
||||
public static final TagKey<Item> SEEDS_PUMPKIN = tag("seeds/pumpkin");
|
||||
public static final TagKey<Item> SEEDS_WHEAT = tag("seeds/wheat");
|
||||
public static final TagKey<Item> SHEARS = tag("shears");
|
||||
public static final TagKey<Item> SLIMEBALLS = tag("slimeballs");
|
||||
public static final TagKey<Item> STAINED_GLASS = tag("stained_glass");
|
||||
public static final TagKey<Item> STAINED_GLASS_PANES = tag("stained_glass_panes");
|
||||
public static final TagKey<Item> STONE = tag("stone");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS = tag("storage_blocks");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_AMETHYST = tag("storage_blocks/amethyst");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_COAL = tag("storage_blocks/coal");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_COPPER = tag("storage_blocks/copper");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_DIAMOND = tag("storage_blocks/diamond");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_EMERALD = tag("storage_blocks/emerald");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_GOLD = tag("storage_blocks/gold");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_IRON = tag("storage_blocks/iron");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_LAPIS = tag("storage_blocks/lapis");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_NETHERITE = tag("storage_blocks/netherite");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_QUARTZ = tag("storage_blocks/quartz");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_RAW_COPPER = tag("storage_blocks/raw_copper");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_RAW_GOLD = tag("storage_blocks/raw_gold");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_RAW_IRON = tag("storage_blocks/raw_iron");
|
||||
public static final TagKey<Item> STORAGE_BLOCKS_REDSTONE = tag("storage_blocks/redstone");
|
||||
public static final TagKey<Item> STRING = tag("string");
|
||||
|
||||
private static IOptionalNamedTag<Item> tag(String name, @Nullable Set<Supplier<Item>> defaults)
|
||||
private static TagKey<Item> tag(String name, @Nullable Set<Supplier<Item>> defaults)
|
||||
{
|
||||
return ItemTags.createOptional(new ResourceLocation("forge", name), defaults);
|
||||
return ItemTags.create(new ResourceLocation("forge", name));
|
||||
}
|
||||
|
||||
private static IOptionalNamedTag<Item> tag(String name)
|
||||
private static TagKey<Item> tag(String name)
|
||||
{
|
||||
return tag(name, null);
|
||||
}
|
||||
@@ -406,20 +406,11 @@ public class Tags
|
||||
{
|
||||
private static void init() {}
|
||||
|
||||
public static final IOptionalNamedTag<Fluid> MILK = tag("milk");
|
||||
public static final TagKey<Fluid> MILK = tag("milk");
|
||||
|
||||
private static IOptionalNamedTag<Fluid> tag(String name)
|
||||
private static TagKey<Fluid> tag(String name)
|
||||
{
|
||||
return FluidTags.createOptional(new ResourceLocation("forge", name));
|
||||
return FluidTags.create(new ResourceLocation("forge", name));
|
||||
}
|
||||
}
|
||||
|
||||
public interface IOptionalNamedTag<T> extends Named<T>
|
||||
{
|
||||
/**
|
||||
* Returns true if the current state is defaulted. This means we have connected to a server that does not contain this tag.
|
||||
* The values referenced in this tag may be empty, or some values specified by the original tag creator.
|
||||
*/
|
||||
boolean isDefaulted();
|
||||
}
|
||||
}
|
||||
@@ -20,7 +20,7 @@ import net.minecraft.server.packs.resources.Resource;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.resources.SimplePreparableReloadListener;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.item.DiggerItem;
|
||||
@@ -127,7 +127,7 @@ public class TierSortingRegistry
|
||||
return isCorrectTierVanilla(tier, state);
|
||||
|
||||
for (int x = sortedTiers.indexOf(tier) + 1; x < sortedTiers.size(); x++) {
|
||||
Tag<Block> tag = sortedTiers.get(x).getTag();
|
||||
TagKey<Block> tag = sortedTiers.get(x).getTag();
|
||||
if (tag != null && state.is(tag))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -7,17 +7,19 @@ package net.minecraftforge.common.crafting.conditions;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.SerializationTags;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class TagEmptyCondition implements ICondition
|
||||
{
|
||||
private static final ResourceLocation NAME = new ResourceLocation("forge", "tag_empty");
|
||||
private final ResourceLocation tag_name;
|
||||
private final TagKey<Item> tag;
|
||||
|
||||
public TagEmptyCondition(String location)
|
||||
{
|
||||
@@ -31,7 +33,7 @@ public class TagEmptyCondition implements ICondition
|
||||
|
||||
public TagEmptyCondition(ResourceLocation tag)
|
||||
{
|
||||
this.tag_name = tag;
|
||||
this.tag = TagKey.create(Registry.ITEM_REGISTRY, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -43,14 +45,13 @@ public class TagEmptyCondition implements ICondition
|
||||
@Override
|
||||
public boolean test()
|
||||
{
|
||||
Tag<Item> tag = SerializationTags.getInstance().getOrEmpty(Registry.ITEM_REGISTRY).getTag(tag_name);
|
||||
return tag == null || tag.getValues().isEmpty();
|
||||
return !Registry.ITEM.getTag(tag).map(HolderSet.Named::iterator).map(Iterator::hasNext).orElse(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "tag_empty(\"" + tag_name + "\")";
|
||||
return "tag_empty(\"" + tag.location() + "\")";
|
||||
}
|
||||
|
||||
public static class Serializer implements IConditionSerializer<TagEmptyCondition>
|
||||
@@ -60,7 +61,7 @@ public class TagEmptyCondition implements ICondition
|
||||
@Override
|
||||
public void write(JsonObject json, TagEmptyCondition value)
|
||||
{
|
||||
json.addProperty("tag", value.tag_name.toString());
|
||||
json.addProperty("tag", value.tag.location().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,7 +8,9 @@ package net.minecraftforge.common.data;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -23,22 +25,19 @@ import net.minecraft.data.HashCache;
|
||||
import net.minecraft.server.packs.FilePackResources;
|
||||
import net.minecraft.server.packs.FolderPackResources;
|
||||
import net.minecraft.server.packs.repository.ServerPacksSource;
|
||||
import net.minecraft.server.packs.resources.MultiPackResourceManager;
|
||||
import net.minecraft.server.packs.resources.Resource;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.server.packs.PackResources;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.minecraft.server.packs.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.server.packs.VanillaPackResources;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.client.model.generators.ModelBuilder;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.forgespi.locating.IModFile;
|
||||
import net.minecraftforge.resource.PathResourcePack;
|
||||
import net.minecraftforge.resource.ResourcePackLoader;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
@@ -79,7 +78,7 @@ public class ExistingFileHelper {
|
||||
public String getPrefix() { return prefix; }
|
||||
}
|
||||
|
||||
private final SimpleReloadableResourceManager clientResources, serverData;
|
||||
private final MultiPackResourceManager clientResources, serverData;
|
||||
private final boolean enable;
|
||||
private final Multimap<PackType, ResourceLocation> generated = HashMultimap.create();
|
||||
|
||||
@@ -97,29 +96,33 @@ public class ExistingFileHelper {
|
||||
* @param assetsDir the directory in which to find vanilla assets and indexes
|
||||
*/
|
||||
public ExistingFileHelper(Collection<Path> existingPacks, final Set<String> existingMods, boolean enable, @Nullable final String assetIndex, @Nullable final File assetsDir) {
|
||||
this.clientResources = new SimpleReloadableResourceManager(PackType.CLIENT_RESOURCES);
|
||||
this.serverData = new SimpleReloadableResourceManager(PackType.SERVER_DATA);
|
||||
List<PackResources> candidateClientResources = new ArrayList<>();
|
||||
List<PackResources> candidateServerResources = new ArrayList<>();
|
||||
|
||||
this.clientResources.add(new VanillaPackResources(ClientPackSource.BUILT_IN, "minecraft", "realms"));
|
||||
candidateClientResources.add(new VanillaPackResources(ClientPackSource.BUILT_IN, "minecraft", "realms"));
|
||||
if (assetIndex != null && assetsDir != null)
|
||||
{
|
||||
this.clientResources.add(new DefaultClientPackResources(ClientPackSource.BUILT_IN, new AssetIndex(assetsDir, assetIndex)));
|
||||
candidateClientResources.add(new DefaultClientPackResources(ClientPackSource.BUILT_IN, new AssetIndex(assetsDir, assetIndex)));
|
||||
}
|
||||
this.serverData.add(new VanillaPackResources(ServerPacksSource.BUILT_IN_METADATA, "minecraft"));
|
||||
candidateServerResources.add(new VanillaPackResources(ServerPacksSource.BUILT_IN_METADATA, "minecraft"));
|
||||
for (Path existing : existingPacks) {
|
||||
File file = existing.toFile();
|
||||
PackResources pack = file.isDirectory() ? new FolderPackResources(file) : new FilePackResources(file);
|
||||
this.clientResources.add(pack);
|
||||
this.serverData.add(pack);
|
||||
candidateClientResources.add(pack);
|
||||
candidateServerResources.add(pack);
|
||||
}
|
||||
for (String existingMod : existingMods) {
|
||||
IModFileInfo modFileInfo = ModList.get().getModFileById(existingMod);
|
||||
if (modFileInfo != null) {
|
||||
PackResources pack = ResourcePackLoader.createPackForMod(modFileInfo);
|
||||
this.clientResources.add(pack);
|
||||
this.serverData.add(pack);
|
||||
candidateClientResources.add(pack);
|
||||
candidateServerResources.add(pack);
|
||||
}
|
||||
}
|
||||
|
||||
this.clientResources = new MultiPackResourceManager(PackType.CLIENT_RESOURCES, candidateClientResources);
|
||||
this.serverData = new MultiPackResourceManager(PackType.SERVER_DATA, candidateServerResources);
|
||||
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.data.tags.BlockTagsProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
@@ -103,13 +104,13 @@ public final class ForgeBlockTagsProvider extends BlockTagsProvider
|
||||
tag(STORAGE_BLOCKS_NETHERITE).add(Blocks.NETHERITE_BLOCK);
|
||||
}
|
||||
|
||||
private void addColored(Consumer<Block> consumer, Tag.Named<Block> group, String pattern)
|
||||
private void addColored(Consumer<Block> consumer, TagKey<Block> group, String pattern)
|
||||
{
|
||||
String prefix = group.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
for (DyeColor color : DyeColor.values())
|
||||
{
|
||||
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName()));
|
||||
Tag.Named<Block> tag = getForgeTag(prefix + color.getName());
|
||||
TagKey<Block> tag = getForgeTag(prefix + color.getName());
|
||||
Block block = ForgeRegistries.BLOCKS.getValue(key);
|
||||
if (block == null || block == Blocks.AIR)
|
||||
throw new IllegalStateException("Unknown vanilla block: " + key.toString());
|
||||
@@ -119,12 +120,12 @@ public final class ForgeBlockTagsProvider extends BlockTagsProvider
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Tag.Named<Block> getForgeTag(String name)
|
||||
private TagKey<Block> getForgeTag(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
name = name.toUpperCase(Locale.ENGLISH);
|
||||
return (Tag.Named<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
|
||||
return (TagKey<Block>) Tags.Blocks.class.getDeclaredField(name).get(null);
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.data.tags.BlockTagsProvider;
|
||||
import net.minecraft.data.tags.ItemTagsProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
@@ -155,13 +156,13 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider
|
||||
tag(Tags.Items.STRING).add(Items.STRING);
|
||||
}
|
||||
|
||||
private void addColored(Consumer<Tag.Named<Item>> consumer, Tag.Named<Item> group, String pattern)
|
||||
private void addColored(Consumer<TagKey<Item>> consumer, TagKey<Item> group, String pattern)
|
||||
{
|
||||
String prefix = group.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
String prefix = group.location().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
for (DyeColor color : DyeColor.values())
|
||||
{
|
||||
ResourceLocation key = new ResourceLocation("minecraft", pattern.replace("{color}", color.getName()));
|
||||
Tag.Named<Item> tag = getForgeItemTag(prefix + color.getName());
|
||||
TagKey<Item> tag = getForgeItemTag(prefix + color.getName());
|
||||
Item item = ForgeRegistries.ITEMS.getValue(key);
|
||||
if (item == null || item == Items.AIR)
|
||||
throw new IllegalStateException("Unknown vanilla item: " + key.toString());
|
||||
@@ -170,26 +171,26 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider
|
||||
}
|
||||
}
|
||||
|
||||
private void copyColored(Tag.Named<Block> blockGroup, Tag.Named<Item> itemGroup)
|
||||
private void copyColored(TagKey<Block> blockGroup, TagKey<Item> itemGroup)
|
||||
{
|
||||
String blockPre = blockGroup.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
String itemPre = itemGroup.getName().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
String blockPre = blockGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
String itemPre = itemGroup.location().getPath().toUpperCase(Locale.ENGLISH) + '_';
|
||||
for (DyeColor color : DyeColor.values())
|
||||
{
|
||||
Tag.Named<Block> from = getForgeBlockTag(blockPre + color.getName());
|
||||
Tag.Named<Item> to = getForgeItemTag(itemPre + color.getName());
|
||||
TagKey<Block> from = getForgeBlockTag(blockPre + color.getName());
|
||||
TagKey<Item> to = getForgeItemTag(itemPre + color.getName());
|
||||
copy(from, to);
|
||||
}
|
||||
copy(getForgeBlockTag(blockPre + "colorless"), getForgeItemTag(itemPre + "colorless"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Tag.Named<Block> getForgeBlockTag(String name)
|
||||
private TagKey<Block> getForgeBlockTag(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
name = name.toUpperCase(Locale.ENGLISH);
|
||||
return (Tag.Named<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
|
||||
return (TagKey<Block>)Tags.Blocks.class.getDeclaredField(name).get(null);
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
|
||||
{
|
||||
@@ -198,12 +199,12 @@ public final class ForgeItemTagsProvider extends ItemTagsProvider
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Tag.Named<Item> getForgeItemTag(String name)
|
||||
private TagKey<Item> getForgeItemTag(String name)
|
||||
{
|
||||
try
|
||||
{
|
||||
name = name.toUpperCase(Locale.ENGLISH);
|
||||
return (Tag.Named<Item>)Tags.Items.class.getDeclaredField(name).get(null);
|
||||
return (TagKey<Item>)Tags.Items.class.getDeclaredField(name).get(null);
|
||||
}
|
||||
catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException | SecurityException e)
|
||||
{
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
@@ -32,7 +33,7 @@ import java.util.function.Consumer;
|
||||
|
||||
public final class ForgeRecipeProvider extends RecipeProvider
|
||||
{
|
||||
private Map<Item, Tag<Item>> replacements = new HashMap<>();
|
||||
private Map<Item, TagKey<Item>> replacements = new HashMap<>();
|
||||
private Set<ResourceLocation> excludes = new HashSet<>();
|
||||
|
||||
public ForgeRecipeProvider(DataGenerator generatorIn)
|
||||
@@ -45,7 +46,7 @@ public final class ForgeRecipeProvider extends RecipeProvider
|
||||
excludes.add(item.asItem().getRegistryName());
|
||||
}
|
||||
|
||||
private void replace(ItemLike item, Tag<Item> tag)
|
||||
private void replace(ItemLike item, TagKey<Item> tag)
|
||||
{
|
||||
replacements.put(item.asItem(), tag);
|
||||
}
|
||||
@@ -148,7 +149,7 @@ public final class ForgeRecipeProvider extends RecipeProvider
|
||||
if (entry instanceof ItemValue)
|
||||
{
|
||||
ItemStack stack = entry.getItems().stream().findFirst().orElse(ItemStack.EMPTY);
|
||||
Tag<Item> replacement = replacements.get(stack.getItem());
|
||||
TagKey<Item> replacement = replacements.get(stack.getItem());
|
||||
if (replacement != null)
|
||||
{
|
||||
items.add(new TagValue(replacement));
|
||||
|
||||
@@ -57,6 +57,7 @@ public abstract class ForgeRegistryTagsProvider<T extends IForgeRegistryEntry<T>
|
||||
@Override
|
||||
protected Path getPath(ResourceLocation id)
|
||||
{
|
||||
//TODO-PATCHING: Mojang has introduced logic here to determine where the tags go, we need to replicate that logic possibly.
|
||||
return generator.getOutputFolder().resolve("data/" + id.getNamespace() + "/tags/" + folder + "/" + id.getPath() + ".json");
|
||||
}
|
||||
}
|
||||
@@ -602,7 +602,7 @@ public interface IForgeBlock
|
||||
{
|
||||
if (entity instanceof EnderDragon)
|
||||
{
|
||||
return !BlockTags.DRAGON_IMMUNE.contains(this.self());
|
||||
return !this.self().defaultBlockState().is(BlockTags.DRAGON_IMMUNE);
|
||||
}
|
||||
else if ((entity instanceof WitherBoss) ||
|
||||
(entity instanceof WitherSkull))
|
||||
@@ -621,12 +621,6 @@ public interface IForgeBlock
|
||||
return state.getBlock().dropFromExplosion(explosion);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of tags names this is known to be associated with.
|
||||
* This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.
|
||||
*/
|
||||
Set<ResourceLocation> getTags();
|
||||
|
||||
/**
|
||||
* Called when the block is destroyed by an explosion.
|
||||
* Useful for allowing the block to take into account tile entities,
|
||||
|
||||
@@ -9,11 +9,11 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.tags.SetTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -35,7 +35,7 @@ public interface IForgeFluid
|
||||
* @param tag Fluid category
|
||||
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
|
||||
*/
|
||||
default boolean isEntityInside(FluidState state, LevelReader level, BlockPos pos, Entity entity, double yToTest, SetTag<Fluid> tag, boolean testingHead)
|
||||
default boolean isEntityInside(FluidState state, LevelReader level, BlockPos pos, Entity entity, double yToTest, HolderSet<Fluid> tag, boolean testingHead)
|
||||
{
|
||||
return state.is(tag) && yToTest < (double)(pos.getY() + state.getHeight(level, pos) + 0.11111111F);
|
||||
}
|
||||
@@ -94,11 +94,12 @@ public interface IForgeFluid
|
||||
return this.getFluid().getRenderLayer() == layer;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Retrieves a list of tags names this is known to be associated with.
|
||||
* This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.
|
||||
*/
|
||||
Set<ResourceLocation> getTags();
|
||||
// /**
|
||||
// * Retrieves a list of tags names this is known to be associated with.
|
||||
// * This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.
|
||||
// */
|
||||
// Set<ResourceLocation> getTags();
|
||||
// TODO-PATCHING: Tag locations are now TagKeys
|
||||
|
||||
/**
|
||||
* Retrieves the non-vanilla fluid attributes, including localized name.
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
package net.minecraftforge.common.extensions;
|
||||
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.tags.SetTag;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
@@ -32,7 +32,7 @@ public interface IForgeFluidState
|
||||
* @param tag to test for.
|
||||
* @param testingHead when true, its testing the entities head for vision, breathing ect... otherwise its testing the body, for swimming and movement adjustment.
|
||||
*/
|
||||
default boolean isEntityInside(LevelReader level, BlockPos pos, Entity entity, double yToTest, SetTag<Fluid> tag, boolean testingHead)
|
||||
default boolean isEntityInside(LevelReader level, BlockPos pos, Entity entity, double yToTest, HolderSet<Fluid> tag, boolean testingHead)
|
||||
{
|
||||
// return ifluidstate.isTagged(p_213290_1_) && d0 < (double)((float)blockpos.getY() + ifluidstate.getActualHeight(this.level, blockpos) + 0.11111111F);
|
||||
return self().getType().isEntityInside(self(), level, pos, entity, yToTest, tag, testingHead);
|
||||
|
||||
@@ -639,12 +639,6 @@ public interface IForgeItem
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a list of tags names this is known to be associated with.
|
||||
* This should be used in favor of TagCollection.getOwningTags, as this caches the result and automatically updates when the TagCollection changes.
|
||||
*/
|
||||
Set<ResourceLocation> getTags();
|
||||
|
||||
/**
|
||||
* Reduce the durability of this item by the amount given.
|
||||
* This can be used to e.g. consume power from NBT before durability.
|
||||
|
||||
@@ -8,9 +8,11 @@ package net.minecraftforge.common.extensions;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.monster.EnderMan;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
@@ -80,7 +82,8 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundTag>
|
||||
Player entityplayer = context.getPlayer();
|
||||
BlockPos blockpos = context.getClickedPos();
|
||||
BlockInWorld blockworldstate = new BlockInWorld(context.getLevel(), blockpos, false);
|
||||
if (entityplayer != null && !entityplayer.getAbilities().mayBuild && !self().hasAdventureModePlaceTagForBlock(context.getLevel().getTagManager(), blockworldstate)) {
|
||||
Registry<Block> registry = entityplayer.level.registryAccess().registryOrThrow(Registry.BLOCK_REGISTRY);
|
||||
if (entityplayer != null && !entityplayer.getAbilities().mayBuild && !self().hasAdventureModePlaceTagForBlock(registry, blockworldstate)) {
|
||||
return InteractionResult.PASS;
|
||||
} else {
|
||||
Item item = self().getItem();
|
||||
@@ -270,17 +273,6 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundTag>
|
||||
self().getItem().onHorseArmorTick(self(), level, horse);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an item entity for this stack is destroyed.
|
||||
*
|
||||
* @param itemEntity The item entity that was destroyed.
|
||||
* @param damageSource Damage source that caused the item entity to "die".
|
||||
*/
|
||||
default void onDestroyed(ItemEntity itemEntity, DamageSource damageSource)
|
||||
{
|
||||
self().getItem().onDestroyed(itemEntity, damageSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the specific ItemStack can be placed in the specified armor
|
||||
* slot, for the entity.
|
||||
@@ -490,4 +482,15 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundTag>
|
||||
{
|
||||
return self().getItem().getSweepHitBox(self(), player, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when an item entity for this stack is destroyed. Note: The {@link ItemStack} can be retrieved from the item entity.
|
||||
*
|
||||
* @param itemEntity The item entity that was destroyed.
|
||||
* @param damageSource Damage source that caused the item entity to "die".
|
||||
*/
|
||||
default void onDestroyed(ItemEntity itemEntity, DamageSource damageSource)
|
||||
{
|
||||
self().getItem().onDestroyed(itemEntity, damageSource);
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public interface IForgeRawTagBuilder
|
||||
{
|
||||
return (Tag.Builder)this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* internal, called when a raw builder is written to json to add forge additions (e.g. the remove list)
|
||||
*/
|
||||
@@ -28,14 +28,14 @@ public interface IForgeRawTagBuilder
|
||||
Tag.Builder rawBuilder = this.getRawBuilder();
|
||||
Stream<Tag.BuilderEntry> removeEntries = rawBuilder.getRemoveEntries();
|
||||
JsonArray removeEntriesAsJsonArray = new JsonArray();
|
||||
removeEntries.forEach(proxy ->proxy.getEntry().serializeTo(removeEntriesAsJsonArray));
|
||||
removeEntries.forEach(proxy ->proxy.entry().serializeTo(removeEntriesAsJsonArray));
|
||||
if (removeEntriesAsJsonArray.size() > 0)
|
||||
{
|
||||
tagJson.add("remove", removeEntriesAsJsonArray);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a tag entry to the remove list.
|
||||
* @param tagEntry The tag entry to add to the remove list
|
||||
@@ -46,7 +46,7 @@ public interface IForgeRawTagBuilder
|
||||
{
|
||||
return this.getRawBuilder().remove(new Tag.BuilderEntry(tagEntry,source));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a single-element entry to the remove list.
|
||||
* @param elementID The ID of the element to add to the remove list
|
||||
@@ -58,7 +58,7 @@ public interface IForgeRawTagBuilder
|
||||
return this.remove(new Tag.ElementEntry(elementID), source);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Adds a tag to the remove list.
|
||||
* @param tagID The ID of the tag to add to the remove list
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge - Forge Development LLC
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.extensions;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.util.random.WeightedRandomList;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
|
||||
public interface IForgeStructureFeature
|
||||
{
|
||||
private StructureFeature<?> self()
|
||||
{
|
||||
return (StructureFeature<?>) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default list of spawns for this structure, of the specified category.
|
||||
*
|
||||
* @apiNote Implement this over any of the type specific getSpecial functions in StructureFeature.
|
||||
*/
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
default List<MobSpawnSettings.SpawnerData> getDefaultSpawnList(MobCategory category)
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the default for if entity spawns are restricted to being inside of the pieces making up the structure or if being in the bounds of the overall structure
|
||||
* is good enough.
|
||||
* @return {@code true} if the location to check spawns for has to be inside of the pieces making up the structure, {@code false} otherwise.
|
||||
*/
|
||||
default boolean getDefaultRestrictsSpawnsToInside()
|
||||
{
|
||||
//The Pillager Outpost and Ocean Monument check the full structure by default instead of limiting themselves to being within the structure's bounds
|
||||
return self() != StructureFeature.PILLAGER_OUTPOST && self() != StructureFeature.OCEAN_MONUMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to get the list of entity spawns for this structure for the given classification.
|
||||
* @param classification The classification of entities.
|
||||
* @apiNote This method is marked as final in {@link StructureFeature} so as to not be overridden by modders and breaking support for
|
||||
* {@link net.minecraftforge.event.world.StructureSpawnListGatherEvent}.
|
||||
*/
|
||||
WeightedRandomList<MobSpawnSettings.SpawnerData> getSpawnList(MobCategory classification);
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.data.tags.TagsProvider;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagKey;
|
||||
|
||||
public interface IForgeTagAppender<T>
|
||||
{
|
||||
@@ -17,22 +18,14 @@ public interface IForgeTagAppender<T>
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
default TagsProvider.TagAppender<T> addTags(Tag.Named<T>... values) {
|
||||
default TagsProvider.TagAppender<T> addTags(TagKey<T>... values) {
|
||||
TagsProvider.TagAppender<T> builder = self();
|
||||
for (Tag.Named<T> value : values) {
|
||||
for (TagKey<T> value : values) {
|
||||
builder.addTag(value);
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
default TagsProvider.TagAppender<T> add(ResourceKey<T>... keys) {
|
||||
TagsProvider.TagAppender<T> builder = self();
|
||||
for (ResourceKey<T> key : keys) {
|
||||
builder.getInternalBuilder().addElement(key.location(), self().getModID());
|
||||
}
|
||||
return builder;
|
||||
}
|
||||
|
||||
default TagsProvider.TagAppender<T> replace() {
|
||||
return replace(true);
|
||||
}
|
||||
@@ -42,16 +35,6 @@ public interface IForgeTagAppender<T>
|
||||
return self();
|
||||
}
|
||||
|
||||
default TagsProvider.TagAppender<T> addOptional(final ResourceLocation location)
|
||||
{
|
||||
return self().add(new Tag.OptionalElementEntry(location));
|
||||
}
|
||||
|
||||
default TagsProvider.TagAppender<T> addOptionalTag(final ResourceLocation location)
|
||||
{
|
||||
return self().add(new Tag.OptionalTagEntry(location));
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a registry entry to the tag json's remove list. Callable during datageneration.
|
||||
* @param entry The entry to remove
|
||||
@@ -61,7 +44,7 @@ public interface IForgeTagAppender<T>
|
||||
{
|
||||
return remove(this.self().registry.getKey(entry));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds multiple registry entries to the tag json's remove list. Callable during datageneration.
|
||||
* @param entries The entries to remove
|
||||
@@ -77,7 +60,7 @@ public interface IForgeTagAppender<T>
|
||||
}
|
||||
return self();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a single element's ID to the tag json's remove list. Callable during datageneration.
|
||||
* @param location The ID of the element to remove
|
||||
@@ -89,7 +72,7 @@ public interface IForgeTagAppender<T>
|
||||
builder.getInternalBuilder().removeElement(location, builder.getModID());
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds multiple elements' IDs to the tag json's remove list. Callable during datageneration.
|
||||
* @param locations The IDs of the elements to remove
|
||||
@@ -104,29 +87,29 @@ public interface IForgeTagAppender<T>
|
||||
}
|
||||
return self();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a tag to the tag json's remove list. Callable during datageneration.
|
||||
* @param tag The ID of the tag to remove
|
||||
* @return The builder for chaining
|
||||
*/
|
||||
default TagsProvider.TagAppender<T> remove(Tag.Named<T> tag)
|
||||
default TagsProvider.TagAppender<T> remove(TagKey<T> tag)
|
||||
{
|
||||
TagsProvider.TagAppender<T> builder = self();
|
||||
builder.getInternalBuilder().removeTag(tag.getName(), builder.getModID());
|
||||
builder.getInternalBuilder().removeTag(tag.location(), builder.getModID());
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds multiple tags to the tag json's remove list. Callable during datageneration.
|
||||
* @param tags The IDs of the tags to remove
|
||||
* @return The builder for chaining
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
default TagsProvider.TagAppender<T> remove(Tag.Named<T> first, Tag.Named<T>...tags)
|
||||
default TagsProvider.TagAppender<T> remove(TagKey<T> first, TagKey<T>...tags)
|
||||
{
|
||||
this.remove(first);
|
||||
for (Tag.Named<T> tag : tags)
|
||||
for (TagKey<T> tag : tags)
|
||||
{
|
||||
this.remove(tag);
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Minecraft Forge - Forge Development LLC
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.util;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagCollection;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
public class ReverseTagWrapper<T>
|
||||
{
|
||||
private final T target;
|
||||
private final Supplier<TagCollection<T>> colSupplier;
|
||||
|
||||
//This map is immutable we track its identity change.
|
||||
private Map<ResourceLocation, Tag<T>> colCache;
|
||||
private Set<ResourceLocation> cache = null;
|
||||
|
||||
public ReverseTagWrapper(T target, Supplier<TagCollection<T>> colSupplier)
|
||||
{
|
||||
this.target = target;
|
||||
this.colSupplier = colSupplier;
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getTagNames()
|
||||
{
|
||||
TagCollection<T> collection = colSupplier.get();
|
||||
if (cache == null || colCache != collection.getAllTags()) // Identity equals.
|
||||
{
|
||||
this.cache = Collections.unmodifiableSet(new HashSet<>(collection.getMatchingTags(target)));
|
||||
this.colCache = collection.getAllTags();
|
||||
}
|
||||
return this.cache;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
package net.minecraftforge.common.world;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.world.level.biome.BiomeGenerationSettings;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
@@ -18,16 +20,23 @@ public class BiomeGenerationSettingsBuilder extends BiomeGenerationSettings.Buil
|
||||
{
|
||||
public BiomeGenerationSettingsBuilder(BiomeGenerationSettings orig)
|
||||
{
|
||||
orig.getCarvingStages().forEach(k -> carvers.put(k, new ArrayList<>(orig.getCarvers(k))));
|
||||
orig.features().forEach(l -> features.add(new ArrayList<>(l)));
|
||||
orig.getCarvingStages().forEach(k -> {
|
||||
carvers.put(k, new ArrayList<>());
|
||||
orig.getCarvers(k).forEach(v -> carvers.get(k).add(v));
|
||||
});
|
||||
orig.features().forEach(l -> {
|
||||
final ArrayList<Holder<PlacedFeature>> featureList = new ArrayList<>();
|
||||
l.forEach(featureList::add);
|
||||
features.add(featureList);
|
||||
});
|
||||
}
|
||||
|
||||
public List<Supplier<PlacedFeature>> getFeatures(GenerationStep.Decoration stage) {
|
||||
public List<Holder<PlacedFeature>> getFeatures(GenerationStep.Decoration stage) {
|
||||
addFeatureStepsUpTo(stage.ordinal());
|
||||
return features.get(stage.ordinal());
|
||||
}
|
||||
|
||||
public List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving stage) {
|
||||
public List<Holder<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving stage) {
|
||||
return carvers.computeIfAbsent(stage, key -> new ArrayList<>());
|
||||
}
|
||||
}
|
||||
@@ -5,25 +5,10 @@
|
||||
|
||||
package net.minecraftforge.common.world;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import javax.annotation.Nullable;
|
||||
import net.minecraft.util.random.WeightedRandomList;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.world.StructureSpawnListGatherEvent;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
//TODO-PATCHING: Reengineer this with configured features in mind as those are what handle spawning right now.s
|
||||
/**
|
||||
* Class to help manage entity spawns inside of structures
|
||||
*/
|
||||
* /
|
||||
public class StructureSpawnManager
|
||||
{
|
||||
private static Map<StructureFeature<?>, StructureSpawnInfo> structuresWithSpawns = Collections.emptyMap();
|
||||
@@ -31,7 +16,7 @@ public class StructureSpawnManager
|
||||
/**
|
||||
* Gathers potential entity spawns for all the different registered structures.
|
||||
* @apiNote Internal
|
||||
*/
|
||||
* /
|
||||
public static void gatherEntitySpawns()
|
||||
{
|
||||
//We use a linked hash map to ensure that we check the structures in an order that if there are multiple structures a position satisfies
|
||||
@@ -75,7 +60,7 @@ public class StructureSpawnManager
|
||||
* @param structureManager Structure Manager, used to check if a position is within a structure.
|
||||
* @param classification Entity classification
|
||||
* @param pos Position to get entity spawns of
|
||||
*/
|
||||
* /
|
||||
@Nullable
|
||||
public static WeightedRandomList<MobSpawnSettings.SpawnerData> getStructureSpawns(StructureFeatureManager structureManager, MobCategory classification, BlockPos pos)
|
||||
{
|
||||
@@ -100,7 +85,7 @@ public class StructureSpawnManager
|
||||
* Gets the entity spawn lists for entities of a given classification for a given structure.
|
||||
* @param structure The Structure
|
||||
* @param classification The classification to lookup
|
||||
*/
|
||||
* /
|
||||
public static WeightedRandomList<MobSpawnSettings.SpawnerData> getSpawnList(StructureFeature<?> structure, MobCategory classification)
|
||||
{
|
||||
StructureSpawnInfo info = structuresWithSpawns.get(structure);
|
||||
@@ -111,7 +96,7 @@ public class StructureSpawnManager
|
||||
|
||||
/**
|
||||
* Helper class to keep track of spawns and if the spawns should be restricted to inside the structure pieces.
|
||||
*/
|
||||
* /
|
||||
private static class StructureSpawnInfo
|
||||
{
|
||||
private final Map<MobCategory, WeightedRandomList<MobSpawnSettings.SpawnerData>> spawns;
|
||||
@@ -124,3 +109,4 @@ public class StructureSpawnManager
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -6,8 +6,8 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.server.ServerResources;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -22,7 +22,7 @@ import java.util.concurrent.Executor;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener.PreparationBarrier;
|
||||
|
||||
/**
|
||||
* The main ResourceManager is recreated on each reload, through {@link ServerResources}'s creation.
|
||||
* The main ResourceManager is recreated on each reload, through {@link MinecraftServer.ReloadableResources}'s creation.
|
||||
*
|
||||
* The event is fired on each reload and lets modders add their own ReloadListeners, for server-side resources.
|
||||
* The event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
@@ -30,30 +30,34 @@ import net.minecraft.server.packs.resources.PreparableReloadListener.Preparation
|
||||
public class AddReloadListenerEvent extends Event
|
||||
{
|
||||
private final List<PreparableReloadListener> listeners = new ArrayList<>();
|
||||
private final ServerResources dataPackRegistries;
|
||||
|
||||
public AddReloadListenerEvent(ServerResources dataPackRegistries)
|
||||
/*
|
||||
private final MinecraftServer.ReloadableResources dataPackRegistries;
|
||||
|
||||
public AddReloadListenerEvent(MinecraftServer.ReloadableResources dataPackRegistries)
|
||||
{
|
||||
this.dataPackRegistries = dataPackRegistries;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param listener the listener to add to the ResourceManager on reload
|
||||
*/
|
||||
public void addListener(PreparableReloadListener listener)
|
||||
{
|
||||
listeners.add(new WrappedStateAwareListener(listener));
|
||||
}
|
||||
public void addListener(PreparableReloadListener listener)
|
||||
{
|
||||
listeners.add(new WrappedStateAwareListener(listener));
|
||||
}
|
||||
|
||||
public List<PreparableReloadListener> getListeners()
|
||||
{
|
||||
return ImmutableList.copyOf(listeners);
|
||||
}
|
||||
|
||||
public ServerResources getDataPackRegistries()
|
||||
public List<PreparableReloadListener> getListeners()
|
||||
{
|
||||
return ImmutableList.copyOf(listeners);
|
||||
}
|
||||
|
||||
/*
|
||||
public MinecraftServer.ReloadableResources getDataPackRegistries()
|
||||
{
|
||||
return dataPackRegistries;
|
||||
}
|
||||
*/
|
||||
private static class WrappedStateAwareListener implements PreparableReloadListener {
|
||||
private final PreparableReloadListener wrapped;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.entity.projectile.FireworkRocketEntity;
|
||||
@@ -48,7 +49,6 @@ import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
import net.minecraft.server.packs.resources.PreparableReloadListener;
|
||||
import net.minecraft.server.ServerResources;
|
||||
import net.minecraft.world.level.BaseSpawner;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
@@ -709,9 +709,9 @@ public class ForgeEventFactory
|
||||
return event.getNewTime();
|
||||
}
|
||||
|
||||
public static List<PreparableReloadListener> onResourceReload(ServerResources dataPackRegistries)
|
||||
public static List<PreparableReloadListener> onResourceReload(/*MinecraftServer.ReloadableResources dataPackRegistries*/)
|
||||
{
|
||||
AddReloadListenerEvent event = new AddReloadListenerEvent(dataPackRegistries);
|
||||
AddReloadListenerEvent event = new AddReloadListenerEvent(/*dataPackRegistries*/);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event.getListeners();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import net.minecraft.server.ServerResources;
|
||||
import net.minecraft.server.ReloadableServerResources;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
/**
|
||||
* Commands are rebuilt whenever {@link ServerResources} is recreated.
|
||||
* Commands are rebuilt whenever {@link ReloadableServerResources} is recreated.
|
||||
* You can use this event to register your commands whenever the {@link Commands} class in constructed.
|
||||
*
|
||||
* The event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
|
||||
@@ -5,33 +5,23 @@
|
||||
|
||||
package net.minecraftforge.event;
|
||||
|
||||
import net.minecraft.tags.TagContainer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
|
||||
/**
|
||||
* Fired on the client when :
|
||||
* {@link TagContainer} has all of its tags synced from the server to the client (just after a client has connected).
|
||||
* The integrated server is about to be created see {@code net.minecraft.client.Minecraft#doLoadLevel}
|
||||
* Fired on the server when {@link TagContainer} has read all tags from disk, during initial load and after the reload command is used
|
||||
* This event is fired on the {@link MinecraftForge#EVENT_BUS}
|
||||
* On the client, this event fires on the Client Thread.
|
||||
* On the server, this event may be fired on the Server Thread, or an async reloader thread.
|
||||
*/
|
||||
public class TagsUpdatedEvent extends Event
|
||||
{
|
||||
private final TagContainer manager;
|
||||
private final RegistryAccess registries;
|
||||
|
||||
public TagsUpdatedEvent(TagContainer manager)
|
||||
{
|
||||
this.manager = manager;
|
||||
}
|
||||
public TagsUpdatedEvent(RegistryAccess registries)
|
||||
{
|
||||
this.registries = registries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The impl tag manager that has been updated with newly received tags.
|
||||
*/
|
||||
public TagContainer getTagManager()
|
||||
{
|
||||
return manager;
|
||||
}
|
||||
/**
|
||||
* @return The dynamic registries that have had their tags rebound.
|
||||
*/
|
||||
public RegistryAccess getTagManager()
|
||||
{
|
||||
return registries;
|
||||
}
|
||||
}
|
||||
@@ -43,13 +43,15 @@ public class StructureSpawnListGatherEvent extends Event
|
||||
public StructureSpawnListGatherEvent(StructureFeature<?> structure)
|
||||
{
|
||||
this.structure = structure;
|
||||
this.insideOnly = this.structure.getDefaultRestrictsSpawnsToInside();
|
||||
this.insideOnly = false;
|
||||
/*this.insideOnly = this.structure.getDefaultRestrictsSpawnsToInside();
|
||||
|
||||
for (MobCategory cat : MobCategory.values()) {
|
||||
List<SpawnerData> lst = this.structure.getDefaultSpawnList(cat);
|
||||
if (!lst.isEmpty())
|
||||
addEntitySpawns(cat, lst);
|
||||
}
|
||||
}*/
|
||||
// TODO-PATCHING: follow how StructureSpawnManager is reengineered
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -24,7 +24,7 @@ import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket;
|
||||
import net.minecraft.network.protocol.game.ClientboundUpdateTagsPacket;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.TagCollection;
|
||||
import net.minecraft.tags.TagNetworkSerialization;
|
||||
import net.minecraftforge.common.ForgeTagHandler;
|
||||
import net.minecraftforge.network.NetworkHooks;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -99,7 +99,7 @@ public class VanillaConnectionNetworkFilter extends VanillaPacketFilter
|
||||
* It prevents a rare error from logging and reduces the packet size
|
||||
*/
|
||||
private static ClientboundUpdateTagsPacket filterCustomTagTypes(ClientboundUpdateTagsPacket packet) {
|
||||
Map<ResourceKey<? extends Registry<?>>, TagCollection.NetworkPayload> tags = packet.getTags()
|
||||
Map<ResourceKey<? extends Registry<?>>, TagNetworkSerialization.NetworkPayload> tags = packet.getTags()
|
||||
.entrySet().stream().filter(e -> !ForgeTagHandler.getCustomTagTypeNames().contains(e.getKey().location()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
||||
return new ClientboundUpdateTagsPacket(tags);
|
||||
|
||||
@@ -392,6 +392,12 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
}
|
||||
}
|
||||
|
||||
if (this.builder.getVanillaHolder() != null)
|
||||
{
|
||||
var ref = this.builder.getVanillaHolder().apply(value);
|
||||
ref.bind(rkey, value);
|
||||
}
|
||||
|
||||
if (this.add != null)
|
||||
this.add.onAdd(this, this.stage, idToUse, value, oldEntry);
|
||||
|
||||
@@ -1140,5 +1146,10 @@ public class ForgeRegistry<V extends IForgeRegistryEntry<V>> implements IForgeRe
|
||||
LOGGER.debug(REGISTRIES,"There were {} missing mappings that have been ignored", ignored);
|
||||
}
|
||||
|
||||
RegistryBuilder<V> getBuilder()
|
||||
{
|
||||
return this.builder;
|
||||
}
|
||||
|
||||
private record OverrideOwner<V>(String owner, ResourceKey<V> key){};
|
||||
}
|
||||
@@ -35,7 +35,6 @@ import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.item.alchemy.Potion;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.stats.StatType;
|
||||
import net.minecraft.tags.StaticTags;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.core.DefaultedRegistry;
|
||||
import net.minecraft.core.Registry;
|
||||
@@ -50,7 +49,6 @@ import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.foliageplacers.FoliagePlacerType;
|
||||
import net.minecraft.world.level.levelgen.feature.treedecorators.TreeDecoratorType;
|
||||
import net.minecraftforge.common.ForgeTagHandler;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.loot.GlobalLootModifierSerializer;
|
||||
import net.minecraftforge.common.util.LogMessageAdapter;
|
||||
@@ -120,15 +118,15 @@ public class GameData
|
||||
hasInit = true;
|
||||
|
||||
// Game objects
|
||||
makeRegistry(BLOCKS, Block.class, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").create();
|
||||
makeRegistry(FLUIDS, Fluid.class, "empty").create();
|
||||
makeRegistry(ITEMS, Item.class, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").create();
|
||||
makeRegistry(BLOCKS, Block.class, "air").addCallback(BlockCallbacks.INSTANCE).legacyName("blocks").vanillaHolder(Block::builtInRegistryHolder).create();
|
||||
makeRegistry(FLUIDS, Fluid.class, "empty").vanillaHolder(Fluid::builtInRegistryHolder).create();
|
||||
makeRegistry(ITEMS, Item.class, "air").addCallback(ItemCallbacks.INSTANCE).legacyName("items").vanillaHolder(Item::builtInRegistryHolder).create();
|
||||
makeRegistry(MOB_EFFECTS, MobEffect.class).legacyName("potions").tagFolder("mob_effects").create();
|
||||
//makeRegistry(BIOMES, Biome.class).legacyName("biomes").create();
|
||||
makeRegistry(SOUND_EVENTS, SoundEvent.class).legacyName("soundevents").create();
|
||||
makeRegistry(POTIONS, Potion.class, "empty").legacyName("potiontypes").tagFolder("potions").create();
|
||||
makeRegistry(ENCHANTMENTS, Enchantment.class).legacyName("enchantments").tagFolder("enchantments").create();
|
||||
makeRegistry(ENTITY_TYPES, c(EntityType.class), "pig").legacyName("entities").create();
|
||||
makeRegistry(ENTITY_TYPES, c(EntityType.class), "pig").legacyName("entities").vanillaHolder(EntityType::builtInRegistryHolder).create();
|
||||
makeRegistry(BLOCK_ENTITY_TYPES, c(BlockEntityType.class)).disableSaving().legacyName("blockentities").tagFolder("block_entity_types").create();
|
||||
makeRegistry(PARTICLE_TYPES, c(ParticleType.class)).disableSaving().create();
|
||||
makeRegistry(CONTAINER_TYPES, c(MenuType.class)).disableSaving().create();
|
||||
@@ -257,10 +255,18 @@ public class GameData
|
||||
LOGGER.debug(REGISTRIES, "Vanilla freeze snapshot created");
|
||||
}
|
||||
|
||||
public static void unfreezeData()
|
||||
{
|
||||
LOGGER.debug(REGISTRIES, "Unfreezing vanilla registries");
|
||||
Registry.REGISTRY.stream().filter(r -> r instanceof MappedRegistry).forEach(r -> ((MappedRegistry<?>)r).unfreeze());
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static void freezeData()
|
||||
{
|
||||
LOGGER.debug(REGISTRIES, "Freezing registries");
|
||||
Registry.REGISTRY.stream().filter(r -> r instanceof MappedRegistry).forEach(r -> ((MappedRegistry<?>)r).freeze());
|
||||
|
||||
for (Map.Entry<ResourceLocation, ForgeRegistry<? extends IForgeRegistryEntry<?>>> r : RegistryManager.ACTIVE.registries.entrySet())
|
||||
{
|
||||
final Class<? extends IForgeRegistryEntry> clazz = RegistryManager.ACTIVE.getSuperType(r.getKey());
|
||||
@@ -372,22 +378,6 @@ public class GameData
|
||||
}, executor);
|
||||
}
|
||||
|
||||
public static void setCustomTagTypesFromRegistries()
|
||||
{
|
||||
Set<ResourceLocation> customTagTypes = new HashSet<>();
|
||||
for (Map.Entry<ResourceLocation, ForgeRegistry<? extends IForgeRegistryEntry<?>>> entry : RegistryManager.ACTIVE.registries.entrySet())
|
||||
{
|
||||
ResourceLocation registryName = entry.getKey();
|
||||
if (entry.getValue().getTagFolder() != null && StaticTags.get(registryName) == null)
|
||||
{
|
||||
LOGGER.debug(REGISTRIES, "Registering custom tag type for: {}", registryName);
|
||||
customTagTypes.add(registryName);
|
||||
StaticTags.create(ResourceKey.createRegistryKey(registryName), "tags/" + entry.getValue().getTagFolder());
|
||||
}
|
||||
}
|
||||
ForgeTagHandler.setCustomTagTypes(customTagTypes);
|
||||
}
|
||||
|
||||
//Lets us clear the map so we can rebuild it.
|
||||
private static class ClearableObjectIntIdentityMap<I> extends IdMapper<I>
|
||||
{
|
||||
|
||||
@@ -5,16 +5,16 @@
|
||||
|
||||
package net.minecraftforge.registries;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
@@ -31,14 +31,14 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
private boolean locked = false;
|
||||
private ForgeRegistry<T> delegate;
|
||||
|
||||
private NamespacedDefaultedWrapper(ForgeRegistry<T> owner)
|
||||
private NamespacedDefaultedWrapper(ForgeRegistry<T> owner, Function<T, Holder.Reference<T>> holderLookup)
|
||||
{
|
||||
super("empty", owner.getRegistryKey(), Lifecycle.experimental());
|
||||
super("empty", owner.getRegistryKey(), Lifecycle.experimental(), holderLookup);
|
||||
this.delegate = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V registerMapping(int id, ResourceKey<T> key, V value, Lifecycle lifecycle)
|
||||
public Holder<T> registerMapping(final int id, final ResourceKey<T> key, final T value, final Lifecycle lifecycle)
|
||||
{
|
||||
if (locked)
|
||||
throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods.");
|
||||
@@ -51,21 +51,22 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
if (realId != id && id != -1)
|
||||
LOGGER.warn("Registered object did not get ID it asked for. Name: {} Type: {} Expected: {} Got: {}", key, value.getRegistryType().getName(), id, realId);
|
||||
|
||||
return value;
|
||||
return super.registerMapping(realId, key, value, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V register(ResourceKey<T> key, V value, Lifecycle lifecycle)
|
||||
public Holder<T> register(final ResourceKey<T> p_205891_, final T p_205892_, final Lifecycle p_205893_)
|
||||
{
|
||||
return registerMapping(-1, key, value, lifecycle);
|
||||
return registerMapping(-1, p_205891_, p_205892_, p_205893_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V registerOrOverride(OptionalInt id, ResourceKey<T> key, V value, Lifecycle lifecycle) {
|
||||
public Holder<T> registerOrOverride(final OptionalInt id, final ResourceKey<T> p_205885_, final T p_205886_, final Lifecycle p_205887_)
|
||||
{
|
||||
int wanted = -1;
|
||||
if (id.isPresent() && byId(id.getAsInt()) != null)
|
||||
wanted = id.getAsInt();
|
||||
return registerMapping(wanted, key, value, lifecycle);
|
||||
return registerMapping(wanted, p_205885_, p_205886_, p_205887_);
|
||||
}
|
||||
|
||||
// Reading Functions
|
||||
@@ -144,13 +145,7 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
return this.delegate.getEntries();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T getRandom(Random random)
|
||||
{
|
||||
Collection<T> values = this.delegate.getValues();
|
||||
return values.stream().skip(random.nextInt(values.size())).findFirst().orElse(this.delegate.getDefault());
|
||||
}
|
||||
//TODO-PATCHING: Figure out if getRandom needs to be overriden.
|
||||
|
||||
@Override
|
||||
public ResourceLocation getDefaultKey()
|
||||
@@ -162,13 +157,16 @@ class NamespacedDefaultedWrapper<T extends IForgeRegistryEntry<T>> extends Defau
|
||||
@Override
|
||||
public void lock(){ this.locked = true; }
|
||||
|
||||
//@Override public void unfreeze() {}
|
||||
|
||||
public static class Factory<V extends IForgeRegistryEntry<V>> implements IForgeRegistry.CreateCallback<V>
|
||||
{
|
||||
public static final ResourceLocation ID = new ResourceLocation("forge", "registry_defaulted_wrapper");
|
||||
@Override
|
||||
public void onCreate(IForgeRegistryInternal<V> owner, RegistryManager stage)
|
||||
{
|
||||
owner.setSlaveMap(ID, new NamespacedDefaultedWrapper<V>((ForgeRegistry<V>)owner));
|
||||
ForgeRegistry<V> fowner = (ForgeRegistry<V>)owner;
|
||||
owner.setSlaveMap(ID, new NamespacedDefaultedWrapper<V>(fowner, fowner.getBuilder().getVanillaHolder()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
package net.minecraftforge.registries;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
@@ -29,14 +29,14 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
private boolean locked = false;
|
||||
private ForgeRegistry<T> delegate;
|
||||
|
||||
public NamespacedWrapper(ForgeRegistry<T> owner)
|
||||
public NamespacedWrapper(ForgeRegistry<T> owner, Function<T, Holder.Reference<T>> holderLookup)
|
||||
{
|
||||
super(owner.getRegistryKey(), Lifecycle.experimental());
|
||||
super(owner.getRegistryKey(), Lifecycle.experimental(), holderLookup);
|
||||
this.delegate = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V registerMapping(int id, ResourceKey<T> key, V value, Lifecycle lifecycle)
|
||||
public Holder<T> registerMapping(int id, ResourceKey<T> key, T value, Lifecycle lifecycle)
|
||||
{
|
||||
if (locked)
|
||||
throw new IllegalStateException("Can not register to a locked registry. Modder should use Forge Register methods.");
|
||||
@@ -49,17 +49,17 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
int realId = this.delegate.add(id, value);
|
||||
if (realId != id && id != -1)
|
||||
LOGGER.warn("Registered object did not get ID it asked for. Name: {} Type: {} Expected: {} Got: {}", key, value.getRegistryType().getName(), id, realId);
|
||||
return value;
|
||||
return super.registerMapping(realId, key, value, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R extends T> R register(ResourceKey<T> key, R value, Lifecycle lifecycle)
|
||||
public Holder<T> register(ResourceKey<T> key, T value, Lifecycle lifecycle)
|
||||
{
|
||||
return registerMapping(-1, key, value, lifecycle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <V extends T> V registerOrOverride(OptionalInt id, ResourceKey<T> key, V value, Lifecycle lifecycle) {
|
||||
public Holder<T> registerOrOverride(OptionalInt id, ResourceKey<T> key, T value, Lifecycle lifecycle) {
|
||||
int wanted = -1;
|
||||
if (id.isPresent() && byId(id.getAsInt()) != null)
|
||||
wanted = id.getAsInt();
|
||||
@@ -142,13 +142,7 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
return this.delegate.getEntries();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T getRandom(Random random)
|
||||
{
|
||||
Collection<T> values = this.delegate.getValues();
|
||||
return values.stream().skip(random.nextInt(values.size())).findFirst().orElse(null);
|
||||
}
|
||||
// TODO-PATCHING: Figure out if getRandom needs to be overriden.
|
||||
|
||||
/*
|
||||
@Override
|
||||
@@ -162,13 +156,16 @@ class NamespacedWrapper<T extends IForgeRegistryEntry<T>> extends MappedRegistry
|
||||
@Override
|
||||
public void lock(){ this.locked = true; }
|
||||
|
||||
//@Override public void unfreeze() {}
|
||||
|
||||
public static class Factory<V extends IForgeRegistryEntry<V>> implements IForgeRegistry.CreateCallback<V>
|
||||
{
|
||||
public static final ResourceLocation ID = new ResourceLocation("forge", "registry_defaulted_wrapper");
|
||||
@Override
|
||||
public void onCreate(IForgeRegistryInternal<V> owner, RegistryManager stage)
|
||||
{
|
||||
owner.setSlaveMap(ID, new NamespacedWrapper<V>((ForgeRegistry<V>)owner));
|
||||
ForgeRegistry<V> fowner = (ForgeRegistry<V>)owner;
|
||||
owner.setSlaveMap(ID, new NamespacedWrapper<V>(fowner, fowner.getBuilder().getVanillaHolder()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,9 +8,11 @@ package net.minecraftforge.registries;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.registries.IForgeRegistry.*;
|
||||
|
||||
@@ -30,6 +32,7 @@ public class RegistryBuilder<T extends IForgeRegistryEntry<T>>
|
||||
private List<CreateCallback<T>> createCallback = Lists.newArrayList();
|
||||
private List<ValidateCallback<T>> validateCallback = Lists.newArrayList();
|
||||
private List<BakeCallback<T>> bakeCallback = Lists.newArrayList();
|
||||
private Function<T, Holder.Reference<T>> vanillaHolder;
|
||||
private boolean saveToDisc = true;
|
||||
private boolean sync = true;
|
||||
private boolean allowOverrides = true;
|
||||
@@ -218,6 +221,12 @@ public class RegistryBuilder<T extends IForgeRegistryEntry<T>>
|
||||
return this;
|
||||
}
|
||||
|
||||
RegistryBuilder<T> vanillaHolder(Function<T, Holder.Reference<T>> func)
|
||||
{
|
||||
this.vanillaHolder = func;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IForgeRegistry<T> create()
|
||||
{
|
||||
if (hasWrapper)
|
||||
@@ -368,4 +377,9 @@ public class RegistryBuilder<T extends IForgeRegistryEntry<T>>
|
||||
{
|
||||
return legacyNames;
|
||||
}
|
||||
|
||||
Function<T, Holder.Reference<T>> getVanillaHolder()
|
||||
{
|
||||
return this.vanillaHolder;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class LanguageHook
|
||||
|
||||
private static void loadLanguage(String langName, MinecraftServer server) {
|
||||
String langFile = String.format(Locale.ROOT, "lang/%s.json", langName);
|
||||
ResourceManager resourceManager = server.getServerResources().getResourceManager();
|
||||
ResourceManager resourceManager = server.getServerResources().resourceManager();
|
||||
resourceManager.getNamespaces().forEach(namespace -> {
|
||||
try {
|
||||
ResourceLocation langResource = new ResourceLocation(namespace, langFile);
|
||||
|
||||
@@ -95,7 +95,7 @@ public final class PermissionAPI
|
||||
*/
|
||||
public static void initializePermissionAPI()
|
||||
{
|
||||
Class callerClass = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
|
||||
Class<?> callerClass = StackWalker.getInstance(StackWalker.Option.RETAIN_CLASS_REFERENCE).getCallerClass();
|
||||
if (callerClass != ServerLifecycleHooks.class)
|
||||
{
|
||||
LOGGER.warn("{} tried to initialize the PermissionAPI, this call will be ignored.", callerClass.getName());
|
||||
|
||||
+3
-3
@@ -11,15 +11,15 @@ import java.util.Locale;
|
||||
|
||||
public class UnregisteredPermissionException extends RuntimeException
|
||||
{
|
||||
private PermissionNode node;
|
||||
private PermissionNode<?> node;
|
||||
|
||||
public UnregisteredPermissionException(PermissionNode node)
|
||||
public UnregisteredPermissionException(PermissionNode<?> node)
|
||||
{
|
||||
super(String.format(Locale.ENGLISH, "Tried to query PermissionNode '%s' although it has not been Registered", node.getNodeName()));
|
||||
this.node = node;
|
||||
}
|
||||
|
||||
public PermissionNode getNode()
|
||||
public PermissionNode<?> getNode()
|
||||
{
|
||||
return node;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user