Added more Behaviours
This commit is contained in:
parent
8777723bb8
commit
f69c1c8588
8 changed files with 103 additions and 4 deletions
|
@ -2,6 +2,7 @@ package org.betterx.bclib.behaviours;
|
||||||
|
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
import net.minecraft.world.level.block.state.BlockBehaviour;
|
||||||
import net.minecraft.world.level.material.Material;
|
import net.minecraft.world.level.material.Material;
|
||||||
import net.minecraft.world.level.material.MaterialColor;
|
import net.minecraft.world.level.material.MaterialColor;
|
||||||
|
@ -84,8 +85,29 @@ public class BehaviourBuilders {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockBehaviour.Properties createGlass() {
|
||||||
|
return BlockBehaviour.Properties
|
||||||
|
.of(Material.GLASS)
|
||||||
|
.strength(0.3F)
|
||||||
|
.sound(SoundType.GLASS)
|
||||||
|
.noOcclusion()
|
||||||
|
.isValidSpawn(Blocks::never)
|
||||||
|
.isRedstoneConductor(Blocks::never)
|
||||||
|
.isSuffocating(Blocks::never)
|
||||||
|
.isViewBlocking(Blocks::never);
|
||||||
|
}
|
||||||
|
|
||||||
public static BlockBehaviour.Properties createWallSign(MaterialColor color, Block dropBlock) {
|
public static BlockBehaviour.Properties createWallSign(MaterialColor color, Block dropBlock) {
|
||||||
return createSign(color).dropsLike(dropBlock);
|
return createSign(color).dropsLike(dropBlock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BlockBehaviour.Properties createSnow() {
|
||||||
|
return BlockBehaviour.Properties
|
||||||
|
.of(Material.SNOW)
|
||||||
|
.color(MaterialColor.SNOW)
|
||||||
|
.requiresCorrectToolForDrops()
|
||||||
|
.strength(0.2F)
|
||||||
|
.sound(SoundType.SNOW);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package org.betterx.bclib.behaviours.interfaces;
|
||||||
|
|
||||||
|
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
|
||||||
|
|
||||||
|
public interface BehaviourPlant extends AddMineableHoe {
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package org.betterx.bclib.behaviours.interfaces;
|
||||||
|
|
||||||
|
import org.betterx.bclib.interfaces.tools.AddMineableHoe;
|
||||||
|
|
||||||
|
public interface BehaviourSeed extends AddMineableHoe {
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
package org.betterx.bclib.behaviours.interfaces;
|
||||||
|
|
||||||
|
import org.betterx.bclib.interfaces.tools.AddMineableShovel;
|
||||||
|
|
||||||
|
public interface BehaviourSnow extends AddMineableShovel {
|
||||||
|
}
|
|
@ -1,5 +1,9 @@
|
||||||
package org.betterx.bclib.blocks;
|
package org.betterx.bclib.blocks;
|
||||||
|
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourGlass;
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
|
||||||
import org.betterx.bclib.util.BlocksHelper;
|
import org.betterx.bclib.util.BlocksHelper;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -21,7 +25,7 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
public abstract class BaseAttachedBlock extends BaseBlockNotFull {
|
public abstract class BaseAttachedBlock extends BaseBlockNotFull {
|
||||||
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.FACING;
|
||||||
|
|
||||||
public BaseAttachedBlock(Properties settings) {
|
protected BaseAttachedBlock(Properties settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
registerDefaultState(defaultBlockState().setValue(FACING, Direction.UP));
|
registerDefaultState(defaultBlockState().setValue(FACING, Direction.UP));
|
||||||
}
|
}
|
||||||
|
@ -80,4 +84,28 @@ public abstract class BaseAttachedBlock extends BaseBlockNotFull {
|
||||||
public BlockState mirror(BlockState state, Mirror mirror) {
|
public BlockState mirror(BlockState state, Mirror mirror) {
|
||||||
return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
|
return BlocksHelper.mirrorHorizontal(state, mirror, FACING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Wood extends BaseAttachedBlock implements BehaviourWood {
|
||||||
|
public Wood(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Stone extends BaseAttachedBlock implements BehaviourStone {
|
||||||
|
public Stone(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Metal extends BaseAttachedBlock implements BehaviourMetal {
|
||||||
|
public Metal(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Glass extends BaseAttachedBlock implements BehaviourGlass {
|
||||||
|
public Glass(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.betterx.bclib.blocks;
|
package org.betterx.bclib.blocks;
|
||||||
|
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourMetal;
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
|
@ -21,4 +25,22 @@ public class BaseBlockNotFull extends BaseBlock {
|
||||||
public boolean allowsSpawning(BlockState state, BlockGetter view, BlockPos pos, EntityType<?> type) {
|
public boolean allowsSpawning(BlockState state, BlockGetter view, BlockPos pos, EntityType<?> type) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Wood extends BaseBlockNotFull implements BehaviourWood {
|
||||||
|
public Wood(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Stone extends BaseBlockNotFull implements BehaviourStone {
|
||||||
|
public Stone(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Metal extends BaseBlockNotFull implements BehaviourMetal {
|
||||||
|
public Metal(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package org.betterx.bclib.blocks;
|
package org.betterx.bclib.blocks;
|
||||||
|
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourStone;
|
||||||
|
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.block.BaseEntityBlock;
|
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||||
|
@ -10,8 +12,8 @@ import net.minecraft.world.level.storage.loot.LootContext;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BaseBlockWithEntity extends BaseEntityBlock {
|
public abstract class BaseBlockWithEntity extends BaseEntityBlock {
|
||||||
public BaseBlockWithEntity(Properties settings) {
|
protected BaseBlockWithEntity(Properties settings) {
|
||||||
super(settings);
|
super(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,4 +27,10 @@ public class BaseBlockWithEntity extends BaseEntityBlock {
|
||||||
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
|
||||||
return Collections.singletonList(new ItemStack(this));
|
return Collections.singletonList(new ItemStack(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Stone extends BaseBlockWithEntity implements BehaviourStone {
|
||||||
|
public Stone(Properties settings) {
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.betterx.bclib.blocks;
|
package org.betterx.bclib.blocks;
|
||||||
|
|
||||||
|
import org.betterx.bclib.behaviours.interfaces.BehaviourWood;
|
||||||
import org.betterx.bclib.client.models.BasePatterns;
|
import org.betterx.bclib.client.models.BasePatterns;
|
||||||
import org.betterx.bclib.client.models.ModelsHelper;
|
import org.betterx.bclib.client.models.ModelsHelper;
|
||||||
import org.betterx.bclib.client.models.PatternsHelper;
|
import org.betterx.bclib.client.models.PatternsHelper;
|
||||||
|
@ -124,7 +125,7 @@ public abstract class BaseWallBlock extends WallBlock implements BlockModelProvi
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Stone extends BaseWallBlock {
|
public static class Stone extends BaseWallBlock implements BehaviourWood {
|
||||||
public Stone(Block source) {
|
public Stone(Block source) {
|
||||||
super(source);
|
super(source);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue