Make converted worms immediately targetable before their first entity tick
This commit is contained in:
parent
a4366107c7
commit
ebd17867be
1 changed files with 2 additions and 2 deletions
|
|
@ -18,7 +18,7 @@ public final class WormTransportProbe extends JavaPlugin implements Listener {
|
|||
World world=Bukkit.getWorlds().getFirst();Location at=world.getSpawnLocation().clone().add(2,2,0);NamespacedKey wild=new NamespacedKey("dunerealms","sandworm");
|
||||
transport=new WormTransport(this,wild,new NamespacedKey(this,"sandworm_model"));UUID owner=UUID.randomUUID();Sniffer body=world.spawn(at,Sniffer.class,e->e.getPersistentDataContainer().set(wild,PersistentDataType.BYTE,(byte)1));
|
||||
HappyGhast pet=transport.convert(body,owner);check(pet!=null&&body.isDead()&&deaths==1,"Conversion must use one native death event");check(owner.toString().equals(pet.getPersistentDataContainer().get(WormTransport.OWNER,PersistentDataType.STRING)),"Owner not retained");check(pet.getEquipment().getItem(EquipmentSlot.BODY).getType()==Material.BROWN_HARNESS,"Native harness absent");check(pet.getAttribute(Attribute.SCALE).getBaseValue()==.5&&pet.getAttribute(Attribute.MAX_HEALTH).getBaseValue()==250,"Wrong half-size native carrier");transport.tick();
|
||||
var boxes=world.getEntitiesByClass(Slime.class).stream().filter(e->e.getPersistentDataContainer().has(WormHitboxes.TARGET,PersistentDataType.STRING)).toList();check(boxes.size()==15,"Missing full body damage boxes");check(boxes.stream().allMatch(e->WormHitboxes.target(e)==pet),"Damage target mismatch");
|
||||
var boxes=world.getEntitiesByClass(Slime.class).stream().filter(e->pet.getUniqueId().toString().equals(e.getPersistentDataContainer().get(WormHitboxes.TARGET,PersistentDataType.STRING))).toList();check(boxes.size()==15,"Missing full body damage boxes: "+boxes.size());check(boxes.stream().allMatch(e->WormHitboxes.target(e)==pet),"Damage target mismatch");
|
||||
double health=pet.getHealth();boxes.getFirst().damage(3,world.spawn(at,Cow.class));check(pet.getHealth()<health,"Body hit did not reach native health pool");
|
||||
var config=Files.readString(Path.of("plugins/ExecutableCrafting/recipes/contaminated_spice_block.yml"));var json=com.google.gson.JsonParser.parseString(config).getAsJsonObject();for(var e:json.entrySet())if(e.getKey().startsWith("input")||e.getKey().equals("result"))check(!Bukkit.getItemFactory().createItemStack(e.getValue().getAsString()).isEmpty(),"Invalid native recipe command");
|
||||
transport.close();check(world.getEntitiesByClass(Slime.class).stream().noneMatch(e->e.getPersistentDataContainer().has(WormHitboxes.TARGET,PersistentDataType.STRING)),"Damage proxy leaked on disable");
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff