Complete some TODO's (#318)

* Re-add Oak Gen replacement

* Update sweeping code to match Player.attack

* Add back worldgen

* Datagen the biome modifiers

* Generate the Mineable tags
This commit is contained in:
Mrbysco 2023-07-25 22:34:18 +02:00 committed by GitHub
parent f3e34143cf
commit be125f3038
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 311 additions and 83 deletions

View file

@ -0,0 +1,15 @@
{
"values": [
"naturesaura:ancient_bark",
"naturesaura:ancient_log",
"naturesaura:ancient_planks",
"naturesaura:ancient_slab",
"naturesaura:ancient_stairs",
"naturesaura:auto_crafter",
"naturesaura:flower_generator",
"naturesaura:nether_wart_mushroom",
"naturesaura:oak_generator",
"naturesaura:offering_table",
"naturesaura:wood_stand"
]
}

View file

@ -0,0 +1,49 @@
{
"values": [
"naturesaura:animal_container",
"naturesaura:animal_generator",
"naturesaura:animal_spawner",
"naturesaura:aura_detector",
"naturesaura:aura_timer",
"naturesaura:blast_furnace_booster",
"naturesaura:chorus_generator",
"naturesaura:chunk_loader",
"naturesaura:conversion_catalyst",
"naturesaura:crushing_catalyst",
"naturesaura:depth_ingot_block",
"naturesaura:ender_crate",
"naturesaura:field_creator",
"naturesaura:firework_generator",
"naturesaura:furnace_heater",
"naturesaura:generator_limit_remover",
"naturesaura:gold_brick",
"naturesaura:gold_nether_brick",
"naturesaura:grated_chute",
"naturesaura:hopper_upgrade",
"naturesaura:infused_brick",
"naturesaura:infused_brick_slab",
"naturesaura:infused_brick_stairs",
"naturesaura:infused_iron_block",
"naturesaura:infused_slab",
"naturesaura:infused_stairs",
"naturesaura:infused_stone",
"naturesaura:item_distributor",
"naturesaura:lower_limiter",
"naturesaura:moss_generator",
"naturesaura:nature_altar",
"naturesaura:nether_grass",
"naturesaura:pickup_stopper",
"naturesaura:placer",
"naturesaura:potion_generator",
"naturesaura:powder_placer",
"naturesaura:projectile_generator",
"naturesaura:rf_converter",
"naturesaura:sky_ingot_block",
"naturesaura:snow_creator",
"naturesaura:spawn_lamp",
"naturesaura:spring",
"naturesaura:tainted_gold_block",
"naturesaura:time_changer",
"naturesaura:weather_changer"
]
}

View file

@ -0,0 +1,6 @@
{
"type": "forge:add_features",
"biomes": "#minecraft:is_overworld",
"features": "naturesaura:aura_bloom",
"step": "vegetal_decoration"
}

View file

@ -0,0 +1,6 @@
{
"type": "forge:add_features",
"biomes": "#forge:is_sandy",
"features": "naturesaura:aura_cactus",
"step": "vegetal_decoration"
}

View file

@ -0,0 +1,6 @@
{
"type": "forge:add_features",
"biomes": "#forge:is_mushroom",
"features": "naturesaura:aura_mushroom",
"step": "vegetal_decoration"
}

View file

@ -0,0 +1,6 @@
{
"type": "forge:add_features",
"biomes": "#minecraft:is_nether",
"features": "naturesaura:crimson_aura_mushroom",
"step": "vegetal_decoration"
}

View file

@ -0,0 +1,6 @@
{
"type": "forge:add_features",
"biomes": "#minecraft:is_nether",
"features": "naturesaura:warped_aura_mushroom",
"step": "vegetal_decoration"
}

View file

@ -0,0 +1,4 @@
{
"type": "naturesaura:ancient_tree",
"config": {}
}

View file

@ -0,0 +1,4 @@
{
"type": "naturesaura:aura_bloom",
"config": {}
}

View file

@ -0,0 +1,4 @@
{
"type": "naturesaura:aura_cactus",
"config": {}
}

View file

@ -0,0 +1,4 @@
{
"type": "naturesaura:aura_mushroom",
"config": {}
}

View file

@ -0,0 +1,4 @@
{
"type": "naturesaura:crimson_aura_mushroom",
"config": {}
}

View file

@ -0,0 +1,4 @@
{
"type": "naturesaura:nether_wart_mushroom",
"config": {}
}

View file

@ -0,0 +1,4 @@
{
"type": "naturesaura:warped_aura_mushroom",
"config": {}
}

View file

@ -0,0 +1,4 @@
{
"feature": "naturesaura:aura_bloom",
"placement": []
}

View file

@ -0,0 +1,4 @@
{
"feature": "naturesaura:aura_cactus",
"placement": []
}

View file

@ -0,0 +1,4 @@
{
"feature": "naturesaura:aura_mushroom",
"placement": []
}

View file

@ -0,0 +1,4 @@
{
"feature": "naturesaura:crimson_aura_mushroom",
"placement": []
}

View file

@ -0,0 +1,4 @@
{
"feature": "naturesaura:warped_aura_mushroom",
"placement": []
}

View file

@ -11,7 +11,6 @@ import de.ellpeck.naturesaura.proxy.ClientProxy;
import de.ellpeck.naturesaura.proxy.IProxy;
import de.ellpeck.naturesaura.proxy.ServerProxy;
import de.ellpeck.naturesaura.recipes.ModRecipes;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraftforge.common.ForgeConfigSpec;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.DistExecutor;
@ -63,7 +62,6 @@ public final class NaturesAura {
event.enqueueWork(ModConfig.instance::apply);
ModRecipes.init();
ModRegistry.init();
DrainSpotEffects.init();
NaturesAura.proxy.init(event);

View file

@ -8,6 +8,8 @@ import de.ellpeck.naturesaura.reg.ICustomItemModel;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockGetter;
@ -16,6 +18,7 @@ import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.event.ForgeEventFactory;
@ -72,7 +75,8 @@ public class BlockAncientSapling extends BushBlock implements BonemealableBlock,
if (state.getValue(SaplingBlock.STAGE) == 0) {
level.setBlock(pos, state.cycle(SaplingBlock.STAGE), 4);
} else if (!ForgeEventFactory.blockGrowFeature(level, rand, pos, null).getResult().equals(Event.Result.DENY)) {
ModFeatures.Configured.ANCIENT_TREE.value().place(level, level.getChunkSource().getGenerator(), rand, pos);
Registry<ConfiguredFeature<?, ?>> registry = level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE);
registry.getHolderOrThrow(ModFeatures.Configured.ANCIENT_TREE).value().place(level, level.getChunkSource().getGenerator(), rand, pos);
}
}

View file

@ -10,6 +10,7 @@ import de.ellpeck.naturesaura.reg.ICustomBlockState;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Holder;
import net.minecraft.data.worldgen.features.TreeFeatures;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.SaplingBlock;
import net.minecraft.world.level.block.SoundType;
@ -38,11 +39,11 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
Helper.getBlockEntitiesInArea(level, pos, 10, tile -> {
if (!(tile instanceof BlockEntityOakGenerator oak))
return false;
/* var replacement = BlockOakGenerator.getReplacement(event.getFeature());
var replacement = BlockOakGenerator.getReplacement(event.getFeature());
if (replacement != null) {
oak.scheduledBigTrees.add(pos);
event.setFeature(replacement);
}*/
}
return true;
});
}
@ -68,8 +69,11 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
generator.modLoc("block/" + this.getBaseName() + "_top")));
}
// TODO oak gen replacements
/*private static Holder<? extends ConfiguredFeature<?, ?>> getReplacement(Holder<? extends ConfiguredFeature<?, ?>> feature) {
private static ResourceKey<ConfiguredFeature<?, ?>> getReplacement(Holder<ConfiguredFeature<?, ?>> holder) {
if(holder == null || !holder.unwrapKey().isPresent())
return null;
ResourceKey<ConfiguredFeature<?, ?>> feature = holder.unwrapKey().get();
if (feature == TreeFeatures.FANCY_OAK || feature == TreeFeatures.FANCY_OAK_BEES) {
return TreeFeatures.OAK;
} else if (feature == TreeFeatures.FANCY_OAK_BEES_002) {
@ -81,5 +85,5 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab
} else {
return null;
}
}*/
}
}

View file

@ -28,6 +28,7 @@ public final class ModBlocks {
public static Block AURA_DETECTOR;
public static Block CONVERSION_CATALYST;
public static Block CRUSHING_CATALYST;
public static Block DEPTH_INGOT_BLOCK;
public static Block FLOWER_GENERATOR;
public static Block PLACER;
public static Block HOPPER_UPGRADE;
@ -45,6 +46,7 @@ public final class ModBlocks {
public static Block GOLD_BRICK;
public static Block GOLD_NETHER_BRICK;
public static Block RF_CONVERTER;
public static Block SKY_INGOT_BLOCK;
public static Block MOSS_GENERATOR;
public static Block TIME_CHANGER;
public static Block GENERATOR_LIMIT_REMOVER;

View file

@ -0,0 +1,60 @@
package de.ellpeck.naturesaura.data;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.gen.ModFeatures;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.HolderSet;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BiomeTags;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.world.BiomeModifier;
import net.minecraftforge.common.world.ForgeBiomeModifiers;
import net.minecraftforge.registries.ForgeRegistries;
public class BiomeModifiers {
public static ResourceKey<BiomeModifier> AURA_BLOOM = createKey("aura_bloom");
public static ResourceKey<BiomeModifier> AURA_CACTUS = createKey("aura_cactus");
public static ResourceKey<BiomeModifier> WARPED_AURA_MUSHROOM = createKey("warped_aura_mushroom");
public static ResourceKey<BiomeModifier> CRIMSON_AURA_MUSHROOM = createKey("crimson_aura_mushroom");
public static ResourceKey<BiomeModifier> AURA_MUSHROOM = createKey("aura_mushroom");
private static ResourceKey<BiomeModifier> createKey(String id) {
return ResourceKey.create(ForgeRegistries.Keys.BIOME_MODIFIERS, new ResourceLocation(NaturesAura.MOD_ID, id));
}
public static void bootstrap(BootstapContext<BiomeModifier> context) {
HolderGetter<Biome> biomeGetter = context.lookup(Registries.BIOME);
HolderGetter<PlacedFeature> placedGetter = context.lookup(Registries.PLACED_FEATURE);
context.register(AURA_BLOOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
biomeGetter.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_BLOOM)),
GenerationStep.Decoration.VEGETAL_DECORATION));
context.register(AURA_CACTUS, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
biomeGetter.getOrThrow(Tags.Biomes.IS_SANDY),
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_CACTUS)),
GenerationStep.Decoration.VEGETAL_DECORATION));
context.register(AURA_MUSHROOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
biomeGetter.getOrThrow(Tags.Biomes.IS_MUSHROOM),
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.AURA_MUSHROOM)),
GenerationStep.Decoration.VEGETAL_DECORATION));
context.register(CRIMSON_AURA_MUSHROOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
biomeGetter.getOrThrow(BiomeTags.IS_NETHER),
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.CRIMSON_AURA_MUSHROOM)),
GenerationStep.Decoration.VEGETAL_DECORATION));
context.register(WARPED_AURA_MUSHROOM, new ForgeBiomeModifiers.AddFeaturesBiomeModifier(
biomeGetter.getOrThrow(BiomeTags.IS_NETHER),
HolderSet.direct(placedGetter.getOrThrow(ModFeatures.Placed.WARPED_AURA_MUSHROOM)),
GenerationStep.Decoration.VEGETAL_DECORATION));
}
}

View file

@ -44,15 +44,22 @@ public class BlockTagProvider extends BlockTagsProvider {
this.tag(BlockTagProvider.ALTAR_GOLD_BRICK).add(ModBlocks.GOLD_BRICK, ModBlocks.GOLD_NETHER_BRICK);
this.tag(BlockTagProvider.ALTAR_FANCY_BRICK).add(Blocks.RED_NETHER_BRICKS, Blocks.CHISELED_STONE_BRICKS);
// sort these so that they don't change the json every time we run data (because it's a set)
ModRegistry.ALL_ITEMS.stream().sorted(Comparator.comparing(IModItem::getBaseName)).filter(i -> i instanceof Block).map(i -> (Block) i).forEach(b -> {
// TODO figure out what to do about materials for mineability
/*var material = b.defaultBlockState().getMaterial();
if (material == Material.STONE || material == Material.METAL) {
this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(b);
} else if (material == Material.WOOD) {
this.tag(BlockTags.MINEABLE_WITH_AXE).add(b);
}*/
});
this.tag(BlockTags.MINEABLE_WITH_PICKAXE).add(ModBlocks.ANIMAL_CONTAINER, ModBlocks.ANIMAL_GENERATOR,
ModBlocks.ANIMAL_SPAWNER, ModBlocks.AURA_DETECTOR, ModBlocks.AURA_TIMER, ModBlocks.BLAST_FURNACE_BOOSTER,
ModBlocks.CHORUS_GENERATOR, ModBlocks.CHUNK_LOADER, ModBlocks.CONVERSION_CATALYST, ModBlocks.CRUSHING_CATALYST,
ModBlocks.DEPTH_INGOT_BLOCK, ModBlocks.ENDER_CRATE, ModBlocks.FIELD_CREATOR, ModBlocks.FIREWORK_GENERATOR,
ModBlocks.FURNACE_HEATER, ModBlocks.GENERATOR_LIMIT_REMOVER, ModBlocks.GOLD_BRICK, ModBlocks.GOLD_NETHER_BRICK,
ModBlocks.GRATED_CHUTE, ModBlocks.HOPPER_UPGRADE, ModBlocks.INFUSED_BRICK, ModBlocks.INFUSED_BRICK_SLAB,
ModBlocks.INFUSED_BRICK_STAIRS, ModBlocks.INFUSED_IRON_BLOCK, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_STAIRS,
ModBlocks.INFUSED_STONE, ModBlocks.ITEM_DISTRIBUTOR, ModBlocks.LOWER_LIMITER, ModBlocks.MOSS_GENERATOR,
ModBlocks.NATURE_ALTAR, ModBlocks.NETHER_GRASS, ModBlocks.PICKUP_STOPPER, ModBlocks.PLACER, ModBlocks.POTION_GENERATOR,
ModBlocks.POWDER_PLACER, ModBlocks.PROJECTILE_GENERATOR, ModBlocks.RF_CONVERTER, ModBlocks.SKY_INGOT_BLOCK,
ModBlocks.SNOW_CREATOR, ModBlocks.SPAWN_LAMP, ModBlocks.SPRING, ModBlocks.TAINTED_GOLD_BLOCK,
ModBlocks.TIME_CHANGER, ModBlocks.WEATHER_CHANGER);
this.tag(BlockTags.MINEABLE_WITH_AXE).add(ModBlocks.ANCIENT_BARK, ModBlocks.ANCIENT_LOG,
ModBlocks.ANCIENT_PLANKS, ModBlocks.ANCIENT_SLAB, ModBlocks.ANCIENT_STAIRS,
ModBlocks.AUTO_CRAFTER, ModBlocks.FLOWER_GENERATOR, ModBlocks.NETHER_WART_MUSHROOM,
ModBlocks.OAK_GENERATOR, ModBlocks.OFFERING_TABLE, ModBlocks.WOOD_STAND);
}
}

View file

@ -1,13 +1,24 @@
package de.ellpeck.naturesaura.data;
import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.gen.ModFeatures;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.RegistryAccess;
import net.minecraft.core.RegistrySetBuilder;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.loot.LootTableProvider;
import net.minecraft.data.registries.VanillaRegistries;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider;
import net.minecraftforge.data.event.GatherDataEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.ForgeRegistries;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public final class ModData {
@ -25,5 +36,18 @@ public final class ModData {
gen.addProvider(event.includeServer(), new LootTableProvider(out, Set.of(), List.of(new LootTableProvider.SubProviderEntry(BlockLootProvider::new, LootContextParamSets.BLOCK))));
gen.addProvider(event.includeServer(), new BlockStateGenerator(out, existing));
gen.addProvider(event.includeServer(), new ItemModelGenerator(out, existing));
gen.addProvider(event.includeServer(), new DatapackBuiltinEntriesProvider(out, CompletableFuture.supplyAsync(ModData::getProvider), Set.of(NaturesAura.MOD_ID)));
}
private static HolderLookup.Provider getProvider() {
final RegistrySetBuilder registryBuilder = new RegistrySetBuilder();
registryBuilder.add(Registries.CONFIGURED_FEATURE, ModFeatures.Configured::bootstrap);
registryBuilder.add(Registries.PLACED_FEATURE, ModFeatures.Placed::bootstrap);
registryBuilder.add(ForgeRegistries.Keys.BIOME_MODIFIERS, BiomeModifiers::bootstrap);
// We need the BIOME registry to be present, so we can use a biome tag, doesn't matter that it's empty
registryBuilder.add(Registries.BIOME, context -> {
});
RegistryAccess.Frozen regAccess = RegistryAccess.fromRegistryOfRegistries(BuiltInRegistries.REGISTRY);
return registryBuilder.buildPatch(regAccess, VanillaRegistries.createLookup());
}
}

View file

@ -1,6 +1,12 @@
package de.ellpeck.naturesaura.gen;
import net.minecraft.core.Holder;
import de.ellpeck.naturesaura.NaturesAura;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstapContext;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.configurations.NoneFeatureConfiguration;
@ -20,23 +26,44 @@ public final class ModFeatures {
public static final class Configured {
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 ResourceKey<ConfiguredFeature<?, ?>> ANCIENT_TREE = FeatureUtils.createKey(NaturesAura.MOD_ID + ":ancient_tree");
public static ResourceKey<ConfiguredFeature<?, ?>> NETHER_WART_MUSHROOM = FeatureUtils.createKey(NaturesAura.MOD_ID + ":nether_wart_mushroom");
public static ResourceKey<ConfiguredFeature<?, ?>> AURA_BLOOM = FeatureUtils.createKey(NaturesAura.MOD_ID + ":aura_bloom");
public static ResourceKey<ConfiguredFeature<?, ?>> AURA_CACTUS = FeatureUtils.createKey(NaturesAura.MOD_ID + ":aura_cactus");
public static ResourceKey<ConfiguredFeature<?, ?>> WARPED_AURA_MUSHROOM = FeatureUtils.createKey(NaturesAura.MOD_ID + ":warped_aura_mushroom");
public static ResourceKey<ConfiguredFeature<?, ?>> CRIMSON_AURA_MUSHROOM = FeatureUtils.createKey(NaturesAura.MOD_ID + ":crimson_aura_mushroom");
public static ResourceKey<ConfiguredFeature<?, ?>> AURA_MUSHROOM = FeatureUtils.createKey(NaturesAura.MOD_ID + ":aura_mushroom");
public static void bootstrap(BootstapContext<ConfiguredFeature<?, ?>> context) {
FeatureUtils.register(context, ModFeatures.Configured.AURA_BLOOM, ModFeatures.AURA_BLOOM, NoneFeatureConfiguration.INSTANCE);
FeatureUtils.register(context, ModFeatures.Configured.AURA_CACTUS, ModFeatures.AURA_CACTUS, NoneFeatureConfiguration.INSTANCE);
FeatureUtils.register(context, ModFeatures.Configured.WARPED_AURA_MUSHROOM, ModFeatures.WARPED_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
FeatureUtils.register(context, ModFeatures.Configured.CRIMSON_AURA_MUSHROOM, ModFeatures.CRIMSON_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
FeatureUtils.register(context, ModFeatures.Configured.AURA_MUSHROOM, ModFeatures.AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
FeatureUtils.register(context, ModFeatures.Configured.ANCIENT_TREE, ModFeatures.ANCIENT_TREE, new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
FeatureUtils.register(context, ModFeatures.Configured.NETHER_WART_MUSHROOM, ModFeatures.NETHER_WART_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
}
}
public static final class 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;
public static ResourceKey<PlacedFeature> AURA_BLOOM = PlacementUtils.createKey(NaturesAura.MOD_ID + ":aura_bloom");
public static ResourceKey<PlacedFeature> AURA_CACTUS = PlacementUtils.createKey(NaturesAura.MOD_ID + ":aura_cactus");
public static ResourceKey<PlacedFeature> WARPED_AURA_MUSHROOM = PlacementUtils.createKey(NaturesAura.MOD_ID + ":warped_aura_mushroom");
public static ResourceKey<PlacedFeature> CRIMSON_AURA_MUSHROOM = PlacementUtils.createKey(NaturesAura.MOD_ID + ":crimson_aura_mushroom");
public static ResourceKey<PlacedFeature> AURA_MUSHROOM = PlacementUtils.createKey(NaturesAura.MOD_ID + ":aura_mushroom");
public static void bootstrap(BootstapContext<PlacedFeature> context) {
HolderGetter<ConfiguredFeature<?, ?>> holdergetter = context.lookup(Registries.CONFIGURED_FEATURE);
PlacementUtils.register(context, AURA_BLOOM, holdergetter.getOrThrow(ModFeatures.Configured.AURA_BLOOM));
PlacementUtils.register(context, AURA_CACTUS, holdergetter.getOrThrow(ModFeatures.Configured.AURA_CACTUS));
PlacementUtils.register(context, WARPED_AURA_MUSHROOM, holdergetter.getOrThrow(ModFeatures.Configured.WARPED_AURA_MUSHROOM));
PlacementUtils.register(context, CRIMSON_AURA_MUSHROOM, holdergetter.getOrThrow(ModFeatures.Configured.CRIMSON_AURA_MUSHROOM));
PlacementUtils.register(context, AURA_MUSHROOM, holdergetter.getOrThrow(ModFeatures.Configured.AURA_MUSHROOM));
}
}
}

View file

@ -1,12 +1,15 @@
package de.ellpeck.naturesaura.items;
import de.ellpeck.naturesaura.gen.ModFeatures;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.NetherWartBlock;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
public class ItemCrimsonMeal extends ItemImpl {
@ -24,7 +27,8 @@ public class ItemCrimsonMeal extends ItemImpl {
if (level.random.nextInt(5) == 0) {
int age = state.getValue(NetherWartBlock.AGE);
if (age >= 3) {
ModFeatures.Configured.NETHER_WART_MUSHROOM.value().place((ServerLevel) level, ((ServerLevel) level).getChunkSource().getGenerator(), level.random, pos);
Registry<ConfiguredFeature<?, ?>> registry = level.registryAccess().registryOrThrow(Registries.CONFIGURED_FEATURE);
registry.getHolderOrThrow(ModFeatures.Configured.NETHER_WART_MUSHROOM).value().place((ServerLevel) level, ((ServerLevel) level).getChunkSource().getGenerator(), level.random, pos);
} else {
level.setBlockAndUpdate(pos, state.setValue(NetherWartBlock.AGE, age + 1));
}

View file

@ -50,8 +50,7 @@ public class ItemSword extends SwordItem implements IModItem, ICustomItemModel {
// this is just a modified copy of Player.attack's sweeping damage code
var damage = (float) player.getAttributeValue(Attributes.ATTACK_DAMAGE) * 0.75F;
for (var other : player.level().getEntitiesOfClass(LivingEntity.class, stack.getSweepHitBox(player, target))) {
// TODO we removed canHit here, is that okay?
if (other != player && other != target && !player.isAlliedTo(other) && (!(other instanceof ArmorStand stand) || !stand.isMarker())) {
if (other != player && other != target && !player.isAlliedTo(other) && (!(other instanceof ArmorStand stand) || !stand.isMarker()) && player.distanceToSqr(other) < Mth.square(player.getEntityReach())) {
other.knockback(0.4F, Mth.sin(player.getYRot() * (Mth.PI / 180)), -Mth.cos(player.getYRot() * (Mth.PI / 180)));
other.hurt(other.damageSources().playerAttack(player), damage);
}

View file

@ -11,6 +11,10 @@ import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat;
import de.ellpeck.naturesaura.enchant.AuraMendingEnchantment;
import de.ellpeck.naturesaura.enchant.ModEnchantments;
import de.ellpeck.naturesaura.entities.*;
import de.ellpeck.naturesaura.gen.LevelGenAncientTree;
import de.ellpeck.naturesaura.gen.LevelGenAuraBloom;
import de.ellpeck.naturesaura.gen.LevelGenNetherWartMushroom;
import de.ellpeck.naturesaura.gen.ModFeatures;
import de.ellpeck.naturesaura.gui.ContainerEnderCrate;
import de.ellpeck.naturesaura.gui.ModContainers;
import de.ellpeck.naturesaura.items.*;
@ -276,7 +280,7 @@ public final class ModRegistry {
Helper.populateObjectHolders(ModEntities.class, event.getForgeRegistry());
});
/*
event.register(ForgeRegistries.Keys.FEATURES, h -> {
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_bloom"), new LevelGenAuraBloom(ModBlocks.AURA_BLOOM, 60, false));
h.register(new ResourceLocation(NaturesAura.MOD_ID, "aura_cactus"), new LevelGenAuraBloom(ModBlocks.AURA_CACTUS, 60, false));
@ -287,7 +291,7 @@ public final class ModRegistry {
h.register(new ResourceLocation(NaturesAura.MOD_ID, "nether_wart_mushroom"), new LevelGenNetherWartMushroom());
Helper.populateObjectHolders(ModFeatures.class, event.getForgeRegistry());
});
*/
event.register(ForgeRegistries.Keys.RECIPE_TYPES, h -> {
h.register(new ResourceLocation(NaturesAura.MOD_ID, "altar"), ModRecipes.ALTAR_TYPE);
@ -324,23 +328,6 @@ public final class ModRegistry {
});
}
public static void init() {
// TODO fucking features changed again
/*ModFeatures.Configured.AURA_BLOOM = FeatureUtils.register(NaturesAura.MOD_ID + ":aura_bloom", ModFeatures.AURA_BLOOM, NoneFeatureConfiguration.INSTANCE);
ModFeatures.Configured.AURA_CACTUS = FeatureUtils.register(NaturesAura.MOD_ID + ":aura_cactus", ModFeatures.AURA_CACTUS, NoneFeatureConfiguration.INSTANCE);
ModFeatures.Configured.WARPED_AURA_MUSHROOM = FeatureUtils.register(NaturesAura.MOD_ID + ":warped_aura_mushroom", ModFeatures.WARPED_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
ModFeatures.Configured.CRIMSON_AURA_MUSHROOM = FeatureUtils.register(NaturesAura.MOD_ID + ":crimson_aura_mushroom", ModFeatures.CRIMSON_AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
ModFeatures.Configured.AURA_MUSHROOM = FeatureUtils.register(NaturesAura.MOD_ID + ":aura_mushroom", ModFeatures.AURA_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
ModFeatures.Configured.ANCIENT_TREE = FeatureUtils.register(NaturesAura.MOD_ID + ":ancient_tree", ModFeatures.ANCIENT_TREE, new TreeConfiguration.TreeConfigurationBuilder(null, null, null, null, null).build());
ModFeatures.Configured.NETHER_WART_MUSHROOM = FeatureUtils.register(NaturesAura.MOD_ID + ":nether_wart_mushroom", ModFeatures.NETHER_WART_MUSHROOM, NoneFeatureConfiguration.INSTANCE);
ModFeatures.Placed.AURA_BLOOM = PlacementUtils.register(NaturesAura.MOD_ID + ":aura_bloom", ModFeatures.Configured.AURA_BLOOM);
ModFeatures.Placed.AURA_CACTUS = PlacementUtils.register(NaturesAura.MOD_ID + ":aura_cactus", ModFeatures.Configured.AURA_CACTUS);
ModFeatures.Placed.WARPED_AURA_MUSHROOM = PlacementUtils.register(NaturesAura.MOD_ID + ":warped_aura_mushroom", ModFeatures.Configured.WARPED_AURA_MUSHROOM);
ModFeatures.Placed.CRIMSON_AURA_MUSHROOM = PlacementUtils.register(NaturesAura.MOD_ID + ":crimson_aura_mushroom", ModFeatures.Configured.CRIMSON_AURA_MUSHROOM);
ModFeatures.Placed.AURA_MUSHROOM = PlacementUtils.register(NaturesAura.MOD_ID + ":aura_mushroom", ModFeatures.Configured.AURA_MUSHROOM);*/
}
public static Block createFlowerPot(Block block) {
var props = Block.Properties.of().strength(0F);
Block potted = new BlockFlowerPot(() -> (FlowerPotBlock) Blocks.FLOWER_POT, () -> block, props);

View file

@ -1,6 +0,0 @@
{
"type": "forge:add_features",
"biomes": "#forge:is_overworld",
"features": "naturesaura:aura_bloom",
"step": "vegetal_decoration"
}

View file

@ -1,6 +0,0 @@
{
"type": "forge:add_features",
"biomes": "#forge:is_sandy",
"features": "naturesaura:aura_cactus",
"step": "vegetal_decoration"
}

View file

@ -1,6 +0,0 @@
{
"type": "forge:add_features",
"biomes": "#forge:is_mushroom",
"features": "naturesaura:aura_mushroom",
"step": "vegetal_decoration"
}

View file

@ -1,6 +0,0 @@
{
"type": "forge:add_features",
"biomes": "#minecraft:is_nether",
"features": "naturesaura:crimson_aura_mushroom",
"step": "vegetal_decoration"
}

View file

@ -1,6 +0,0 @@
{
"type": "forge:add_features",
"biomes": "#minecraft:is_nether",
"features": "naturesaura:warped_aura_mushroom",
"step": "vegetal_decoration"
}