Update to 1.18.2

Co-authored-by: sciwhiz12 <[email protected]>
Co-authored-by: Marc Hermans <[email protected]>
Co-authored-by: LexManos <[email protected]>
Co-authored-by: Curle <[email protected]>
Signed-off-by: SizableShrimp <[email protected]>
This commit is contained in:
authored and LexManos committed 2022-03-01 14:16:46 -08:00
1 parent 34291c1fb2
commit 425eff39ff
234 files changed
+2175 -3226

No files matched your search

@@ -456,7 +456,7 @@ public class DataGeneratorTest
@Override
protected void addTags()
{
tag(BlockTags.bind(new ResourceLocation(MODID, "test").toString()))
tag(BlockTags.create(new ResourceLocation(MODID, "test")))
.add(Blocks.DIAMOND_BLOCK)
.addTag(BlockTags.STONE_BRICKS)
.addTag(net.minecraftforge.common.Tags.Blocks.COBBLESTONE)
@@ -464,14 +464,14 @@ public class DataGeneratorTest
.addOptionalTag(new ResourceLocation("forge", "storage_blocks/ruby"));
// Hopefully sorting issues
tag(BlockTags.bind(new ResourceLocation(MODID, "thing/one").toString()))
tag(BlockTags.create(new ResourceLocation(MODID, "thing/one")))
.add(Blocks.COBBLESTONE);
tag(BlockTags.bind(new ResourceLocation(MODID, "thing/two").toString()))
tag(BlockTags.create(new ResourceLocation(MODID, "thing/two")))
.add(Blocks.DIORITE);
tag(BlockTags.bind(new ResourceLocation(MODID, "thing/three").toString()))
tag(BlockTags.create(new ResourceLocation(MODID, "thing/three")))
.add(Blocks.ANDESITE);
tag(BlockTags.bind(new ResourceLocation(MODID, "things").toString()))
tag(BlockTags.create(new ResourceLocation(MODID, "things")))
.add(Blocks.COBBLESTONE)
.add(Blocks.DIORITE)
.add(Blocks.ANDESITE);
@@ -41,45 +41,46 @@ public class DuplicateOptionalTagTest
private static final Set<Supplier<Block>> TAG_A_DEFAULTS = Set.of(Blocks.BEDROCK.delegate);
private static final Set<Supplier<Block>> TAG_B_DEFAULTS = Set.of(Blocks.WHITE_WOOL.delegate);
private static final Tags.IOptionalNamedTag<Block> TAG_A = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME,
TAG_A_DEFAULTS);
private static final Tags.IOptionalNamedTag<Block> TAG_B = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME,
TAG_B_DEFAULTS);
// TODO-PATCHING: fix or remove this accordingly with optional tags feature (specifically, default values for opt. tags)
// private static final Tags.IOptionalNamedTag<Block> TAG_A = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME,
// TAG_A_DEFAULTS);
// private static final Tags.IOptionalNamedTag<Block> TAG_B = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCKS, TAG_NAME,
// TAG_B_DEFAULTS);
public DuplicateOptionalTagTest()
{
MinecraftForge.EVENT_BUS.addListener(this::onServerStarted);
// MinecraftForge.EVENT_BUS.addListener(this::onServerStarted);
}
private void onServerStarted(ServerStartedEvent event)
{
if (!TAG_A.isDefaulted())
{
LOGGER.warn("First instance of optional tag is not defaulted!");
}
if (!TAG_B.isDefaulted())
{
LOGGER.warn("Second instance of optional tag is not defaulted!");
}
if (!TAG_A.getValues().equals(TAG_B.getValues()))
{
LOGGER.error("Values of both optional tag instances are not the same: first instance: {}, second instance: {}",
TAG_A.getValues(), TAG_B.getValues());
return;
}
final List<Block> expected = Sets.union(TAG_A_DEFAULTS, TAG_B_DEFAULTS).stream()
.map(Supplier::get)
.toList();
if (!TAG_A.getValues().equals(expected))
{
LOGGER.error("Values of the optional tag do not match the expected union of their defaults: expected {}, got {}",
expected, TAG_A.getValues());
return;
}
LOGGER.info("Optional tag instances match each other and the expected union of their defaults");
}
// private void onServerStarted(ServerStartedEvent event)
// {
// if (!TAG_A.isDefaulted())
// {
// LOGGER.warn("First instance of optional tag is not defaulted!");
// }
//
// if (!TAG_B.isDefaulted())
// {
// LOGGER.warn("Second instance of optional tag is not defaulted!");
// }
//
// if (!TAG_A.getValues().equals(TAG_B.getValues()))
// {
// LOGGER.error("Values of both optional tag instances are not the same: first instance: {}, second instance: {}",
// TAG_A.getValues(), TAG_B.getValues());
// return;
// }
//
// final List<Block> expected = Sets.union(TAG_A_DEFAULTS, TAG_B_DEFAULTS).stream()
// .map(Supplier::get)
// .toList();
// if (!TAG_A.getValues().equals(expected))
// {
// LOGGER.error("Values of the optional tag do not match the expected union of their defaults: expected {}, got {}",
// expected, TAG_A.getValues());
// return;
// }
//
// LOGGER.info("Optional tag instances match each other and the expected union of their defaults");
// }
}
@@ -7,8 +7,10 @@ package net.minecraftforge.debug;
import net.minecraft.data.DataGenerator;
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.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraftforge.common.data.ExistingFileHelper;
@@ -21,7 +23,7 @@ import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
public class RemoveTagDatagenTest
{
public static final String MODID = "remove_tag_datagen_test";
public static final Tag.Named<Block> TEST_TAG = BlockTags.bind("test_tag");
public static final TagKey<Block> TEST_TAG = BlockTags.create(new ResourceLocation("test_tag"));
public RemoveTagDatagenTest()
{
@@ -5,6 +5,7 @@
package net.minecraftforge.debug.block;
import com.mojang.logging.LogUtils;
import net.minecraft.core.BlockPos;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
@@ -24,8 +25,7 @@ import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.slf4j.Logger;
import javax.annotation.Nullable;
import java.util.Locale;
@@ -34,6 +34,7 @@ import java.util.Locale;
public class BlockEntityOnLoadTest
{
private static final boolean ENABLED = true;
private static final Logger LOGGER = LogUtils.getLogger();
private static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, "be_onload_test");
private static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, "be_onload_test");
@@ -82,7 +83,6 @@ public class BlockEntityOnLoadTest
private static class TestBlockEntity extends BlockEntity
{
private static final Logger LOGGER = LogManager.getLogger();
private boolean loaded = false;
public TestBlockEntity(BlockPos pos, BlockState state)
@@ -5,6 +5,7 @@
package net.minecraftforge.debug.block;
import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.ScaffoldingBlock;
@@ -20,7 +21,6 @@ import net.minecraft.world.level.LevelReader;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ConfiguredModel;
import net.minecraftforge.client.model.generators.ModelFile;
import net.minecraftforge.common.Tags.IOptionalNamedTag;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.RegistryObject;
@@ -41,7 +41,7 @@ public class ScaffoldingTest
{
static final String MODID = "scaffolding_test";
static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, MODID);
static final IOptionalNamedTag<Block> SCAFFOLDING = BlockTags.createOptional(new ResourceLocation("forge", "scaffolding"));
static final TagKey<Block> SCAFFOLDING = BlockTags.create(new ResourceLocation("forge", "scaffolding"));
static final RegistryObject<Block> SCAFFOLDING_METHOD_TEST = BLOCKS.register("scaffolding_method_test", () -> new ScaffoldingMethodTestBlock(Properties.of(Material.DECORATION, MaterialColor.SAND).noCollission().sound(SoundType.SCAFFOLDING).dynamicShape()));
@@ -43,7 +43,7 @@ public class ClientCommandTest
// Used for checking suggestion providers that are registered
.then(Commands.literal("registeredsuggest").then(
Commands.argument("block", ResourceLocationArgument.id())
.suggests(SuggestionProviders.AVAILABLE_BIOMES)
.suggests(SuggestionProviders.ALL_RECIPES)
.executes(this::testCommand)))
// Used for checking if attempting to get the server on the client side errors
.then(Commands.literal("server")
@@ -13,6 +13,7 @@ import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.level.biome.Biome;
import net.minecraftforge.common.ForgeMod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -93,7 +94,7 @@ public class GravityAttributeTest
for(LivingEntity liv : list)
{
AttributeInstance grav = liv.getAttribute(ForgeMod.ENTITY_GRAVITY.get());
boolean inPlains = liv.level.getBiome(liv.blockPosition()).getBiomeCategory() == BiomeCategory.PLAINS;
boolean inPlains = Biome.getBiomeCategory(liv.level.getBiome(liv.blockPosition())) == BiomeCategory.PLAINS;
if (inPlains && !grav.hasModifier(REDUCED_GRAVITY))
{
logger.info("Granted low gravity to Entity: {}", liv);
@@ -8,6 +8,7 @@ package net.minecraftforge.debug.item;
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.*;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.Block;
@@ -26,8 +27,8 @@ import java.util.List;
@Mod.EventBusSubscriber(bus= Mod.EventBusSubscriber.Bus.MOD)
public class TagBasedToolTypesTest
{
public static final Tag.Named<Block> MY_TOOL_TAG = BlockTags.createOptional(new ResourceLocation("tag_based_tool_types:minable/my_tool"));
public static final Tag.Named<Block> MY_TIER_TAG = BlockTags.createOptional(new ResourceLocation("tag_based_tool_types:needs_my_tier_tool"));
public static final TagKey<Block> MY_TOOL_TAG = BlockTags.create(new ResourceLocation("tag_based_tool_types:minable/my_tool"));
public static final TagKey<Block> MY_TIER_TAG = BlockTags.create(new ResourceLocation("tag_based_tool_types:needs_my_tier_tool"));
public static final Tier MY_TIER = TierSortingRegistry.registerTier(
new ForgeTier(5, 5000, 10, 100, 0, MY_TIER_TAG, () -> Ingredient.of(Items.BEDROCK)),
new ResourceLocation("tag_based_tool_types:my_tier"),
@@ -1,265 +0,0 @@
/*
* Minecraft Forge - Forge Development LLC
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.debug.misc;
import java.util.Set;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.PotionItem;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.world.item.alchemy.Potions;
import net.minecraft.tags.Tag;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.SerializationTags;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.levelgen.feature.StructureFeature;
import net.minecraftforge.common.ForgeTagHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.common.data.ForgeRegistryTagsProvider;
import net.minecraftforge.common.util.ReverseTagWrapper;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistryEntry;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.RegistryBuilder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@Mod(CustomTagTypesTest.MODID)
public class CustomTagTypesTest
{
public static final String MODID = "custom_tag_types_test";
private static final Logger LOGGER = LogManager.getLogger(MODID);
private static final ResourceLocation customRegistryName = new ResourceLocation(MODID, "custom_type_registry");
private static final DeferredRegister<Custom> CUSTOMS = DeferredRegister.create(Custom.class, MODID);
private static final RegistryObject<Custom> CUSTOM = CUSTOMS.register("custom", Custom::new);
private static final ResourceKey<? extends Registry<Custom>> CUSTOM_KEY = ResourceKey.createRegistryKey(customRegistryName);
private static final Supplier<IForgeRegistry<Custom>> CUSTOM_REG = CUSTOMS.makeRegistry(customRegistryName.getPath(),
() -> new RegistryBuilder<Custom>().tagFolder(MODID + "/custom_types"));
private static final Tag.Named<Custom> TESTS = ForgeTagHandler.createOptionalTag(customRegistryName, new ResourceLocation(MODID, "tests"), Set.of(CUSTOM));
private static final Tag.Named<Item> OPTIONAL_TEST = ItemTags.createOptional(new ResourceLocation(MODID, "optional_test"), Set.of(() -> Items.BONE));
private static final Tag.Named<Enchantment> FIRE = ForgeTagHandler.createOptionalTag(ForgeRegistries.ENCHANTMENTS, new ResourceLocation(MODID, "fire"));
private static final Tag.Named<Potion> DAMAGE = ForgeTagHandler.createOptionalTag(ForgeRegistries.POTIONS, new ResourceLocation(MODID, "damage"));
private static final Tag.Named<BlockEntityType<?>> STORAGE = ForgeTagHandler.createOptionalTag(ForgeRegistries.BLOCK_ENTITIES, new ResourceLocation(MODID, "storage"));
private static final Tag.Named<MobEffect> BEACON = ForgeTagHandler.createOptionalTag(ForgeRegistries.MOB_EFFECTS, new ResourceLocation(MODID, "beacon"));
private static final Tag.Named<StructureFeature<?>> OVERWORLD_TEMPLE = ForgeTagHandler.createOptionalTag(ForgeRegistries.STRUCTURE_FEATURES, new ResourceLocation(MODID, "overworld_temple"));
public CustomTagTypesTest()
{
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
CUSTOMS.register(modBus);
modBus.addListener(this::gatherData);
MinecraftForge.EVENT_BUS.addListener(this::leftClick);
}
private void gatherData(GatherDataEvent event)
{
if (event.includeServer())
{
DataGenerator gen = event.getGenerator();
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
gen.addProvider(new CustomRegistryTags(gen, existingFileHelper));
gen.addProvider(new EnchantmentTags(gen, existingFileHelper));
gen.addProvider(new PotionTags(gen, existingFileHelper));
gen.addProvider(new BlockEntityTypeTags(gen, existingFileHelper));
gen.addProvider(new MobEffectTypeTags(gen, existingFileHelper));
gen.addProvider(new StructureFeatureTags(gen, existingFileHelper));
}
}
private void leftClick(PlayerInteractEvent.LeftClickBlock event)
{
ItemStack itemStack = event.getItemStack();
if (!itemStack.isEmpty())
{
LOGGER.info("{} {} {}", Items.BONE.getTags(), OPTIONAL_TEST.getValues().size(), SerializationTags.getInstance().getOrEmpty(Registry.ITEM_REGISTRY).getTag(new ResourceLocation(MODID, "optional_test")));
LOGGER.info("{} {}", CUSTOM.get().getTags(), TESTS.getValues().size());
EnchantmentHelper.getEnchantments(itemStack).forEach((enchantment, level) -> logTagsIfPresent(enchantment.getTags()));
if (itemStack.getItem() instanceof PotionItem) logTagsIfPresent(PotionUtils.getPotion(itemStack).getTags());
BlockEntity blockEntity = event.getWorld().getBlockEntity(event.getPos());
if (blockEntity != null) logTagsIfPresent(blockEntity.getType().getTags());
event.getEntityLiving().getActiveEffects().forEach((mobEffectInstance) -> logTagsIfPresent(mobEffectInstance.getEffect().getTags()));
}
if (event.getPlayer().getLevel() instanceof ServerLevel serverLevel)
{
OVERWORLD_TEMPLE.getValues().forEach(temple -> {
final BlockPos found = serverLevel.findNearestMapFeature(temple, event.getPos(), 100, false);
if (found != null)
{
LOGGER.info("Found {} at {}", temple.getRegistryName(), found);
}
else
{
LOGGER.info("Could not find {}", temple.getRegistryName());
}
});
}
}
private void logTagsIfPresent(Set<ResourceLocation> tags)
{
if (!tags.isEmpty())
{
LOGGER.info("Tags: {}", tags);
}
}
public static class Custom extends ForgeRegistryEntry<Custom>
{
private final ReverseTagWrapper<Custom> reverseTags = new ReverseTagWrapper<>(this, () -> SerializationTags.getInstance().getOrEmpty(CUSTOM_KEY));
public Set<ResourceLocation> getTags()
{
return reverseTags.getTagNames();
}
}
public static class CustomRegistryTags extends ForgeRegistryTagsProvider<Custom>
{
public CustomRegistryTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper)
{
super(gen, CUSTOM_REG.get(), MODID, existingFileHelper);
}
@Override
protected void addTags()
{
tag(TESTS).add(CUSTOM.get());
}
@Override
public String getName()
{
return "Custom Registry Tags";
}
}
public static class EnchantmentTags extends ForgeRegistryTagsProvider<Enchantment>
{
public EnchantmentTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper)
{
super(gen, ForgeRegistries.ENCHANTMENTS, MODID, existingFileHelper);
}
@Override
protected void addTags()
{
tag(FIRE).add(Enchantments.FIRE_ASPECT, Enchantments.FLAMING_ARROWS);
}
@Override
public String getName()
{
return "Enchantment Tags";
}
}
public static class PotionTags extends ForgeRegistryTagsProvider<Potion>
{
public PotionTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper)
{
super(gen, ForgeRegistries.POTIONS, MODID, existingFileHelper);
}
@Override
protected void addTags()
{
tag(DAMAGE).add(Potions.HARMING, Potions.STRONG_HARMING);
}
@Override
public String getName()
{
return "Potion Tags";
}
}
public static class BlockEntityTypeTags extends ForgeRegistryTagsProvider<BlockEntityType<?>>
{
public BlockEntityTypeTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper)
{
super(gen, ForgeRegistries.BLOCK_ENTITIES, MODID, existingFileHelper);
}
@Override
protected void addTags()
{
tag(STORAGE).add(BlockEntityType.BARREL, BlockEntityType.CHEST, BlockEntityType.ENDER_CHEST, BlockEntityType.TRAPPED_CHEST);
}
@Override
public String getName()
{
return "Block Entity Type Tags";
}
}
public static class MobEffectTypeTags extends ForgeRegistryTagsProvider<MobEffect>
{
public MobEffectTypeTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper)
{
super(gen, ForgeRegistries.MOB_EFFECTS, MODID, existingFileHelper);
}
@Override
protected void addTags()
{
tag(BEACON).add(MobEffects.MOVEMENT_SPEED, MobEffects.JUMP, MobEffects.DIG_SPEED, MobEffects.REGENERATION, MobEffects.DAMAGE_RESISTANCE, MobEffects.DAMAGE_BOOST);
}
@Override
public String getName()
{
return "Mob Effect Tags";
}
}
public static class StructureFeatureTags extends ForgeRegistryTagsProvider<StructureFeature<?>>
{
public StructureFeatureTags(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper)
{
super(gen, ForgeRegistries.STRUCTURE_FEATURES, MODID, existingFileHelper);
}
@Override
public String getName()
{
return "Structure Feature Tags";
}
@Override
protected void addTags()
{
tag(OVERWORLD_TEMPLE).add(StructureFeature.DESERT_PYRAMID, StructureFeature.JUNGLE_TEMPLE);
}
}
}
@@ -9,9 +9,7 @@ import com.sun.jna.Structure;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
import net.minecraft.world.level.levelgen.StructureSettings;
import net.minecraft.world.level.levelgen.feature.StructureFeature;
import net.minecraft.world.level.levelgen.feature.configurations.StructureFeatureConfiguration;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
@@ -35,12 +33,14 @@ import java.util.Optional;
@Mod(DimensionSettingsTest.MODID)
public class DimensionSettingsTest {
public static final String MODID = "dimension_settings_test";
/*
public static final ResourceLocation TEST_OVERWORLD = new ResourceLocation(MODID, "test_overworld");
private static final Logger LOGGER = LogManager.getLogger();
public DimensionSettingsTest()
{
// TODO-PATCHING: Fix these dimensional stuffs
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::registerSettings);
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::addStructure);
}
@@ -49,7 +49,7 @@ public class DimensionSettingsTest {
* Demonstrates how a mod can register custom DimensionSettings which can be referenced from
* within a datapack dimension config whilst being discoverable for other mods to add to and
* remove structures etc from.
*/
* /
private void registerSettings(FMLCommonSetupEvent event)
{
event.enqueueWork(() ->
@@ -62,7 +62,7 @@ public class DimensionSettingsTest {
/**
* Demonstrates how a mod could handle adding their structure settings to a specific dimension.
*/
* /
private void addStructure(FMLLoadCompleteEvent event)
{
event.enqueueWork(() ->
@@ -84,7 +84,7 @@ public class DimensionSettingsTest {
/**
* Create a NoiseGeneratorSettings instance copying all but the structure settings from overworld.
*/
* /
private static NoiseGeneratorSettings createNoiseGenerationSettings()
{
NoiseGeneratorSettings overworld = BuiltinRegistries.NOISE_GENERATOR_SETTINGS.getOrThrow(NoiseGeneratorSettings.OVERWORLD);
@@ -96,8 +96,8 @@ public class DimensionSettingsTest {
return new NoiseGeneratorSettings(
structures,
overworld.noiseSettings(),
overworld.getDefaultBlock(),
overworld.getDefaultFluid(),
overworld.defaultBlock(),
overworld.defaultFluid(),
overworld.surfaceRule(),
overworld.seaLevel(),
overworld.disableMobGeneration(),
@@ -108,4 +108,29 @@ public class DimensionSettingsTest {
overworld.useLegacyRandomSource()
);
}
*/
}
/*
TODO: Make this a data gen:
data/dimension_settings_test/dimension/test_overworld.json
{
"#comment": [
"This is an example Dimension showing how it can be configured to use a custom",
"DimensionSettings that possess similar generation settings to overworld but",
"has independently configurable structure settings.",
"",
"See the 'settings' field below"
],
"type": "minecraft:overworld",
"generator": {
"type": "minecraft:noise",
"seed": 12345,
"settings": "dimension_settings_test:test_overworld",
"biome_source": {
"preset": "minecraft:overworld",
"type": "minecraft:multi_noise"
}
}
}
*/