Dropt

Dropt

3M Downloads

About "mods.dropt.Rule:" (ZenScript)

delta-nos opened this issue ยท 1 comments

commented

I want to create function that remove block drop.

My script:

import mods.dropt.Dropt;
import mods.dropt.RuleList;
import mods.dropt.Rule;

function removeBlockDrop(ruleList as RuleList, blocks as string[], drop as IItemStack) {
	if (!isNull(blocks)) {
	    ruleList.add(Rule.matchBlocks(blocks).matchDrops([drop]).addDrop(Dropt.drop()));
	} else {
		ruleList.add(Rule.matchDrops([drop]).addDrop(Dropt.drop()));
	}
}

Log:

No such static member in mods.dropt.Rule: matchBlocks
No such static member in mods.dropt.Rule: matchDrops
No such static member in mods.dropt.Rule: addDrop

In dropt wiki, they are showen as rule, but actually, this isn't work.
In most of modpacks and most of documentations, they use as NOT function (like this example) so I can find no informations.
Where can I know about this? Help me and thanks.

commented

The wiki indicates that calling the member functions on the Rule object return the same Rule object for method chaining. The Rule object doesn't have any static methods though, just member methods. You're calling the methods statically, hence the errors that say no such static member. Using Dropt.rule() instead creates a new Rule object and you can call those member methods on that object.

Use Dropt.rule() instead of Rule as shown in the example.

If you have further questions, please use the Discord: discord.codetaylor.com