mcme / mcme-entities Goto Github PK
View Code? Open in Web Editor NEWEntities API for NPCs, virtual Entities, complex animated entities and more
License: GNU General Public License v3.0
Entities API for NPCs, virtual Entities, complex animated entities and more
License: GNU General Public License v3.0
Turns out the changes introduced in #5 and #6 do not work as intended due to some packets relying on being updated every tick to maintain synchronization with the entity they're linked to.
Specifically:
BoneMetaPacket
checks flags updated every tick to detect changes to the entity and has an internal queue for head positions,BoneInitPacket
checks flags updated every tick to detect changes to the entity,SimpleEntityMovePacket
checks flags updated every tick to detect changes to the entity,Personally, I'd argue that this polling approach is wasteful, both because it needs to query the entity every tick to detect changes, and because it makes it difficult to prevent unnecessary updates to the packets in situations where the entity is not visible to any players or the state it contains hasn't actually changed.
This is made worse by two factors:
A lot of this is out of scope for me right now, but we should address what this issue is actually about: packets not getting updated. There are two ways to move forward:
I'm attempting to do the former (writing this issue in part serves as research), but I'm a little afraid to touch this in fear of breaking it. I've also been forced to put this off for long enough that I feel it's important to acknowledge this issue in case someone runs into it.
Concerning https://github.com/MCME/MCME-Entities/blob/master/src/main/java/com/mcmiddleearth/entities/util/RotationMatrix.java , it might be beneficial to decouple the matrix from the internal bukkit system completely. Using a double/float array (float[]) or double array (float[][]) will result in faster calculations because of memory colocation and skipping jit optimizations completely (getter inlining). See https://math.nist.gov/javanumerics/jama/doc/ implementations for instance.
looks like a simple euler rotation, which may result in gimbal lock. (See https://gamedev.stackexchange.com/questions/45292/how-is-the-gimbal-locked-problem-solved-using-accumulative-matrix-transformation) shouldn't return null if its not implemented but throw an UnsupportedOperationException. https://docs.oracle.com/javase/8/docs/api/java/lang/UnsupportedOperationException.htmlplayer.world.spawn(player.location, Firework.class);
Above code causes the following exception to be thrown:
[17:25:40 ERROR]: Could not pass event ProjectileLaunchEvent to MCME-Entities v1.0 java.lang.NullPointerException: Cannot invoke "com.mcmiddleearth.entities.entities.McmeEntity.getEntityId()" because "shooter" is null at com.mcmiddleearth.entities.protocol.packets.simple.ProjectileSpawnPacket.(ProjectileSpawnPacket.java:24) ~[MCME-Entities-1.0.jar:?] at com.mcmiddleearth.entities.entities.Projectile.(Projectile.java:45) ~[MCME-Entities-1.0.jar:?] at com.mcmiddleearth.entities.api.VirtualEntityFactory.build(VirtualEntityFactory.java:572) ~[MCME-Entities-1.0.jar:?] at com.mcmiddleearth.entities.server.SyncEntityServer.spawnEntity(SyncEntityServer.java:145) ~[MCME-Entities-1.0.jar:?] at com.mcmiddleearth.entities.events.listener.ProjectileListener.onProjectileLaunch(ProjectileListener.java:49) ~[MCME-Entities-1.0.jar:?] at com.destroystokyo.paper.event.executor.asm.generated.GeneratedEventExecutor8.execute(Unknown Source) ~[?:?] at org.bukkit.plugin.EventExecutor.lambda$create$1(EventExecutor.java:75) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at co.aikar.timings.TimedEventExecutor.execute(TimedEventExecutor.java:80) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:git-Paper-317] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:669) ~[paper-api-1.18.2-R0.1-SNAPSHOT.jar:?] at org.bukkit.craftbukkit.v1_18_R2.event.CraftEventFactory.callProjectileLaunchEvent(CraftEventFactory.java:1398) ~[paper-1.18.2.jar:git-Paper-317] at org.bukkit.craftbukkit.v1_18_R2.event.CraftEventFactory.doEntityAddEventCalling(CraftEventFactory.java:649) ~[paper-1.18.2.jar:git-Paper-317] at net.minecraft.server.level.ServerLevel.addEntity(ServerLevel.java:1422) ~[?:?] at net.minecraft.server.level.ServerLevel.addFreshEntity(ServerLevel.java:1331) ~[?:?] at org.bukkit.craftbukkit.v1_18_R2.CraftWorld.addEntityToWorld(CraftWorld.java:1063) ~[paper-1.18.2.jar:git-Paper-317] at org.bukkit.craftbukkit.v1_18_R2.CraftRegionAccessor.addEntity(CraftRegionAccessor.java:523) ~[paper-1.18.2.jar:git-Paper-317] at org.bukkit.craftbukkit.v1_18_R2.CraftRegionAccessor.spawn(CraftRegionAccessor.java:499) ~[paper-1.18.2.jar:git-Paper-317] at org.bukkit.craftbukkit.v1_18_R2.CraftRegionAccessor.spawn(CraftRegionAccessor.java:493) ~[paper-1.18.2.jar:git-Paper-317] at org.bukkit.craftbukkit.v1_18_R2.CraftRegionAccessor.spawn(CraftRegionAccessor.java:484) ~[paper-1.18.2.jar:git-Paper-317] [snip]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.