mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-25 04:58:33 +01:00
Compare commits
2 commits
f6496454be
...
d539a09bdf
Author | SHA1 | Date | |
---|---|---|---|
d539a09bdf | |||
73b4d285f1 |
19 changed files with 76 additions and 69 deletions
18
build.gradle
18
build.gradle
|
@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
version = '35.5'
|
||||
version = '36.0'
|
||||
group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'NaturesAura'
|
||||
|
||||
|
@ -24,7 +24,7 @@ if (System.getenv('BUILD_NUMBER') != null) {
|
|||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'official', version: '1.18.1'
|
||||
mappings channel: 'official', version: '1.18.2'
|
||||
|
||||
runs {
|
||||
client {
|
||||
|
@ -102,16 +102,16 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
minecraft 'net.minecraftforge:forge:1.18.1-39.0.5'
|
||||
minecraft 'net.minecraftforge:forge:1.18.2-40.0.3'
|
||||
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.1:9.1.0.47")
|
||||
compileOnly fg.deobf("mezz.jei:jei-1.18.2:9.4.1.117:api")
|
||||
runtimeOnly fg.deobf("mezz.jei:jei-1.18.2:9.4.1.117")
|
||||
|
||||
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-63:api")
|
||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.1-63")
|
||||
compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.2-66-SNAPSHOT:api")
|
||||
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.18.2-66-SNAPSHOT")
|
||||
|
||||
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0")
|
||||
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.1-5.0.3.0:api")
|
||||
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.2-5.0.6.3")
|
||||
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:1.18.2-5.0.6.3:api")
|
||||
|
||||
// TODO Enchantability
|
||||
/* compile fg.deobf("quarris.enchantability:Enchantability:11.0.48")*/
|
||||
|
|
|
@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.api.multiblock;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -13,8 +14,8 @@ public record Matcher(BlockState defaultState, ICheck check) {
|
|||
return new Matcher(Blocks.AIR.defaultBlockState(), null);
|
||||
}
|
||||
|
||||
public static Matcher tag(Block defaultBlock, Tag.Named<?> tag) {
|
||||
return new Matcher(defaultBlock.defaultBlockState(), (level, start, offset, pos, state, c) -> state.getBlock().getTags().contains(tag.getName()));
|
||||
public static Matcher tag(Block defaultBlock, TagKey<Block> tag) {
|
||||
return new Matcher(defaultBlock.defaultBlockState(), (level, start, offset, pos, state, c) -> state.is(tag));
|
||||
}
|
||||
|
||||
public interface ICheck {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
|
|||
if (state.getValue(SaplingBlock.STAGE) == 0) {
|
||||
level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4);
|
||||
} else if (ForgeEventFactory.saplingGrowTree(level, rand, pos)) {
|
||||
ModFeatures.Configured.ANCIENT_TREE.place(level, level.getChunkSource().getGenerator(), rand, pos);
|
||||
ModFeatures.Configured.ANCIENT_TREE.value().place(level, level.getChunkSource().getGenerator(), rand, pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ public final class Multiblocks {
|
|||
new String[][]{
|
||||
{" RRRRR ", " R R ", "R RRR R", "R R R R", "R R 0 R R", "R R R R", "R RRR R", " R R ", " RRRRR "}},
|
||||
'R', new Matcher(Blocks.POPPY.defaultBlockState(),
|
||||
(level, start, offset, pos, state, c) -> BlockTags.SMALL_FLOWERS.contains(state.getBlock())),
|
||||
(level, start, offset, pos, state, c) -> state.is(BlockTags.SMALL_FLOWERS)),
|
||||
'0', ModBlocks.OFFERING_TABLE,
|
||||
' ', Matcher.wildcard());
|
||||
public static final IMultiblock ANIMAL_SPAWNER = NaturesAuraAPI.instance().createMultiblock(
|
||||
|
|
|
@ -68,7 +68,7 @@ public class BlockEntityBlastFurnaceBooster extends BlockEntityImpl implements I
|
|||
private boolean isApplicable(List<Ingredient> ingredients) {
|
||||
for (var ing : ingredients) {
|
||||
for (var stack : ing.getItems()) {
|
||||
if (stack.getItem().getTags().stream().anyMatch(t -> t.getPath().startsWith("ores/")))
|
||||
if (stack.getTags().anyMatch(t -> t.location().getPath().startsWith("ores/")))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class BlockEntityFlowerGenerator extends BlockEntityImpl implements ITick
|
|||
for (var z = -range; z <= range; z++) {
|
||||
var offset = this.worldPosition.offset(x, y, z);
|
||||
var state = this.level.getBlockState(offset);
|
||||
if (BlockTags.SMALL_FLOWERS.contains(state.getBlock()))
|
||||
if (state.is(BlockTags.SMALL_FLOWERS))
|
||||
possible.add(offset);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class BlockEntityOakGenerator extends BlockEntityImpl implements ITickabl
|
|||
if (!this.level.isClientSide)
|
||||
while (!this.scheduledBigTrees.isEmpty()) {
|
||||
var pos = this.scheduledBigTrees.remove();
|
||||
if (this.level.getBlockState(pos).getBlock().getTags().contains(BlockTags.LOGS.getName())) {
|
||||
if (this.level.getBlockState(pos).is(BlockTags.LOGS)) {
|
||||
var toAdd = 100000;
|
||||
var canGen = this.canGenerateRightNow(toAdd);
|
||||
if (canGen)
|
||||
|
|
|
@ -133,7 +133,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
|
|||
for (var z = -1; z <= 1; z++) {
|
||||
var offset = pos.offset(x, y, z);
|
||||
var state = level.getBlockState(offset);
|
||||
if (state.getBlock().getTags().contains(BlockTags.LOGS.getName()) || includeLeaves && state.getBlock() instanceof LeavesBlock) {
|
||||
if (state.is(BlockTags.LOGS) || includeLeaves && state.getBlock() instanceof LeavesBlock) {
|
||||
if (drop) {
|
||||
level.destroyBlock(offset, true);
|
||||
} else {
|
||||
|
@ -154,7 +154,7 @@ public class BlockEntityWoodStand extends BlockEntityImpl implements ITickableBl
|
|||
}
|
||||
for (var i = 0; i < 2; i++) {
|
||||
var state = this.level.getBlockState(this.ritualPos.above(i));
|
||||
if (!(state.getBlock().getTags().contains(BlockTags.LOGS.getName())))
|
||||
if (!(state.is(BlockTags.LOGS)))
|
||||
return false;
|
||||
}
|
||||
if (this.timer < this.recipe.time / 2) {
|
||||
|
|
|
@ -80,8 +80,7 @@ public class NetherGrassEffect implements IDrainSpotEffect {
|
|||
continue;
|
||||
|
||||
var state = level.getBlockState(goalPos);
|
||||
var block = state.getBlock();
|
||||
if (Tags.Blocks.NETHERRACK.contains(block)) {
|
||||
if (state.is(Tags.Blocks.NETHERRACK)) {
|
||||
level.setBlockAndUpdate(goalPos, ModBlocks.NETHER_GRASS.defaultBlockState());
|
||||
|
||||
var closestSpot = IAuraChunk.getHighestSpot(level, goalPos, 25, pos);
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.minecraft.core.Registry;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.Tuple;
|
||||
import net.minecraft.util.random.WeightedRandom;
|
||||
|
@ -105,7 +106,7 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
|||
var y = Mth.floor(powderPos.y + level.random.nextGaussian() * range);
|
||||
var z = Mth.floor(powderPos.z + level.random.nextGaussian() * range);
|
||||
var orePos = new BlockPos(x, y, z);
|
||||
if (orePos.distSqr(powderPos.x, powderPos.y, powderPos.z, true) <= range * range
|
||||
if (orePos.distToCenterSqr(powderPos.x, powderPos.y, powderPos.z) <= range * range
|
||||
&& orePos.distSqr(pos) <= this.dist * this.dist && level.isLoaded(orePos)) {
|
||||
var state = level.getBlockState(orePos);
|
||||
if (state.getBlock() != requiredBlock)
|
||||
|
@ -116,10 +117,11 @@ public class OreSpawnEffect implements IDrainSpotEffect {
|
|||
var ore = WeightedRandom.getRandomItem(level.random, ores, totalWeight).orElse(null);
|
||||
if (ore == null)
|
||||
continue;
|
||||
var tag = level.getTagManager().getOrEmpty(Registry.BLOCK_REGISTRY).getTag(ore.tag);
|
||||
var tag = TagKey.create(Registry.BLOCK_REGISTRY, ore.tag);
|
||||
if (tag == null)
|
||||
continue;
|
||||
for (var toPlace : tag.getValues()) {
|
||||
for (var holder : Registry.BLOCK.getTagOrEmpty(tag)) {
|
||||
var toPlace = holder.value();
|
||||
if (toPlace == null || toPlace == Blocks.AIR)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ public class CuriosCompat implements ICompat {
|
|||
@Override
|
||||
public void addItemTags(ItemTagProvider provider) {
|
||||
for (var entry : TYPES.entrySet()) {
|
||||
var tag = ItemTags.createOptional(new ResourceLocation("curios", entry.getValue()));
|
||||
var tag = ItemTags.create(new ResourceLocation("curios", entry.getValue()));
|
||||
provider.tag(tag).add(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ 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.TagKey;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
@ -14,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
public class BlockTagProvider extends BlockTagsProvider {
|
||||
|
||||
public static final Tags.IOptionalNamedTag<Block> NETHER_ALTAR_WOOD = BlockTags.createOptional(new ResourceLocation(NaturesAura.MOD_ID, "nether_altar_wood"));
|
||||
public static final TagKey<Block> NETHER_ALTAR_WOOD = BlockTags.create(new ResourceLocation(NaturesAura.MOD_ID, "nether_altar_wood"));
|
||||
|
||||
public BlockTagProvider(DataGenerator gen, @Nullable ExistingFileHelper existingFileHelper) {
|
||||
super(gen, NaturesAura.MOD_ID, existingFileHelper);
|
||||
|
@ -28,7 +29,7 @@ public class BlockTagProvider extends BlockTagsProvider {
|
|||
this.tag(BlockTags.LEAVES).add(ModBlocks.GOLDEN_LEAVES, ModBlocks.ANCIENT_LEAVES, ModBlocks.DECAYED_LEAVES);
|
||||
this.tag(BlockTags.RAILS).add(ModBlocks.DIMENSION_RAIL_END, ModBlocks.DIMENSION_RAIL_NETHER, ModBlocks.DIMENSION_RAIL_OVERWORLD);
|
||||
this.tag(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB);
|
||||
this.tag(Tags.Blocks.DIRT).add(ModBlocks.NETHER_GRASS);
|
||||
this.tag(BlockTags.DIRT).add(ModBlocks.NETHER_GRASS);
|
||||
this.tag(BlockTags.SMALL_FLOWERS).add(ModBlocks.END_FLOWER, ModBlocks.AURA_BLOOM);
|
||||
this.tag(NETHER_ALTAR_WOOD).add(Blocks.CRIMSON_PLANKS, Blocks.WARPED_PLANKS);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.data.tags.ItemTagsProvider;
|
|||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.data.ExistingFileHelper;
|
||||
|
@ -37,7 +38,7 @@ public class ItemTagProvider extends ItemTagsProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public TagAppender<Item> tag(Tag.Named<Item> p_126549_) {
|
||||
public TagAppender<Item> tag(TagKey<Item> p_126549_) {
|
||||
// super is protected, but CuriosCompat needs this
|
||||
return super.tag(p_126549_);
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public class EntityMoverMinecart extends AbstractMinecart {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCartItem() {
|
||||
public ItemStack getPickResult() {
|
||||
return new ItemStack(ModItems.MOVER_CART);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package de.ellpeck.naturesaura.gen;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||
|
@ -20,22 +21,23 @@ public final class ModFeatures {
|
|||
|
||||
public static final class Configured {
|
||||
|
||||
public static final ConfiguredFeature<TreeConfiguration, ?> ANCIENT_TREE = ModFeatures.ANCIENT_TREE.configured(new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
|
||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_BLOOM = ModFeatures.AURA_BLOOM.configured(FeatureConfiguration.NONE);
|
||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_CACTUS = ModFeatures.AURA_CACTUS.configured(FeatureConfiguration.NONE);
|
||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> WARPED_AURA_MUSHROOM = ModFeatures.WARPED_AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> CRIMSON_AURA_MUSHROOM = ModFeatures.CRIMSON_AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
||||
public static final ConfiguredFeature<NoneFeatureConfiguration, ?> AURA_MUSHROOM = ModFeatures.AURA_MUSHROOM.configured(FeatureConfiguration.NONE);
|
||||
public static Holder<ConfiguredFeature<TreeConfiguration, ?>> ANCIENT_TREE;
|
||||
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> NETHER_WART_MUSHROOM;
|
||||
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> AURA_BLOOM;
|
||||
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> AURA_CACTUS;
|
||||
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> WARPED_AURA_MUSHROOM;
|
||||
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> CRIMSON_AURA_MUSHROOM;
|
||||
public static Holder<ConfiguredFeature<NoneFeatureConfiguration, ?>> AURA_MUSHROOM;
|
||||
|
||||
}
|
||||
|
||||
public static final class Placed {
|
||||
|
||||
public static final PlacedFeature AURA_BLOOM = ModFeatures.Configured.AURA_BLOOM.placed();
|
||||
public static final PlacedFeature AURA_CACTUS = ModFeatures.Configured.AURA_CACTUS.placed();
|
||||
public static final PlacedFeature WARPED_AURA_MUSHROOM = ModFeatures.Configured.WARPED_AURA_MUSHROOM.placed();
|
||||
public static final PlacedFeature CRIMSON_AURA_MUSHROOM = ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.placed();
|
||||
public static final PlacedFeature AURA_MUSHROOM = ModFeatures.Configured.AURA_MUSHROOM.placed();
|
||||
public static Holder<PlacedFeature> AURA_BLOOM;
|
||||
public static Holder<PlacedFeature> AURA_CACTUS;
|
||||
public static Holder<PlacedFeature> WARPED_AURA_MUSHROOM;
|
||||
public static Holder<PlacedFeature> CRIMSON_AURA_MUSHROOM;
|
||||
public static Holder<PlacedFeature> AURA_MUSHROOM;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ItemCrimsonMeal extends ItemImpl {
|
|||
if (level.random.nextInt(5) == 0) {
|
||||
int age = state.getValue(NetherWartBlock.AGE);
|
||||
if (age >= 3) {
|
||||
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.place((ServerLevel) level, ((ServerLevel) level).getChunkSource().getGenerator(), level.random, pos);
|
||||
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM.value().place((ServerLevel) level, ((ServerLevel) level).getChunkSource().getGenerator(), level.random, pos);
|
||||
} else {
|
||||
level.setBlockAndUpdate(pos, state.setValue(NetherWartBlock.AGE, age + 1));
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ package de.ellpeck.naturesaura.items;
|
|||
|
||||
import de.ellpeck.naturesaura.entities.EntityStructureFinder;
|
||||
import de.ellpeck.naturesaura.entities.ModEntities;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.HolderSet;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
|
@ -10,15 +11,15 @@ import net.minecraft.world.InteractionResultHolder;
|
|||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
|
||||
public class ItemStructureFinder extends ItemImpl {
|
||||
|
||||
private final StructureFeature<?> structureName;
|
||||
private final Holder<ConfiguredStructureFeature<?, ?>> structureName;
|
||||
private final int color;
|
||||
private final int radius;
|
||||
|
||||
public ItemStructureFinder(String baseName, StructureFeature<?> structureName, int color, int radius) {
|
||||
public ItemStructureFinder(String baseName, Holder<ConfiguredStructureFeature<?, ?>> structureName, int color, int radius) {
|
||||
super(baseName);
|
||||
this.structureName = structureName;
|
||||
this.color = color;
|
||||
|
@ -29,13 +30,14 @@ public class ItemStructureFinder extends ItemImpl {
|
|||
public InteractionResultHolder<ItemStack> use(Level levelIn, Player playerIn, InteractionHand handIn) {
|
||||
var stack = playerIn.getItemInHand(handIn);
|
||||
if (!levelIn.isClientSide && ((ServerLevel) levelIn).structureFeatureManager().shouldGenerateFeatures()) {
|
||||
var pos = ((ServerLevel) levelIn).getChunkSource().getGenerator().findNearestMapFeature((ServerLevel) levelIn, this.structureName, playerIn.blockPosition(), this.radius, false);
|
||||
var holderSet = HolderSet.direct(this.structureName);
|
||||
var pos = ((ServerLevel) levelIn).getChunkSource().getGenerator().findNearestMapFeature((ServerLevel) levelIn, holderSet, playerIn.blockPosition(), this.radius, false);
|
||||
if (pos != null) {
|
||||
var entity = new EntityStructureFinder(ModEntities.STRUCTURE_FINDER, levelIn);
|
||||
entity.setPos(playerIn.getX(), playerIn.getY(0.5D), playerIn.getZ());
|
||||
entity.setItem(stack);
|
||||
entity.getEntityData().set(EntityStructureFinder.COLOR, this.color);
|
||||
entity.signalTo(pos.above(64));
|
||||
entity.signalTo(pos.getFirst().above(64));
|
||||
levelIn.addFreshEntity(entity);
|
||||
|
||||
stack.shrink(1);
|
||||
|
|
|
@ -48,7 +48,7 @@ public class ItemAxe extends AxeItem implements IModItem, ICustomItemModel {
|
|||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, Player player) {
|
||||
if (itemstack.getItem() == ModItems.SKY_AXE) {
|
||||
if (player.level.getBlockState(pos).getBlock().getTags().contains(BlockTags.LOGS.getName())) {
|
||||
if (player.level.getBlockState(pos).is(BlockTags.LOGS)) {
|
||||
BlockEntityWoodStand.recurseTreeDestruction(player.level, pos, pos, false, true);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@ import de.ellpeck.naturesaura.recipes.EnabledCondition;
|
|||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.data.BuiltinRegistries;
|
||||
import net.minecraft.data.worldgen.StructureFeatures;
|
||||
import net.minecraft.data.worldgen.features.FeatureUtils;
|
||||
import net.minecraft.data.worldgen.placement.PlacementUtils;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
|
@ -42,6 +45,8 @@ import net.minecraft.world.level.block.entity.BlockEntityType;
|
|||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.TreeConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||
|
@ -214,9 +219,9 @@ public final class ModRegistry {
|
|||
new ItemArmor("sky_chest", ModArmorMaterial.SKY, EquipmentSlot.CHEST),
|
||||
new ItemArmor("sky_pants", ModArmorMaterial.SKY, EquipmentSlot.LEGS),
|
||||
new ItemArmor("sky_shoes", ModArmorMaterial.SKY, EquipmentSlot.FEET),
|
||||
new ItemStructureFinder("fortress_finder", StructureFeature.NETHER_BRIDGE, 0xba2800, 1024),
|
||||
new ItemStructureFinder("end_city_finder", StructureFeature.END_CITY, 0xca5cd6, 1024),
|
||||
new ItemStructureFinder("outpost_finder", StructureFeature.PILLAGER_OUTPOST, 0xab9f98, 2048),
|
||||
new ItemStructureFinder("fortress_finder", StructureFeatures.FORTRESS, 0xba2800, 1024),
|
||||
new ItemStructureFinder("end_city_finder", StructureFeatures.END_CITY, 0xca5cd6, 1024),
|
||||
new ItemStructureFinder("outpost_finder", StructureFeatures.PILLAGER_OUTPOST, 0xab9f98, 2048),
|
||||
new ItemBreakPrevention(),
|
||||
new ItemPetReviver(),
|
||||
new ItemNetheriteFinder()
|
||||
|
@ -313,25 +318,19 @@ public final class ModRegistry {
|
|||
}
|
||||
|
||||
public static void init() {
|
||||
// register features 27 more times for some reason
|
||||
for (var entry : ModFeatures.Configured.class.getFields()) {
|
||||
try {
|
||||
var feature = (ConfiguredFeature<?, ?>) entry.get(null);
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, feature.feature.getRegistryName(), feature);
|
||||
} catch (IllegalAccessException e) {
|
||||
NaturesAura.LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
for (var entry : ModFeatures.Placed.class.getFields()) {
|
||||
try {
|
||||
var placed = (PlacedFeature) entry.get(null);
|
||||
// why are you making this so difficult for me
|
||||
Supplier<ConfiguredFeature<?, ?>> feature = ObfuscationReflectionHelper.getPrivateValue(PlacedFeature.class, placed, "f_191775_");
|
||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, feature.get().feature.getRegistryName(), placed);
|
||||
} catch (IllegalAccessException e) {
|
||||
NaturesAura.LOGGER.error(e);
|
||||
}
|
||||
}
|
||||
ModFeatures.Configured.AURA_BLOOM = FeatureUtils.register(ModFeatures.AURA_BLOOM.getRegistryName().toString(), ModFeatures.AURA_BLOOM, NoneFeatureConfiguration.INSTANCE);
|
||||
ModFeatures.Configured.AURA_CACTUS = FeatureUtils.register(ModFeatures.AURA_CACTUS.getRegistryName().toString(), ModFeatures.AURA_CACTUS, NoneFeatureConfiguration.INSTANCE);
|
||||
ModFeatures.Configured.WARPED_AURA_MUSHROOM = FeatureUtils.register(ModFeatures.WARPED_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.WARPED_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM = FeatureUtils.register(ModFeatures.CRIMSON_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.CRIMSON_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||
ModFeatures.Configured.AURA_MUSHROOM = FeatureUtils.register(ModFeatures.AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||
ModFeatures.Configured.ANCIENT_TREE = FeatureUtils.register(ModFeatures.ANCIENT_TREE.getRegistryName().toString(), ModFeatures.ANCIENT_TREE, new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
|
||||
ModFeatures.Configured.NETHER_WART_MUSHROOM = FeatureUtils.register(ModFeatures.NETHER_WART_MUSHROOM.getRegistryName().toString(), ModFeatures.NETHER_WART_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
|
||||
|
||||
ModFeatures.Placed.AURA_BLOOM = PlacementUtils.register(ModFeatures.AURA_BLOOM.getRegistryName().toString(), ModFeatures.Configured.AURA_BLOOM);
|
||||
ModFeatures.Placed.AURA_CACTUS = PlacementUtils.register(ModFeatures.AURA_CACTUS.getRegistryName().toString(), ModFeatures.Configured.AURA_CACTUS);
|
||||
ModFeatures.Placed.WARPED_AURA_MUSHROOM = PlacementUtils.register(ModFeatures.WARPED_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.WARPED_AURA_MUSHROOM);
|
||||
ModFeatures.Placed.CRIMSON_AURA_MUSHROOM = PlacementUtils.register(ModFeatures.CRIMSON_AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.CRIMSON_AURA_MUSHROOM);
|
||||
ModFeatures.Placed.AURA_MUSHROOM = PlacementUtils.register(ModFeatures.AURA_MUSHROOM.getRegistryName().toString(), ModFeatures.Configured.AURA_MUSHROOM);
|
||||
}
|
||||
|
||||
public static Block createFlowerPot(Block block) {
|
||||
|
|
Loading…
Reference in a new issue