Skip to content

Commit 013de39

Browse files
committed
feat: add new DTOs for versions from 1.19
1 parent 784094c commit 013de39

7,748 files changed

Lines changed: 148844 additions & 23643 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"Bash(npm run:*)",
2121
"Bash(xargs -I {} sh -c 'echo \"\"\"\"=== {} ===\"\"\"\" && head -30 {}')",
2222
"Bash(jar -tf:*)",
23-
"Bash(javap:*)"
23+
"Bash(javap:*)",
24+
"Bash(git log:*)",
25+
"Bash(git checkout tags/v1.20.0-0)"
2426
],
2527
"deny": [],
2628
"ask": []

adapter-easecation/src/main/java/net/easecation/bridge/adapter/easecation/EasecationRegistry.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ private CompoundTag buildBlockNBT(BlockDef blockDef, int runtimeId) {
383383
CompoundTag menuCategory = new CompoundTag();
384384
var mc = blockDef.description().menuCategory();
385385

386-
menuCategory.putString("category", mc.category() != null ? mc.category().toString() : "none");
386+
menuCategory.putString("category", mc.category() != null ? mc.category() : "none");
387387
if (mc.group() != null) {
388388
menuCategory.putString("group", mc.group());
389389
}

adapter-easecation/src/main/java/net/easecation/bridge/adapter/easecation/block/BlockComponentsNBT.java

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import cn.nukkit.nbt.tag.CompoundTag;
44
import cn.nukkit.nbt.tag.ListTag;
55
import cn.nukkit.nbt.tag.StringTag;
6-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.*;
6+
import net.easecation.bridge.core.dto.block.v1_21_60.*;
77

88
import java.util.List;
99
import java.util.Map;
@@ -150,15 +150,15 @@ public static CompoundTag toNBT(Component component, boolean override) {
150150
}
151151

152152
// Destruction Particles
153-
if (component.minecraft_destructionParticles() != null) {
154-
tag.putCompound("minecraft:destruction_particles",
155-
convertDestructionParticles(component.minecraft_destructionParticles()));
156-
}
153+
// Note: minecraft:destruction_particles not in v1_21_60 schema
154+
// if (component.minecraft_destructionParticles() != null) {
155+
// tag.putCompound("minecraft:destruction_particles",
156+
// convertDestructionParticles(component.minecraft_destructionParticles()));
157+
// }
157158

158159
// Replaceable
159-
if (component.minecraft_replaceable() != null) {
160-
tag.putCompound("minecraft:replaceable", new CompoundTag());
161-
}
160+
// Note: minecraft:replaceable component was removed from v1_21_60 schema
161+
// This component is no longer supported in the latest version
162162

163163
// Item Visual
164164
if (component.minecraft_itemVisual() != null) {
@@ -480,15 +480,11 @@ private static CompoundTag convertMaterialInstances(Map<String, MaterialInstance
480480
// Texture: default empty string
481481
material.putString("texture", variant1.texture() != null ? variant1.texture() : "");
482482

483-
// Tint Method: convert enum to string, default "none"
484-
if (variant1.tintMethod() != null) {
485-
material.putString("tint_method", variant1.tintMethod().toString());
486-
} else {
487-
material.putString("tint_method", "none");
488-
}
483+
// Tint Method: 使用默认值(behavior schema 中不包含此字段)
484+
material.putString("tint_method", "none");
489485

490-
// Isotropic: default false
491-
material.putBoolean("isotropic", variant1.isotropic() != null ? variant1.isotropic() : false);
486+
// Isotropic: 使用默认值(behavior schema 中不包含此字段)
487+
material.putBoolean("isotropic", false);
492488
}
493489

494490
materials.put(faceName, material);
@@ -746,18 +742,19 @@ private static CompoundTag convertLiquidDetection(LiquidDetection detection) {
746742
return result;
747743
}
748744

749-
private static CompoundTag convertDestructionParticles(DestructionParticles particles) {
750-
CompoundTag result = new CompoundTag();
751-
if (particles.texture() != null) {
752-
result.putString("texture", particles.texture());
753-
}
754-
if (particles.tintMethod() != null) {
755-
result.putString("tint_method", particles.tintMethod().toString());
756-
}
757-
// Note: particle_count is not in the v1_21_60 schema, using default
758-
result.putInt("particle_count", 100);
759-
return result;
760-
}
745+
// Note: DestructionParticles class not in v1_21_60 schema
746+
// private static CompoundTag convertDestructionParticles(DestructionParticles particles) {
747+
// CompoundTag result = new CompoundTag();
748+
// if (particles.texture() != null) {
749+
// result.putString("texture", particles.texture());
750+
// }
751+
// if (particles.tintMethod() != null) {
752+
// result.putString("tint_method", particles.tintMethod().toString());
753+
// }
754+
// // Note: particle_count is not in the v1_21_60 schema, using default
755+
// result.putInt("particle_count", 100);
756+
// return result;
757+
// }
761758

762759
/**
763760
* Convert ItemVisual to NBT.

adapter-easecation/src/main/java/net/easecation/bridge/adapter/easecation/block/BlockDataDriven.java

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import cn.nukkit.math.AxisAlignedBB;
77
import cn.nukkit.math.SimpleAxisAlignedBB;
88
import net.easecation.bridge.core.BlockDef;
9-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Component;
10-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Geometry;
11-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.CollisionBox;
12-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.StatesValue;
9+
import net.easecation.bridge.core.dto.block.v1_21_60.Component;
10+
import net.easecation.bridge.core.dto.block.v1_21_60.Geometry;
11+
import net.easecation.bridge.core.dto.block.v1_21_60.CollisionBox;
12+
import net.easecation.bridge.core.dto.block.v1_21_60.StatesValue;
1313

1414
import java.util.List;
1515
import java.util.Map;
@@ -213,10 +213,10 @@ private SimpleAxisAlignedBB extractCollisionBox(Component comp) {
213213
var collisionBox = comp.minecraft_collisionBox();
214214

215215
// CollisionBox is a sealed interface with variants
216-
if (collisionBox instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.CollisionBox.CollisionBox_Variant0 variant0) {
216+
if (collisionBox instanceof net.easecation.bridge.core.dto.block.v1_21_60.CollisionBox.CollisionBox_Variant0 variant0) {
217217
// Boolean value: true = default cube, false = no collision
218218
return variant0.value() ? CUBE : null;
219-
} else if (collisionBox instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.CollisionBox.CollisionBox_Variant1 variant1) {
219+
} else if (collisionBox instanceof net.easecation.bridge.core.dto.block.v1_21_60.CollisionBox.CollisionBox_Variant1 variant1) {
220220
// Detailed config with origin and size
221221
// Origin is specified as [x, y, z] in range (-8, 0, -8) to (8, 16, 8)
222222
// Size is specified as [x, y, z]
@@ -264,10 +264,10 @@ private float extractHardness(Component comp) {
264264
if (comp.minecraft_destructibleByMining() != null) {
265265
var destructible = comp.minecraft_destructibleByMining();
266266
// DestructibleByMining is a sealed interface with variants
267-
if (destructible instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.DestructibleByMining.DestructibleByMining_Variant0 variant0) {
267+
if (destructible instanceof net.easecation.bridge.core.dto.block.v1_21_60.DestructibleByMining.DestructibleByMining_Variant0 variant0) {
268268
// Boolean value: true = default hardness, false = unbreakable
269269
return variant0.value() ? 1.0f : -1.0f;
270-
} else if (destructible instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.DestructibleByMining.DestructibleByMining_Variant1 variant1) {
270+
} else if (destructible instanceof net.easecation.bridge.core.dto.block.v1_21_60.DestructibleByMining.DestructibleByMining_Variant1 variant1) {
271271
// Detailed config with seconds_to_destroy
272272
if (variant1.secondsToDestroy() != null) {
273273
return variant1.secondsToDestroy().floatValue();
@@ -281,10 +281,10 @@ private float extractResistance(Component comp, float hardness) {
281281
if (comp.minecraft_destructibleByExplosion() != null) {
282282
var explosion = comp.minecraft_destructibleByExplosion();
283283
// DestructibleByExplosion is a sealed interface with variants
284-
if (explosion instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.DestructibleByExplosion.DestructibleByExplosion_Variant0 variant0) {
284+
if (explosion instanceof net.easecation.bridge.core.dto.block.v1_21_60.DestructibleByExplosion.DestructibleByExplosion_Variant0 variant0) {
285285
// Boolean value: true = default resistance, false = immune
286286
return variant0.value() ? hardness * 5.0f : Float.MAX_VALUE;
287-
} else if (explosion instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.DestructibleByExplosion.DestructibleByExplosion_Variant1 variant1) {
287+
} else if (explosion instanceof net.easecation.bridge.core.dto.block.v1_21_60.DestructibleByExplosion.DestructibleByExplosion_Variant1 variant1) {
288288
// Detailed config with explosion_resistance
289289
if (variant1.explosionResistance() != null) {
290290
return variant1.explosionResistance().floatValue();
@@ -328,9 +328,9 @@ private SimpleAxisAlignedBB extractSelectionBox(Component comp, SimpleAxisAligne
328328
}
329329

330330
var selectionBox = comp.minecraft_selectionBox();
331-
if (selectionBox instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.SelectionBox.SelectionBox_Variant0 variant0) {
331+
if (selectionBox instanceof net.easecation.bridge.core.dto.block.v1_21_60.SelectionBox.SelectionBox_Variant0 variant0) {
332332
return variant0.value() ? CUBE : null;
333-
} else if (selectionBox instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.SelectionBox.SelectionBox_Variant1 variant1) {
333+
} else if (selectionBox instanceof net.easecation.bridge.core.dto.block.v1_21_60.SelectionBox.SelectionBox_Variant1 variant1) {
334334
float[] origin = new float[]{-8, 0, -8};
335335
float[] size = new float[]{16, 16, 16};
336336

@@ -375,18 +375,20 @@ private boolean extractSolid(Component comp) {
375375
}
376376

377377
private boolean extractReplaceable(Component comp) {
378-
return comp.minecraft_replaceable() != null;
378+
// Note: minecraft:replaceable component was removed from v1_21_60 schema
379+
// Replaceable blocks should be identified through other means
380+
return false;
379381
}
380382

381383
private int extractFlameOdds(Component comp) {
382384
if (comp.minecraft_flammable() != null) {
383385
var flammable = comp.minecraft_flammable();
384-
if (flammable instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Flammable.Flammable_Variant1 variant1) {
386+
if (flammable instanceof net.easecation.bridge.core.dto.block.v1_21_60.Flammable.Flammable_Variant1 variant1) {
385387
if (variant1.catchChanceModifier() != null) {
386388
return variant1.catchChanceModifier().intValue();
387389
}
388390
return 5; // Default catch chance
389-
} else if (flammable instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Flammable.Flammable_Variant0 variant0) {
391+
} else if (flammable instanceof net.easecation.bridge.core.dto.block.v1_21_60.Flammable.Flammable_Variant0 variant0) {
390392
return variant0.value() ? 5 : 0;
391393
}
392394
}
@@ -396,12 +398,12 @@ private int extractFlameOdds(Component comp) {
396398
private int extractBurnOdds(Component comp) {
397399
if (comp.minecraft_flammable() != null) {
398400
var flammable = comp.minecraft_flammable();
399-
if (flammable instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Flammable.Flammable_Variant1 variant1) {
401+
if (flammable instanceof net.easecation.bridge.core.dto.block.v1_21_60.Flammable.Flammable_Variant1 variant1) {
400402
if (variant1.destroyChanceModifier() != null) {
401403
return variant1.destroyChanceModifier().intValue();
402404
}
403405
return 20; // Default destroy chance
404-
} else if (flammable instanceof net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Flammable.Flammable_Variant0 variant0) {
406+
} else if (flammable instanceof net.easecation.bridge.core.dto.block.v1_21_60.Flammable.Flammable_Variant0 variant0) {
405407
return variant0.value() ? 20 : 0;
406408
}
407409
}
@@ -429,7 +431,7 @@ private int extractAllowedPlacementFaces(Component comp) {
429431
return 0b111111; // Default: all faces
430432
}
431433

432-
private boolean[] extractTraitStates(net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Traits traits) {
434+
private boolean[] extractTraitStates(net.easecation.bridge.core.dto.block.v1_21_60.Traits traits) {
433435
// Returns: [cardinalDirection, facingDirection, blockFace, verticalHalf, cardinalConnections]
434436
boolean[] states = new boolean[5];
435437
if (traits == null) {

adapter-easecation/src/main/java/net/easecation/bridge/adapter/easecation/block/BlockPermutationNBT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import cn.nukkit.nbt.tag.ListTag;
55
import com.fasterxml.jackson.core.type.TypeReference;
66
import com.fasterxml.jackson.databind.ObjectMapper;
7-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Component;
7+
import net.easecation.bridge.core.dto.block.v1_21_60.Component;
88

99
import java.util.List;
1010
import java.util.Map;

adapter-easecation/src/main/java/net/easecation/bridge/adapter/easecation/block/BlockStatesNBT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import cn.nukkit.nbt.tag.IntTag;
55
import cn.nukkit.nbt.tag.ListTag;
66
import cn.nukkit.nbt.tag.StringTag;
7-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.StatesValue;
7+
import net.easecation.bridge.core.dto.block.v1_21_60.StatesValue;
88

99
import java.util.ArrayList;
1010
import java.util.List;

adapter-easecation/src/main/java/net/easecation/bridge/adapter/easecation/block/BlockTraitsNBT.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
import cn.nukkit.nbt.tag.CompoundTag;
44
import cn.nukkit.nbt.tag.ListTag;
5-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Connection;
6-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.PlacementDirection;
7-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.PlacementPosition;
8-
import net.easecation.bridge.core.dto.v1_21_60.behavior.blocks.Traits;
5+
import net.easecation.bridge.core.dto.block.v1_21_60.PlacementDirection;
6+
import net.easecation.bridge.core.dto.block.v1_21_60.PlacementPosition;
7+
import net.easecation.bridge.core.dto.block.v1_21_60.Traits;
98

109
/**
1110
* Utility class for converting Traits DTO to NBT format.

adapter-easecation/src/main/java/net/easecation/bridge/adapter/easecation/entity/EntityDataDriven.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@
99
import cn.nukkit.level.format.FullChunk;
1010
import cn.nukkit.nbt.tag.CompoundTag;
1111
import cn.nukkit.network.protocol.AddEntityPacket;
12-
import cn.nukkit.network.protocol.ProtocolInfo;
1312
import cn.nukkit.network.protocol.UpdateAttributesPacket;
14-
import net.easecation.bridge.core.dto.v1_21_60.behavior.entities.Components;
15-
import net.easecation.bridge.core.dto.v1_21_60.behavior.entities.Range_a_B_;
13+
import net.easecation.bridge.core.dto.entity.v1_21_60.Components;
14+
import net.easecation.bridge.core.dto.entity.v1_21_60.Range_a_B;
1615

1716
import java.util.Map;
1817
import java.util.concurrent.ConcurrentHashMap;
1918

2019
/**
2120
* Data-driven custom entity implementation for EaseCation Nukkit.
22-
* Based on ECProEntity's EntityDataDriven implementation.
21+
* Uses the LATEST version (v1_21_60) - old versions will be auto-upgraded before registration.
2322
*/
2423
public class EntityDataDriven extends EntityCreature {
2524

@@ -196,16 +195,16 @@ private void initComponents() {
196195
}
197196

198197
/**
199-
* Extract a numeric value from Range_a_B_ sealed interface.
198+
* Extract a numeric value from Range_a_B sealed interface.
200199
*/
201-
private Double extractRangeValue(Range_a_B_ range) {
200+
private Double extractRangeValue(Range_a_B range) {
202201
if (range == null) {
203202
return null;
204203
}
205204

206-
if (range instanceof Range_a_B_.Range_a_B__Variant0 variant0) {
205+
if (range instanceof Range_a_B.Range_a_BVariant0 variant0) {
207206
return variant0.value();
208-
} else if (range instanceof Range_a_B_.Range_a_B__Variant2 variant2) {
207+
} else if (range instanceof Range_a_B.Range_a_BVariant2 variant2) {
209208
// For range, use min value
210209
if (variant2.rangeMin() != null) {
211210
return variant2.rangeMin();

0 commit comments

Comments
 (0)