Fixes
This commit is contained in:
parent
3f9e524b54
commit
287c1fce62
15 changed files with 120 additions and 26 deletions
|
@ -6,6 +6,7 @@ import net.minecraft.state.StateManager;
|
|||
import net.minecraft.state.property.EnumProperty;
|
||||
import ru.betterend.blocks.BlockProperties.TripleShape;
|
||||
import ru.betterend.blocks.basis.BlockUpDownPlant;
|
||||
import ru.betterend.registry.BlockRegistry;
|
||||
|
||||
public class BlockBlueVine extends BlockUpDownPlant {
|
||||
public static final EnumProperty<TripleShape> SHAPE = BlockProperties.TRIPLE_SHAPE;
|
||||
|
@ -14,4 +15,9 @@ public class BlockBlueVine extends BlockUpDownPlant {
|
|||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(SHAPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package ru.betterend.blocks;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.StructureWorldAccess;
|
||||
|
@ -40,4 +41,9 @@ public class BlockBlueVineSeed extends BlockPlantWithAge {
|
|||
BlocksHelper.setWithoutUpdate(world, pos.up(), BlockRegistry.BLUE_VINE_FUR.getDefaultState().with(BlockGlowingFur.FACING, Direction.UP));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTerrain(BlockState state) {
|
||||
return state.getBlock() == BlockRegistry.END_MOSS || state.getBlock() == BlockRegistry.END_MYCELIUM;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ public class BlockEndLilySeed extends BlockUnderwaterPlantWithAge {
|
|||
@Override
|
||||
public void grow(StructureWorldAccess world, Random random, BlockPos pos) {
|
||||
if (canGrow(world, pos)) {
|
||||
world.setBlockState(pos, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM), 0);
|
||||
BlocksHelper.setWithoutUpdate(world, pos, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM));
|
||||
BlockPos up = pos.up();
|
||||
while (world.getFluidState(up).isStill()) {
|
||||
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.MIDDLE));
|
||||
|
|
|
@ -46,7 +46,7 @@ public class BlockPlant extends BlockBaseNotFull implements IRenderTypeable, Fer
|
|||
}
|
||||
|
||||
public BlockPlant(boolean replaceable) {
|
||||
super(FabricBlockSettings.of(replaceable ? Material.PLANT : Material.REPLACEABLE_PLANT)
|
||||
super(FabricBlockSettings.of(replaceable ? Material.REPLACEABLE_PLANT : Material.PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.GRASS)
|
||||
.breakByHand(true)
|
||||
|
@ -54,7 +54,7 @@ public class BlockPlant extends BlockBaseNotFull implements IRenderTypeable, Fer
|
|||
}
|
||||
|
||||
public BlockPlant(boolean replaceable, int light) {
|
||||
super(FabricBlockSettings.of(replaceable ? Material.PLANT : Material.REPLACEABLE_PLANT)
|
||||
super(FabricBlockSettings.of(replaceable ? Material.REPLACEABLE_PLANT : Material.PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.GRASS)
|
||||
.lightLevel(light)
|
||||
|
@ -62,6 +62,10 @@ public class BlockPlant extends BlockBaseNotFull implements IRenderTypeable, Fer
|
|||
.noCollision());
|
||||
}
|
||||
|
||||
public BlockPlant(Settings settings) {
|
||||
super(settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ePos) {
|
||||
Vec3d vec3d = state.getModelOffset(view, pos);
|
||||
|
|
|
@ -2,9 +2,13 @@ package ru.betterend.blocks.basis;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -13,6 +17,15 @@ import net.minecraft.world.StructureWorldAccess;
|
|||
public abstract class BlockPlantWithAge extends BlockPlant {
|
||||
public static final IntProperty AGE = IntProperty.of("age", 0, 3);
|
||||
|
||||
public BlockPlantWithAge() {
|
||||
super(FabricBlockSettings.of(Material.PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.GRASS)
|
||||
.breakByHand(true)
|
||||
.ticksRandomly()
|
||||
.noCollision());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(AGE);
|
||||
|
@ -22,12 +35,22 @@ public abstract class BlockPlantWithAge extends BlockPlant {
|
|||
|
||||
@Override
|
||||
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
|
||||
int age = state.get(AGE);
|
||||
if (age < 3) {
|
||||
world.setBlockState(pos, state.with(AGE, age + 1));
|
||||
if (random.nextInt(4) == 0) {
|
||||
int age = state.get(AGE);
|
||||
if (age < 3) {
|
||||
world.setBlockState(pos, state.with(AGE, age + 1));
|
||||
}
|
||||
else {
|
||||
grow(world, random, pos);
|
||||
}
|
||||
}
|
||||
else {
|
||||
grow(world, random, pos);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,13 @@ package ru.betterend.blocks.basis;
|
|||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Material;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -13,6 +17,15 @@ import net.minecraft.world.StructureWorldAccess;
|
|||
public abstract class BlockUnderwaterPlantWithAge extends BlockUnderwaterPlant {
|
||||
public static final IntProperty AGE = IntProperty.of("age", 0, 3);
|
||||
|
||||
public BlockUnderwaterPlantWithAge() {
|
||||
super(FabricBlockSettings.of(Material.UNDERWATER_PLANT)
|
||||
.breakByTool(FabricToolTags.SHEARS)
|
||||
.sounds(BlockSoundGroup.WET_GRASS)
|
||||
.breakByHand(true)
|
||||
.ticksRandomly()
|
||||
.noCollision());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
|
||||
stateManager.add(AGE);
|
||||
|
@ -22,12 +35,22 @@ public abstract class BlockUnderwaterPlantWithAge extends BlockUnderwaterPlant {
|
|||
|
||||
@Override
|
||||
public void grow(ServerWorld world, Random random, BlockPos pos, BlockState state) {
|
||||
int age = state.get(AGE);
|
||||
if (age < 3) {
|
||||
world.setBlockState(pos, state.with(AGE, age + 1));
|
||||
if (random.nextInt(4) == 0) {
|
||||
int age = state.get(AGE);
|
||||
if (age < 3) {
|
||||
world.setBlockState(pos, state.with(AGE, age + 1));
|
||||
}
|
||||
else {
|
||||
grow(world, random, pos);
|
||||
}
|
||||
}
|
||||
else {
|
||||
grow(world, random, pos);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -215,7 +215,7 @@ public class EndLakeFeature extends DefaultFeature {
|
|||
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);
|
||||
BlocksHelper.setWithoutUpdate(world, POS, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.BOTTOM));
|
||||
BlockPos up = POS.up();
|
||||
while (up.getY() < waterLevel) {
|
||||
BlocksHelper.setWithoutUpdate(world, up, BlockRegistry.END_LILY.getDefaultState().with(BlockEndLily.SHAPE, TripleShape.MIDDLE));
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"variants": {
|
||||
"age=0": { "model": "betterend:block/end_lily_seed_0" },
|
||||
"age=1": { "model": "betterend:block/end_lily_seed_1" },
|
||||
"age=2": { "model": "betterend:block/end_lily_seed_2" },
|
||||
"age=3": { "model": "betterend:block/end_lily_seed_3" }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/end_lily_0"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/end_lily_1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/end_lily_2"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "betterend:block/cross_no_distortion",
|
||||
"textures": {
|
||||
"texture": "betterend:block/end_lily_3"
|
||||
}
|
||||
}
|
|
@ -50,8 +50,8 @@
|
|||
},
|
||||
{
|
||||
"__comment": "PlaneY6",
|
||||
"from": [ 8, 0.018, 8 ],
|
||||
"to": [ 24, 0.018, 24 ],
|
||||
"from": [ 8, 0.029, 8 ],
|
||||
"to": [ 24, 0.029, 24 ],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaf", "rotation": 270 },
|
||||
|
@ -60,8 +60,8 @@
|
|||
},
|
||||
{
|
||||
"__comment": "PlaneY6",
|
||||
"from": [ -8, 0.014, 8 ],
|
||||
"to": [ 8, 0.014, 24 ],
|
||||
"from": [ -8, 0.026, 8 ],
|
||||
"to": [ 8, 0.026, 24 ],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaf", "rotation": 180 },
|
||||
|
@ -70,8 +70,8 @@
|
|||
},
|
||||
{
|
||||
"__comment": "PlaneY6",
|
||||
"from": [ -8, 0.012, -8 ],
|
||||
"to": [ 8, 0.012, 8 ],
|
||||
"from": [ -8, 0.023, -8 ],
|
||||
"to": [ 8, 0.023, 8 ],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaf", "rotation": 90 },
|
||||
|
@ -80,8 +80,8 @@
|
|||
},
|
||||
{
|
||||
"__comment": "PlaneY6",
|
||||
"from": [ 8, 0.01, -8 ],
|
||||
"to": [ 24, 0.01, 8 ],
|
||||
"from": [ 8, 0.02, -8 ],
|
||||
"to": [ 24, 0.02, 8 ],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaf" },
|
||||
|
|
|
@ -50,8 +50,8 @@
|
|||
},
|
||||
{
|
||||
"__comment": "PlaneY6",
|
||||
"from": [ 0, 0, 0 ],
|
||||
"to": [ 16, 0.001, 16 ],
|
||||
"from": [ 0, 0.02, 0 ],
|
||||
"to": [ 16, 0.02, 16 ],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaf", "rotation": 270 },
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
"elements": [
|
||||
{
|
||||
"__comment": "PlaneY6",
|
||||
"from": [ 0, 0, 0 ],
|
||||
"to": [ 16, 0.001, 16 ],
|
||||
"from": [ 0, 0.02, 0 ],
|
||||
"to": [ 16, 0.02, 16 ],
|
||||
"shade": false,
|
||||
"faces": {
|
||||
"down": { "uv": [ 0, 0, 16, 16 ], "texture": "#leaf", "rotation": 270 },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue