Snow, sponge & helix tree fixes
This commit is contained in:
parent
4d397e2be7
commit
387e2e5812
4 changed files with 26 additions and 5 deletions
|
@ -1,11 +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.Material;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import ru.betterend.blocks.basis.BlockBase;
|
||||
|
||||
public class BlockDenseSnow extends BlockBase {
|
||||
public BlockDenseSnow() {
|
||||
super(FabricBlockSettings.copyOf(Blocks.SNOW));
|
||||
super(FabricBlockSettings.of(Material.SNOW_BLOCK).strength(0.2F).sounds(BlockSoundGroup.SNOW));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import ru.betterend.blocks.basis.BlockBaseNotFull;
|
|||
import ru.betterend.client.render.ERenderLayer;
|
||||
import ru.betterend.interfaces.IRenderTypeable;
|
||||
import ru.betterend.registry.EndBlocks;
|
||||
import ru.betterend.util.BlocksHelper;
|
||||
|
||||
public class BlockMengerSpongeWet extends BlockBaseNotFull implements IRenderTypeable {
|
||||
public BlockMengerSpongeWet() {
|
||||
|
@ -78,6 +79,12 @@ public class BlockMengerSpongeWet extends BlockBaseNotFull implements IRenderTyp
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
super.onBreak(world, pos, state, player);
|
||||
BlocksHelper.setWithUpdate(world, pos, Blocks.AIR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERenderLayer getRenderLayer() {
|
||||
return ERenderLayer.CUTOUT;
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.Random;
|
|||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
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;
|
||||
|
|
|
@ -3,6 +3,7 @@ package ru.betterend.world.features.trees;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
|
@ -19,6 +20,7 @@ import ru.betterend.registry.EndTags;
|
|||
import ru.betterend.util.BlocksHelper;
|
||||
import ru.betterend.util.MHelper;
|
||||
import ru.betterend.util.SplineHelper;
|
||||
import ru.betterend.util.sdf.PosInfo;
|
||||
import ru.betterend.util.sdf.SDF;
|
||||
import ru.betterend.util.sdf.operator.SDFRotation;
|
||||
import ru.betterend.util.sdf.operator.SDFScale;
|
||||
|
@ -28,6 +30,8 @@ import ru.betterend.util.sdf.operator.SDFUnion;
|
|||
import ru.betterend.world.features.DefaultFeature;
|
||||
|
||||
public class HelixTreeFeature extends DefaultFeature {
|
||||
private static final Function<PosInfo, BlockState> POST;
|
||||
|
||||
@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;
|
||||
|
@ -60,7 +64,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
dx = 30 * scale;
|
||||
float dy1 = -20 * scale;
|
||||
float dy2 = 100 * scale;
|
||||
sdf.fillArea(world, pos, new Box(pos.add(-dx, dy1, -dx), pos.add(dx, dy2, dx)));
|
||||
sdf.setPostProcess(POST).fillArea(world, pos, new Box(pos.add(-dx, dy1, -dx), pos.add(dx, dy2, dx)));
|
||||
SplineHelper.scale(spline, scale);
|
||||
SplineHelper.fillSplineForce(spline, world, EndBlocks.HELIX_TREE.bark.getDefaultState(), pos, (state) -> {
|
||||
return state.getMaterial().isReplaceable();
|
||||
|
@ -71,7 +75,7 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
});
|
||||
SplineHelper.scale(spline2, scale);
|
||||
BlockPos leafStart = pos.add(lastPoint.getX() + 0.5, lastPoint.getY() + 0.5, lastPoint.getZ() + 0.5);
|
||||
SplineHelper.fillSplineForce(spline2, world, EndBlocks.HELIX_TREE.bark.getDefaultState(), leafStart, (state) -> {
|
||||
SplineHelper.fillSplineForce(spline2, world, EndBlocks.HELIX_TREE.log.getDefaultState(), leafStart, (state) -> {
|
||||
return state.getMaterial().isReplaceable();
|
||||
});
|
||||
|
||||
|
@ -164,4 +168,13 @@ public class HelixTreeFeature extends DefaultFeature {
|
|||
BlocksHelper.setWithoutUpdate(world, bPos, state.with(BlockHelixTreeLeaves.COLOR, 7));
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
POST = (info) -> {
|
||||
if (EndBlocks.HELIX_TREE.isTreeLog(info.getStateUp()) && EndBlocks.HELIX_TREE.isTreeLog(info.getStateDown())) {
|
||||
return EndBlocks.HELIX_TREE.log.getDefaultState();
|
||||
}
|
||||
return info.getState();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue