mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 11:53:29 +01:00
added more types of aura plants
This commit is contained in:
parent
df887b60fd
commit
c495f51e55
35 changed files with 368 additions and 49 deletions
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/crimson_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/potted_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/potted_crimson_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/potted_warped_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/warped_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/cross",
|
||||||
|
"textures": {
|
||||||
|
"cross": "naturesaura:block/aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/cross",
|
||||||
|
"textures": {
|
||||||
|
"cross": "naturesaura:block/crimson_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/flower_pot_cross",
|
||||||
|
"textures": {
|
||||||
|
"plant": "naturesaura:block/aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/flower_pot_cross",
|
||||||
|
"textures": {
|
||||||
|
"plant": "naturesaura:block/crimson_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/flower_pot_cross",
|
||||||
|
"textures": {
|
||||||
|
"plant": "naturesaura:block/warped_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:block/cross",
|
||||||
|
"textures": {
|
||||||
|
"cross": "naturesaura:block/warped_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "naturesaura:block/aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "naturesaura:block/crimson_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "minecraft:item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "naturesaura:block/warped_aura_mushroom"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "naturesaura:aura_mushroom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "naturesaura:crimson_aura_mushroom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "minecraft:flower_pot"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "naturesaura:aura_mushroom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "minecraft:flower_pot"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "naturesaura:crimson_aura_mushroom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "minecraft:flower_pot"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "naturesaura:warped_aura_mushroom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "naturesaura:warped_aura_mushroom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package de.ellpeck.naturesaura.blocks;
|
package de.ellpeck.naturesaura.blocks;
|
||||||
|
|
||||||
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom;
|
||||||
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
import de.ellpeck.naturesaura.data.BlockStateGenerator;
|
||||||
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
import de.ellpeck.naturesaura.data.ItemModelGenerator;
|
||||||
import de.ellpeck.naturesaura.reg.*;
|
import de.ellpeck.naturesaura.reg.*;
|
||||||
|
@ -7,6 +8,8 @@ import net.minecraft.block.*;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.tags.BlockTags;
|
||||||
|
import net.minecraft.tags.ITag;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -18,27 +21,32 @@ import net.minecraft.world.IWorldReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.function.Predicate;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockState, ICustomItemModel, ICustomRenderType {
|
public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockState, ICustomItemModel, ICustomRenderType {
|
||||||
|
|
||||||
protected static final VoxelShape SHAPE = Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
|
protected static final VoxelShape SHAPE = Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
|
||||||
private final String baseName;
|
private final String baseName;
|
||||||
private final Supplier<TileEntity> tileEntitySupplier;
|
private final Block[] allowedGround;
|
||||||
|
|
||||||
public BlockAuraBloom(String baseName, Supplier<TileEntity> tileEntitySupplier) {
|
public BlockAuraBloom(String baseName, Block... allowedGround) {
|
||||||
super(Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT));
|
super(Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT));
|
||||||
this.baseName = baseName;
|
this.baseName = baseName;
|
||||||
this.tileEntitySupplier = tileEntitySupplier;
|
this.allowedGround = allowedGround;
|
||||||
ModRegistry.add(this);
|
ModRegistry.add(this);
|
||||||
ModRegistry.add(new ModTileType<>(this.tileEntitySupplier, this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||||
if (this == ModBlocks.AURA_CACTUS)
|
BlockPos down = pos.down();
|
||||||
return worldIn.getBlockState(pos.down()).getBlock() instanceof SandBlock;
|
return this.isValidGround(worldIn.getBlockState(down), worldIn, down);
|
||||||
return super.isValidPosition(state, worldIn, pos);
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||||
|
return Arrays.stream(this.allowedGround).anyMatch(state::isIn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,7 +84,7 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
return this.tileEntitySupplier.get();
|
return new TileEntityAuraBloom();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,6 +3,8 @@ package de.ellpeck.naturesaura.blocks;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.block.material.MaterialColor;
|
import net.minecraft.block.material.MaterialColor;
|
||||||
|
import net.minecraft.world.gen.feature.Feature;
|
||||||
|
import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||||
|
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("FieldNamingConvention")
|
||||||
public final class ModBlocks {
|
public final class ModBlocks {
|
||||||
|
@ -72,4 +74,7 @@ public final class ModBlocks {
|
||||||
public static Block AURA_TIMER;
|
public static Block AURA_TIMER;
|
||||||
public static Block SLIME_SPLIT_GENERATOR;
|
public static Block SLIME_SPLIT_GENERATOR;
|
||||||
public static Block SPRING;
|
public static Block SPRING;
|
||||||
|
public static Block WARPED_AURA_MUSHROOM;
|
||||||
|
public static Block CRIMSON_AURA_MUSHROOM;
|
||||||
|
public static Block AURA_MUSHROOM;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ public final class ModTileEntities {
|
||||||
public static TileEntityType<TileEntitySnowCreator> SNOW_CREATOR;
|
public static TileEntityType<TileEntitySnowCreator> SNOW_CREATOR;
|
||||||
public static TileEntityType<TileEntityItemDistributor> ITEM_DISTRIBUTOR;
|
public static TileEntityType<TileEntityItemDistributor> ITEM_DISTRIBUTOR;
|
||||||
public static TileEntityType<TileEntityAuraBloom> AURA_BLOOM;
|
public static TileEntityType<TileEntityAuraBloom> AURA_BLOOM;
|
||||||
public static TileEntityType<TileEntityAuraBloom> AURA_CACTUS;
|
|
||||||
public static TileEntityType<TileEntityChorusGenerator> CHORUS_GENERATOR;
|
public static TileEntityType<TileEntityChorusGenerator> CHORUS_GENERATOR;
|
||||||
public static TileEntityType<TileEntityAuraTimer> AURA_TIMER;
|
public static TileEntityType<TileEntityAuraTimer> AURA_TIMER;
|
||||||
public static TileEntityType<TileEntitySlimeSplitGenerator> SLIME_SPLIT_GENERATOR;
|
public static TileEntityType<TileEntitySlimeSplitGenerator> SLIME_SPLIT_GENERATOR;
|
||||||
|
|
|
@ -40,10 +40,4 @@ public class TileEntityAuraBloom extends TileEntityImpl implements ITickableTile
|
||||||
if (type == SaveType.TILE)
|
if (type == SaveType.TILE)
|
||||||
this.justGenerated = compound.getBoolean("just_generated");
|
this.justGenerated = compound.getBoolean("just_generated");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TileEntityAuraCactus extends TileEntityAuraBloom {
|
|
||||||
public TileEntityAuraCactus() {
|
|
||||||
super(ModTileEntities.AURA_CACTUS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,21 +14,19 @@ import de.ellpeck.naturesaura.commands.CommandAura;
|
||||||
import de.ellpeck.naturesaura.gen.ModFeatures;
|
import de.ellpeck.naturesaura.gen.ModFeatures;
|
||||||
import de.ellpeck.naturesaura.misc.WorldData;
|
import de.ellpeck.naturesaura.misc.WorldData;
|
||||||
import de.ellpeck.naturesaura.packet.PacketHandler;
|
import de.ellpeck.naturesaura.packet.PacketHandler;
|
||||||
import de.ellpeck.naturesaura.recipes.ModRecipes;
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.profiler.IProfiler;
|
|
||||||
import net.minecraft.resources.IFutureReloadListener;
|
|
||||||
import net.minecraft.resources.IResourceManager;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.biome.Biome;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.gen.GenerationStage;
|
import net.minecraft.world.gen.GenerationStage;
|
||||||
|
import net.minecraft.world.gen.GenerationStage.Decoration;
|
||||||
import net.minecraft.world.gen.feature.IFeatureConfig;
|
import net.minecraft.world.gen.feature.IFeatureConfig;
|
||||||
|
import net.minecraft.world.gen.placement.ConfiguredPlacement;
|
||||||
import net.minecraft.world.gen.placement.IPlacementConfig;
|
import net.minecraft.world.gen.placement.IPlacementConfig;
|
||||||
|
import net.minecraft.world.gen.placement.NoPlacementConfig;
|
||||||
import net.minecraft.world.gen.placement.Placement;
|
import net.minecraft.world.gen.placement.Placement;
|
||||||
import net.minecraft.world.server.ChunkHolder;
|
import net.minecraft.world.server.ChunkHolder;
|
||||||
import net.minecraft.world.server.ChunkManager;
|
import net.minecraft.world.server.ChunkManager;
|
||||||
|
@ -40,15 +38,12 @@ import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||||
import net.minecraftforge.event.world.ChunkWatchEvent;
|
import net.minecraftforge.event.world.ChunkWatchEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||||
import net.minecraftforge.fml.event.server.FMLServerAboutToStartEvent;
|
|
||||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||||
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
|
|
||||||
public class CommonEvents {
|
public class CommonEvents {
|
||||||
|
|
||||||
|
@ -58,9 +53,20 @@ public class CommonEvents {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onBiomeLoad(BiomeLoadingEvent event) {
|
public void onBiomeLoad(BiomeLoadingEvent event) {
|
||||||
if (ModConfig.instance.auraBlooms.get()) {
|
if (ModConfig.instance.auraBlooms.get()) {
|
||||||
event.getGeneration().func_242513_a(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG)));
|
ConfiguredPlacement<NoPlacementConfig> placement = Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG);
|
||||||
if (event.getCategory() == Biome.Category.DESERT)
|
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||||
event.getGeneration().func_242513_a(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_CACTUS.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(Placement.NOPE.configure(IPlacementConfig.NO_PLACEMENT_CONFIG)));
|
switch (event.getCategory()) {
|
||||||
|
case DESERT:
|
||||||
|
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.AURA_CACTUS.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||||
|
break;
|
||||||
|
case NETHER:
|
||||||
|
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.CRIMSON_AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||||
|
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.WARPED_AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||||
|
break;
|
||||||
|
case MUSHROOM:
|
||||||
|
event.getGeneration().func_242513_a(Decoration.VEGETAL_DECORATION, ModFeatures.AURA_MUSHROOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).withPlacement(placement));
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,5 +12,8 @@ public final class ModFeatures {
|
||||||
public static Feature<NoFeatureConfig> NETHER_WART_MUSHROOM;
|
public static Feature<NoFeatureConfig> NETHER_WART_MUSHROOM;
|
||||||
public static Feature<NoFeatureConfig> AURA_BLOOM;
|
public static Feature<NoFeatureConfig> AURA_BLOOM;
|
||||||
public static Feature<NoFeatureConfig> AURA_CACTUS;
|
public static Feature<NoFeatureConfig> AURA_CACTUS;
|
||||||
|
public static Feature<NoFeatureConfig> WARPED_AURA_MUSHROOM;
|
||||||
|
public static Feature<NoFeatureConfig> CRIMSON_AURA_MUSHROOM;
|
||||||
|
public static Feature<NoFeatureConfig> AURA_MUSHROOM;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.world.ISeedReader;
|
import net.minecraft.world.ISeedReader;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.gen.ChunkGenerator;
|
import net.minecraft.world.gen.ChunkGenerator;
|
||||||
import net.minecraft.world.gen.Heightmap;
|
import net.minecraft.world.gen.Heightmap;
|
||||||
import net.minecraft.world.gen.feature.Feature;
|
import net.minecraft.world.gen.feature.Feature;
|
||||||
|
@ -20,34 +21,53 @@ import java.util.Random;
|
||||||
public class WorldGenAuraBloom extends Feature<NoFeatureConfig> {
|
public class WorldGenAuraBloom extends Feature<NoFeatureConfig> {
|
||||||
|
|
||||||
private final Block block;
|
private final Block block;
|
||||||
|
private final int chance;
|
||||||
|
private final boolean nether;
|
||||||
|
|
||||||
public WorldGenAuraBloom(Block block) {
|
public WorldGenAuraBloom(Block block, int chance, boolean nether) {
|
||||||
super(Codec.unit(IFeatureConfig.NO_FEATURE_CONFIG));
|
super(Codec.unit(IFeatureConfig.NO_FEATURE_CONFIG));
|
||||||
this.block = block;
|
this.block = block;
|
||||||
|
this.chance = chance;
|
||||||
|
this.nether = nether;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean func_241855_a(ISeedReader worldIn, ChunkGenerator gen, Random rand, BlockPos pos, NoFeatureConfig p_241855_5_) {
|
public boolean func_241855_a(ISeedReader worldIn, ChunkGenerator gen, Random rand, BlockPos pos, NoFeatureConfig config) {
|
||||||
if (rand.nextInt(60) != 0)
|
if (rand.nextInt(this.chance) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int startX = pos.getX() + rand.nextInt(16);
|
int startX = pos.getX() + rand.nextInt(16);
|
||||||
int startZ = pos.getZ() + rand.nextInt(16);
|
int startZ = pos.getZ() + rand.nextInt(16);
|
||||||
boolean any = false;
|
boolean any = false;
|
||||||
for (int i = MathHelper.nextInt(rand, 3, 8); i > 0; i--) {
|
for (int i = MathHelper.nextInt(rand, 3, 8); i > 0; i--) {
|
||||||
int offX = startX + MathHelper.nextInt(rand, -5, 5);
|
int offX = startX + MathHelper.nextInt(rand, -5, 5);
|
||||||
int offZ = startZ + MathHelper.nextInt(rand, -5, 5);
|
int offZ = startZ + MathHelper.nextInt(rand, -5, 5);
|
||||||
BlockPos placePos = new BlockPos(offX, worldIn.getHeight(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, offX, offZ), offZ);
|
if (this.nether) {
|
||||||
BlockState state = this.block.getDefaultState();
|
int y = MathHelper.nextInt(rand, 0, 128);
|
||||||
if (this.block.isValidPosition(state, worldIn, placePos)) {
|
for (int off = 0; off < 64; off++) {
|
||||||
worldIn.setBlockState(placePos, state, 3);
|
// try to find a good location in both directions of the random pos
|
||||||
|
if (this.tryPlace(worldIn, new BlockPos(offX, y - off, offZ)) || this.tryPlace(worldIn, new BlockPos(offX, y + off, offZ))) {
|
||||||
TileEntity tile = worldIn.getTileEntity(placePos);
|
any = true;
|
||||||
if (tile instanceof TileEntityAuraBloom)
|
break;
|
||||||
((TileEntityAuraBloom) tile).justGenerated = true;
|
}
|
||||||
any = true;
|
}
|
||||||
|
} else {
|
||||||
|
BlockPos placePos = new BlockPos(offX, worldIn.getHeight(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, offX, offZ), offZ);
|
||||||
|
if (this.tryPlace(worldIn, placePos))
|
||||||
|
any = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return any;
|
return any;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean tryPlace(ISeedReader world, BlockPos pos) {
|
||||||
|
BlockState state = this.block.getDefaultState();
|
||||||
|
if (this.block.isValidPosition(state, world, pos)) {
|
||||||
|
world.setBlockState(pos, state, 3);
|
||||||
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if (tile instanceof TileEntityAuraBloom)
|
||||||
|
((TileEntityAuraBloom) tile).justGenerated = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import de.ellpeck.naturesaura.api.misc.IWorldData;
|
||||||
import de.ellpeck.naturesaura.blocks.*;
|
import de.ellpeck.naturesaura.blocks.*;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom;
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom.TileEntityAuraCactus;
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate;
|
||||||
import de.ellpeck.naturesaura.enchant.AuraMendingEnchantment;
|
import de.ellpeck.naturesaura.enchant.AuraMendingEnchantment;
|
||||||
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
import de.ellpeck.naturesaura.enchant.ModEnchantments;
|
||||||
|
@ -127,9 +126,15 @@ public final class ModRegistry {
|
||||||
new BlockAnimalContainer(),
|
new BlockAnimalContainer(),
|
||||||
new BlockSnowCreator(),
|
new BlockSnowCreator(),
|
||||||
new BlockItemDistributor(),
|
new BlockItemDistributor(),
|
||||||
temp = new BlockAuraBloom("aura_bloom", TileEntityAuraBloom::new),
|
temp = new BlockAuraBloom("aura_bloom", Blocks.GRASS_BLOCK, Blocks.DIRT, Blocks.PODZOL, Blocks.COARSE_DIRT, Blocks.FARMLAND),
|
||||||
createFlowerPot(temp),
|
createFlowerPot(temp),
|
||||||
temp = new BlockAuraBloom("aura_cactus", TileEntityAuraCactus::new),
|
temp = new BlockAuraBloom("aura_cactus", Blocks.SAND, Blocks.RED_SAND),
|
||||||
|
createFlowerPot(temp),
|
||||||
|
temp = new BlockAuraBloom("warped_aura_mushroom", Blocks.WARPED_NYLIUM),
|
||||||
|
createFlowerPot(temp),
|
||||||
|
temp = new BlockAuraBloom("crimson_aura_mushroom", Blocks.CRIMSON_NYLIUM),
|
||||||
|
createFlowerPot(temp),
|
||||||
|
temp = new BlockAuraBloom("aura_mushroom", Blocks.MYCELIUM),
|
||||||
createFlowerPot(temp),
|
createFlowerPot(temp),
|
||||||
new BlockImpl("tainted_gold_block", Block.Properties.create(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(3F)),
|
new BlockImpl("tainted_gold_block", Block.Properties.create(Material.IRON).sound(SoundType.METAL).hardnessAndResistance(3F)),
|
||||||
new BlockNetherGrass(),
|
new BlockNetherGrass(),
|
||||||
|
@ -225,6 +230,9 @@ public final class ModRegistry {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void registerTiles(RegistryEvent.Register<TileEntityType<?>> event) {
|
public static void registerTiles(RegistryEvent.Register<TileEntityType<?>> event) {
|
||||||
|
// add tile entities that support multiple blocks
|
||||||
|
add(new ModTileType<>(TileEntityAuraBloom::new, "aura_bloom", ALL_ITEMS.stream().filter(i -> i instanceof BlockAuraBloom).toArray(IModItem[]::new)));
|
||||||
|
|
||||||
for (IModItem item : ALL_ITEMS) {
|
for (IModItem item : ALL_ITEMS) {
|
||||||
if (item instanceof ModTileType)
|
if (item instanceof ModTileType)
|
||||||
event.getRegistry().register(((ModTileType) item).type);
|
event.getRegistry().register(((ModTileType) item).type);
|
||||||
|
@ -303,8 +311,11 @@ public final class ModRegistry {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void registerFeatures(RegistryEvent.Register<Feature<?>> event) {
|
public static void registerFeatures(RegistryEvent.Register<Feature<?>> event) {
|
||||||
event.getRegistry().registerAll(
|
event.getRegistry().registerAll(
|
||||||
new WorldGenAuraBloom(ModBlocks.AURA_BLOOM).setRegistryName("aura_bloom"),
|
new WorldGenAuraBloom(ModBlocks.AURA_BLOOM, 60, false).setRegistryName("aura_bloom"),
|
||||||
new WorldGenAuraBloom(ModBlocks.AURA_CACTUS).setRegistryName("aura_cactus"),
|
new WorldGenAuraBloom(ModBlocks.AURA_CACTUS, 60, false).setRegistryName("aura_cactus"),
|
||||||
|
new WorldGenAuraBloom(ModBlocks.WARPED_AURA_MUSHROOM, 10, true).setRegistryName("warped_aura_mushroom"),
|
||||||
|
new WorldGenAuraBloom(ModBlocks.CRIMSON_AURA_MUSHROOM, 10, true).setRegistryName("crimson_aura_mushroom"),
|
||||||
|
new WorldGenAuraBloom(ModBlocks.AURA_MUSHROOM, 20, false).setRegistryName("aura_mushroom"),
|
||||||
new WorldGenAncientTree().setRegistryName("ancient_tree"),
|
new WorldGenAncientTree().setRegistryName("ancient_tree"),
|
||||||
new WorldGenNetherWartMushroom().setRegistryName("nether_wart_mushroom")
|
new WorldGenNetherWartMushroom().setRegistryName("nether_wart_mushroom")
|
||||||
);
|
);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.tileentity.TileEntityType;
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
import net.minecraftforge.registries.ForgeRegistryEntry;
|
import net.minecraftforge.registries.ForgeRegistryEntry;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class ModTileType<T extends TileEntity> implements IModItem {
|
public class ModTileType<T extends TileEntity> implements IModItem {
|
||||||
|
@ -12,9 +13,14 @@ public class ModTileType<T extends TileEntity> implements IModItem {
|
||||||
public final TileEntityType<T> type;
|
public final TileEntityType<T> type;
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
||||||
public ModTileType(Supplier<T> supplier, IModItem block) {
|
public ModTileType(Supplier<T> supplier, IModItem item) {
|
||||||
this.type = TileEntityType.Builder.create(supplier, (Block) block).build(null);
|
this(supplier, item.getBaseName(), item);
|
||||||
this.name = block.getBaseName();
|
}
|
||||||
|
|
||||||
|
public ModTileType(Supplier<T> supplier, String name, IModItem... items) {
|
||||||
|
this.name = name;
|
||||||
|
Block[] blocks = Arrays.stream(items).map(i -> (Block) i).toArray(Block[]::new);
|
||||||
|
this.type = TileEntityType.Builder.create(supplier, blocks).build(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -61,6 +61,9 @@
|
||||||
"block.naturesaura.item_distributor": "Item Distributor",
|
"block.naturesaura.item_distributor": "Item Distributor",
|
||||||
"block.naturesaura.aura_bloom": "Aura Bloom",
|
"block.naturesaura.aura_bloom": "Aura Bloom",
|
||||||
"block.naturesaura.aura_cactus": "Aura Cactus",
|
"block.naturesaura.aura_cactus": "Aura Cactus",
|
||||||
|
"block.naturesaura.aura_mushroom": "Aura Mushroom",
|
||||||
|
"block.naturesaura.warped_aura_mushroom": "Warped Aura Fungus",
|
||||||
|
"block.naturesaura.crimson_aura_mushroom": "Crimson Aura Fungus",
|
||||||
"block.naturesaura.tainted_gold_block": "Tainted Gold Block",
|
"block.naturesaura.tainted_gold_block": "Tainted Gold Block",
|
||||||
"block.naturesaura.nether_grass": "Grassy Netherrack",
|
"block.naturesaura.nether_grass": "Grassy Netherrack",
|
||||||
"block.naturesaura.chorus_generator": "Reaper of Ender Heights",
|
"block.naturesaura.chorus_generator": "Reaper of Ender Heights",
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 276 B |
Binary file not shown.
After Width: | Height: | Size: 393 B |
Binary file not shown.
After Width: | Height: | Size: 355 B |
|
@ -5,7 +5,7 @@
|
||||||
"pages": [
|
"pages": [
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"text": "A natural occurence that helped the discovery of $(aura) are certain kinds of vegetation that appear almost everywhere in the world. These two plants, specifically $(item)Aura Blooms$() and $(item)Aura Cacti$() are known to cause the area around them to naturally contain a higher concentration of $(aura) when they first grow."
|
"text": "A natural occurence that helped the discovery of $(aura) are certain kinds of vegetation that appear almost everywhere in the world. These plants are known to cause the area around them to naturally contain a higher concentration of $(aura) when they first grow. Additionally, all of these plants fit perfectly into $(item)Flower Pots$(), serving as a nice decoration."
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "spotlight",
|
"type": "spotlight",
|
||||||
|
@ -17,7 +17,19 @@
|
||||||
"type": "spotlight",
|
"type": "spotlight",
|
||||||
"item": "naturesaura:aura_cactus",
|
"item": "naturesaura:aura_cactus",
|
||||||
"link_recipe": true,
|
"link_recipe": true,
|
||||||
"text": "The $(item)Aura Cactus$() grows in deserted areas of any color, as well as $(thing)mesa$() regions. Since these areas are usually fairly barren with not many plants to be found, these can be a good starting point as well as a nice decoration, since they, along with their bloom counterpart, fit perfectly inside $(item)Flower Pots$()."
|
"text": "The $(item)Aura Cactus$() grows in deserted areas of any color, as well as $(thing)mesa$() regions. Since these areas are usually fairly barren with not many plants to be found, these can be a good starting point."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "spotlight",
|
||||||
|
"item": "naturesaura:aura_mushroom",
|
||||||
|
"link_recipe": true,
|
||||||
|
"text": "The $(item)Aura Mushroom$() is found on mycelium-infested islands, where it appears alongside giant mushrooms and bright red cows. In these regions, it causes beautiful purple aura particles to rise from the ground."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "spotlight",
|
||||||
|
"item": "naturesaura:crimson_aura_mushroom",
|
||||||
|
"link_recipe": true,
|
||||||
|
"text": "The $(item)Crimson$() and $(item)Warped Aura Mushrooms$() can be found in the forested regions of $(thing)the nether$(), where they sprout alongside their aura-less counterparts. When starting out as a magical botanist in these hellish regions, they can prove especially beneficial."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
Loading…
Reference in a new issue