Comments (4)
This is being caused because nearest entity
is an Expression returning an array of Entities, being cast to an Expression that wants to return an array of LivingEntities, and an array of Entities is not an array of LivingEntities, so it's failing.
Here at Skript, our policy is to do these unchecked, unverified casts without properly checking and just suppress the warning, which is why this is occurring as a problem.
The easy fix is to just make the charge effect not do that cast, since it isn't necessary, but the larger question is why the %livingentities%
input is accepting %entities%
without any kind of conversion, since this will run into the same problem elsewhere.
from skript.
This is being caused because
nearest entity
is an Expression returning an array of Entities, being cast to an Expression that wants to return an array of LivingEntities, and an array of Entities is not an array of LivingEntities, so it's failing.Here at Skript, our policy is to do these unchecked, unverified casts without properly checking and just suppress the warning, which is why this is occurring as a problem.
The easy fix is to just make the charge effect not do that cast, since it isn't necessary, but the larger question is why the
%livingentities%
input is accepting%entities%
without any kind of conversion, since this will run into the same problem elsewhere.
I feel like it might be a bit more complicated than that, since nearest entity
works fine, and player's spectator target
, which is an Expression<Entity>, also worked fine in tests.
from skript.
I feel like it might be a bit more complicated than that, since
nearest entity
works fine, andplayer's spectator target
, which is an Expression, also worked fine in tests.
No, it's exactly this, and it happens with a bunch of other syntax -- I'm testing it right now to find the whole list.
Basically, %livingentities%
permits Expression<Entity>
s and doesn't apply any kind of conversion, and because of the generic <LivingEntity>
type, when getArray
is called it tries to cast the array to a LivingEntity[]
which, clearly, it won't be, since it's an entity expression, so it's throwing the class cast exception.
What probably ought to be happening is that it should sub in some kind of converted Expression that filters out the incorrect elements and returns the array that's been asked for.
from skript.
Having chased this issue down the rabbit hole, we discovered its cause is some expressions wrongly reporting their returntype as being different from the array type they return in get...
, so in this issue the charge the nearest creeper
fails because the expression promises to return a Creeper
(a LivingEntity
) but actually returns an array of Entities. This means the parser doesn't convert the expression.
I have a fix for this in the pipeline but I'd also like to find a way to address the more pervasive issue in future.
from skript.
Related Issues (20)
- Legacy Code Tracker
- unexpected repair/damage behaviour HOT 4
- Add recently added attributes HOT 2
- Searching Feature
- Add experience class into accept change on ExprTotalExperience
- Add skript-reflect (or at least some features) into Skript HOT 1
- Expose required variable changes for save as a config option
- SimpleLiterals pass "constant" backing array to other syntax.
- Stop referencing the old Converter class in PropertyExpression HOT 2
- Wither HOT 2
- Allow `armour stand` as `armor stand` HOT 2
- Entities despawning when target is set HOT 1
- bStats syntax for Skript HOT 14
- Remove skript: from commands created in skript (config option) HOT 8
- New beta: not setting canceled event-block to bedrock
- Error HOT 1
- Tadpoles cannot spawn HOT 6
- Release Channel / Update Checker logic not handling betas properly HOT 1
- Streams HOT 1
- Checking for updates failed. Do you have Internet connection? HOT 1
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 skript.