- Added some custom potion handling

This commit is contained in:
HellFirePvP committed 2015-12-07 20:42:44 +01:00
1 parent e3a912da6f
commit 1efbf409e0
4 files changed
+75 -1

No files matched your search

@@ -0,0 +1,47 @@
package makeo.gadomancy.common.potions;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
import java.awt.Color;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
*
* Created by HellFirePvP @ 07.12.2015 20:31
*/
public abstract class PotionCustomTexture extends Potion {
private ResourceLocation texture;
protected PotionCustomTexture(int id, boolean isBad, int color, ResourceLocation texture) {
super(id, isBad, color);
this.texture = texture;
}
@Override
public boolean hasStatusIcon() {
return false;
}
@Override
public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) {
Tessellator tes = Tessellator.instance;
mc.renderEngine.bindTexture(texture);
tes.startDrawingQuads();
Color c = new Color(getLiquidColor());
tes.setColorRGBA(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
tes.addVertexWithUV(x + 6, y + 7, 0, 0, 0);
tes.addVertexWithUV(x + 6, y + 7 + 18, 0, 0, 1);
tes.addVertexWithUV(x + 6 + 18, y + 7 + 18, 0, 1, 1);
tes.addVertexWithUV(x + 6 + 18, y + 7, 0, 1, 0);
tes.draw();
}
}
@@ -0,0 +1,20 @@
package makeo.gadomancy.common.potions;
import thaumcraft.api.aspects.Aspect;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
* GNU LESSER GENERAL PUBLIC LICENSE
* for more read the LICENSE file
* <p/>
* Created by HellFirePvP @ 07.12.2015 20:05
*/
public class PotionMiningLuck extends PotionCustomTexture {
public PotionMiningLuck(int id) {
super(id, false, Aspect.MINE.getColor(), Aspect.MINE.getImage());
setPotionName("potion.miningluck");
}
}
@@ -1,5 +1,6 @@
package makeo.gadomancy.common.registration;
import makeo.gadomancy.common.potions.PotionMiningLuck;
import makeo.gadomancy.common.utils.Injector;
import net.minecraft.potion.Potion;
@@ -12,7 +13,11 @@ import net.minecraft.potion.Potion;
* Created by makeo @ 31.10.2015 23:09
*/
public class RegisteredPotions {
public static PotionMiningLuck POTION_MINING_LUCK;
public static void init() {
POTION_MINING_LUCK = registerPotion(PotionMiningLuck.class);
}
private static <T extends Potion> T registerPotion(Class<T> potionClass) {