-
-
Notifications
You must be signed in to change notification settings - Fork 408
Spawners #8193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev/feature
Are you sure you want to change the base?
Spawners #8193
Conversation
🫡 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First batch
@Description(""" | ||
Returns the weight of a weighted object. If supported, this weight can be modified. | ||
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Description(""" | |
Returns the weight of a weighted object. If supported, this weight can be modified. | |
""") | |
@Description("Returns the weight of a weighted object. If supported, this weight can be modified.") |
@Description(""" | ||
Checks whether a block or entity is a mob spawner (monster spawner or spawner minecart). | ||
""") | ||
@Example(""" | ||
broadcast whether event-block is a mob spawner | ||
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Description(""" | |
Checks whether a block or entity is a mob spawner (monster spawner or spawner minecart). | |
""") | |
@Example(""" | |
broadcast whether event-block is a mob spawner | |
""") | |
@Description("Checks whether a block or entity is a mob spawner (monster spawner or spawner minecart).") | |
@Example("broadcast whether event-block is a mob spawner") |
if event-entity is a mob spawner: | ||
broadcast "%event-entity% is a mob spawner!" | ||
""") | ||
public class CondIsMobSpawner extends PropertyCondition<Object> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing @Since
@Description(""" | ||
Checks whether a trial spawner is ominous. This can also be used with trial spawner block datas. | ||
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Description(""" | |
Checks whether a trial spawner is ominous. This can also be used with trial spawner block datas. | |
""") | |
@Description("Checks whether a trial spawner is ominous. This can also be used with trial spawner block datas.") |
@Description(""" | ||
Make a trial spawner eject its rewards. | ||
""") | ||
@Example(""" | ||
spit out the trial rewards from event-block | ||
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Description(""" | |
Make a trial spawner eject its rewards. | |
""") | |
@Example(""" | |
spit out the trial rewards from event-block | |
""") | |
@Description("Make a trial spawner eject its rewards.") | |
@Example("spit out the trial rewards from event-block") |
@Description(""" | ||
The spawn rule used in the spawn rule section. | ||
""") | ||
@Examples(""" | ||
the spawn rule | ||
""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Description(""" | |
The spawn rule used in the spawn rule section. | |
""") | |
@Examples(""" | |
the spawn rule | |
""") | |
@Description("The spawn rule used in the spawn rule section.") | |
@Examples("the spawn rule") |
|
||
@Name("Spawn Rule Light Level") | ||
@Description(""" | ||
Returns the minimum or maximum block or sky light levels of a spawn rule. \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns the minimum or maximum block or sky light levels of a spawn rule. \ | |
The minimum or maximum block or sky light levels of a spawn rule. \ |
} | ||
} | ||
|
||
} No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
} | |
/** | ||
* Abstract class representing the data of a trial spawner or a regular spawner. | ||
*/ | ||
public abstract class SkriptSpawnerData { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I'm not too keen on this naming schema, I think SpawnerData
or SpawnerDataWrapper
would be nicer.
import org.skriptlang.skript.registration.SyntaxRegistry; | ||
|
||
@Name("Trial Spawner State") | ||
@Description("Make a trial spawner or a trial spawner block data ominous or normal.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Description("Make a trial spawner or a trial spawner block data ominous or normal.") | |
@Description("Make a trial spawner block or block data ominous or normal.") |
Can you explain to me the reasoning of having spawner data? It seems to be like a mostly unnecessary in between step, and id prefer skript to treat it more like it does items/tileentities where it hides the intermediate step of item meta/block states. E.g. |
I think keeping it in the current form is actually simpler for users. For example, how would properties of the different states of a trial spawner (regular vs ominous) be changed? Would every syntax that trial spawners use need a keyword to specify the state? Only changing the properties of the current state, or would it apply across both states? That would just end up giving users less control of what they can do. For mob spawner data, hiding the step is feasible, but having different behavior between mob spawners and trial spawners could make things more confusing rather than less Also, it was done so users could store the data if needed (without having to store the properties separately) |
Yeah I suppose the two states of the trial spawner would make it a bit more annoying, but not by very much. It kind of removes the need for the modify section and is overall more straightforward, though.
I get that it doesn't allow storing a common set of properties, but something like that can be done with functions or variables, or even an effect to copy data from one spawner to another. Having a keyword It just makes me think of, like, items and how annoying they would be if we forced the use of itemmeta:
Basically it's a little less flexible in exchange for being much simpler. I'd like others' opinions on this too, I'm fine with the current solution but I think avoiding spawner data would be an improvement. |
Problem
In Skript, there is currently no support for spawner related APIs. This limits what users can achieve with Skript alone, often requiring addons and/or reflection.
Solution
This pull request introduces full support for spawner related features, made with the new registration API.
Spawner Data
The spawner data represents the properties shared by both mob spawners and trial spawners.
Mob Spawner Data
The mob spawner data refers to the static data of a monster spawner block or a spawner minecart entity. In Skript, they will be simply referred to as mob spawners.
Trial Spawner Data
The trial spawner data represents the static data of a trial spawner. It can hold two data sets:
The appropriate data set is applied automatically based on the spawner's current state.
Creating, Obtaining & Modifying Spawner Data
Creating Data
You can create the mob, trial spawner data with a section expression:
Obtaining Data
You can obtain spawner data using these expressions:
Modifying Data
You can modify spawner data using changers or the
modify
section expression:Spawner Entries
Spawner entries define what entities spawn from a spawner. They include properties such as the entity type, spawn rules, weight, and equipment with drop chances.
You can construct a spawner entry using a section expression:
You can also obtain existing entries with the expression
spawner entries of {_spawner data}
.Spawn Rules
Spawn rules specify the light conditions under which a spawner entry can spawn, using minimum and maximum block and sky light levels.
You can construct a spawn rule using a section expression:
You can obtain the spawn rule of an entry with the expression
spawn rule of {_spawner entry}
.Testing Completed
At the moment, there are no tests.
Supporting Information
This pull request is targeted for 2.14, due to only allowing support for versions 1.21 and above.
Also, I marked it as up for debate on whether it should be an official addon instead of integrated into Skript.
Tests are failing because they run in versions below 1.21.
BREAKING CHANGES:
ExprSpawnerType
from(spawner|entity|creature) type[s]
tospawner [entity] (type|snapshot)[s]
due to its vagueness.TODO:
Completes: #6856, #5846
Related: none