mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2026-01-04 15:41:38 +00:00
Update LiquidCollisionBlockItemBehavior.java
This commit is contained in:
@@ -63,11 +63,16 @@ public class LiquidCollisionBlockItemBehavior extends BlockItemBehavior {
|
|||||||
public ItemBehavior create(Pack pack, Path path, Key key, Map<String, Object> arguments) {
|
public ItemBehavior create(Pack pack, Path path, Key key, Map<String, Object> arguments) {
|
||||||
Object id = arguments.get("block");
|
Object id = arguments.get("block");
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
throw new IllegalArgumentException("Missing required parameter 'block' for on_liquid_block_item behavior");
|
throw new IllegalArgumentException("Missing required parameter 'block' for liquid_collision_block_item behavior");
|
||||||
}
|
}
|
||||||
int offset = MiscUtils.getAsInt(arguments.getOrDefault("y-offset", 1));
|
int offset = MiscUtils.getAsInt(arguments.getOrDefault("y-offset", 1));
|
||||||
if (id instanceof Map<?, ?> map) {
|
if (id instanceof Map<?, ?> map) {
|
||||||
BukkitBlockManager.instance().parser().parseSection(pack, path, key, MiscUtils.castToMap(map, false));
|
if (map.containsKey(key.toString())) {
|
||||||
|
// 防呆
|
||||||
|
BukkitBlockManager.instance().parser().parseSection(pack, path, key, MiscUtils.castToMap(map.get(key.toString()), false));
|
||||||
|
} else {
|
||||||
|
BukkitBlockManager.instance().parser().parseSection(pack, path, key, MiscUtils.castToMap(map, false));
|
||||||
|
}
|
||||||
return new LiquidCollisionBlockItemBehavior(key, offset);
|
return new LiquidCollisionBlockItemBehavior(key, offset);
|
||||||
} else {
|
} else {
|
||||||
return new LiquidCollisionBlockItemBehavior(Key.of(id.toString()), offset);
|
return new LiquidCollisionBlockItemBehavior(Key.of(id.toString()), offset);
|
||||||
|
|||||||
Reference in New Issue
Block a user