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

添加掉落经验方块别名

This commit is contained in:
XiaoMoMi
2025-12-04 19:18:25 +08:00
parent cba5de8f98
commit 64a510d89d
2 changed files with 3 additions and 1 deletions

View File

@@ -48,6 +48,7 @@ public class BukkitBlockBehaviors extends BlockBehaviors {
public static final Key SNOWY_BLOCK = Key.from("craftengine:snowy_block"); public static final Key SNOWY_BLOCK = Key.from("craftengine:snowy_block");
public static final Key HANGABLE_BLOCK = Key.from("craftengine:hangable_block"); public static final Key HANGABLE_BLOCK = Key.from("craftengine:hangable_block");
public static final Key DROP_EXPERIENCE_BLOCK = Key.from("craftengine:drop_experience_block"); public static final Key DROP_EXPERIENCE_BLOCK = Key.from("craftengine:drop_experience_block");
public static final Key DROP_EXP_BLOCK = Key.from("craftengine:drop_exp_block");
public static void init() { public static void init() {
register(EMPTY, (block, args) -> EmptyBlockBehavior.INSTANCE); register(EMPTY, (block, args) -> EmptyBlockBehavior.INSTANCE);
@@ -94,5 +95,6 @@ public class BukkitBlockBehaviors extends BlockBehaviors {
register(SNOWY_BLOCK, SnowyBlockBehavior.FACTORY); register(SNOWY_BLOCK, SnowyBlockBehavior.FACTORY);
register(HANGABLE_BLOCK, HangableBlockBehavior.FACTORY); register(HANGABLE_BLOCK, HangableBlockBehavior.FACTORY);
register(DROP_EXPERIENCE_BLOCK, DropExperienceBlockBehavior.FACTORY); register(DROP_EXPERIENCE_BLOCK, DropExperienceBlockBehavior.FACTORY);
register(DROP_EXP_BLOCK, DropExperienceBlockBehavior.FACTORY);
} }
} }

View File

@@ -90,7 +90,7 @@ public class DropExperienceBlockBehavior extends BukkitBlockBehavior {
@Override @Override
public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) { public BlockBehavior create(CustomBlock block, Map<String, Object> arguments) {
NumberProvider amount = NumberProviders.fromObject(arguments.getOrDefault("amount", 0)); NumberProvider amount = NumberProviders.fromObject(ResourceConfigUtils.get(arguments, "amount", "count"));
Condition<Context> conditions = null; Condition<Context> conditions = null;
List<Condition<Context>> conditionList = ResourceConfigUtils.parseConfigAsList(ResourceConfigUtils.get(arguments, "conditions", "condition"), EventConditions::fromMap); List<Condition<Context>> conditionList = ResourceConfigUtils.parseConfigAsList(ResourceConfigUtils.get(arguments, "conditions", "condition"), EventConditions::fromMap);
if (conditionList.size() == 1) { if (conditionList.size() == 1) {