mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-26 06:52:58 +00:00
Change the Rune Altar item position for rendering to be calculated during the render.
This commit is contained in:
1 parent
b6bdaa2919
commit
f6285e31bf
2 files changed
+15
-33
No files matched your search
@@ -45,14 +45,26 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(x, y, z);
|
||||
|
||||
int items = 0;
|
||||
for(int i = 0; i < altar.getSizeInventory(); i++)
|
||||
if(altar.getStackInSlot(i) == null)
|
||||
break;
|
||||
else items++;
|
||||
float[] angles = new float[altar.getSizeInventory()];
|
||||
|
||||
float anglePer = 360F / items;
|
||||
float totalAngle = 0F;
|
||||
for(int i = 0; i < angles.length; i++)
|
||||
angles[i] = totalAngle += anglePer;
|
||||
|
||||
for(int i = 0; i < altar.getSizeInventory(); i++) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glTranslatef(1F, 2.5F, 1F);
|
||||
GL11.glRotatef(altar.angles[i], 0F, 1F, 0F);
|
||||
GL11.glRotatef(angles[i] + altar.worldObj.getTotalWorldTime(), 0F, 1F, 0F);
|
||||
GL11.glTranslatef(2.25F, 0F, 0.5F);
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GL11.glTranslated(0D, 0.1 * Math.sin((tileentity.worldObj.getTotalWorldTime() + i * 10) / 5D), 0F);
|
||||
GL11.glTranslated(0D, 0.15 * Math.sin((tileentity.worldObj.getTotalWorldTime() + i * 10) / 5D), 0F);
|
||||
ItemStack stack = altar.getStackInSlot(i);
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if(stack != null) {
|
||||
|
||||
@@ -33,13 +33,11 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
|
||||
|
||||
private static final String TAG_MANA = "mana";
|
||||
|
||||
public float[] angles = new float[getSizeInventory()];
|
||||
boolean firstTick = true;
|
||||
int manaToGet = 0;
|
||||
int mana = 0;
|
||||
|
||||
public boolean addItem(EntityPlayer player, ItemStack stack) {
|
||||
if(stack.itemID == ModItems.twigWand.itemID)
|
||||
if(stack.itemID == ModItems.twigWand.itemID || stack.itemID == ModItems.lexicon.itemID || manaToGet != 0)
|
||||
return false;
|
||||
|
||||
boolean did = false;
|
||||
@@ -70,15 +68,6 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
if(firstTick) {
|
||||
updateRotationAngles();
|
||||
firstTick = false;
|
||||
}
|
||||
|
||||
|
||||
for(int i = 0; i < angles.length; i++)
|
||||
angles[i]++;
|
||||
|
||||
// Update every tick.
|
||||
recieveMana(0);
|
||||
|
||||
@@ -94,12 +83,6 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack) {
|
||||
super.setInventorySlotContents(i, itemstack);
|
||||
updateRotationAngles();
|
||||
}
|
||||
|
||||
public void updateRecipe() {
|
||||
int manaToGet = this.manaToGet;
|
||||
|
||||
@@ -118,19 +101,6 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
|
||||
}
|
||||
}
|
||||
|
||||
public void updateRotationAngles() {
|
||||
int items = 0;
|
||||
for(int i = 0; i < getSizeInventory(); i++)
|
||||
if(getStackInSlot(i) == null)
|
||||
break;
|
||||
else items++;
|
||||
|
||||
float anglePer = 360F / items;
|
||||
float totalAngle = 0F;
|
||||
for(int i = 0; i < angles.length; i++)
|
||||
angles[i] = totalAngle += anglePer;
|
||||
}
|
||||
|
||||
public void onWanded(EntityPlayer player, ItemStack wand) {
|
||||
updateRecipe();
|
||||
|
||||
|
||||
Reference in new issue
Block a user