mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-17 02:45:13 +00:00
Petal Apothecary HUD.
This commit is contained in:
1 parent
47a5f6d2f8
commit
a6d532cacc
5 files changed
+75
-11
No files matched your search
@@ -52,6 +52,8 @@ import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaCrystalCube;
|
||||
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
@@ -112,12 +114,16 @@ public final class HUDHandler {
|
||||
((IWandHUD) block).renderHUD(mc, event.resolution, mc.theWorld, pos.blockX, pos.blockY, pos.blockZ);
|
||||
profiler.endSection();
|
||||
}
|
||||
}
|
||||
else if(pos != null && equippedStack.getItem() instanceof ILexicon)
|
||||
} else if(pos != null && equippedStack.getItem() instanceof ILexicon)
|
||||
drawLexiconHUD(mc.thePlayer.getCurrentEquippedItem(), block, pos, event.resolution);
|
||||
else if(tile != null && tile instanceof TilePool)
|
||||
if(tile != null && tile instanceof TilePool)
|
||||
renderPoolRecipeHUD(event.resolution, (TilePool) tile, equippedStack);
|
||||
}
|
||||
if(tile != null && tile instanceof TileAltar)
|
||||
((TileAltar) tile).renderHUD(mc, event.resolution);
|
||||
else if(tile != null && tile instanceof TileRuneAltar)
|
||||
((TileRuneAltar) tile).renderHUD(mc, event.resolution);
|
||||
|
||||
if(tile != null && tile instanceof TileCorporeaCrystalCube)
|
||||
renderCrystalCubeHUD(event.resolution, (TileCorporeaCrystalCube) tile);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
@@ -89,7 +90,8 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
|
||||
if(par5Entity instanceof EntityItem) {
|
||||
TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4);
|
||||
tile.collideEntityItem((EntityItem) par5Entity);
|
||||
if(tile.collideEntityItem((EntityItem) par5Entity))
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockRuneAltar extends BlockModContainer implements IWandable, IWandHUD, ILexiconable {
|
||||
public class BlockRuneAltar extends BlockModContainer implements IWandable, ILexiconable {
|
||||
|
||||
Random random;
|
||||
IIcon[] icons;
|
||||
@@ -166,10 +166,4 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, IWan
|
||||
return LexiconData.runicAltar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res, World world, int x, int y, int z) {
|
||||
((TileRuneAltar) world.getTileEntity(x, y, z)).renderHUD(mc, res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,6 +15,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -26,11 +33,15 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.internal.VanillaPacketDispatcher;
|
||||
import vazkii.botania.api.item.IPetalApothecary;
|
||||
import vazkii.botania.api.recipe.IFlowerComponent;
|
||||
import vazkii.botania.api.recipe.RecipePetals;
|
||||
import vazkii.botania.api.recipe.RecipeRuneAltar;
|
||||
import vazkii.botania.client.core.handler.HUDHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
@@ -320,5 +331,54 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory, I
|
||||
public boolean hasLava() {
|
||||
return hasLava;
|
||||
}
|
||||
|
||||
public void renderHUD(Minecraft mc, ScaledResolution res) {
|
||||
int xc = res.getScaledWidth() / 2;
|
||||
int yc = res.getScaledHeight() / 2;
|
||||
|
||||
float angle = -90;
|
||||
int radius = 24;
|
||||
int amt = 0;
|
||||
for(int i = 0; i < getSizeInventory(); i++) {
|
||||
if(getStackInSlot(i) == null)
|
||||
break;
|
||||
amt++;
|
||||
}
|
||||
|
||||
if(amt > 0) {
|
||||
float anglePer = 360F / amt;
|
||||
|
||||
for(RecipePetals recipe : BotaniaAPI.petalRecipes)
|
||||
if(recipe.matches(this)) {
|
||||
mc.renderEngine.bindTexture(HUDHandler.manaBar);
|
||||
RenderHelper.drawTexturedModalRect(xc + radius + 9, yc - 8, 0, 0, 8, 22, 15);
|
||||
|
||||
ItemStack stack = recipe.getOutput();
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, stack, xc + radius + 32, yc - 8);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(Items.wheat_seeds), xc + radius + 16, yc + 6);
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
mc.fontRenderer.drawStringWithShadow("+", xc + radius + 14, yc + 10, 0xFFFFFF);
|
||||
}
|
||||
|
||||
net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
|
||||
for(int i = 0; i < amt; i++) {
|
||||
double xPos = xc + Math.cos(angle * Math.PI / 180D) * radius - 8;
|
||||
double yPos = yc + Math.sin(angle * Math.PI / 180D) * radius - 8;
|
||||
GL11.glTranslated(xPos, yPos, 0);
|
||||
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, getStackInSlot(i), 0, 0);
|
||||
GL11.glTranslated(-xPos, -yPos, 0);
|
||||
|
||||
angle += anglePer;
|
||||
}
|
||||
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
|
||||
} else if(recipeKeepTicks > 0 && hasWater) {
|
||||
String s = StatCollector.translateToLocal("botaniamisc.altarRefill0");
|
||||
mc.fontRenderer.drawStringWithShadow(s, xc - mc.fontRenderer.getStringWidth(s) / 2, yc + 10, 0xFFFFFF);
|
||||
s = StatCollector.translateToLocal("botaniamisc.altarRefill1");
|
||||
mc.fontRenderer.drawStringWithShadow(s, xc - mc.fontRenderer.getStringWidth(s) / 2, yc + 20, 0xFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user