This commit is contained in:
Aleksey 2020-10-11 00:21:34 +03:00
commit 8aab4fa033
145 changed files with 1369 additions and 1510 deletions

View file

@ -38,15 +38,23 @@ public class BlockPlant extends BlockBaseNotFull implements IRenderTypeable, Fer
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 0, 4, 12, 14, 12);
public BlockPlant() {
super(FabricBlockSettings.of(Material.PLANT)
this(false);
}
public BlockPlant(int light) {
this(false, light);
}
public BlockPlant(boolean replaceable) {
super(FabricBlockSettings.of(replaceable ? Material.PLANT : Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.GRASS)
.breakByHand(true)
.noCollision());
}
public BlockPlant(int light) {
super(FabricBlockSettings.of(Material.PLANT)
public BlockPlant(boolean replaceable, int light) {
super(FabricBlockSettings.of(replaceable ? Material.PLANT : Material.REPLACEABLE_PLANT)
.breakByTool(FabricToolTags.SHEARS)
.sounds(BlockSoundGroup.GRASS)
.lightLevel(light)

View file

@ -17,12 +17,10 @@ import me.shedaniel.rei.api.widgets.Widgets;
import me.shedaniel.rei.gui.entries.RecipeEntry;
import me.shedaniel.rei.gui.entries.SimpleRecipeEntry;
import me.shedaniel.rei.gui.widget.Widget;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import ru.betterend.recipe.AlloyingRecipe;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.util.LangUtil;

View file

@ -24,6 +24,7 @@ import net.minecraft.util.math.Box;
import net.minecraft.world.LocalDifficulty;
import net.minecraft.world.ServerWorldAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.util.ISlime;
@ -105,7 +106,12 @@ public class EntityEndSlime extends SlimeEntity {
}
public static boolean canSpawn(EntityType<EntityEndSlime> type, ServerWorldAccess world, SpawnReason spawnReason, BlockPos pos, Random random) {
return notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32);
return isPermanentBiome(world, pos) || (notManyEntities(world, pos, 32, 3) && isWaterNear(world, pos, 32, 8));
}
private static boolean isPermanentBiome(ServerWorldAccess world, BlockPos pos) {
Biome biome = world.getBiome(pos);
return BiomeRegistry.getFromBiome(biome) == BiomeRegistry.CHORUS_FOREST;
}
private static boolean notManyEntities(ServerWorldAccess world, BlockPos pos, int radius, int maxCount) {
@ -114,12 +120,12 @@ public class EntityEndSlime extends SlimeEntity {
return list.size() <= maxCount;
}
private static boolean isWaterNear(ServerWorldAccess world, BlockPos pos, int radius) {
private static boolean isWaterNear(ServerWorldAccess world, BlockPos pos, int radius, int radius2) {
for (int x = pos.getX() - radius; x <= pos.getX() + radius; x++) {
POS.setX(x);
for (int z = pos.getZ() - radius; z <= pos.getZ() + radius; z++) {
POS.setZ(z);
for (int y = pos.getY() - radius; y <= pos.getY() + radius; y++) {
for (int y = pos.getY() - radius2; y <= pos.getY() + radius2; y++) {
POS.setY(y);
if (world.getBlockState(POS).getBlock() == Blocks.WATER) {
return true;

View file

@ -12,6 +12,7 @@ import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.Biome.Category;
import net.minecraft.world.biome.BiomeKeys;
import ru.betterend.world.biome.BiomeChorusForest;
import ru.betterend.world.biome.BiomeFoggyMushroomland;
import ru.betterend.world.biome.EndBiome;
import ru.betterend.world.generator.BiomePicker;
@ -30,6 +31,7 @@ public class BiomeRegistry {
public static final EndBiome END_MIDLANDS = registerBiome(BiomeKeys.END_MIDLANDS, BiomeType.LAND, false);
public static final EndBiome SMALL_END_ISLANDS = registerBiome(BiomeKeys.SMALL_END_ISLANDS, BiomeType.VOID, true);
public static final EndBiome FOGGY_MUSHROOMLAND = registerBiome(new BiomeFoggyMushroomland(), BiomeType.LAND);
public static final EndBiome CHORUS_FOREST = registerBiome(new BiomeChorusForest(), BiomeType.LAND);
public static void register() {}

View file

@ -29,6 +29,7 @@ import ru.betterend.blocks.EndStoneSmelter;
import ru.betterend.blocks.EnderBlock;
import ru.betterend.blocks.TerminiteBlock;
import ru.betterend.blocks.basis.BlockGlowingFur;
import ru.betterend.blocks.basis.BlockPlant;
import ru.betterend.blocks.basis.BlockVine;
import ru.betterend.blocks.complex.WoodenMaterial;
import ru.betterend.tab.CreativeTab;
@ -38,10 +39,12 @@ public class BlockRegistry {
public static final Block ENDSTONE_DUST = registerBlock("endstone_dust", new BlockEndstoneDust());
public static final Block END_MYCELIUM = registerBlock("end_mycelium", new BlockTerrain(MaterialColor.LIGHT_BLUE));
public static final Block END_MOSS = registerBlock("end_moss", new BlockTerrain(MaterialColor.CYAN));
public static final Block CHORUS_NYLIUM = registerBlock("chorus_nylium", new BlockTerrain(MaterialColor.MAGENTA));
// Roads //
public static final Block END_MYCELIUM_PATH = registerBlock("end_mycelium_path", new BlockPath(END_MYCELIUM));
public static final Block END_MOSS_PATH = registerBlock("end_moss_path", new BlockPath(END_MOSS));
public static final Block CHORUS_NYLIUM_PATH = registerBlock("chorus_nylium_path", new BlockPath(CHORUS_NYLIUM));
// Rocks //
public static final Block FLAVOLITE = registerBlock("flavolite", new BlockStone(MaterialColor.SAND));
@ -52,6 +55,7 @@ public class BlockRegistry {
public static final Block MOSSY_GLOWSHROOM_HYMENOPHORE = registerBlock("mossy_glowshroom_hymenophore", new BlockMossyGlowshroomHymenophore());
public static final Block MOSSY_GLOWSHROOM_FUR = registerBlock("mossy_glowshroom_fur", new BlockGlowingFur(MOSSY_GLOWSHROOM_SAPLING, 16));
public static final WoodenMaterial MOSSY_GLOWSHROOM = new WoodenMaterial("mossy_glowshroom", MaterialColor.GRAY, MaterialColor.WOOD);
public static final WoodenMaterial CHORUS = new WoodenMaterial("chorus", MaterialColor.MAGENTA, MaterialColor.PURPLE);
// Small Plants //
public static final Block UMBRELLA_MOSS = registerBlock("umbrella_moss", new BlockUmbrellaMoss());
@ -67,6 +71,8 @@ public class BlockRegistry {
public static final Block END_LILY = registerBlockNI("end_lily", new BlockEndLily());
public static final Block END_LILY_SEED = registerBlock("end_lily_seed", new BlockEndLilySeed());
public static final Block CHORUS_GRASS = registerBlock("chorus_grass", new BlockPlant(true));
// Vines //
public static final Block DENSE_VINE = registerBlock("dense_vine", new BlockVine(15, true));

View file

@ -22,6 +22,7 @@ public class BlockTagRegistry {
public static void register() {
addSurfaceBlock(BlockRegistry.END_MOSS);
addSurfaceBlock(BlockRegistry.END_MYCELIUM);
addSurfaceBlock(BlockRegistry.CHORUS_NYLIUM);
TagHelper.addTag(GEN_TERRAIN, BlockRegistry.ENDER_ORE);
}

View file

@ -16,11 +16,13 @@ public class FeatureRegistry {
public static final EndFeature UMBRELLA_MOSS = new EndFeature("umbrella_moss", new DoublePlantFeature(BlockRegistry.UMBRELLA_MOSS, BlockRegistry.UMBRELLA_MOSS_TALL, 5), 5);
public static final EndFeature CREEPING_MOSS = new EndFeature("creeping_moss", new SinglePlantFeature(BlockRegistry.CREEPING_MOSS, 5), 5);
public static final EndFeature BLUE_VINE = new EndFeature("blue_vine", new BlueVineFeature(), 1);
public static final EndFeature CHORUS_GRASS = new EndFeature("chorus_grass", new SinglePlantFeature(BlockRegistry.CHORUS_GRASS, 4), 4);
public static final EndFeature DENSE_VINE = new EndFeature("dense_vine", new VineFeature(BlockRegistry.DENSE_VINE, 24), 3);
// Features //
public static final EndFeature END_LAKE = EndFeature.makeLakeFeature("end_lake", new EndLakeFeature(), 4);
public static final EndFeature RARE_END_LAKE = EndFeature.makeLakeFeature("rare_end_lake", new EndLakeFeature(), 40);
// Ores //
public static final EndFeature ENDER_ORE = EndFeature.makeOreFeature("ender_ore", BlockRegistry.ENDER_ORE, 6, 3, 0, 4, 96);

View file

@ -0,0 +1,25 @@
package ru.betterend.world.biome;
import net.minecraft.entity.EntityType;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.EntityRegistry;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.registry.StructureRegistry;
public class BiomeChorusForest extends EndBiome {
public BiomeChorusForest() {
super(new BiomeDefinition("chorus_forest")
.setFogColor(87, 26, 87)
.setFogDensity(3)
.setSurface(BlockRegistry.CHORUS_NYLIUM)
//.setParticles(ParticleRegistry.GLOWING_SPHERE, 0.001F)
//.setLoop(SoundRegistry.AMBIENT_FOGGY_MUSHROOMLAND)
//.setMusic(SoundRegistry.MUSIC_FOGGY_MUSHROOMLAND)
.addStructureFeature(StructureRegistry.GIANT_MOSSY_GLOWSHROOM)
.addFeature(FeatureRegistry.ENDER_ORE)
.addFeature(FeatureRegistry.RARE_END_LAKE)
.addFeature(FeatureRegistry.CHORUS_GRASS)
.addMobSpawn(EntityRegistry.END_SLIME, 5, 1, 2)
.addMobSpawn(EntityType.ENDERMAN, 50, 1, 4));
}
}

View file

@ -8,15 +8,18 @@ import net.minecraft.fluid.FluidState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockPos.Mutable;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.blocks.BlockEndLily;
import ru.betterend.blocks.BlockProperties.TripleShape;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.registry.BiomeRegistry;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper;
import ru.betterend.world.biome.EndBiome;
public class EndLakeFeature extends DefaultFeature {
private static final BlockState END_STONE = Blocks.END_STONE.getDefaultState();
@ -165,18 +168,10 @@ public class EndLakeFeature extends DefaultFeature {
if (world.getBlockState(pos).getBlock().isIn(BlockTagRegistry.GEN_TERRAIN))
{
BlocksHelper.setWithoutUpdate(world, POS.down(), BlockRegistry.ENDSTONE_DUST.getDefaultState());
if (y < waterLevel - 1 && random.nextInt(3) == 0 && ((x + z) & 1) == 0) {
if (NOISE.eval(x * 0.1, z * 0.1, 0) > 0) {
BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.BUBBLE_CORAL.getDefaultState());
}
else if (NOISE.eval(x * 0.1, z * 0.1, 1) > 0) {
world.setBlockState(POS, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM), 0);
BlockPos up = POS.up();
while (up.getY() < waterLevel) {
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.MIDDLE));
up = up.up();
}
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.TOP));
if (random.nextInt(3) == 0 && pos.getY() < waterLevel - 1) {
EndBiome biome = BiomeRegistry.getFromBiome(world.getBiome(POS));
if (biome == BiomeRegistry.FOGGY_MUSHROOMLAND) {
generateFoggyMushroomland(world, x, z, waterLevel);
}
}
}
@ -214,4 +209,19 @@ public class EndLakeFeature extends DefaultFeature {
return true;
}
private void generateFoggyMushroomland(WorldAccess world, int x, int z, int waterLevel) {
if (NOISE.eval(x * 0.1, z * 0.1, 0) > 0) {
BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.BUBBLE_CORAL.getDefaultState());
}
else if (NOISE.eval(x * 0.1, z * 0.1, 1) > 0) {
world.setBlockState(POS, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM), 0);
BlockPos up = POS.up();
while (up.getY() < waterLevel) {
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.MIDDLE));
up = up.up();
}
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.TOP));
}
}
}