Some tree blocks (WIP)

This commit is contained in:
paulevsGitch 2021-01-16 04:17:30 +03:00
parent f9d765bee8
commit 59167a18f7
14 changed files with 58 additions and 3 deletions

View file

@ -16,6 +16,7 @@ public class BlockProperties {
public static final IntProperty ROTATION = IntProperty.of("rotation", 0, 3);
public static final BooleanProperty NATURAL = BooleanProperty.of("natural");
public static final IntProperty FULLNESS = IntProperty.of("fullness", 0, 3);
public static final IntProperty COLOR = IntProperty.of("color", 0, 7);
public static enum TripleShape implements StringIdentifiable {
TOP("top"),

View file

@ -0,0 +1,35 @@
package ru.betterend.blocks;
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.MaterialColor;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.IntProperty;
import ru.betterend.blocks.basis.BaseBlock;
import ru.betterend.noise.OpenSimplexNoise;
import ru.betterend.util.MHelper;
public class CapsacisCapBlock extends BaseBlock {
public static final IntProperty COLOR = IntProperty.of("color", 0, 7);
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
public CapsacisCapBlock(MaterialColor color) {
super(FabricBlockSettings.copyOf(Blocks.NETHER_WART_BLOCK).materialColor(color));
}
@Override
public BlockState getPlacementState(ItemPlacementContext ctx) {
double px = ctx.getBlockPos().getX() * 0.1;
double py = ctx.getBlockPos().getY() * 0.1;
double pz = ctx.getBlockPos().getZ() * 0.1;
return this.getDefaultState().with(COLOR, MHelper.floor(NOISE.eval(px, py, pz) * 3.5 + 4));
}
@Override
protected void appendProperties(StateManager.Builder<Block, BlockState> stateManager) {
stateManager.add(COLOR);
}
}

View file

@ -30,7 +30,7 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.util.MHelper;
public class HelixTreeLeavesBlock extends BaseBlock implements IColorProvider {
public static final IntProperty COLOR = IntProperty.of("color", 0, 7);
public static final IntProperty COLOR = BlockProperties.COLOR;
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
public HelixTreeLeavesBlock() {

View file

@ -30,7 +30,7 @@ import ru.betterend.patterns.Patterns;
import ru.betterend.util.MHelper;
public class JellyshroomCapBlock extends SlimeBlock implements IRenderTypeable, BlockPatterned, IColorProvider {
public static final IntProperty COLOR = IntProperty.of("color", 0, 7);
public static final IntProperty COLOR = BlockProperties.COLOR;
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
private final Vec3i colorStart;
private final Vec3i colorEnd;

View file

@ -32,7 +32,7 @@ import ru.betterend.registry.EndBlocks;
import ru.betterend.util.MHelper;
public class UmbrellaTreeMembraneBlock extends SlimeBlock implements IRenderTypeable, BlockPatterned {
public static final IntProperty COLOR = IntProperty.of("color", 0, 7);
public static final IntProperty COLOR = BlockProperties.COLOR;
private static final OpenSimplexNoise NOISE = new OpenSimplexNoise(0);
public UmbrellaTreeMembraneBlock() {