Amaranita mushroom blocks (WIP), shaders for new plants

This commit is contained in:
paulevsGitch 2021-03-01 01:06:04 +03:00
parent 5e3a3ef6cd
commit 4aec8487fa
33 changed files with 229 additions and 1 deletions

View file

@ -0,0 +1,12 @@
package ru.betterend.blocks;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Blocks;
import net.minecraft.block.MaterialColor;
import ru.betterend.blocks.basis.EndPillarBlock;
public class AmaranitaHyphaeBlock extends EndPillarBlock {
public AmaranitaHyphaeBlock() {
super(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).materialColor(MaterialColor.LIME));
}
}

View file

@ -1,12 +1,45 @@
package ru.betterend.blocks;
import java.util.Random;
import net.minecraft.block.BlockState;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import ru.betterend.blocks.basis.EndPlantBlock;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndFeatures;
public class SmallAmaranitaBlock extends EndPlantBlock {
@Override
protected boolean isTerrain(BlockState state) {
return state.getBlock() == EndBlocks.SANGNUM;
}
@Override
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
BlockPos bigPos = growBig(world, pos);
if (bigPos != null) {
return;
}
EndFeatures.LARGE_AMARANITA.getFeature().generate(world, null, random, pos, null);
}
private BlockPos growBig(ServerWorld world, BlockPos pos) {
for (int x = -1; x < 2; x++) {
for (int z = -1; z < 2; z++) {
BlockPos p = pos.add(x, 0, z);
if (checkFrame(world, p)) {
return p;
}
}
}
return null;
}
private boolean checkFrame(ServerWorld world, BlockPos pos) {
return world.getBlockState(pos).isOf(this) ||
world.getBlockState(pos.south()).isOf(this) ||
world.getBlockState(pos.east()).isOf(this) ||
world.getBlockState(pos.south().east()).isOf(this);
}
}

View file

@ -11,6 +11,7 @@ import ru.betterend.blocks.AeterniumAnvil;
import ru.betterend.blocks.AeterniumBlock;
import ru.betterend.blocks.AmaranitaCapBlock;
import ru.betterend.blocks.AmaranitaHymenophoreBlock;
import ru.betterend.blocks.AmaranitaHyphaeBlock;
import ru.betterend.blocks.AmberBlock;
import ru.betterend.blocks.AncientEmeraldIceBlock;
import ru.betterend.blocks.AuroraCrystalBlock;
@ -230,6 +231,8 @@ public class EndBlocks {
public static final Block SALTEAGO = registerBlock("salteago", new TerrainPlantBlock(END_MOSS));
public static final Block VAIOLUSH_FERN = registerBlock("vaiolush_fern", new TerrainPlantBlock(END_MOSS));
public static final Block FRACTURN = registerBlock("fracturn", new TerrainPlantBlock(END_MOSS));
public static final Block CLAWFERN = registerBlock("clawfern", new TerrainPlantBlock(SANGNUM));
public static final Block GLOBULAGUS = registerBlock("globulagus", new TerrainPlantBlock(SANGNUM));
public static final Block ORANGO = registerBlock("orango", new TerrainPlantBlock(RUTISCUS));
public static final Block AERIDIUM = registerBlock("aeridium", new TerrainPlantBlock(RUTISCUS));
public static final Block LUTEBUS = registerBlock("lutebus", new TerrainPlantBlock(RUTISCUS));
@ -255,7 +258,7 @@ public class EndBlocks {
public static final Block SMALL_AMARANITA_MUSHROOM = registerBlock("small_amaranita_mushroom", new SmallAmaranitaBlock());
public static final Block LARGE_AMARANITA_MUSHROOM = registerBlockNI("large_amaranita_mushroom", new LargeAmaranitaBlock());
public static final Block AMARANITA_HYPHAE = registerBlock("amaranita_hyphae", new AmaranitaCapBlock());
public static final Block AMARANITA_HYPHAE = registerBlock("amaranita_hyphae", new AmaranitaHyphaeBlock());
public static final Block AMARANITA_HYMENOPHORE = registerBlock("amaranita_hymenophore", new AmaranitaHymenophoreBlock());
public static final Block AMARANITA_FUR = registerBlock("amaranita_fur", new FurBlock(MOSSY_GLOWSHROOM_SAPLING, 15, 4));
public static final Block AMARANITA_CAP = registerBlock("amaranita_cap", new AmaranitaCapBlock());

View file

@ -34,6 +34,7 @@ import ru.betterend.world.features.VineFeature;
import ru.betterend.world.features.WallPlantFeature;
import ru.betterend.world.features.WallPlantOnLogFeature;
import ru.betterend.world.features.bushes.BushFeature;
import ru.betterend.world.features.bushes.LargeAmaranitaFeature;
import ru.betterend.world.features.bushes.Lumecorn;
import ru.betterend.world.features.bushes.TenaneaBushFeature;
import ru.betterend.world.features.terrain.EndLakeFeature;
@ -75,6 +76,7 @@ public class EndFeatures {
public static final EndFeature DRAGON_TREE_BUSH = new EndFeature("dragon_tree_bush", new BushFeature(EndBlocks.DRAGON_TREE_LEAVES, EndBlocks.DRAGON_TREE.bark), 15);
public static final EndFeature TENANEA_BUSH = new EndFeature("tenanea_bush", new TenaneaBushFeature(), 10);
public static final EndFeature LUMECORN = new EndFeature("lumecorn", new Lumecorn(), 5);
public static final EndFeature LARGE_AMARANITA = new EndFeature("large_amaranita", new LargeAmaranitaFeature(), 5);
// Plants //
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(EndBlocks.UMBRELLA_MOSS, EndBlocks.UMBRELLA_MOSS_TALL, 5), 5);
@ -107,6 +109,9 @@ public class EndFeatures {
public static final EndFeature AERIDIUM = new EndFeature("aeridium", new SinglePlantFeature(EndBlocks.AERIDIUM, 5, 4), 5);
public static final EndFeature LUTEBUS = new EndFeature("lutebus", new SinglePlantFeature(EndBlocks.LUTEBUS, 5, 2), 5);
public static final EndFeature LAMELLARIUM = new EndFeature("lamellarium", new SinglePlantFeature(EndBlocks.LAMELLARIUM, 5), 6);
public static final EndFeature SMALL_AMARANITA = new EndFeature("small_amaranita", new SinglePlantFeature(EndBlocks.SMALL_AMARANITA_MUSHROOM, 5, 5), 4);
public static final EndFeature GLOBULAGUS = new EndFeature("globulagus", new SinglePlantFeature(EndBlocks.GLOBULAGUS, 5, 3), 6);
public static final EndFeature CLAWFERN = new EndFeature("clawfern", new SinglePlantFeature(EndBlocks.CLAWFERN, 5, 4), 5);
// Vines //
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(EndBlocks.DENSE_VINE, 24), 3);

View file

@ -19,6 +19,10 @@ public class DragonGraveyardsBiome extends EndBiome {
.addFeature(EndFeatures.OBSIDIAN_PILLAR_BASEMENT)
.addFeature(EndFeatures.FALLEN_PILLAR)
.addFeature(EndFeatures.OBSIDIAN_BOULDER)
.addFeature(EndFeatures.LARGE_AMARANITA)
.addFeature(EndFeatures.SMALL_AMARANITA)
.addFeature(EndFeatures.GLOBULAGUS)
.addFeature(EndFeatures.CLAWFERN)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 2));
}
}

View file

@ -0,0 +1,44 @@
package ru.betterend.world.features.bushes;
import java.util.Random;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.util.math.Direction;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.blocks.BlockProperties;
import ru.betterend.registry.EndBlocks;
import ru.betterend.registry.EndTags;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.world.features.DefaultFeature;
public class LargeAmaranitaFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator chunkGenerator, Random random, BlockPos pos, DefaultFeatureConfig config) {
if (!world.getBlockState(pos.down()).getBlock().isIn(EndTags.END_GROUND)) return false;
Mutable mut = new Mutable().set(pos);
int height = MHelper.randRange(2, 3, random);
for (int i = 1; i < height; i++) {
mut.setY(mut.getY() + 1);
if (!world.isAir(mut)) {
return false;
}
}
mut.set(pos);
BlockState state = EndBlocks.LARGE_AMARANITA_MUSHROOM.getDefaultState();
BlocksHelper.setWithUpdate(world, mut, state.with(BlockProperties.TRIPLE_SHAPE, TripleShape.BOTTOM));
if (height > 2) {
BlocksHelper.setWithUpdate(world, mut.move(Direction.UP), state.with(BlockProperties.TRIPLE_SHAPE, TripleShape.MIDDLE));
}
BlocksHelper.setWithUpdate(world, mut.move(Direction.UP), state.with(BlockProperties.TRIPLE_SHAPE, TripleShape.TOP));
return true;
}
}