Preserve Arrakis menu cameras and support modern rabbit texture atlases
This commit is contained in:
parent
63a674f0eb
commit
8fcd1e339a
9 changed files with 37 additions and 8 deletions
|
|
@ -1,6 +1,6 @@
|
|||
plugins { java }
|
||||
group = "com.dunerealms"
|
||||
version = "1.1.22"
|
||||
version = "1.1.23"
|
||||
repositories { mavenCentral(); maven("https://repo.papermc.io/repository/maven-public/"); maven("https://repo.opencollab.dev/main/") }
|
||||
dependencies {
|
||||
compileOnly("io.papermc.paper:paper-api:1.21.8-R0.1-SNAPSHOT")
|
||||
|
|
|
|||
|
|
@ -30,3 +30,20 @@ Approved release pack hashes (SHA-256):
|
|||
Rebuilding with another ZIP implementation may change compression bytes.
|
||||
Publish an immutable version and update both SHA-1 pins in EcologyArtwork
|
||||
when rebuilding; never replace a public ZIP under an existing pinned URL.
|
||||
|
||||
### Modern-client correction (2026-11-23)
|
||||
|
||||
Minecraft 26.x resolves rabbits as `rabbit/rabbit_gold.png` (adult 64×64)
|
||||
and `rabbit/rabbit_gold_baby.png` (baby 32×32), rather than the legacy
|
||||
`rabbit/gold.png` atlas. Creatures v2 includes both native layouts and every
|
||||
rabbit variant. The modern atlases preserve the native UV islands and use a
|
||||
darker ochre/cream palette; geometry remains the native rabbit model.
|
||||
The separately pinned item pack remains v1.
|
||||
|
||||
Creatures v2 deployed SHA-1: `1ca3b97ecd2882f5277c3d2b42b0ec18d13ed2cf`.
|
||||
SHA-256: `1f9a7462cd380d5830ff42297ed0deb7d56854d4c3d82186e3560c925f48f82c`.
|
||||
As before, alternate ZIP implementations produce different archive hashes.
|
||||
|
||||
The Arrakis wildlife filter must preserve non-Mob living entities: MCGUI's
|
||||
Mannequin camera and ArmorStand seat are presentation entities, not wildlife.
|
||||
Its load-time cleanup previously removed these one tick after opening a view.
|
||||
|
|
|
|||
BIN
DuneRealmsGUI/ecology/jerboa_baby.png
Normal file
BIN
DuneRealmsGUI/ecology/jerboa_baby.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 451 B |
BIN
DuneRealmsGUI/ecology/jerboa_modern.png
Normal file
BIN
DuneRealmsGUI/ecology/jerboa_modern.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 705 B |
|
|
@ -24,7 +24,7 @@ final class EcologyArtwork implements Listener {
|
|||
// Resource packs survive proxy transfers. Remove this exact layer on every
|
||||
// other planet; never clear the GUI, MCGUI or carried-item packs.
|
||||
if(!player.getWorld().getName().equalsIgnoreCase("arrakis")){player.removeResourcePack(CREATURES);return;}
|
||||
player.addResourcePack(CREATURES,"https://www.dunerealms.com/downloads/DuneRealms-Arrakis-Creatures-v1.zip",HexFormat.of().parseHex("2e2fee75f75fe03e660df8889ddc8e60362e4831"),"Arrakis Jerboa and worm-pet skins",false);
|
||||
player.addResourcePack(CREATURES,"https://www.dunerealms.com/downloads/DuneRealms-Arrakis-Creatures-v2.zip",HexFormat.of().parseHex("1ca3b97ecd2882f5277c3d2b42b0ec18d13ed2cf"),"Arrakis Jerboa and worm-pet skins",false);
|
||||
}
|
||||
@EventHandler public void world(PlayerChangedWorldEvent event){creatures(event.getPlayer());}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
name: DunerealmsGUI
|
||||
main: com.dunerealms.gui.DuneGUI
|
||||
version: 1.1.22
|
||||
version: 1.1.23
|
||||
api-version: '1.21.8'
|
||||
depend: [JarvisTranslator]
|
||||
softdepend: [MCGUI, DecentHolograms, DuneLobby, DuneCore, DuneEss, DuneNPC, Vault, floodgate, ViaVersion]
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public final class ArrakisEcology implements Listener {
|
|||
private static boolean arrakis(Entity e){return e.getWorld().getName().equalsIgnoreCase("arrakis");}
|
||||
private static boolean pet(Entity e){return e instanceof Wolf&&e.getPersistentDataContainer().has(PET,PersistentDataType.BYTE);}
|
||||
private static String itemId(ItemStack stack){return stack==null||!stack.hasItemMeta()?null:stack.getItemMeta().getPersistentDataContainer().get(EI,PersistentDataType.STRING);}
|
||||
private static boolean protectedMob(LivingEntity e){return pet(e)||e.customName()!=null||e.hasMetadata("NPC")||!e.getPersistentDataContainer().getKeys().isEmpty()||e instanceof Tameable t&&t.isTamed();}
|
||||
private static boolean protectedMob(LivingEntity e){return !(e instanceof Mob)||pet(e)||e.customName()!=null||e.hasMetadata("NPC")||!e.getPersistentDataContainer().getKeys().isEmpty()||e instanceof Tameable t&&t.isTamed();}
|
||||
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void spawning(CreatureSpawnEvent event){
|
||||
var e=event.getEntity();if(!arrakis(e))return;
|
||||
if(e instanceof Rabbit rabbit){rabbit.customName(Component.text("Jerboa",NamedTextColor.YELLOW));rabbit.setRabbitType(Rabbit.Type.GOLD);return;}
|
||||
|
|
@ -83,4 +83,4 @@ public final class ArrakisEcology implements Listener {
|
|||
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void cook(BlockCookEvent event){if(!event.getBlock().getWorld().getName().equalsIgnoreCase("arrakis")||!"jerboa_raw_meat".equals(itemId(event.getSource())))return;try{event.setResult(items.build("jerboa_cooked_meat"));}catch(ReflectiveOperationException failure){event.setCancelled(true);plugin.getLogger().warning("Jerboa cooking definition unavailable; input retained");}}
|
||||
private static ItemStack item(String id)throws ReflectiveOperationException{var score=Bukkit.getPluginManager().getPlugin("SCore");if(score==null||!score.isEnabled())throw new ReflectiveOperationException("Native item engine unavailable");var loader=score.getClass().getClassLoader();var api=loader.loadClass("com.ssomar.score.api.executableitems.ExecutableItemsAPI");var manager=api.getMethod("getExecutableItemsManager").invoke(null);var managerAPI=loader.loadClass("com.ssomar.score.api.executableitems.config.ExecutableItemsManagerInterface");var definition=(Optional<?>)managerAPI.getMethod("getExecutableItem",String.class).invoke(manager,id);if(definition.isEmpty())throw new ReflectiveOperationException("Missing native item definition");var itemAPI=loader.loadClass("com.ssomar.score.api.executableitems.config.ExecutableItemInterface");return (ItemStack)itemAPI.getMethod("buildItem",int.class,Optional.class,Optional.class).invoke(definition.get(),1,Optional.empty(),Optional.empty());}
|
||||
@EventHandler public void disable(PluginDisableEvent event){if(event.getPlugin()!=plugin)return;INSTANCES.remove(plugin);for(var world:Bukkit.getWorlds())for(var wolf:world.getEntitiesByClass(Wolf.class))if(pet(wolf)){modifier(wolf,Attribute.ATTACK_DAMAGE,DAMAGE,false);modifier(wolf,Attribute.MAX_HEALTH,HEALTH,false);wolf.setHealth(Math.min(wolf.getHealth(),wolf.getAttribute(Attribute.MAX_HEALTH).getValue()));}}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,16 @@ import org.bukkit.plugin.Plugin;
|
|||
|
||||
class ArrakisEcologyTest {
|
||||
private <T extends LivingEntity>T entity(Class<T> kind,String worldName){T e=mock(kind);World world=mock(World.class);when(world.getName()).thenReturn(worldName);when(e.getWorld()).thenReturn(world);var pdc=mock(PersistentDataContainer.class);when(e.getPersistentDataContainer()).thenReturn(pdc);when(pdc.getKeys()).thenReturn(Set.of());return e;}
|
||||
@Test void menuCameraAndSeatAreNotWildlife()throws Exception {
|
||||
var protectedMob=ArrakisEcology.class.getDeclaredMethod("protectedMob",LivingEntity.class);protectedMob.setAccessible(true);
|
||||
// MCGUI uses an ArmorStand seat and a non-Mob LivingEntity camera (Mannequin on newer Paper).
|
||||
assertEquals(true,protectedMob.invoke(null,entity(ArmorStand.class,"arrakis")));
|
||||
assertEquals(true,protectedMob.invoke(null,entity(LivingEntity.class,"arrakis")));
|
||||
assertEquals(false,protectedMob.invoke(null,entity(Zombie.class,"arrakis")));
|
||||
}
|
||||
@Test void ordinaryNaturalMobsAreBlockedOnlyOnArrakis(){var feature=new ArrakisEcology(mock(Plugin.class),id->{throw new AssertionError();},()->0);var desert=new CreatureSpawnEvent(entity(Zombie.class,"arrakis"),CreatureSpawnEvent.SpawnReason.NATURAL);feature.spawning(desert);assertTrue(desert.isCancelled());var other=new CreatureSpawnEvent(entity(Zombie.class,"caladan"),CreatureSpawnEvent.SpawnReason.NATURAL);feature.spawning(other);assertFalse(other.isCancelled());}
|
||||
@Test void customSpawnedRaidersAndTaggedCreaturesSurvive(){var feature=new ArrakisEcology(mock(Plugin.class),id->{throw new AssertionError();},()->0);var custom=new CreatureSpawnEvent(entity(Zombie.class,"arrakis"),CreatureSpawnEvent.SpawnReason.CUSTOM);feature.spawning(custom);assertFalse(custom.isCancelled());var tagged=entity(Zombie.class,"arrakis");when(tagged.getPersistentDataContainer().getKeys()).thenReturn(Set.of(new NamespacedKey("dunerealms","raider")));var event=new CreatureSpawnEvent(tagged,CreatureSpawnEvent.SpawnReason.NATURAL);feature.spawning(event);assertFalse(event.isCancelled());}
|
||||
@Test void fireDeathsUseCookedDefinitionAndWaterRollIsExactlyTwentyPercent(){for(boolean burning:new boolean[]{false,true})for(double roll:new double[]{.19999,.2}){var animal=entity(Rabbit.class,"arrakis");when(animal.getFireTicks()).thenReturn(burning?20:0);var meat=mock(ItemStack.class);var hide=mock(ItemStack.class);var vial=mock(ItemStack.class);var requested=new ArrayList<String>();var feature=new ArrakisEcology(mock(Plugin.class),id->{requested.add(id);return id.equals("jerboa_hide")?hide:id.equals("jerboa_water_vial")?vial:meat;},()->roll);var event=new EntityDeathEvent(animal,mock(org.bukkit.damage.DamageSource.class),new ArrayList<>());feature.death(event);assertEquals(burning?"jerboa_cooked_meat":"jerboa_raw_meat",requested.getFirst());assertEquals(roll<.2?List.of(meat,hide,vial):List.of(meat,hide),event.getDrops());}}
|
||||
@Test void suffocationImmunityDoesNotDependOnWater(){var wolf=entity(Wolf.class,"arrakis");when(wolf.getPersistentDataContainer().has(new NamespacedKey("dunerealms","tiny_worm_pet"),PersistentDataType.BYTE)).thenReturn(true);var feature=new ArrakisEcology(mock(Plugin.class),id->{throw new AssertionError();},()->0);var event=mock(EntityDamageEvent.class);when(event.getEntity()).thenReturn(wolf);when(event.getCause()).thenReturn(EntityDamageEvent.DamageCause.SUFFOCATION);feature.suffocation(event);verify(event).setCancelled(true);var attack=mock(EntityDamageEvent.class);when(attack.getEntity()).thenReturn(wolf);when(attack.getCause()).thenReturn(EntityDamageEvent.DamageCause.ENTITY_ATTACK);feature.suffocation(attack);verify(attack,never()).setCancelled(anyBoolean());}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,13 +24,18 @@ def build(output):
|
|||
items[f'assets/dunerealms/models/item/ecology/{item}.json'] = json.dumps({'parent': 'minecraft:item/generated', 'textures': {'layer0': f'dunerealms:item/ecology/{item}'}}).encode()
|
||||
items[f'assets/dunerealms/items/ecology/{item}.json'] = json.dumps({'model': {'type': 'minecraft:model', 'model': f'dunerealms:item/ecology/{item}'}}).encode()
|
||||
entities = dict(common)
|
||||
creature_meta = {'pack': {**metadata['pack'], 'supported_formats': [64, 97], 'max_format': 97}}
|
||||
entities['pack.mcmeta'] = json.dumps(creature_meta).encode()
|
||||
for rabbit in RABBITS:
|
||||
entities[f'assets/minecraft/textures/entity/rabbit/{rabbit}.png'] = png('jerboa', (64, 32))
|
||||
for rabbit in RABBITS:
|
||||
entities[f'assets/minecraft/textures/entity/rabbit/rabbit_{rabbit}.png'] = png('jerboa_modern', (64, 64))
|
||||
entities[f'assets/minecraft/textures/entity/rabbit/rabbit_{rabbit}_baby.png'] = png('jerboa_baby', (32, 32))
|
||||
for wolf in WOLVES:
|
||||
for state in ('', '_tame', '_angry'):
|
||||
entities[f'assets/minecraft/textures/entity/wolf/{wolf}{state}.png'] = png('worm_pet', (64, 32))
|
||||
result = {}
|
||||
for name, entries in [('DuneRealms-Ecology-Items-v1.zip', items), ('DuneRealms-Arrakis-Creatures-v1.zip', entities)]:
|
||||
for name, entries in [('DuneRealms-Ecology-Items-v1.zip', items), ('DuneRealms-Arrakis-Creatures-v2.zip', entities)]:
|
||||
path = output / name
|
||||
with zipfile.ZipFile(path, 'w', zipfile.ZIP_DEFLATED) as archive:
|
||||
for key, value in sorted(entries.items()):
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff