mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-24 01:19:24 +00:00
增强1.21.2的item model生成
This commit is contained in:
@@ -310,4 +310,6 @@ warning.config.function.actionbar.missing_actionbar: "<yellow>Issue found in fil
|
||||
warning.config.function.message.missing_message: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'message' argument for 'message' function.</yellow>"
|
||||
warning.config.selector.missing_type: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is missing the required 'type' argument for selector.</yellow>"
|
||||
warning.config.selector.invalid_type: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is using an invalid selector type '<arg:2>'.</yellow>"
|
||||
warning.config.selector.invalid_target: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is using an invalid selector target '<arg:2>'.</yellow>"
|
||||
warning.config.selector.invalid_target: "<yellow>Issue found in file <arg:0> - The config '<arg:1>' is using an invalid selector target '<arg:2>'.</yellow>"
|
||||
warning.config.resource_pack.item_model.conflict: "<yellow>Failed to generate item model for '<arg:0>' because this item model has been occupied by a vanilla item.</yellow>"
|
||||
warning.config.resource_pack.item_model.v1_21_2.conflict: "<yellow>Failed to generate item model(v1.21.2) for '<arg:0>'.</yellow>"
|
||||
@@ -132,18 +132,17 @@ public class BlockEventListener implements Listener {
|
||||
if (itemInHand != null) {
|
||||
Optional<CustomItem<ItemStack>> optionalCustomItem = itemInHand.getCustomItem();
|
||||
if (optionalCustomItem.isPresent()) {
|
||||
Cancellable dummy = Cancellable.dummy();
|
||||
Cancellable cancellable = Cancellable.of(event::isCancelled, event::setCancelled);
|
||||
optionalCustomItem.get().execute(
|
||||
PlayerOptionalContext.of(serverPlayer, ContextHolder.builder()
|
||||
.withParameter(DirectContextParameters.BLOCK, new BukkitBlockInWorld(block))
|
||||
.withParameter(DirectContextParameters.POSITION, position)
|
||||
.withParameter(DirectContextParameters.PLAYER, serverPlayer)
|
||||
.withParameter(DirectContextParameters.EVENT, dummy)
|
||||
.withParameter(DirectContextParameters.EVENT, cancellable)
|
||||
.withOptionalParameter(DirectContextParameters.ITEM_IN_HAND, itemInHand)
|
||||
), EventTrigger.BREAK
|
||||
);
|
||||
if (dummy.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
if (cancellable.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -166,7 +165,7 @@ public class BlockEventListener implements Listener {
|
||||
}
|
||||
|
||||
// execute functions
|
||||
Cancellable cancellable = Cancellable.dummy();
|
||||
Cancellable cancellable = Cancellable.of(event::isCancelled, event::setCancelled);
|
||||
PlayerOptionalContext context = PlayerOptionalContext.of(serverPlayer, ContextHolder.builder()
|
||||
.withParameter(DirectContextParameters.BLOCK, new BukkitBlockInWorld(block))
|
||||
.withParameter(DirectContextParameters.BLOCK_STATE, state)
|
||||
@@ -176,7 +175,6 @@ public class BlockEventListener implements Listener {
|
||||
);
|
||||
state.owner().value().execute(context, EventTrigger.BREAK);
|
||||
if (cancellable.isCancelled()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.momirealms.craftengine.bukkit.entity.data;
|
||||
import net.momirealms.craftengine.core.util.VersionHelper;
|
||||
|
||||
public class InteractionEntityData<T> extends BaseEntityData<T> {
|
||||
// Interaction only
|
||||
public static final InteractionEntityData<Float> Width = of(8, EntityDataValue.Serializers$FLOAT, 1F);
|
||||
public static final InteractionEntityData<Float> Height = of(9, EntityDataValue.Serializers$FLOAT, 1F);
|
||||
public static final InteractionEntityData<Boolean> Responsive = of(10, EntityDataValue.Serializers$BOOLEAN, false);
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.momirealms.craftengine.bukkit.entity.data;
|
||||
import net.momirealms.craftengine.bukkit.util.Reflections;
|
||||
|
||||
public class TextDisplayEntityData<T> extends DisplayEntityData<T> {
|
||||
// Text display only
|
||||
public static final DisplayEntityData<Object> Text = of(23, EntityDataValue.Serializers$COMPONENT, Reflections.instance$Component$empty);
|
||||
public static final DisplayEntityData<Integer> LineWidth = of(24, EntityDataValue.Serializers$INT, 200);
|
||||
public static final DisplayEntityData<Integer> BackgroundColor = of(25, EntityDataValue.Serializers$INT, 0x40000000);
|
||||
|
||||
@@ -5,7 +5,6 @@ import net.momirealms.craftengine.bukkit.util.Reflections;
|
||||
public class ThrowableItemProjectileData<T> extends BaseEntityData<T> {
|
||||
public static final ThrowableItemProjectileData<Object> ItemStack = new ThrowableItemProjectileData<>(8, EntityDataValue.Serializers$ITEM_STACK, Reflections.instance$ItemStack$Air);
|
||||
|
||||
|
||||
public ThrowableItemProjectileData(int id, Object serializer, T defaultValue) {
|
||||
super(id, serializer, defaultValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user