Comments (3)
I think I managed to get a working version, but it required making a fork of Movecraft-Cannons and Movecraft itself with a few changes
One problem with cannon rotation was that the CraftRotateEvent
could be cancelled by other plugins with listeners operating at a higher priority. As a result, Movecraft-Cannons would rotate the cannons data even though the craft itself was ultimately prevented from rotating. To resolve this, the CraftRotateEvent listener was set to run at EventPriority.MONITOR
with ignoreCancelled
set to true
.
With translation, I think the problems stemmed from the use of CraftPreTranslateEvent
:
- The craft may be prevented from moving if
CraftTranslateEvent
is cancelled, which is fired afterCraftPreTranslateEvent
. As a result, the data of the cannons is translated while the craft itself is not. - It looks like the displacement of the craft may be modified after
CraftPreTranslateEvent
is called (e.g. the y displacement for gravity-enabled craft here, if I'm understanding this correctly), so there could be a discrepancy between how much Movecraft-Cannons translates the cannons data by and how much the craft translates in reality. To resolve this, I added a newCraftPostTranslateEvent
event to Movecraft, which is identical toCraftPreTranslateEvent
but is only fired after translation has occurred.
Another change I made was caching the cannons of each craft after detection, rather than trying to find them at the translation stage. I don't know if that particularly helped, but it was a nice performance booster
from movecraft-cannons.
One problem with cannon rotation was that the
CraftRotateEvent
could be cancelled by other plugins with listeners operating at a higher priority. As a result, Movecraft-Cannons would rotate the cannons data even though the craft itself was ultimately prevented from rotating. To resolve this, the CraftRotateEvent listener was set to run atEventPriority.MONITOR
withignoreCancelled
set totrue
.
This is a good point, thank you for letting me know.
With translation, I think the problems stemmed from the use of
CraftPreTranslateEvent
Hmm, that is a good point. I'm going to ask CC if there is a proper method to do this in the current API, or if we need to expand the API as you suggest.
from movecraft-cannons.
Since there have been no reports of problems in 3 months, I am going to mark this as resolved!
from movecraft-cannons.
Related Issues (19)
- [Feature Request] Per-craft cannon limits HOT 5
- Cannon rotation reports HOT 2
- cannons reset when craft is repiloted HOT 11
- Aiming mode cannons bug HOT 4
- StackOverflowError - Could not pass event EntityDamageByEntityEvent to Cannons HOT 4
- Cannons being unbought when a craft moves in any way
- Cannons not functioning properly in subcrafts HOT 5
- Download? HOT 1
- Not functioning HOT 4
- Director aiming HOT 11
- Fire cannons on left/right click HOT 1
- Error on ship movement HOT 2
- Disabling cannons if not on a piloted craft HOT 2
- 1.16.5 Support HOT 4
- Cannons have to be rebought when movecraft moves HOT 5
- Cannons and Server software incompatibilities? HOT 4
- Cannons being unregistered on craft movement HOT 1
- Cannon translation reports HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from movecraft-cannons.