mirror of
https://github.com/Ellpeck/NaturesAura.git
synced 2024-11-22 19:58:34 +01:00
added the aura cactus
This commit is contained in:
parent
a4f0f509e8
commit
29b291eb15
18 changed files with 151 additions and 20 deletions
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/aura_cactus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "naturesaura:block/potted_aura_cactus"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/cross",
|
||||||
|
"textures": {
|
||||||
|
"cross": "naturesaura:block/aura_cactus"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "block/flower_pot_cross",
|
||||||
|
"textures": {
|
||||||
|
"plant": "naturesaura:block/aura_cactus"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"parent": "item/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "naturesaura:block/aura_cactus"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "naturesaura:block/potted_aura_cactus"
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
{
|
||||||
|
"type": "minecraft:block",
|
||||||
|
"pools": [
|
||||||
|
{
|
||||||
|
"rolls": 1,
|
||||||
|
"entries": [
|
||||||
|
{
|
||||||
|
"type": "minecraft:item",
|
||||||
|
"name": "naturesaura:aura_cactus"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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_cactus"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"conditions": [
|
||||||
|
{
|
||||||
|
"condition": "minecraft:survives_explosion"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -121,7 +121,7 @@ public final class ModConfig {
|
||||||
.translation("config." + NaturesAura.MOD_ID + ".oreEffect")
|
.translation("config." + NaturesAura.MOD_ID + ".oreEffect")
|
||||||
.define("oreEffect", true);
|
.define("oreEffect", true);
|
||||||
this.auraBlooms = builder
|
this.auraBlooms = builder
|
||||||
.comment("If Aura Blooms should generate in the world")
|
.comment("If Aura Blooms and Aura Cacti should generate in the world")
|
||||||
.translation("config." + NaturesAura.MOD_ID + ".auraBlooms")
|
.translation("config." + NaturesAura.MOD_ID + ".auraBlooms")
|
||||||
.define("auraBlooms", true);
|
.define("auraBlooms", true);
|
||||||
builder.pop();
|
builder.pop();
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
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.*;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.BushBlock;
|
|
||||||
import net.minecraft.block.SoundType;
|
|
||||||
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.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraft.world.IWorldReader;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
@ -23,11 +23,28 @@ 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 Supplier<TileEntity> tileEntitySupplier;
|
||||||
|
|
||||||
public BlockAuraBloom() {
|
public BlockAuraBloom(String baseName, Supplier<TileEntity> tileEntitySupplier) {
|
||||||
super(ModBlocks.prop(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT));
|
super(ModBlocks.prop(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0).sound(SoundType.PLANT));
|
||||||
|
this.baseName = baseName;
|
||||||
|
this.tileEntitySupplier = tileEntitySupplier;
|
||||||
ModRegistry.add(this);
|
ModRegistry.add(this);
|
||||||
ModRegistry.add(new ModTileType<>(TileEntityAuraBloom::new, this));
|
ModRegistry.add(new ModTileType<>(this.tileEntitySupplier, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
|
||||||
|
if (this == ModBlocks.AURA_CACTUS)
|
||||||
|
return worldIn.getBlockState(pos.down()).getBlock() instanceof SandBlock;
|
||||||
|
return super.isValidPosition(state, worldIn, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onEntityCollision(BlockState state, World worldIn, BlockPos pos, Entity entityIn) {
|
||||||
|
if (this == ModBlocks.AURA_CACTUS)
|
||||||
|
entityIn.attackEntityFrom(DamageSource.CACTUS, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,13 +70,13 @@ public class BlockAuraBloom extends BushBlock implements IModItem, ICustomBlockS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getBaseName() {
|
public String getBaseName() {
|
||||||
return "aura_bloom";
|
return this.baseName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
return new TileEntityAuraBloom();
|
return this.tileEntitySupplier.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -63,6 +63,7 @@ public final class ModBlocks {
|
||||||
public static Block SNOW_CREATOR;
|
public static Block SNOW_CREATOR;
|
||||||
public static Block ITEM_DISTRIBUTOR;
|
public static Block ITEM_DISTRIBUTOR;
|
||||||
public static Block AURA_BLOOM;
|
public static Block AURA_BLOOM;
|
||||||
|
public static Block AURA_CACTUS;
|
||||||
|
|
||||||
public static Block.Properties prop(Material material, MaterialColor color) {
|
public static Block.Properties prop(Material material, MaterialColor color) {
|
||||||
return Block.Properties.create(material, color);
|
return Block.Properties.create(material, color);
|
||||||
|
|
|
@ -37,4 +37,5 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,13 +3,18 @@ package de.ellpeck.naturesaura.blocks.tiles;
|
||||||
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.ITickableTileEntity;
|
import net.minecraft.tileentity.ITickableTileEntity;
|
||||||
|
import net.minecraft.tileentity.TileEntityType;
|
||||||
|
|
||||||
public class TileEntityAuraBloom extends TileEntityImpl implements ITickableTileEntity {
|
public class TileEntityAuraBloom extends TileEntityImpl implements ITickableTileEntity {
|
||||||
|
|
||||||
public boolean justGenerated;
|
public boolean justGenerated;
|
||||||
|
|
||||||
public TileEntityAuraBloom() {
|
public TileEntityAuraBloom() {
|
||||||
super(ModTileEntities.AURA_BLOOM);
|
this(ModTileEntities.AURA_BLOOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected TileEntityAuraBloom(TileEntityType<TileEntityAuraBloom> type) {
|
||||||
|
super(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Doing this in validate() creates a loading deadlock for some reason...
|
// Doing this in validate() creates a loading deadlock for some reason...
|
||||||
|
@ -18,7 +23,7 @@ public class TileEntityAuraBloom extends TileEntityImpl implements ITickableTile
|
||||||
if (this.world.isRemote || !this.justGenerated)
|
if (this.world.isRemote || !this.justGenerated)
|
||||||
return;
|
return;
|
||||||
IAuraChunk chunk = IAuraChunk.getAuraChunk(this.world, this.pos);
|
IAuraChunk chunk = IAuraChunk.getAuraChunk(this.world, this.pos);
|
||||||
chunk.storeAura(this.pos, 200000);
|
chunk.storeAura(this.pos, 150000);
|
||||||
this.justGenerated = false;
|
this.justGenerated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,4 +40,10 @@ 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,9 @@ import net.minecraft.world.gen.feature.TreeFeatureConfig;
|
||||||
@SuppressWarnings("FieldNamingConvention")
|
@SuppressWarnings("FieldNamingConvention")
|
||||||
public final class ModFeatures {
|
public final class ModFeatures {
|
||||||
|
|
||||||
public static Feature<NoFeatureConfig> AURA_BLOOM;
|
|
||||||
public static Feature<TreeFeatureConfig> ANCIENT_TREE;
|
public static Feature<TreeFeatureConfig> ANCIENT_TREE;
|
||||||
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_CACTUS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package de.ellpeck.naturesaura.gen;
|
package de.ellpeck.naturesaura.gen;
|
||||||
|
|
||||||
import de.ellpeck.naturesaura.blocks.ModBlocks;
|
|
||||||
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom;
|
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraBloom;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -17,8 +17,12 @@ import net.minecraft.world.gen.feature.NoFeatureConfig;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class WorldGenAuraBloom extends Feature<NoFeatureConfig> {
|
public class WorldGenAuraBloom extends Feature<NoFeatureConfig> {
|
||||||
public WorldGenAuraBloom() {
|
|
||||||
|
private final Block block;
|
||||||
|
|
||||||
|
public WorldGenAuraBloom(Block block) {
|
||||||
super(d -> IFeatureConfig.NO_FEATURE_CONFIG);
|
super(d -> IFeatureConfig.NO_FEATURE_CONFIG);
|
||||||
|
this.block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,8 +37,8 @@ public class WorldGenAuraBloom extends Feature<NoFeatureConfig> {
|
||||||
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);
|
BlockPos placePos = new BlockPos(offX, worldIn.getHeight(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, offX, offZ), offZ);
|
||||||
BlockState state = ModBlocks.AURA_BLOOM.getDefaultState();
|
BlockState state = this.block.getDefaultState();
|
||||||
if (ModBlocks.AURA_BLOOM.isValidPosition(state, worldIn, placePos)) {
|
if (this.block.isValidPosition(state, worldIn, placePos)) {
|
||||||
worldIn.setBlockState(placePos, state, 3);
|
worldIn.setBlockState(placePos, state, 3);
|
||||||
|
|
||||||
TileEntity tile = worldIn.getTileEntity(placePos);
|
TileEntity tile = worldIn.getTileEntity(placePos);
|
||||||
|
|
|
@ -6,6 +6,8 @@ import de.ellpeck.naturesaura.NaturesAura;
|
||||||
import de.ellpeck.naturesaura.api.misc.IWorldData;
|
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.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;
|
||||||
|
@ -123,7 +125,9 @@ public final class ModRegistry {
|
||||||
new BlockAnimalContainer(),
|
new BlockAnimalContainer(),
|
||||||
new BlockSnowCreator(),
|
new BlockSnowCreator(),
|
||||||
new BlockItemDistributor(),
|
new BlockItemDistributor(),
|
||||||
temp = new BlockAuraBloom(),
|
temp = new BlockAuraBloom("aura_bloom", TileEntityAuraBloom::new),
|
||||||
|
createFlowerPot(temp),
|
||||||
|
temp = new BlockAuraBloom("aura_cactus", TileEntityAuraCactus::new),
|
||||||
createFlowerPot(temp)
|
createFlowerPot(temp)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -256,7 +260,8 @@ 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().setRegistryName("aura_bloom"),
|
new WorldGenAuraBloom(ModBlocks.AURA_BLOOM).setRegistryName("aura_bloom"),
|
||||||
|
new WorldGenAuraBloom(ModBlocks.AURA_CACTUS).setRegistryName("aura_cactus"),
|
||||||
new WorldGenAncientTree().setRegistryName("ancient_tree"),
|
new WorldGenAncientTree().setRegistryName("ancient_tree"),
|
||||||
new WorldGenNetherWartMushroom().setRegistryName("nether_wart_mushroom")
|
new WorldGenNetherWartMushroom().setRegistryName("nether_wart_mushroom")
|
||||||
);
|
);
|
||||||
|
@ -274,8 +279,11 @@ public final class ModRegistry {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Biome biome : ForgeRegistries.BIOMES) {
|
for (Biome biome : ForgeRegistries.BIOMES) {
|
||||||
if (ModConfig.instance.auraBlooms.get())
|
if (ModConfig.instance.auraBlooms.get()) {
|
||||||
biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).func_227228_a_(Placement.NOPE.func_227446_a_(IPlacementConfig.NO_PLACEMENT_CONFIG)));
|
biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_BLOOM.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).func_227228_a_(Placement.NOPE.func_227446_a_(IPlacementConfig.NO_PLACEMENT_CONFIG)));
|
||||||
|
if (biome.getCategory() == Biome.Category.DESERT)
|
||||||
|
biome.addFeature(GenerationStage.Decoration.VEGETAL_DECORATION, ModFeatures.AURA_CACTUS.withConfiguration(IFeatureConfig.NO_FEATURE_CONFIG).func_227228_a_(Placement.NOPE.func_227446_a_(IPlacementConfig.NO_PLACEMENT_CONFIG)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"block.naturesaura.snow_creator": "Winter's Calling",
|
"block.naturesaura.snow_creator": "Winter's Calling",
|
||||||
"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",
|
||||||
"item.naturesaura.eye": "Environmental Eye",
|
"item.naturesaura.eye": "Environmental Eye",
|
||||||
"item.naturesaura.eye_improved": "Environmental Ocular",
|
"item.naturesaura.eye_improved": "Environmental Ocular",
|
||||||
"item.naturesaura.gold_fiber": "Brilliant Fiber",
|
"item.naturesaura.gold_fiber": "Brilliant Fiber",
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 467 B |
Loading…
Reference in a new issue