Skip to content

GameRuleHelper

friendlyhj edited this page Jun 22, 2024 · 1 revision

GameRuleHelper

This allows you to create custom gamerules, and get the value of any existing gamerule.

Import the package

mods.zenutils.GameRuleHelper

Methods

Get the instance from IWorld using ZenGetter gameRuleHelper, or method getGameRuleHelper.

  • void addGameRule(String key, String value, String type) --- add gamerule with the given default value and type, type must be Any, Numeric or Boolean.

  • boolean hasRule(String name) --- check whether the given rule existed.

  • String[] getRules() --- get all the existing rules.

  • boolean getBoolean(String name) --- get the rule value as boolean type.

  • int getInt(String name) --- get the rule value as int type.

  • String getString(String name) --- get the rule value as string type.

Clone this wiki locally