RT custom potion [RT] Randomtweaker Minecraft Game

This tutorial is set by the author to use the CC By-NC-SA protocol.

The linkage between RT and COT has brought a custom potion effect function to the game

First guide bag:

 Import Mods.ContentTweaker.VanillaFactory;

Import mode.randomtweaker.cote.ipotion;

Then tell the game that I want to customize a potion:

 VAR POTION As iPotion = VanillaFactory.createPotion (UnLocalizedName, LiquidColorin); 

UnlocalizedName is registered, not repeated! The type is string

LiquidColorin is the color of the potion, such as 0xf7d575

Then there is the function of containing:

IsReady function:

Determine whether the current tick trigger the PerformFFFECT function

Official examples:

 Potion.isReady = Function (duration, amplifier) ​​{

if (duration%20 == 0) {{

Return true;

}

Return false;

};

As well

 Return duration%20 == 0 

It means 20T trigger once (20t is one second)

Amplifier is the potion level (int)

duration is potion time (int)

Performeffect function:

This function is called every tick

Official examples:

 Potion.PerFormeffect = Function (living, amplifier) ​​{

If (! Living.World.remote && Living Instanceof Player) {

Var player as player = living;

Player.sendchat ("Didiidid ~~~");

}

};

Living for IentitylivingBase has this potion with this potion and a life entity

Amplifier is the potion level (int)

AFFECENTITY function:

This function triggers only when the Instant of Potion is True

Please guide bag:

 Import Mods.randomtweaker.cotx.Potion PerformFFECT; 

Official examples:

 PotionObj.afFectionity = Function (living, amplifier) ​​{

If (! Living.World.remote && Living Instanceof Player) {Var Player as Player = Living;

Player.sendchat ("Didiidid ~~~");

}

};

How to use is the same as the PerformeFFECT function

Full code:

#loader contenttweaker

Import Mods.ContentTweaker.Vanillafactory;

Import mode.randomtweaker.cote.ipotion;

Import Mods.ContentTweaker.player;

varpoion as iPotion = vanillafactory.createPotion ("Lhhd", 0xf7d575);

Potion.isReady = Function (Duration, Amplifier) ​​{

if (duration%20 == 0) {{

Return true;

}

Return false;

};

Potion.perMeFFECT = Function (living, amplifier) ​​{

If (! Living.World.remote && Living Instanceof Player) {

Var player as player = living;

Player.sendchat ("Didiidid ~~~");

}

};

potion.register ();

Other methods:

Method type describes whether the effect of BadeFFECTINBOOL potion gives bad effects is good for players. The beneficial potion will be placed on the first Instantbook potion immediately or continues to take effect immediately (True is immediately, FALSE is continuing) [Corresponding above the above,AFFECENTITY function] Shouldrenderbook rendering in the backpack bar

Shouldrenderhudbook rendering whether to render in HUD (in the upper right corner)

The texture must be 18 * 18 size!

The texture must be 18 * 18 size!

The texture must be 18 * 18 size!

Looks like 16*16 can also be? 64*64, it must be done

Patch position: ContentTweaker: Textures/GUI/UNLOCALIZEDNAME.PNG

Patch position: ContentTweaker: Textures/GUI/UNLOCALIZEDNAME.PNG

Patch position: ContentTweaker: Textures/GUI/UNLOCALIZEDNAME.PNG

References:

https://github.com/project-randomtweaker/tree/1.12/wiki


[Minecraft Demon Reform Class #001] Magic Reform Thought: Homemade Pottery Effect