Update forge and close #245

This commit is contained in:
Vincent Lee committed 2016-05-03 12:38:52 -05:00
1 parent f24409f336
commit a0d251fafd
3 files changed
+40 -11

No files matched your search

@@ -11,8 +11,13 @@
package vazkii.botania.common.brew.potion;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
@@ -23,20 +28,13 @@ import vazkii.botania.common.lib.LibMisc;
public class PotionMod extends Potion {
private static final ResourceLocation resource = new ResourceLocation(LibResources.GUI_POTIONS);
private final int iconIndex;
public PotionMod(String name, boolean badEffect, int color, int iconIndex) {
super(badEffect, color);
GameRegistry.register(this, new ResourceLocation(LibMisc.MOD_ID, name));
setPotionName("botania.potion." + name);
setIconIndex(iconIndex % 8, iconIndex / 8);
}
@Override
@SideOnly(Side.CLIENT)
public int getStatusIconIndex() {
Minecraft.getMinecraft().renderEngine.bindTexture(resource);
return super.getStatusIconIndex();
this.iconIndex = iconIndex;
}
public boolean hasEffect(EntityLivingBase entity) {
@@ -47,4 +45,35 @@ public class PotionMod extends Potion {
return entity.getActivePotionEffect(potion) != null;
}
@Override
@SideOnly(Side.CLIENT)
public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) {
render(x + 6, y + 7, 1);
}
@Override
@SideOnly(Side.CLIENT)
public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha) {
render(x + 3, y + 3, alpha);
}
@SideOnly(Side.CLIENT)
private void render(int x, int y, float alpha) {
Minecraft.getMinecraft().renderEngine.bindTexture(resource);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buf = tessellator.getBuffer();
buf.begin(7, DefaultVertexFormats.POSITION_TEX);
GlStateManager.color(1, 1, 1, alpha);
int textureX = iconIndex % 8 * 18;
int textureY = 198 + iconIndex / 8 * 18;
buf.pos(x, y + 18, 0).tex(textureX * 0.00390625, (textureY + 18) * 0.00390625).endVertex();
buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * 0.00390625, (textureY + 18) * 0.00390625).endVertex();
buf.pos(x + 18, y, 0).tex((textureX + 18) * 0.00390625, textureY * 0.00390625).endVertex();
buf.pos(x, y, 0).tex(textureX * 0.00390625, textureY * 0.00390625).endVertex();
tessellator.draw();
}
}
@@ -17,7 +17,7 @@ public final class LibMisc {
public static final String MOD_NAME = MOD_ID;
public static final String BUILD = "GRADLE:BUILD";
public static final String VERSION = "GRADLE:VERSION-" + BUILD;
public static final String DEPENDENCIES = "required-after:Baubles;after:Thaumcraft";
public static final String DEPENDENCIES = "required-after:Forge@[12.16.0.1874,];required-after:Baubles;after:Thaumcraft";
public static final String MC_VERSIONS = "[1.9]";
// Network Contants