9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-25 18:09:27 +00:00

完善摔落伤害机制处理等

This commit is contained in:
XiaoMoMi
2025-09-11 03:20:47 +08:00
parent b817426575
commit 584d8e1f7a
10 changed files with 159 additions and 157 deletions

View File

@@ -6,6 +6,7 @@ import net.momirealms.craftengine.bukkit.util.LocationUtils;
import net.momirealms.craftengine.core.block.BlockBehavior;
import net.momirealms.craftengine.core.block.CustomBlock;
import net.momirealms.craftengine.core.block.behavior.BlockBehaviorFactory;
import net.momirealms.craftengine.core.block.behavior.special.TriggerOnceBlockBehavior;
import net.momirealms.craftengine.core.util.ResourceConfigUtils;
import net.momirealms.craftengine.core.util.VersionHelper;
import net.momirealms.craftengine.core.world.Vec3d;
@@ -13,19 +14,22 @@ import net.momirealms.craftengine.core.world.Vec3d;
import java.util.Map;
import java.util.concurrent.Callable;
public class BouncingBlockBehavior extends BukkitBlockBehavior {
public class BouncingBlockBehavior extends BukkitBlockBehavior implements TriggerOnceBlockBehavior {
public static final Factory FACTORY = new Factory();
private final double bounceHeight;
private final boolean syncPlayerSelf;
private final boolean fallDamage;
public BouncingBlockBehavior(CustomBlock customBlock, double bounceHeight, boolean syncPlayerSelf) {
public BouncingBlockBehavior(CustomBlock customBlock, double bounceHeight, boolean fallDamage) {
super(customBlock);
this.bounceHeight = bounceHeight;
this.syncPlayerSelf = syncPlayerSelf;
this.fallDamage = fallDamage;
}
@Override
public void fallOn(Object thisBlock, Object[] args, Callable<Object> superMethod) {
if (!this.fallDamage) {
return;
}
Object entity = args[3];
Object finalFallDistance = VersionHelper.isOrAbove1_21_5() ? (double) args[4] * 0.5 : (float) args[4] * 0.5F;
FastNMS.INSTANCE.method$Entity$causeFallDamage(
@@ -50,7 +54,8 @@ public class BouncingBlockBehavior extends BukkitBlockBehavior {
double d = CoreReflections.clazz$LivingEntity.isInstance(entity) ? 1.0 : 0.8;
double y = -deltaMovement.y * this.bounceHeight * d;
FastNMS.INSTANCE.method$Entity$setDeltaMovement(entity, deltaMovement.x, y, deltaMovement.z);
if (CoreReflections.clazz$Player.isInstance(entity) && this.syncPlayerSelf && y > 0.032) { // 防抖
if (CoreReflections.clazz$Player.isInstance(entity) && y > 0.032) {
// 防抖
FastNMS.INSTANCE.field$Entity$hurtMarked(entity, true);
}
}
@@ -61,8 +66,8 @@ public class BouncingBlockBehavior extends BukkitBlockBehavior {
@Override
public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) {
double bounceHeight = ResourceConfigUtils.getAsDouble(arguments.getOrDefault("bounce-height", 0.66), "bounce-height");
boolean syncPlayerSelf = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("sync-player-self", true), "sync-player-self");
return new BouncingBlockBehavior(block, bounceHeight, syncPlayerSelf);
boolean fallDamage = ResourceConfigUtils.getAsBoolean(arguments.getOrDefault("fall-damage", false), "fall-damage");
return new BouncingBlockBehavior(block, bounceHeight, fallDamage);
}
}
}

View File

@@ -5,6 +5,7 @@ import net.momirealms.craftengine.core.block.CustomBlock;
import net.momirealms.craftengine.core.block.ImmutableBlockState;
import net.momirealms.craftengine.core.block.behavior.AbstractBlockBehavior;
import net.momirealms.craftengine.core.block.behavior.EntityBlockBehavior;
import net.momirealms.craftengine.core.block.behavior.special.TriggerOnceBlockBehavior;
import net.momirealms.craftengine.core.entity.player.InteractionResult;
import net.momirealms.craftengine.core.item.context.BlockPlaceContext;
import net.momirealms.craftengine.core.item.context.UseOnContext;
@@ -14,7 +15,7 @@ import java.util.List;
import java.util.Optional;
import java.util.concurrent.Callable;
public class UnsafeCompositeBlockBehavior extends BukkitBlockBehavior {
public class UnsafeCompositeBlockBehavior extends BukkitBlockBehavior implements TriggerOnceBlockBehavior {
private final AbstractBlockBehavior[] behaviors;
public UnsafeCompositeBlockBehavior(CustomBlock customBlock, List<AbstractBlockBehavior> behaviors) {
@@ -340,18 +341,22 @@ public class UnsafeCompositeBlockBehavior extends BukkitBlockBehavior {
@Override
public void fallOn(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
for (AbstractBlockBehavior behavior : this.behaviors) {
behavior.fallOn(thisBlock, args, superMethod);
if (behavior instanceof TriggerOnceBlockBehavior f) {
f.fallOn(thisBlock, args, superMethod);
return;
}
}
TriggerOnceBlockBehavior.super.fallOn(thisBlock, args, superMethod);
}
@Override
public void updateEntityMovementAfterFallOn(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
for (AbstractBlockBehavior behavior : this.behaviors) {
if (behavior instanceof BouncingBlockBehavior bouncingBlockBehavior) {
bouncingBlockBehavior.updateEntityMovementAfterFallOn(thisBlock, args, superMethod);
if (behavior instanceof TriggerOnceBlockBehavior f) {
f.updateEntityMovementAfterFallOn(thisBlock, args, superMethod);
return;
}
}
super.updateEntityMovementAfterFallOn(thisBlock, args, superMethod);
TriggerOnceBlockBehavior.super.updateEntityMovementAfterFallOn(thisBlock, args, superMethod);
}
}

View File

@@ -23,6 +23,7 @@ import net.momirealms.craftengine.core.block.BlockKeys;
import net.momirealms.craftengine.core.block.BlockShape;
import net.momirealms.craftengine.core.block.DelegatingBlock;
import net.momirealms.craftengine.core.block.behavior.EmptyBlockBehavior;
import net.momirealms.craftengine.core.block.behavior.special.TriggerOnceBlockBehavior;
import net.momirealms.craftengine.core.plugin.CraftEngine;
import net.momirealms.craftengine.core.plugin.config.Config;
import net.momirealms.craftengine.core.util.Key;
@@ -538,7 +539,7 @@ public final class BlockGenerator {
public void intercept(@This Object thisObj, @AllArguments Object[] args, @SuperCall Callable<Object> superMethod) {
ObjectHolder<BlockBehavior> holder = ((DelegatingBlock) thisObj).behaviorDelegate();
try {
holder.value().onExplosionHit(thisObj, args, superMethod);
holder.value().onExplosionHit(thisObj, args, () -> null);
superMethod.call();
} catch (Exception e) {
CraftEngine.instance().logger().severe("Failed to run onExplosionHit", e);
@@ -714,7 +715,11 @@ public final class BlockGenerator {
public void intercept(@This Object thisObj, @AllArguments Object[] args, @SuperCall Callable<Object> superMethod) {
ObjectHolder<BlockBehavior> holder = ((DelegatingBlock) thisObj).behaviorDelegate();
try {
holder.value().fallOn(thisObj, args, superMethod);
if (holder.value() instanceof TriggerOnceBlockBehavior behavior) {
behavior.fallOn(thisObj, args, superMethod);
} else {
superMethod.call();
}
} catch (Exception e) {
CraftEngine.instance().logger().severe("Failed to run fallOn", e);
}
@@ -728,7 +733,11 @@ public final class BlockGenerator {
public void intercept(@This Object thisObj, @AllArguments Object[] args, @SuperCall Callable<Object> superMethod) {
ObjectHolder<BlockBehavior> holder = ((DelegatingBlock) thisObj).behaviorDelegate();
try {
holder.value().updateEntityMovementAfterFallOn(thisObj, args, superMethod);
if (holder.value() instanceof TriggerOnceBlockBehavior behavior) {
behavior.updateEntityMovementAfterFallOn(thisObj, args, superMethod);
} else {
superMethod.call();
}
} catch (Exception e) {
CraftEngine.instance().logger().severe("Failed to run updateEntityMovementAfterFallOn", e);
}

View File

@@ -555,23 +555,23 @@ items#misc:
facing=west,open=true:
appearance: west_open
id: 29
default:sofa:
default:sleeper_sofa:
material: nether_brick
custom-model-data: 3008
data:
item-name: <!i><i18n:item.sofa>
model:
type: minecraft:model
path: minecraft:item/custom/sofa
path: minecraft:item/custom/sleeper_sofa
behavior:
type: block_item
block:
loot:
template: default:loot_table/self
settings:
hardness: 2
resistance: 3
map-color: 56
hardness: 0.5
resistance: 0.5
map-color: 27
burn-chance: 5
fire-spread-chance: 20
burnable: true
@@ -595,40 +595,30 @@ items#misc:
id: 0
state: white_bed[facing=west,occupied=false,part=foot]
entity-renderer:
item: default:sofa
default:connectable_sofa_straight:
item: default:sleeper_sofa
default:sofa_inner:
material: nether_brick
custom-model-data: 3009
data:
item-name: <!i><i18n:item.sofa>
model:
type: minecraft:model
path: minecraft:item/custom/sofa_straight
default:connectable_sofa_inner:
path: minecraft:item/custom/sofa_inner
default:sofa:
material: nether_brick
custom-model-data: 3010
data:
item-name: <!i><i18n:item.sofa>
model:
type: minecraft:model
path: minecraft:item/custom/sofa_inner
default:connectable_sofa:
material: nether_brick
custom-model-data: 3011
data:
item-name: <!i><i18n:item.sofa>
model:
type: minecraft:model
path: minecraft:item/custom/sofa_straight
path: minecraft:item/custom/sofa
behavior:
type: block_item
block:
loot:
template: default:loot_table/self
settings:
hardness: 2
resistance: 3
map-color: 56
hardness: 0.5
resistance: 0.5
map-color: 27
burn-chance: 5
fire-spread-chance: 20
burnable: true
@@ -658,59 +648,59 @@ items#misc:
facing=east,shape=straight:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_straight
item: default:sofa
yaw: 90
facing=north,shape=straight:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_straight
item: default:sofa
facing=south,shape=straight:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_straight
item: default:sofa
yaw: 180
facing=west,shape=straight:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_straight
item: default:sofa
yaw: 270
facing=east,shape=inner_left:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
facing=north,shape=inner_left:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
yaw: 270
facing=south,shape=inner_left:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
yaw: 90
facing=west,shape=inner_left:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
yaw: 180
facing=east,shape=inner_right:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
yaw: 90
facing=north,shape=inner_right:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
facing=south,shape=inner_right:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
yaw: 180
facing=west,shape=inner_right:
state: barrier[waterlogged=false]
entity-renderer:
item: default:connectable_sofa_inner
item: default:sofa_inner
yaw: 270
variants:
facing=east,shape=inner_left:

View File

@@ -80,7 +80,7 @@ categories:
- default:pebble
- default:chessboard_block
- default:safe_block
- default:sofa
- default:sleeper_sofa
- minecraft:air
- minecraft:air
- default:connectable_sofa
- default:sofa

View File

@@ -1,53 +1,24 @@
{
"texture_size": [64, 64],
"textures": {
"0": "item/custom/sofa",
"particle": "item/custom/sofa"
},
"elements": [
{
"from": [1, 0, 1],
"to": [3, 3, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [1, 0, 1]},
"from": [-0.005, 2.995, -0.005],
"to": [16.005, 9.005, 16.005],
"faces": {
"north": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
"east": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"south": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"west": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
"up": {"uv": [16, 15.5, 15.5, 15], "texture": "#0"},
"down": {"uv": [16, 15.5, 15.5, 16], "texture": "#0"}
"north": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
"east": {"uv": [8, 11.5, 4, 13], "texture": "#0"},
"south": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
"west": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
"up": {"uv": [4, 4, 0, 0], "texture": "#0"},
"down": {"uv": [4, 12, 0, 16], "texture": "#0"}
}
},
{
"from": [13, 0, 1],
"to": [15, 3, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 1]},
"faces": {
"north": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
"east": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
"south": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
"west": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
"up": {"uv": [15.5, 15.5, 16, 15], "texture": "#0"},
"down": {"uv": [15.5, 15.5, 16, 16], "texture": "#0"}
}
},
{
"from": [13, 0, 13],
"to": [15, 3, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 15]},
"faces": {
"north": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"east": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
"south": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
"west": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"up": {"uv": [15.5, 15, 16, 15.5], "texture": "#0"},
"down": {"uv": [15.5, 16, 16, 15.5], "texture": "#0"}
}
},
{
"from": [1, 0, 13],
"to": [3, 3, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [1, 0, 15]},
"from": [-0.005, -0.005, 12.995],
"to": [3.005, 3.005, 16.005],
"faces": {
"north": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
"east": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
@@ -58,29 +29,39 @@
}
},
{
"from": [0.01, 2.51, 0.01],
"to": [15.99, 8.49, 15.99],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 2, 0]},
"from": [12.995, -0.005, 12.995],
"to": [16.005, 3.005, 16.005],
"faces": {
"north": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
"east": {"uv": [8, 14.5, 4, 16], "texture": "#0"},
"south": {"uv": [4, 13, 8, 14.5], "texture": "#0"},
"west": {"uv": [4, 14.5, 8, 16], "texture": "#0"},
"up": {"uv": [4, 12, 0, 8], "texture": "#0"},
"down": {"uv": [4, 12, 0, 16], "texture": "#0"}
"north": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"east": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
"south": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
"west": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"up": {"uv": [15.5, 15, 16, 15.5], "texture": "#0"},
"down": {"uv": [15.5, 16, 16, 15.5], "texture": "#0"}
}
},
{
"from": [0.02, 6.02, 12.02],
"to": [15.98, 19.98, 15.98],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7, 8, 14]},
"from": [12.995, -0.005, -0.005],
"to": [16.005, 3.005, 3.005],
"faces": {
"north": {"uv": [9, 8.5, 13, 12], "texture": "#0"},
"east": {"uv": [8, 12.5, 9, 16], "texture": "#0"},
"south": {"uv": [9, 12.5, 13, 16], "texture": "#0"},
"west": {"uv": [9, 12.5, 8, 16], "texture": "#0"},
"up": {"uv": [9, 12, 8, 8.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [7.75, 10.5, 4.25, 11.5], "texture": "#0"}
"north": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
"east": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
"south": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
"west": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
"up": {"uv": [15.5, 15.5, 16, 15], "texture": "#0"},
"down": {"uv": [15.5, 15.5, 16, 16], "texture": "#0"}
}
},
{
"from": [-0.005, -0.005, -0.005],
"to": [3.005, 3.005, 3.005],
"faces": {
"north": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
"east": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"south": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"west": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
"up": {"uv": [16, 15.5, 15.5, 15], "texture": "#0"},
"down": {"uv": [16, 15.5, 15.5, 16], "texture": "#0"}
}
}
],
@@ -96,12 +77,12 @@
"scale": [0.25, 0.25, 0.25]
},
"firstperson_righthand": {
"rotation": [0, 180, 0],
"rotation": [0, -180, 0],
"translation": [0.5, 0.5, 0],
"scale": [0.5, 0.5, 0.5]
},
"firstperson_lefthand": {
"rotation": [0, 180, 0],
"rotation": [0, -180, 0],
"translation": [0.5, 0.5, 0],
"scale": [0.5, 0.5, 0.5]
},
@@ -111,7 +92,7 @@
},
"gui": {
"rotation": [25, -135, 0],
"translation": [0.5, -1, 0],
"translation": [0.25, -1, 0],
"scale": [0.5, 0.5, 0.5]
},
"fixed": {
@@ -119,13 +100,5 @@
"translation": [0, 0, -16],
"scale": [2, 2, 2]
}
},
"groups": [
{
"name": "group",
"origin": [0, 0, 0],
"color": 0,
"children": [0, 1, 2, 3, 4, 5]
}
]
}
}

View File

@@ -1,13 +1,14 @@
{
"texture_size": [64, 64],
"textures": {
"0": "item/custom/sofa",
"particle": "item/custom/sofa"
},
"elements": [
{
"from": [-0.07, -0.035, -0.07],
"to": [2.95, 2.495, 2.95],
"rotation": {"angle": 0, "axis": "y", "origin": [-0.07, -0.035, -0.07]},
"from": [1, 0, 1],
"to": [3, 3, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [1, 0, 1]},
"faces": {
"north": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
"east": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
@@ -18,9 +19,9 @@
}
},
{
"from": [13.05, -0.035, -0.07],
"to": [16.07, 2.495, 2.95],
"rotation": {"angle": 0, "axis": "y", "origin": [16.07, -0.035, -0.07]},
"from": [13, 0, 1],
"to": [15, 3, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 1]},
"faces": {
"north": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
"east": {"uv": [14.5, 15.25, 15, 16], "texture": "#0"},
@@ -31,9 +32,9 @@
}
},
{
"from": [13.05, -0.035, 13.05],
"to": [16.07, 2.495, 16.07],
"rotation": {"angle": 0, "axis": "y", "origin": [16.07, -0.035, 16.07]},
"from": [13, 0, 13],
"to": [15, 3, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 15]},
"faces": {
"north": {"uv": [15, 15.25, 15.5, 16], "texture": "#0"},
"east": {"uv": [15, 15.25, 14.5, 16], "texture": "#0"},
@@ -44,9 +45,9 @@
}
},
{
"from": [-0.07, -0.035, 13.05],
"to": [2.95, 2.495, 16.07],
"rotation": {"angle": 0, "axis": "y", "origin": [-0.07, -0.035, 16.07]},
"from": [1, 0, 13],
"to": [3, 3, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [1, 0, 15]},
"faces": {
"north": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
"east": {"uv": [15.5, 15.25, 15, 16], "texture": "#0"},
@@ -57,17 +58,30 @@
}
},
{
"from": [-0.0699, 2.5001, -0.0699],
"to": [16.0699, 9.0399, 16.0699],
"rotation": {"angle": 0, "axis": "y", "origin": [-0.08, 1.985, -0.08]},
"from": [0, 3, 0],
"to": [16, 9, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 2, 0]},
"faces": {
"north": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
"east": {"uv": [8, 11.5, 4, 13], "texture": "#0"},
"south": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
"west": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
"up": {"uv": [4, 4, 0, 0], "texture": "#0"},
"east": {"uv": [8, 14.5, 4, 16], "texture": "#0"},
"south": {"uv": [4, 13, 8, 14.5], "texture": "#0"},
"west": {"uv": [4, 14.5, 8, 16], "texture": "#0"},
"up": {"uv": [4, 12, 0, 8], "texture": "#0"},
"down": {"uv": [4, 12, 0, 16], "texture": "#0"}
}
},
{
"from": [0.02, 6.02, 12.02],
"to": [15.98, 19.98, 15.98],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7, 8, 14]},
"faces": {
"north": {"uv": [9, 8.5, 13, 12], "texture": "#0"},
"east": {"uv": [8, 12.5, 9, 16], "texture": "#0"},
"south": {"uv": [9, 12.5, 13, 16], "texture": "#0"},
"west": {"uv": [9, 12.5, 8, 16], "texture": "#0"},
"up": {"uv": [9, 12, 8, 8.5], "rotation": 90, "texture": "#0"},
"down": {"uv": [7.75, 10.5, 4.25, 11.5], "texture": "#0"}
}
}
],
"display": {
@@ -97,7 +111,7 @@
},
"gui": {
"rotation": [25, -135, 0],
"translation": [0.25, -1, 0],
"translation": [0.5, -1, 0],
"scale": [0.5, 0.5, 0.5]
},
"fixed": {
@@ -111,7 +125,7 @@
"name": "group",
"origin": [0, 0, 0],
"color": 0,
"children": [0, 1, 2, 3, 4]
"children": [0, 1, 2, 3, 4, 5]
}
]
}

View File

@@ -57,8 +57,8 @@
}
},
{
"from": [0.01, 2.51, 0.01],
"to": [15.99, 8.49, 15.99],
"from": [0, 3, 0],
"to": [16, 9, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [0, 2, 0]},
"faces": {
"north": {"uv": [4, 11.5, 8, 13], "texture": "#0"},
@@ -98,7 +98,7 @@
],
"display": {
"thirdperson_righthand": {
"rotation": [60, 180, 0],
"rotation": [60, -180, 0],
"translation": [-0.5, 3, 0.25],
"scale": [0.25, 0.25, 0.25]
},
@@ -108,7 +108,7 @@
"scale": [0.25, 0.25, 0.25]
},
"firstperson_righthand": {
"rotation": [0, 180, 0],
"rotation": [0, -180, 0],
"translation": [0.5, 0.5, 0],
"scale": [0.5, 0.5, 0.5]
},

View File

@@ -178,17 +178,6 @@ public abstract class BlockBehavior {
public void spawnAfterBreak(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
}
// 1.20.1~1.21.4 Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance
// 1.21.5+ Level level, BlockState state, BlockPos pos, Entity entity, double fallDistance
public void fallOn(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
// BlockGetter level, Entity entity
public void updateEntityMovementAfterFallOn(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
public ImmutableBlockState updateStateForPlacement(BlockPlaceContext context, ImmutableBlockState state) {
return state;
}

View File

@@ -0,0 +1,17 @@
package net.momirealms.craftengine.core.block.behavior.special;
import java.util.concurrent.Callable;
public interface TriggerOnceBlockBehavior {
// 1.20.1~1.21.4 Level world, BlockState state, BlockPos pos, Entity entity, float fallDistance
// 1.21.5+ Level level, BlockState state, BlockPos pos, Entity entity, double fallDistance
default void fallOn(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
// BlockGetter level, Entity entity
default void updateEntityMovementAfterFallOn(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
}