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

修复其他弹射物

This commit is contained in:
XiaoMoMi
2025-06-21 19:17:34 +08:00
parent 82933f9537
commit dfac8503cb
16 changed files with 515 additions and 189 deletions

View File

@@ -615,17 +615,16 @@ public class BukkitBlockManager extends AbstractBlockManager {
if (!Files.exists(mappingsFile)) {
this.plugin.saveResource("mappings.yml");
}
File mappingFile = new File(plugin.dataFolderFile(), "mappings.yml");
Yaml yaml = new Yaml(new StringKeyConstructor(null, new LoaderOptions()));
Yaml yaml = new Yaml(new StringKeyConstructor(mappingsFile, new LoaderOptions()));
try (InputStream inputStream = Files.newInputStream(mappingsFile)) {
Map<String, String> blockStateMappings = loadBlockStateMappings(yaml.load(inputStream));
this.validateBlockStateMappings(mappingFile, blockStateMappings);
this.validateBlockStateMappings(mappingsFile, blockStateMappings);
Map<Integer, String> stateMap = new Int2ObjectOpenHashMap<>();
Map<Key, Integer> blockTypeCounter = new LinkedHashMap<>();
Map<Integer, Integer> appearanceMapper = new Int2IntOpenHashMap();
Map<Key, List<Integer>> appearanceArranger = new HashMap<>();
for (Map.Entry<String, String> entry : blockStateMappings.entrySet()) {
this.processBlockStateMapping(mappingFile, entry, stateMap, blockTypeCounter, appearanceMapper, appearanceArranger);
this.processBlockStateMapping(mappingsFile, entry, stateMap, blockTypeCounter, appearanceMapper, appearanceArranger);
}
this.blockAppearanceMapper = ImmutableMap.copyOf(appearanceMapper);
this.blockAppearanceArranger = ImmutableMap.copyOf(appearanceArranger);
@@ -679,7 +678,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
return blockStateMappings;
}
private void validateBlockStateMappings(File mappingFile, Map<String, String> blockStateMappings) {
private void validateBlockStateMappings(Path mappingFile, Map<String, String> blockStateMappings) {
Map<String, String> temp = new HashMap<>(blockStateMappings);
for (Map.Entry<String, String> entry : temp.entrySet()) {
String state = entry.getValue();
@@ -690,7 +689,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
}
}
private void processBlockStateMapping(File mappingFile,
private void processBlockStateMapping(Path mappingFile,
Map.Entry<String, String> entry,
Map<Integer, String> stateMap,
Map<Key, Integer> counter,
@@ -725,7 +724,7 @@ public class BukkitBlockManager extends AbstractBlockManager {
}
}
private Object createBlockState(File mappingFile, String state) {
private Object createBlockState(Path mappingFile, String state) {
try {
Object registryOrLookUp = MBuiltInRegistries.BLOCK;
if (CoreReflections.method$Registry$asLookup != null) {

View File

@@ -16,4 +16,10 @@ public class BukkitCustomProjectile extends AbstractCustomProjectile {
public BukkitProjectile projectile() {
return (BukkitProjectile) super.projectile();
}
@SuppressWarnings("unchecked")
@Override
public Item<ItemStack> item() {
return (Item<ItemStack>) item;
}
}

View File

@@ -2,6 +2,7 @@ package net.momirealms.craftengine.bukkit.entity.projectile;
import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent;
import com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent;
import com.destroystokyo.paper.event.player.PlayerReadyArrowEvent;
import io.papermc.paper.event.player.PlayerStopUsingItemEvent;
import net.momirealms.craftengine.bukkit.item.BukkitItemManager;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
@@ -65,7 +66,7 @@ public class BukkitProjectileManager implements Listener, ProjectileManager {
}
@Override
public Optional<CustomProjectile> projectileByEntityId(int entityId) {
public Optional<BukkitCustomProjectile> projectileByEntityId(int entityId) {
return Optional.ofNullable(this.projectiles.get(entityId));
}
@@ -191,14 +192,18 @@ public class BukkitProjectileManager implements Listener, ProjectileManager {
this.cachedServerEntity = serverEntity;
}
boolean inGround = FastNMS.INSTANCE.method$AbstractArrow$isInGround(nmsEntity);
if (canSpawnParticle(nmsEntity, inGround)) {
this.projectile.getWorld().spawnParticle(ParticleUtils.BUBBLE, this.projectile.getLocation(), 3, 0.1, 0.1, 0.1, 0);
}
if (inGround) {
updateProjectileUpdateInterval(Integer.MAX_VALUE);
} else {
if (!CoreReflections.clazz$AbstractArrow.isInstance(nmsEntity)) {
updateProjectileUpdateInterval(1);
} else {
boolean inGround = FastNMS.INSTANCE.method$AbstractArrow$isInGround(nmsEntity);
if (canSpawnParticle(nmsEntity, inGround)) {
this.projectile.getWorld().spawnParticle(ParticleUtils.BUBBLE, this.projectile.getLocation(), 3, 0.1, 0.1, 0.1, 0);
}
if (inGround) {
updateProjectileUpdateInterval(Integer.MAX_VALUE);
} else {
updateProjectileUpdateInterval(1);
}
}
}

View File

@@ -303,13 +303,14 @@ public class BukkitRecipeManager extends AbstractRecipeManager<ItemStack> {
public void unload() {
if (!Config.enableRecipeSystem()) return;
super.unload();
try {
if (VersionHelper.isOrAbove1_21_2()) {
// TODO: 排查为什么会出现并发修改问题
CoreReflections.method$RecipeManager$finalizeRecipeLoading.invoke(nmsRecipeManager);
}
} catch (ReflectiveOperationException e) {
this.plugin.logger().warn("Failed to unregister recipes", e);
if (VersionHelper.isOrAbove1_21_2()) {
this.plugin.scheduler().executeSync(() -> {
try {
CoreReflections.method$RecipeManager$finalizeRecipeLoading.invoke(nmsRecipeManager);
} catch (ReflectiveOperationException e) {
this.plugin.logger().warn("Failed to unregister recipes", e);
}
});
}
}
@@ -435,7 +436,7 @@ public class BukkitRecipeManager extends AbstractRecipeManager<ItemStack> {
}
}
} catch (Exception e) {
plugin.logger().warn("Failed to read data pack recipes", e);
this.plugin.logger().warn("Failed to read data pack recipes", e);
}
}

View File

@@ -1,6 +1,8 @@
package net.momirealms.craftengine.bukkit.plugin.network.handler;
import net.momirealms.craftengine.bukkit.block.BukkitBlockManager;
import net.momirealms.craftengine.bukkit.entity.data.ItemDisplayEntityData;
import net.momirealms.craftengine.bukkit.entity.projectile.BukkitCustomProjectile;
import net.momirealms.craftengine.bukkit.item.BukkitItemManager;
import net.momirealms.craftengine.bukkit.nms.FastNMS;
import net.momirealms.craftengine.bukkit.plugin.injector.ProtectedFieldVisitor;
@@ -26,11 +28,11 @@ import java.util.UUID;
public class ProjectilePacketHandler implements EntityPacketHandler {
private final int entityId;
private final CustomProjectile projectile;
private final BukkitCustomProjectile projectile;
private final Object cachedPacket;
private final List<Object> cachedData;
public ProjectilePacketHandler(CustomProjectile projectile, int entityId) {
public ProjectilePacketHandler(BukkitCustomProjectile projectile, int entityId) {
this.projectile = projectile;
this.entityId = entityId;
this.cachedData = createCustomProjectileEntityDataValues();
@@ -111,7 +113,7 @@ public class ProjectilePacketHandler implements EntityPacketHandler {
Optional<CustomItem<ItemStack>> customItem = BukkitItemManager.instance().getCustomItem(this.projectile.metadata().item());
if (customItem.isEmpty()) return itemDisplayValues;
ProjectileMeta meta = this.projectile.metadata();
Item<?> displayedItem = customItem.get().buildItem(ItemBuildContext.EMPTY);
Item<ItemStack> displayedItem = customItem.get().buildItem(ItemBuildContext.EMPTY);
// 我们应当使用新的展示物品的组件覆盖原物品的组件,以完成附魔,附魔光效等组件的继承
displayedItem = this.projectile.item().mergeCopy(displayedItem);
ItemDisplayEntityData.InterpolationDelay.addEntityDataIfNotDefaultValue(-1, itemDisplayValues);
@@ -124,7 +126,11 @@ public class ProjectilePacketHandler implements EntityPacketHandler {
} else {
ItemDisplayEntityData.InterpolationDuration.addEntityDataIfNotDefaultValue(1, itemDisplayValues);
}
ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(displayedItem.getLiteralObject(), itemDisplayValues);
Object literalItem = displayedItem.getLiteralObject();
BukkitItemManager.instance().s2c(displayedItem.getItem(), null).ifPresentOrElse(
it -> ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(FastNMS.INSTANCE.field$CraftItemStack$handle(it), itemDisplayValues),
() -> ItemDisplayEntityData.DisplayedItem.addEntityDataIfNotDefaultValue(literalItem, itemDisplayValues));
ItemDisplayEntityData.DisplayType.addEntityDataIfNotDefaultValue(meta.displayType().id(), itemDisplayValues);
return itemDisplayValues;
}

View File

@@ -155,57 +155,127 @@ items#topaz_gears:
template: default:model/simplified_handheld
arguments:
path: minecraft:item/custom/topaz_sword
default:topaz_helmet:
template: default:armor/topaz
arguments:
part: helmet
slot: head
default:topaz_chestplate:
template: default:armor/topaz
arguments:
part: chestplate
slot: chest
default:topaz_leggings:
template: default:armor/topaz
arguments:
part: leggings
slot: legs
default:topaz_boots:
template: default:armor/topaz
arguments:
part: boots
slot: feet
default:topaz_trident:
material: trident
custom-model-data: 1000
settings:
projectile:
item: default:topaz_trident
translation: 0,0,0
rotation: 1,1,1,1
display-transform: NONE
scale: 0.5
tags:
- default:topaz_tools
data:
item-name: <!i><#FF8C00><i18n:item.topaz_trident>
tooltip-style: minecraft:topaz
model:
type: minecraft:select
property: minecraft:display_context
cases:
- when:
- gui
- ground
- fixed
model:
$$>=1.21.2#armor:
default:topaz_helmet:
template: default:armor/topaz
arguments:
part: helmet
slot: head
default:topaz_chestplate:
template: default:armor/topaz
arguments:
part: chestplate
slot: chest
default:topaz_leggings:
template: default:armor/topaz
arguments:
part: leggings
slot: legs
default:topaz_boots:
template: default:armor/topaz
arguments:
part: boots
slot: feet
$$>=1.21.4#topaz_trident:
default:topaz_trident:
material: trident
custom-model-data: 1000
settings:
projectile:
item: default:topaz_trident
translation: 0,0,0
rotation: 1,1,1,1
display-transform: NONE
scale: 0.5
tags:
- default:topaz_tools
data:
item-name: <!i><#FF8C00><i18n:item.topaz_trident>
tooltip-style: minecraft:topaz
model:
type: minecraft:select
property: minecraft:display_context
cases:
- when:
- gui
- ground
- fixed
model:
type: minecraft:model
path: minecraft:item/custom/topaz_trident
generation:
parent: minecraft:item/generated
textures:
layer0: minecraft:item/custom/topaz_trident
fallback:
type: minecraft:condition
property: minecraft:using_item
on-true:
type: minecraft:model
path: minecraft:item/custom/topaz_trident
generation:
parent: minecraft:item/generated
textures:
layer0: minecraft:item/custom/topaz_trident
fallback:
path: minecraft:item/custom/topaz_trident_throwing
on-false:
type: minecraft:model
path: minecraft:item/custom/topaz_trident_in_hand
legacy-model:
path: minecraft:item/custom/topaz_trident_in_hand
overrides:
- path: minecraft:item/custom/topaz_trident_throwing
predicate:
throwing: 1
$$1.21.2~1.21.3#topaz_trident:
default:topaz_trident:
material: honey_bottle
custom-model-data: 1000
settings:
projectile:
item: default:topaz_trident
translation: 0,0,0
rotation: 1,1,1,1
display-transform: NONE
scale: 0.5
type: trident
throwing-item-in-hand: default:topaz_trident_throwing_in_hand
tags:
- default:topaz_tools
data:
item-name: <!i><#FF8C00><i18n:item.topaz_trident>
tooltip-style: minecraft:topaz
components:
minecraft:max_stack_size: 1
minecraft:consumable:
animation: spear
has_consume_particles: false
consume_seconds: 128000
minecraft:food:
nutrition: 0
saturation: 0.0
can_always_eat: true
model:
type: minecraft:model
path: minecraft:item/custom/topaz_trident_in_hand
default:topaz_trident_throwing_in_hand:
material: honey_bottle
custom-model-data: 1001
model:
type: minecraft:model
path: minecraft:item/custom/topaz_trident_throwing
$$1.20.1~1.21.1#topaz_trident:
default:topaz_trident:
material: trident
client-bound-material: bow
custom-model-data: 1001
data:
item-name: <!i><#FF8C00><i18n:item.topaz_trident>
settings:
projectile:
item: default:topaz_trident
translation: 0,0,0
rotation: 1,1,1,1
display-transform: NONE
scale: 0.5
tags:
- default:topaz_tools
model:
type: minecraft:condition
property: minecraft:using_item
on-true:
@@ -214,21 +284,22 @@ items#topaz_gears:
on-false:
type: minecraft:model
path: minecraft:item/custom/topaz_trident_in_hand
default:flame_elytra:
material: elytra
custom-model-data: 1000
settings:
equippable:
slot: chest
asset-id: flame
wings: flame_elytra
data:
item-name: <!i><#FF8C00><i18n:item.flame_elytra>
model:
template: default:model/simplified_elytra
arguments:
path: minecraft:item/custom/flame_elytra
broken_path: minecraft:item/custom/broken_flame_elytra
$$>=1.21.2#flame_elytra:
default:flame_elytra:
material: elytra
custom-model-data: 1000
settings:
equippable:
slot: chest
asset-id: flame
wings: flame_elytra
data:
item-name: <!i><#FF8C00><i18n:item.flame_elytra>
model:
template: default:model/simplified_elytra
arguments:
path: minecraft:item/custom/flame_elytra
broken_path: minecraft:item/custom/broken_flame_elytra
default:cap:
material: leather_helmet
client-bound-material: leather_horse_armor

View File

@@ -380,51 +380,37 @@ items:
model_top_left_path: minecraft:block/custom/palm_door_top_left
model_top_left_generation:
parent: minecraft:block/door_top_left
textures:
textures: &textures
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
model_top_right_path: minecraft:block/custom/palm_door_top_right
model_top_right_generation:
parent: minecraft:block/door_top_right
textures:
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
textures: *textures
model_top_left_open_path: minecraft:block/custom/palm_door_top_left_open
model_top_left_open_generation:
parent: minecraft:block/door_top_left_open
textures:
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
textures: *textures
model_top_right_open_path: minecraft:block/custom/palm_door_top_right_open
model_top_right_open_generation:
parent: minecraft:block/door_top_right_open
textures:
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
textures: *textures
model_bottom_left_path: minecraft:block/custom/palm_door_bottom_left
model_bottom_left_generation:
parent: minecraft:block/door_bottom_left
textures:
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
textures: *textures
model_bottom_right_path: minecraft:block/custom/palm_door_bottom_right
model_bottom_right_generation:
parent: minecraft:block/door_bottom_right
textures:
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
textures: *textures
model_bottom_left_open_path: minecraft:block/custom/palm_door_bottom_left_open
model_bottom_left_open_generation:
parent: minecraft:block/door_bottom_left_open
textures:
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
textures: *textures
model_bottom_right_open_path: minecraft:block/custom/palm_door_bottom_right_open
model_bottom_right_open_generation:
parent: minecraft:block/door_bottom_right_open
textures:
bottom: minecraft:block/custom/palm_door_bottom
top: minecraft:block/custom/palm_door_top
textures: *textures
default:palm_fence_gate:
material: nether_brick
custom-model-data: 1008
@@ -452,11 +438,10 @@ items:
settings:
template:
- default:sound/wood
- default:hardness/planks
overrides:
map-color: 2
instrument: bass
hardness: 2.0
resistance: 3.0
burnable: true
tags:
- minecraft:fence_gates
@@ -506,11 +491,10 @@ items:
template:
- default:sound/wood
- default:burn_data/planks
- default:hardness/planks
overrides:
map-color: 2
instrument: bass
hardness: 2.0
resistance: 3.0
tags:
- minecraft:wooden_slabs
- minecraft:slabs
@@ -522,67 +506,66 @@ items:
model_bottom_path: minecraft:block/custom/palm_slab
model_bottom_generation:
parent: minecraft:block/slab
textures:
textures: &textures
bottom: minecraft:block/custom/palm_planks
side: minecraft:block/custom/palm_planks
top: minecraft:block/custom/palm_planks
model_top_path: minecraft:block/custom/palm_slab_top
model_top_generation:
parent: minecraft:block/slab_top
textures:
bottom: minecraft:block/custom/palm_planks
side: minecraft:block/custom/palm_planks
top: minecraft:block/custom/palm_planks
textures: *textures
model_double_path: minecraft:block/custom/palm_planks
default:palm_stairs:
material: nether_brick
custom-model-data: 1013
model:
type: minecraft:model
path: minecraft:item/custom/palm_stairs
generation:
parent: minecraft:block/custom/palm_stairs
data:
item-name: <!i><i18n:item.palm_stairs>
behavior:
type: block_item
block:
loot:
template: default:loot_table/self
settings:
template:
- default:sound/wood
overrides:
map-color: 2
instrument: bass
hardness: 2.0
resistance: 3.0
burnable: true
tags:
- minecraft:mineable/axe
- minecraft:stairs
- minecraft:wooden_stairs
behaviors:
type: stairs_block
states:
template: default:block_state/stairs
arguments:
base_block: cut_copper_stairs
model_stairs_inner_path: minecraft:block/custom/palm_stairs_inner
model_stairs_inner_generation:
parent: minecraft:block/inner_stairs
textures: &textures
bottom: &block_texture minecraft:block/custom/palm_planks
side: *block_texture
top: *block_texture
model_stairs_outer_path: minecraft:block/custom/palm_stairs_outer
model_stairs_outer_generation:
parent: minecraft:block/outer_stairs
textures: *textures
model_stairs_path: minecraft:block/custom/palm_stairs
model_stairs_generation:
parent: minecraft:block/stairs
textures: *textures
$$>=1.20.3#palm_stairs:
default:palm_stairs:
material: nether_brick
custom-model-data: 1013
model:
type: minecraft:model
path: minecraft:item/custom/palm_stairs
generation:
parent: minecraft:block/custom/palm_stairs
data:
item-name: <!i><i18n:item.palm_stairs>
settings:
fuel-time: 300
behavior:
type: block_item
block:
loot:
template: default:loot_table/self
settings:
template:
- default:sound/wood
- default:hardness/planks
- default:burn_data/planks
overrides:
map-color: 2
instrument: bass
tags:
- minecraft:mineable/axe
- minecraft:stairs
- minecraft:wooden_stairs
behaviors:
type: stairs_block
states:
template: default:block_state/stairs
arguments:
base_block: cut_copper_stairs
model_stairs_inner_path: minecraft:block/custom/palm_stairs_inner
model_stairs_inner_generation:
parent: minecraft:block/inner_stairs
textures: &textures
bottom: &block_texture minecraft:block/custom/palm_planks
side: *block_texture
top: *block_texture
model_stairs_outer_path: minecraft:block/custom/palm_stairs_outer
model_stairs_outer_generation:
parent: minecraft:block/outer_stairs
textures: *textures
model_stairs_path: minecraft:block/custom/palm_stairs
model_stairs_generation:
parent: minecraft:block/stairs
textures: *textures
recipes:
default:palm_planks:
template: default:recipe/planks
@@ -626,14 +609,15 @@ recipes:
result:
id: default:palm_slab
count: 6
default:palm_stairs:
type: shaped
pattern:
- 'A '
- 'AA '
- 'AAA'
ingredients:
A: default:palm_planks
result:
id: default:palm_stairs
count: 4
$$>=1.20.3#palm_stairs:
default:palm_stairs:
type: shaped
pattern:
- 'A '
- 'AA '
- 'AAA'
ingredients:
A: default:palm_planks
result:
id: default:palm_stairs
count: 4

View File

@@ -0,0 +1,75 @@
{
"credit": "Made with Blockbench",
"textures": {
"1": "block/custom/pebble"
},
"elements": [
{
"from": [6, -1, 6],
"to": [11, 2, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 0, 6]},
"faces": {
"north": {"uv": [2.5, 0, 5, 1.5], "texture": "#1"},
"east": {"uv": [2.5, 1.5, 5, 3], "texture": "#1"},
"south": {"uv": [2.5, 3, 5, 4.5], "texture": "#1"},
"west": {"uv": [2.5, 4.5, 5, 6], "texture": "#1"},
"up": {"uv": [2.5, 2.5, 0, 0], "texture": "#1"},
"down": {"uv": [2.5, 2.5, 0, 5], "texture": "#1"}
}
},
{
"from": [4, -0.99, 5],
"to": [7, 1.01, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [4, 0, 5]},
"faces": {
"north": {"uv": [5, 1.5, 6.5, 2.5], "texture": "#1"},
"east": {"uv": [5, 2.5, 6.5, 3.5], "texture": "#1"},
"south": {"uv": [5, 3.5, 6.5, 4.5], "texture": "#1"},
"west": {"uv": [5, 4.5, 6.5, 5.5], "texture": "#1"},
"up": {"uv": [1.5, 6.5, 0, 5], "texture": "#1"},
"down": {"uv": [6.5, 0, 5, 1.5], "texture": "#1"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [45, 0, 0],
"translation": [0.5, 5, 4.75],
"scale": [0.8, 0.8, 0.8]
},
"thirdperson_lefthand": {
"rotation": [45, 0, 0],
"translation": [0.5, 5, 4.75],
"scale": [0.8, 0.8, 0.8]
},
"firstperson_righthand": {
"rotation": [0, -149, 0],
"translation": [3.25, 4.75, 0]
},
"firstperson_lefthand": {
"rotation": [0, 38, 0],
"translation": [1.75, 7, 0]
},
"ground": {
"translation": [0, 5.75, 0],
"scale": [0.85, 0.85, 0.85]
},
"gui": {
"rotation": [30, -155, 0],
"translation": [-1, 4.25, 0]
},
"fixed": {
"rotation": [-90, 0, 0],
"translation": [0, -1, -11.75],
"scale": [1.5, 1.5, 1.5]
}
},
"groups": [
{
"name": "group",
"origin": [4, 0, 5],
"color": 0,
"children": [0, 1]
}
]
}

View File

@@ -0,0 +1,90 @@
{
"credit": "Made with Blockbench",
"texture_size": [32, 32],
"textures": {
"2": "block/custom/pebble",
"particle": "block/custom/pebble"
},
"elements": [
{
"from": [4.99, -0.01, 6.99],
"to": [10.01, 4.01, 12.01],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 6]},
"faces": {
"north": {"uv": [9.5, 0, 12, 2], "texture": "#2"},
"east": {"uv": [9.5, 2, 12, 4], "texture": "#2"},
"south": {"uv": [9.5, 4, 12, 6], "texture": "#2"},
"west": {"uv": [7, 5, 9.5, 7], "texture": "#2"},
"up": {"uv": [9.5, 2.5, 7, 0], "texture": "#2"},
"down": {"uv": [9.5, 2.5, 7, 5], "texture": "#2"}
}
},
{
"from": [8, 0, 5],
"to": [12, 3, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [5, 0, 6]},
"faces": {
"north": {"uv": [14, 3, 16, 4.5], "texture": "#2"},
"east": {"uv": [7, 7, 9, 8.5], "texture": "#2"},
"south": {"uv": [14, 0, 16, 1.5], "texture": "#2"},
"west": {"uv": [14, 1.5, 16, 3], "texture": "#2"},
"up": {"uv": [14, 2, 12, 0], "texture": "#2"},
"down": {"uv": [14, 2, 12, 4], "texture": "#2"}
}
},
{
"from": [2.01, -0.99, 8.01],
"to": [4.99, 2.99, 10.99],
"rotation": {"angle": 45, "axis": "z", "origin": [3.5, 1.5, 9.5]},
"faces": {
"north": {"uv": [12, 4, 13.5, 6], "texture": "#2"},
"east": {"uv": [2.5, 6, 4, 8], "texture": "#2"},
"south": {"uv": [4, 6, 5.5, 8], "texture": "#2"},
"west": {"uv": [5.5, 6, 7, 8], "texture": "#2"},
"up": {"uv": [16, 6, 14.5, 4.5], "texture": "#2"},
"down": {"uv": [16, 6, 14.5, 7.5], "texture": "#2"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [45, 0, 0],
"translation": [0.5, 5, 4.75],
"scale": [0.8, 0.8, 0.8]
},
"thirdperson_lefthand": {
"rotation": [45, 0, 0],
"translation": [0.5, 5, 4.75],
"scale": [0.8, 0.8, 0.8]
},
"firstperson_righthand": {
"rotation": [0, 38, 0],
"translation": [1.75, 7, 0]
},
"firstperson_lefthand": {
"rotation": [0, 38, 0],
"translation": [1.75, 7, 0]
},
"ground": {
"translation": [0, 5.75, 0],
"scale": [0.85, 0.85, 0.85]
},
"gui": {
"rotation": [25, 144, 0],
"translation": [-0.5, 4.75, 0]
},
"fixed": {
"rotation": [-90, 0, 0],
"translation": [0, -1, -11.75],
"scale": [1.5, 1.5, 1.5]
}
},
"groups": [
{
"name": "group",
"origin": [8, 8, 8],
"color": 0,
"children": [0, 1, 2]
}
]
}

View File

@@ -0,0 +1,90 @@
{
"credit": "Made with Blockbench",
"texture_size": [32, 32],
"textures": {
"2": "block/custom/pebble",
"particle": "block/custom/pebble"
},
"elements": [
{
"from": [3, 0, 6],
"to": [9, 8, 12],
"rotation": {"angle": 22.5, "axis": "z", "origin": [7, 3.5, 9]},
"faces": {
"north": {"uv": [0, 8, 3, 12], "texture": "#2"},
"east": {"uv": [3, 8, 6, 12], "texture": "#2"},
"south": {"uv": [0, 12, 3, 16], "texture": "#2"},
"west": {"uv": [3, 12, 6, 16], "texture": "#2"},
"up": {"uv": [9, 13, 6, 10], "texture": "#2"},
"down": {"uv": [9, 13, 6, 16], "texture": "#2"}
}
},
{
"from": [7, 0, 4],
"to": [12, 4, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [-1, 0, 1]},
"faces": {
"north": {"uv": [9, 11.5, 11.5, 13.5], "texture": "#2"},
"east": {"uv": [11.5, 10, 14, 12], "texture": "#2"},
"south": {"uv": [11.5, 12, 14, 14], "texture": "#2"},
"west": {"uv": [11.5, 14, 14, 16], "texture": "#2"},
"up": {"uv": [11.5, 16, 9, 13.5], "texture": "#2"},
"down": {"uv": [11.5, 9, 9, 11.5], "texture": "#2"}
}
},
{
"from": [6, 0, 9],
"to": [11, 2, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 1]},
"faces": {
"north": {"uv": [15, 13.5, 16, 16], "rotation": 90, "texture": "#2"},
"east": {"uv": [6.5, 9, 9, 10], "texture": "#2"},
"south": {"uv": [11.5, 9, 14, 10], "texture": "#2"},
"west": {"uv": [15, 16, 14, 13.5], "rotation": 90, "texture": "#2"},
"up": {"uv": [12, 9, 9.5, 6.5], "texture": "#2"},
"down": {"uv": [14.5, 6.5, 12, 9], "texture": "#2"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [45, 0, 0],
"translation": [0.5, 5, 4.75],
"scale": [0.8, 0.8, 0.8]
},
"thirdperson_lefthand": {
"rotation": [45, 0, 0],
"translation": [0.5, 5, 4.75],
"scale": [0.8, 0.8, 0.8]
},
"firstperson_righthand": {
"rotation": [0, -149, 0],
"translation": [3.25, 4.75, 0]
},
"firstperson_lefthand": {
"rotation": [0, 38, 0],
"translation": [1.75, 7, 0]
},
"ground": {
"translation": [0, 5.75, 0],
"scale": [0.85, 0.85, 0.85]
},
"gui": {
"rotation": [30, -155, 0],
"translation": [-1, 4.25, 0]
},
"fixed": {
"rotation": [-90, 0, 0],
"translation": [0, -1, -11.75],
"scale": [1.5, 1.5, 1.5]
}
},
"groups": [
{
"name": "group",
"origin": [8, 8, 8],
"color": 0,
"children": [0, 1, 2]
}
]
}

View File

@@ -6,5 +6,5 @@ import java.util.Optional;
public interface ProjectileManager extends Manageable {
Optional<CustomProjectile> projectileByEntityId(int entityId);
Optional<? extends CustomProjectile> projectileByEntityId(int entityId);
}

View File

@@ -17,7 +17,7 @@ public class LegacyOverridesModel implements Comparable<LegacyOverridesModel> {
this.predicate = predicate == null ? new HashMap<>() : predicate;
this.model = model;
this.customModelData = customModelData;
if (customModelData > 0) {
if (customModelData > 0 && !this.predicate.containsKey("custom_model_data")) {
this.predicate.put("custom_model_data", customModelData);
}
}

View File

@@ -139,6 +139,7 @@ public class StringKeyConstructor extends SafeConstructor {
}
private void logWarning(String keyInLocale, String configKey, Node node) {
if (this.path == null) return;
TranslationManager.instance().log("warning.config.yaml." + keyInLocale,
this.path.toAbsolutePath().toString(),
configKey,

View File

@@ -20,10 +20,10 @@ public final class CommonFunctions {
public static final Key UPDATE_INTERACTION_TICK = Key.of("craftengine:update_interaction_tick");
public static final Key SET_COUNT = Key.of("craftengine:set_count");
public static final Key PLACE_BLOCK = Key.of("craftengine:place_block");
public static final Key SET_FOOD = Key.of("craftengine:food");
public static final Key SET_FOOD = Key.of("craftengine:set_food");
public static final Key SET_COOLDOWN = Key.of("craftengine:set_cooldown");
public static final Key REMOVE_COOLDOWN = Key.of("craftengine:remove_cooldown");
public static final Key SET_SATURATION = Key.of("craftengine:saturation");
public static final Key SET_SATURATION = Key.of("craftengine:set_saturation");
public static final Key DROP_LOOT = Key.of("craftengine:drop_loot");
public static final Key SWING_HAND = Key.of("craftengine:swing_hand");
public static final Key LEVELER_EXP = Key.of("craftengine:leveler_exp");

View File

@@ -247,7 +247,6 @@ public class ItemBrowserManagerImpl implements ItemBrowserManager {
Item<?> item = this.plugin.itemManager().createWrappedItem(subCategory.icon(), player);
if (item == null) {
if (!subCategory.icon().equals(ItemKeys.AIR)) {
this.plugin.logger().warn("Can't find item " + subCategory.icon() + " as icon for sub category " + subCategoryId);
item = this.plugin.itemManager().createWrappedItem(ItemKeys.BARRIER, player);
item.customNameJson(AdventureHelper.componentToJson(AdventureHelper.miniMessage().deserialize(subCategory.displayName(), ItemBuildContext.EMPTY.tagResolvers())));
item.loreJson(subCategory.displayLore().stream().map(lore -> AdventureHelper.componentToJson(AdventureHelper.miniMessage().deserialize(lore, ItemBuildContext.EMPTY.tagResolvers()))).toList());
@@ -269,7 +268,6 @@ public class ItemBrowserManagerImpl implements ItemBrowserManager {
boolean canGoFurther;
if (item == null) {
if (!itemId.equals(ItemKeys.AIR)) {
this.plugin.logger().warn("Can't find item " + itemId + " for category " + categoryId);
item = this.plugin.itemManager().createWrappedItem(ItemKeys.BARRIER, player);
item.customNameJson(AdventureHelper.componentToJson(Component.text(it).decoration(TextDecoration.ITALIC, TextDecoration.State.FALSE).color(NamedTextColor.RED)));
}