<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://modded.wiki/index.php?action=history&amp;feed=atom&amp;title=KoalaLib%3AMagic_Bar</id>
	<title>KoalaLib:Magic Bar - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://modded.wiki/index.php?action=history&amp;feed=atom&amp;title=KoalaLib%3AMagic_Bar"/>
	<link rel="alternate" type="text/html" href="https://modded.wiki/index.php?title=KoalaLib:Magic_Bar&amp;action=history"/>
	<updated>2026-04-25T09:22:48Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://modded.wiki/index.php?title=KoalaLib:Magic_Bar&amp;diff=12543&amp;oldid=prev</id>
		<title>Deadlydiamond98: Created page with &quot;Screenshot of the Magic Bar in Game The &#039;&#039;&#039;Magic Bar&#039;&#039;&#039; is a GUI feature added by Koala Lib. The &#039;&#039;&#039;Magic Bar&#039;&#039;&#039; will only refill itself when the player is at full hunger and doesn&#039;t have a Magic Regeneration Delay. Various Items can be used to add or remove Magic from the &#039;&#039;&#039;Magic Bar&#039;&#039;&#039;.  Every time Magic is consumed, the following formula is used to add a Magic Regeneration Delay to the player:{{Message box|title=|tex...&quot;</title>
		<link rel="alternate" type="text/html" href="https://modded.wiki/index.php?title=KoalaLib:Magic_Bar&amp;diff=12543&amp;oldid=prev"/>
		<updated>2025-07-13T03:30:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&lt;a href=&quot;/w/File:KoalaLib_MagicBarScreenshot.png&quot; title=&quot;File:KoalaLib MagicBarScreenshot.png&quot;&gt;thumb|Screenshot of the Magic Bar in Game&lt;/a&gt; The &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039; is a GUI feature added by &lt;a href=&quot;/w/Koala_Lib&quot; title=&quot;Koala Lib&quot;&gt;Koala Lib&lt;/a&gt;. The &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039; will only refill itself when the player is at full hunger and doesn&amp;#039;t have a Magic Regeneration Delay. Various Items can be used to add or remove Magic from the &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039;.  Every time Magic is consumed, the following formula is used to add a Magic Regeneration Delay to the player:{{Message box|title=|tex...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[File:KoalaLib MagicBarScreenshot.png|thumb|Screenshot of the Magic Bar in Game]]&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039; is a GUI feature added by [[Koala Lib]]. The &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039; will only refill itself when the player is at full hunger and doesn&amp;#039;t have a Magic Regeneration Delay. Various Items can be used to add or remove Magic from the &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
Every time Magic is consumed, the following formula is used to add a Magic Regeneration Delay to the player:{{Message box|title=|text=&amp;#039;&amp;#039;&amp;#039;floor&amp;#039;&amp;#039;&amp;#039;( &amp;#039;&amp;#039;&amp;#039;min&amp;#039;&amp;#039;&amp;#039;( 0.7 * (1 - (&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;mana&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; / &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;max mana&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;)) * 500 - 45 , -60)}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Koala Lib]] allows you to change the position of the &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039; on screen, and change when the &amp;#039;&amp;#039;&amp;#039;Magic Bar&amp;#039;&amp;#039;&amp;#039; is shown (Always, When Using, or Never).&lt;br /&gt;
&lt;br /&gt;
== Using the Library ==&lt;br /&gt;
To enable the Magic Bar in a mod, you can toggle it in your mod&amp;#039;s initializer:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;&lt;br /&gt;
public class KoalaLib implements ModInitializer {&lt;br /&gt;
	@Override&lt;br /&gt;
	public void onInitialize() {&lt;br /&gt;
        ToggleableContent.enableMagicBar(true);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
‎&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Doing this will show the bar on screen and allow you to use it. There are a few built in Items to help with creating Items that [[KoalaLib:Magic Consuming Items|Consume]] or [[KoalaLib:Magic Consumable Items|Grant]] Magic, but there are also many built in helper methods in the &amp;#039;&amp;#039;&amp;#039;MagicBarHelper&amp;#039;&amp;#039;&amp;#039; class.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;hr&amp;gt;&lt;br /&gt;
=== Adding Magic ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean addMana(LivingEntity entity, int amount)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;addMana()&amp;#039;&amp;#039;&amp;#039; method takes in an entity and an amount. The entity is the entity that magic will be added to, while the amount is the magic the entity will be granted.&lt;br /&gt;
=== Removing Magic ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean removeMana(LivingEntity entity, int amount)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;removeMana()&amp;#039;&amp;#039;&amp;#039; method takes in an entity and an amount. The entity is the entity that magic will be removed from, while the amount is the magic the entity will loose. This method will apply a regeneration delay which will prevent magic from being gained for a small period.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean removeMana(LivingEntity entity, int amount, boolean addDelay)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is an alternative method which also takes in a boolean, &amp;quot;&amp;#039;&amp;#039;addDelay&amp;#039;&amp;#039;&amp;quot;. If this is false, a regeneration delay won&amp;#039;t be applied to the entity.&lt;br /&gt;
=== Adding Max Magic ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean increaseMaxMana(LivingEntity entity, int amount, boolean replenish)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;increaseMaxMana()&amp;#039;&amp;#039;&amp;#039; method increases the maximum magic on an entity. The entity is the entity that magic will be added to, while the amount is the magic the entity will have added to their max. The &amp;quot;&amp;#039;&amp;#039;replenish&amp;#039;&amp;#039;&amp;quot; value will determine if the amount added will be replenished.&lt;br /&gt;
=== Removing Max Magic ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean decreaseMaxMana(LivingEntity entity, int amount)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;#039;&amp;#039;&amp;#039;decreaseMaxMana()&amp;#039;&amp;#039;&amp;#039; method decreases the maximum magic on an entity. The entity is the entity that magic will be added to, while the amount is the magic the entity will have removed from their max.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;hr&amp;gt;&lt;br /&gt;
=== Magic checks ===&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean canAddMana(LivingEntity entity, int amount)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This method can be used to check if Mana can be added.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean canRemoveMana(LivingEntity entity, int amount)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This method can be used to check if Mana can be removed.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot; line&amp;gt;public static boolean canDecreaseMaxMana(LivingEntity entity, int amount)&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
This method can be used to check if the max Mana can be decreased (meaning it wouldn&amp;#039;t go below zero).&lt;/div&gt;</summary>
		<author><name>Deadlydiamond98</name></author>
	</entry>
</feed>