Vanilla Expansion - TCreopargh/CraftTweakerIntegration GitHub Wiki

Adds missing features from crafttweaker itself.

IPlayer Expansion

You can call these methods on an IPlayer instance.

Methods Description
void addExperience(int amount) adds experiece points, instead of levels
void removeExperience(int amount) removes experience points
int getTotalXP() returns total XP amount the player has
void playSound(String soundResourceLocation, float volume, float pitch) Note: Client and server players have different behaviors. For more info see how forge handles sound events. Check for whether the world is remote to determine what side it is on.
sendPlaySoundPacket(String soundResourceLocation, String soundCategory, Position3f pos, float volume, float pitch) Makes the player play a sound on their client
boolean isPlayerMP() returns true if the IPlayer's internal object is an instance of EntityPlayerMP (server side player)
IAdvancementProgress getAdvancementProgress(IAdvancement advancement) Get the progress of an advancement. Note that the player must be an instance of EntityPlayerMP or this will return null

IWorld Expansion

Methods Description
void setOrCreateGameRule(String key, String value) For more gamerule operations please install CraftTweaker Utils, this is just a missing feature from it
void playSound(String soundResourceLocation, String soundCategory, Position3f location, float volume, float pitch, @Optional boolean distanceDelay)

IItemStack Expansion

Methods Description
IData asData(IItemStack itemStack) (Also a ZenCaster) Serializes an ItemStack into its NBT form
IItemStack fromData(IData data) Deserialize from NBT
boolean isEnergyStorage(IItemStack itemStack) Returns true if the itemstack is capable of storing energy
ZenGetter Return Type Description
energy IEnergyStorage Get an IEnergyStorage instance from the item stack. Will produce an error if the item is not an energy container.

IServer Expansion

ZenGetter Return Type Description
players IPlayer[] A list of all players on the server
playerCount int
maxPlayers int
Methods Description
IPlayer getPlayerByUUID(String uuid)
IPlayer getPlayerByUsername(String name)
void broadcastMessage(ITextComponent message, @Optional boolean isSystem) Sends a message to all players and print in server logs. If isSystem is true it's a system message, otherwise it's chat message