This commit is contained in:
paulevsGitch 2020-09-30 00:14:10 +03:00
parent 518e7b3fcf
commit 46ceaee8be
21 changed files with 207 additions and 55 deletions

View file

@ -33,6 +33,8 @@ import net.minecraft.world.WorldView;
import ru.betterend.blocks.basis.BlockBaseNotFull; import ru.betterend.blocks.basis.BlockBaseNotFull;
import ru.betterend.client.ERenderLayer; import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable; import ru.betterend.client.IRenderTypeable;
import ru.betterend.registry.BlockRegistry;
import ru.betterend.util.MHelper;
public class BlockMossyGlowshroomFur extends BlockBaseNotFull implements IRenderTypeable { public class BlockMossyGlowshroomFur extends BlockBaseNotFull implements IRenderTypeable {
private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class); private static final EnumMap<Direction, VoxelShape> BOUNDING_SHAPES = Maps.newEnumMap(Direction.class);
@ -96,7 +98,11 @@ public class BlockMossyGlowshroomFur extends BlockBaseNotFull implements IRender
ItemStack tool = builder.get(LootContextParameters.TOOL); ItemStack tool = builder.get(LootContextParameters.TOOL);
if (tool != null && tool.getItem().isIn(FabricToolTags.SHEARS) || EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, tool) > 0) { if (tool != null && tool.getItem().isIn(FabricToolTags.SHEARS) || EnchantmentHelper.getLevel(Enchantments.SILK_TOUCH, tool) > 0) {
return Lists.newArrayList(new ItemStack(this)); return Lists.newArrayList(new ItemStack(this));
} else { }
else if (MHelper.RANDOM.nextInt(16) == 0) {
return Lists.newArrayList(new ItemStack(BlockRegistry.MOSSY_GLOWSHROOM_SAPLING));
}
else {
return Lists.newArrayList(); return Lists.newArrayList();
} }
} }

View file

@ -0,0 +1,11 @@
package ru.betterend.blocks;
import ru.betterend.blocks.basis.BlockFeatureSapling;
import ru.betterend.registry.FeatureRegistry;
import ru.betterend.world.features.DefaultFeature;
public class BlockMossyGlowshroomSapling extends BlockFeatureSapling {
public BlockMossyGlowshroomSapling() {
super((DefaultFeature) FeatureRegistry.MOSSY_GLOWSHROOM.getFeature(), 7);
}
}

View file

@ -0,0 +1,97 @@
package ru.betterend.blocks.basis;
import java.util.Random;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Fertilizable;
import net.minecraft.block.Material;
import net.minecraft.block.ShapeContext;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
import ru.betterend.client.ERenderLayer;
import ru.betterend.client.IRenderTypeable;
import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.world.features.DefaultFeature;
public class BlockFeatureSapling extends BlockBaseNotFull implements Fertilizable, IRenderTypeable {
private static final VoxelShape SHAPE = Block.createCuboidShape(4, 2, 4, 12, 16, 12);
private final DefaultFeature feature;
public BlockFeatureSapling(DefaultFeature feature) {
super(FabricBlockSettings.of(Material.PLANT)
.breakByHand(true)
.collidable(false)
.breakInstantly()
.sounds(BlockSoundGroup.GRASS)
.ticksRandomly());
this.feature = feature;
}
public BlockFeatureSapling(DefaultFeature feature, int light) {
super(FabricBlockSettings.of(Material.PLANT)
.breakByHand(true)
.collidable(false)
.breakInstantly()
.sounds(BlockSoundGroup.GRASS)
.lightLevel(light)
.ticksRandomly());
this.feature = feature;
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
return SHAPE;
}
@Override
public boolean canPlaceAt(BlockState state, WorldView world, BlockPos pos) {
return world.getBlockState(pos.down()).isIn(BlockTagRegistry.END_GROUND);
}
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState neighborState, WorldAccess world, BlockPos pos, BlockPos neighborPos) {
if (!canPlaceAt(state, world, pos))
return Blocks.AIR.getDefaultState();
else
return state;
}
@Override
public boolean isFertilizable(BlockView world, BlockPos pos, BlockState state, boolean isClient) {
return true;
}
@Override
public boolean canGrow(World world, Random random, BlockPos pos, BlockState state) {
return random.nextInt(16) == 0;
}
@Override
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
feature.generate(world, world.getChunkManager().getChunkGenerator(), random, pos, DefaultFeatureConfig.INSTANCE);
}
@Override
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
super.scheduledTick(state, world, pos, random);
if (canGrow(world, random, pos, state)) {
grow(world, random, pos, state);
}
}
@Override
public ERenderLayer getRenderLayer() {
return ERenderLayer.CUTOUT;
}
}

View file

@ -18,7 +18,6 @@ import net.minecraft.recipe.Ingredient;
import net.minecraft.recipe.Recipe; import net.minecraft.recipe.Recipe;
import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.Slot;
import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.collection.DefaultedList;
import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity; import ru.betterend.blocks.entities.EndStoneSmelterBlockEntity;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -4,7 +4,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType; import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment; import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider; import net.minecraft.client.gui.screen.recipebook.RecipeBookProvider;
import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget; import net.minecraft.client.gui.screen.recipebook.RecipeBookWidget;
@ -16,7 +15,6 @@ import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.text.StringVisitable; import net.minecraft.text.StringVisitable;
import net.minecraft.text.Text; import net.minecraft.text.Text;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import ru.betterend.BetterEnd; import ru.betterend.BetterEnd;
@Environment(EnvType.CLIENT) @Environment(EnvType.CLIENT)

View file

@ -11,6 +11,7 @@ import ru.betterend.blocks.BlockEndstoneDust;
import ru.betterend.blocks.BlockMossyGlowshroomCap; import ru.betterend.blocks.BlockMossyGlowshroomCap;
import ru.betterend.blocks.BlockMossyGlowshroomFur; import ru.betterend.blocks.BlockMossyGlowshroomFur;
import ru.betterend.blocks.BlockMossyGlowshroomHymenophore; import ru.betterend.blocks.BlockMossyGlowshroomHymenophore;
import ru.betterend.blocks.BlockMossyGlowshroomSapling;
import ru.betterend.blocks.BlockOre; import ru.betterend.blocks.BlockOre;
import ru.betterend.blocks.BlockTerrain; import ru.betterend.blocks.BlockTerrain;
import ru.betterend.blocks.EndStoneSmelter; import ru.betterend.blocks.EndStoneSmelter;
@ -30,6 +31,7 @@ public class BlockRegistry {
public static final Block MOSSY_GLOWSHROOM_HYMENOPHORE = registerBlock("mossy_glowshroom_hymenophore", new BlockMossyGlowshroomHymenophore()); 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 BlockMossyGlowshroomFur()); public static final Block MOSSY_GLOWSHROOM_FUR = registerBlock("mossy_glowshroom_fur", new BlockMossyGlowshroomFur());
public static final WoodenMaterial MOSSY_GLOWSHROOM = new WoodenMaterial("mossy_glowshroom", MaterialColor.GRAY, MaterialColor.WOOD); public static final WoodenMaterial MOSSY_GLOWSHROOM = new WoodenMaterial("mossy_glowshroom", MaterialColor.GRAY, MaterialColor.WOOD);
public static final Block MOSSY_GLOWSHROOM_SAPLING = registerBlock("mossy_glowshroom_sapling", new BlockMossyGlowshroomSapling());
// Ores // // Ores //
public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(ItemRegistry.ENDER_DUST, 1, 3)); public static final Block ENDER_ORE = registerBlock("ender_ore", new BlockOre(ItemRegistry.ENDER_DUST, 1, 3));

View file

@ -3,10 +3,8 @@ package ru.betterend.registry;
import ru.betterend.world.features.EndFeature; import ru.betterend.world.features.EndFeature;
import ru.betterend.world.features.EndLakeFeature; import ru.betterend.world.features.EndLakeFeature;
import ru.betterend.world.features.MossyGlowshroomFeature; import ru.betterend.world.features.MossyGlowshroomFeature;
import ru.betterend.world.features.StoneSpiralFeature;
public class FeatureRegistry { public class FeatureRegistry {
public static final EndFeature STONE_SPIRAL = new EndFeature("stone_spiral", new StoneSpiralFeature(), 2);
public static final EndFeature MOSSY_GLOWSHROOM = new EndFeature("mossy_glowshroom", new MossyGlowshroomFeature(), 1); public static final EndFeature MOSSY_GLOWSHROOM = new EndFeature("mossy_glowshroom", new MossyGlowshroomFeature(), 1);
public static final EndFeature END_LAKE = EndFeature.MakeLakeFeature("end_lake", new EndLakeFeature(), 100); public static final EndFeature END_LAKE = EndFeature.MakeLakeFeature("end_lake", new EndLakeFeature(), 100);

View file

@ -5,6 +5,7 @@ import java.util.Map;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class PosInfo { public class PosInfo {
private static final BlockState AIR = Blocks.AIR.getDefaultState(); private static final BlockState AIR = Blocks.AIR.getDefaultState();
@ -30,20 +31,20 @@ public class PosInfo {
this.state = state; this.state = state;
} }
public BlockState getStateUp() { public BlockState getState(Direction dir) {
PosInfo info = blocks.get(pos.up()); PosInfo info = blocks.get(pos.offset(dir));
if (info == null) { if (info == null) {
return AIR; return AIR;
} }
return info.getState(); return info.getState();
} }
public BlockState getStateUp() {
return getState(Direction.UP);
}
public BlockState getStateDown() { public BlockState getStateDown() {
PosInfo info = blocks.get(pos.down()); return getState(Direction.DOWN);
if (info == null) {
return AIR;
}
return info.getState();
} }
public int hashCode() { public int hashCode() {

View file

@ -2,6 +2,7 @@ package ru.betterend.util.sdf.primitive;
import java.util.function.Function; import java.util.function.Function;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -20,6 +21,10 @@ public class SDFCapedCone extends SDFPrimitive {
super(state); super(state);
} }
public SDFCapedCone(Block block) {
super(block);
}
public SDFCapedCone setRadius1(float radius) { public SDFCapedCone setRadius1(float radius) {
this.radius1 = radius; this.radius1 = radius;
return this; return this;

View file

@ -2,6 +2,7 @@ package ru.betterend.util.sdf.primitive;
import java.util.function.Function; import java.util.function.Function;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -19,6 +20,10 @@ public class SDFCapsule extends SDFPrimitive {
super(state); super(state);
} }
public SDFCapsule(Block block) {
super(block);
}
public SDFCapsule setRadius(float radius) { public SDFCapsule setRadius(float radius) {
this.radius = radius; this.radius = radius;
return this; return this;

View file

@ -2,6 +2,7 @@ package ru.betterend.util.sdf.primitive;
import java.util.function.Function; import java.util.function.Function;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -24,6 +25,10 @@ public class SDFLine extends SDFPrimitive {
super(state); super(state);
} }
public SDFLine(Block block) {
super(block);
}
public SDFLine setRadius(float radius) { public SDFLine setRadius(float radius) {
this.radius = radius; this.radius = radius;
return this; return this;

View file

@ -2,6 +2,7 @@ package ru.betterend.util.sdf.primitive;
import java.util.function.Function; import java.util.function.Function;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import ru.betterend.util.sdf.SDF; import ru.betterend.util.sdf.SDF;
@ -19,6 +20,12 @@ public abstract class SDFPrimitive extends SDF {
}; };
} }
public SDFPrimitive(Block block) {
this.placerFunction = (pos) -> {
return block.getDefaultState();
};
}
public BlockState getBlockState(BlockPos pos) { public BlockState getBlockState(BlockPos pos) {
return placerFunction.apply(pos); return placerFunction.apply(pos);
} }

View file

@ -2,6 +2,7 @@ package ru.betterend.util.sdf.primitive;
import java.util.function.Function; import java.util.function.Function;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
@ -17,6 +18,10 @@ public class SDFSphere extends SDFPrimitive {
super(state); super(state);
} }
public SDFSphere(Block block) {
super(block);
}
public SDFSphere setRadius(float radius) { public SDFSphere setRadius(float radius) {
this.radius = radius; this.radius = radius;
return this; return this;

View file

@ -3,6 +3,7 @@ package ru.betterend.world.features;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.function.Function;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@ -20,6 +21,7 @@ import ru.betterend.registry.BlockTagRegistry;
import ru.betterend.util.BlocksHelper; import ru.betterend.util.BlocksHelper;
import ru.betterend.util.MHelper; import ru.betterend.util.MHelper;
import ru.betterend.util.SplineHelper; import ru.betterend.util.SplineHelper;
import ru.betterend.util.sdf.PosInfo;
import ru.betterend.util.sdf.SDF; import ru.betterend.util.sdf.SDF;
import ru.betterend.util.sdf.operator.SDFBinary; import ru.betterend.util.sdf.operator.SDFBinary;
import ru.betterend.util.sdf.operator.SDFCoordModify; import ru.betterend.util.sdf.operator.SDFCoordModify;
@ -34,6 +36,8 @@ import ru.betterend.util.sdf.primitive.SDFCapedCone;
import ru.betterend.util.sdf.primitive.SDFSphere; import ru.betterend.util.sdf.primitive.SDFSphere;
public class MossyGlowshroomFeature extends DefaultFeature { public class MossyGlowshroomFeature extends DefaultFeature {
private static final Function<PosInfo, BlockState> POST_PROCESS;
private static final Function<BlockState, Boolean> REPLACE;
private static final Vector3f CENTER = new Vector3f(); private static final Vector3f CENTER = new Vector3f();
private static final SDFBinary FUNCTION; private static final SDFBinary FUNCTION;
private static final SDFTranslate HEAD_POS; private static final SDFTranslate HEAD_POS;
@ -61,7 +65,12 @@ public class MossyGlowshroomFeature extends DefaultFeature {
HEAD_POS.setTranslate(pos.getX(), pos.getY(), pos.getZ()); HEAD_POS.setTranslate(pos.getX(), pos.getY(), pos.getZ());
ROOTS.setAngle(random.nextFloat() * MHelper.PI2); ROOTS.setAngle(random.nextFloat() * MHelper.PI2);
FUNCTION.setSourceA(sdf); FUNCTION.setSourceA(sdf);
Set<BlockPos> blocks = new SDFScale().setScale(MHelper.randRange(0.5F, 1F, random)).setSource(FUNCTION).fillRecursive(world, blockPos); Set<BlockPos> blocks = new SDFScale()
.setScale(MHelper.randRange(0.5F, 1F, random))
.setSource(FUNCTION)
.setReplaceFunction(REPLACE)
.setPostProcess(POST_PROCESS)
.fillRecursive(world, blockPos);
for (BlockPos bpos: blocks) { for (BlockPos bpos: blocks) {
BlockState state = world.getBlockState(bpos); BlockState state = world.getBlockState(bpos);
@ -92,8 +101,8 @@ public class MossyGlowshroomFeature extends DefaultFeature {
} }
static { static {
SDFCapedCone cone1 = new SDFCapedCone(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState()).setHeight(2.5F).setRadius1(1.5F).setRadius2(2.5F); SDFCapedCone cone1 = new SDFCapedCone(BlockRegistry.MOSSY_GLOWSHROOM_CAP).setHeight(2.5F).setRadius1(1.5F).setRadius2(2.5F);
SDFCapedCone cone2 = new SDFCapedCone(BlockRegistry.MOSSY_GLOWSHROOM_CAP.getDefaultState()).setHeight(3F).setRadius1(2.5F).setRadius2(13F); SDFCapedCone cone2 = new SDFCapedCone(BlockRegistry.MOSSY_GLOWSHROOM_CAP).setHeight(3F).setRadius1(2.5F).setRadius2(13F);
SDF posedCone2 = new SDFTranslate().setTranslate(0, 5, 0).setSource(cone2); SDF posedCone2 = new SDFTranslate().setTranslate(0, 5, 0).setSource(cone2);
SDF posedCone3 = new SDFTranslate().setTranslate(0, 7F, 0).setSource(cone2); SDF posedCone3 = new SDFTranslate().setTranslate(0, 7F, 0).setSource(cone2);
SDF upCone = new SDFSubtraction().setSourceA(posedCone2).setSourceB(posedCone3); SDF upCone = new SDFSubtraction().setSourceA(posedCone2).setSourceB(posedCone3);
@ -104,7 +113,7 @@ public class MossyGlowshroomFeature extends DefaultFeature {
innerCone = new SDFScale3D().setScale(1.2F, 1F, 1.2F).setSource(innerCone); innerCone = new SDFScale3D().setScale(1.2F, 1F, 1.2F).setSource(innerCone);
cones = new SDFUnion().setSourceA(cones).setSourceB(innerCone); cones = new SDFUnion().setSourceA(cones).setSourceB(innerCone);
SDF glowCone = new SDFCapedCone(BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE.getDefaultState()).setHeight(3F).setRadius1(2F).setRadius2(12.5F); SDF glowCone = new SDFCapedCone(BlockRegistry.MOSSY_GLOWSHROOM_HYMENOPHORE).setHeight(3F).setRadius1(2F).setRadius2(12.5F);
glowCone = new SDFTranslate().setTranslate(0, 4.25F, 0).setSource(glowCone); glowCone = new SDFTranslate().setTranslate(0, 4.25F, 0).setSource(glowCone);
glowCone = new SDFSubtraction().setSourceA(glowCone).setSourceB(posedCone3); glowCone = new SDFSubtraction().setSourceA(glowCone).setSourceB(posedCone3);
@ -119,15 +128,22 @@ public class MossyGlowshroomFeature extends DefaultFeature {
HEAD_POS = (SDFTranslate) new SDFTranslate().setSource(new SDFTranslate().setTranslate(0, 2.5F, 0).setSource(cones)); HEAD_POS = (SDFTranslate) new SDFTranslate().setSource(new SDFTranslate().setTranslate(0, 2.5F, 0).setSource(cones));
SDF roots = new SDFSphere(BlockRegistry.MOSSY_GLOWSHROOM.bark.getDefaultState()).setRadius(4F); SDF roots = new SDFSphere(BlockRegistry.MOSSY_GLOWSHROOM.bark).setRadius(4F);
roots = new SDFScale3D().setScale(1, 0.7F, 1).setSource(roots); roots = new SDFScale3D().setScale(1, 0.7F, 1).setSource(roots);
ROOTS = (SDFFlatWave) new SDFFlatWave().setRaysCount(5).setIntensity(1.5F).setSource(roots); ROOTS = (SDFFlatWave) new SDFFlatWave().setRaysCount(5).setIntensity(1.5F).setSource(roots);
FUNCTION = new SDFSmoothUnion().setRadius(4).setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS)); FUNCTION = new SDFSmoothUnion().setRadius(4).setSourceB(new SDFUnion().setSourceA(HEAD_POS).setSourceB(ROOTS));
FUNCTION.setPostProcess((info) -> {
REPLACE = (state) -> {
if (state.getBlock() != Blocks.END_STONE && state.isIn(BlockTagRegistry.END_GROUND)) {
return true;
}
return state.getMaterial().isReplaceable();
};
POST_PROCESS = (info) -> {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) { if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getState())) {
BlockState up = info.getStateUp(); if (!BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateUp()) || !BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
if (!BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(up) || !BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
return BlockRegistry.MOSSY_GLOWSHROOM.bark.getDefaultState(); return BlockRegistry.MOSSY_GLOWSHROOM.bark.getDefaultState();
} }
} }
@ -135,15 +151,19 @@ public class MossyGlowshroomFeature extends DefaultFeature {
if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) { if (BlockRegistry.MOSSY_GLOWSHROOM.isTreeLog(info.getStateDown())) {
return info.getState().with(BlockMossyGlowshroomCap.TRANSITION, true); return info.getState().with(BlockMossyGlowshroomCap.TRANSITION, true);
} }
int air = 0;
for (Direction dir: Direction.values()) {
if (info.getState(dir).isAir()) {
air ++;
}
}
if (air > 4) {
info.setState(AIR);
return AIR;
}
} }
return info.getState(); return info.getState();
}); };
FUNCTION.setReplaceFunction((state) -> {
if (state.getBlock() != Blocks.END_STONE && state.isIn(BlockTagRegistry.END_GROUND)) {
return true;
}
return state.getMaterial().isReplaceable();
});
} }
} }

View file

@ -1,26 +0,0 @@
package ru.betterend.world.features;
import java.util.Random;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.Heightmap.Type;
import net.minecraft.world.StructureWorldAccess;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.feature.DefaultFeatureConfig;
public class StoneSpiralFeature extends DefaultFeature {
@Override
public boolean generate(StructureWorldAccess world, ChunkGenerator generator, Random random, BlockPos pos, DefaultFeatureConfig config) {
BlockPos topPos = world.getTopPosition(Type.WORLD_SURFACE, pos);
Direction offset = Direction.NORTH;
for (int y = 1; y <= 15; y++) {
offset = offset.rotateYClockwise();
world.setBlockState(topPos.up(y).offset(offset), Blocks.STONE.getDefaultState(), 3);
}
return true;
}
}

View file

@ -0,0 +1,5 @@
{
"variants": {
"": { "model": "betterend:block/mossy_glowshroom_sapling" }
}
}

View file

@ -14,6 +14,7 @@
"item.betterend.terminite_ingot": "Terminite Ingot", "item.betterend.terminite_ingot": "Terminite Ingot",
"item.betterend.aeternium_ingot": "Aeternium Ingot", "item.betterend.aeternium_ingot": "Aeternium Ingot",
"block.betterend.mossy_glowshroom_sapling": "Mossy Glowshroom Sapling",
"block.betterend.mossy_glowshroom_cap": "Mossy Glowshroom Cap", "block.betterend.mossy_glowshroom_cap": "Mossy Glowshroom Cap",
"block.betterend.mossy_glowshroom_fur": "Mossy Glowshroom Fur", "block.betterend.mossy_glowshroom_fur": "Mossy Glowshroom Fur",
"block.betterend.mossy_glowshroom_hymenophore": "Mossy Glowshroom Hymenophore", "block.betterend.mossy_glowshroom_hymenophore": "Mossy Glowshroom Hymenophore",

View file

@ -14,6 +14,7 @@
"item.betterend.terminite_ingot": "Терминитовый слиток", "item.betterend.terminite_ingot": "Терминитовый слиток",
"item.betterend.aeternium_ingot": "Этериевый слиток", "item.betterend.aeternium_ingot": "Этериевый слиток",
"block.betterend.mossy_glowshroom_sapling": "Саженец мшистого светогриба",
"block.betterend.mossy_glowshroom_cap": "Шляпка мшистого светогриба", "block.betterend.mossy_glowshroom_cap": "Шляпка мшистого светогриба",
"block.betterend.mossy_glowshroom_fur": "Волоски мшистого светогриба", "block.betterend.mossy_glowshroom_fur": "Волоски мшистого светогриба",
"block.betterend.mossy_glowshroom_hymenophore": "Гименофор мшистого светогриба", "block.betterend.mossy_glowshroom_hymenophore": "Гименофор мшистого светогриба",

View file

@ -0,0 +1,6 @@
{
"parent": "minecraft:block/cross",
"textures": {
"cross": "betterend:block/mossy_glowshroom_sapling"
}
}

View file

@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "betterend:block/mossy_glowshroom_sapling"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB