9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-26 18:39:20 +00:00

feat(block): 添加按钮方块行为

This commit is contained in:
jhqwqmc
2025-09-19 09:16:26 +08:00
parent 13bcf6333c
commit 6ed54af7ab
15 changed files with 444 additions and 24 deletions

View File

@@ -55,18 +55,18 @@ public abstract class BlockBehavior {
superMethod.call();
}
// ServerLevel level, BlockPos pos, RandomSource random
// BlockState state, ServerLevel level, BlockPos pos, RandomSource random
public void tick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
// ServerLevel level, BlockPos pos, RandomSource random
// BlockState state, ServerLevel level, BlockPos pos, RandomSource random
public void randomTick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
// 1.20-1.20.4 BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify, UseOnContext context
// 1.20.5+ Level level, BlockPos pos, BlockState oldState, boolean movedByPiston
// 1.20.5+ BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston
public void onPlace(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
@@ -95,12 +95,12 @@ public abstract class BlockBehavior {
return false;
}
//BlockState state
// BlockState state
public boolean hasAnalogOutputSignal(Object thisBlock, Object[] args) throws Exception {
return false;
}
//BlockState state, Level level, BlockPos pos
// BlockState state, Level level, BlockPos pos
public int getAnalogOutputSignal(Object thisBlock, Object[] args) throws Exception {
return 0;
}

View File

@@ -22,6 +22,7 @@ public final class Properties {
public static final Key STAIRS_SHAPE = Key.of("craftengine:stairs_shape");
public static final Key SLAB_TYPE = Key.of("craftengine:slab_type");
public static final Key SOFA_SHAPE = Key.of("craftengine:sofa_shape");
public static final Key ATTACH_FACE = Key.of("craftengine:attach_face");
static {
register(BOOLEAN, BooleanProperty.FACTORY);
@@ -38,6 +39,7 @@ public final class Properties {
register(STAIRS_SHAPE, new EnumProperty.Factory<>(StairsShape.class));
register(SLAB_TYPE, new EnumProperty.Factory<>(SlabType.class));
register(SOFA_SHAPE, new EnumProperty.Factory<>(SofaShape.class));
register(ATTACH_FACE, new EnumProperty.Factory<>(AttachFace.class));
}

View File

@@ -0,0 +1,7 @@
package net.momirealms.craftengine.core.block.state.properties;
public enum AttachFace {
FLOOR,
WALL,
CEILING
}