Fixed the Mana Prism accepting non lens items through automation and crashing the game if any make it in. Closes #1527

This commit is contained in:
Vasco Lavos committed 2015-11-10 23:59:05 +00:00
1 parent 811ed70ef6
commit fd7a2f887d
2 files changed
+25 -7

No files matched your search

@@ -36,12 +36,14 @@ public class RenderTilePrism extends TileEntitySpecialRenderer {
if(stack != null) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
ILens lens = (ILens) stack.getItem();
GL11.glPushMatrix();
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glTranslatef(0F, 0F, pos);
RenderLens.render(stack, lens.getLensColor(stack));
GL11.glPopMatrix();
if(stack.getItem() instanceof ILens) {
ILens lens = (ILens) stack.getItem();
GL11.glPushMatrix();
GL11.glRotatef(90F, 1F, 0F, 0F);
GL11.glTranslatef(0F, 0F, pos);
RenderLens.render(stack, lens.getLensColor(stack));
GL11.glPopMatrix();
}
}
GL11.glPopMatrix();
}
@@ -11,6 +11,7 @@
package vazkii.botania.common.block.tile.mana;
import net.minecraft.entity.Entity;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.api.mana.BurstProperties;
@@ -20,7 +21,7 @@ import vazkii.botania.api.mana.ITinyPlanetExcempt;
import vazkii.botania.common.block.tile.TileSimpleInventory;
import vazkii.botania.common.lib.LibBlockNames;
public class TilePrism extends TileSimpleInventory implements IManaCollisionGhost {
public class TilePrism extends TileSimpleInventory implements IManaCollisionGhost, ISidedInventory {
public void onBurstCollision(IManaBurst burst) {
ItemStack lens = getStackInSlot(0);
@@ -63,4 +64,19 @@ public class TilePrism extends TileSimpleInventory implements IManaCollisionGhos
return LibBlockNames.PRISM;
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return new int[] { 0 };
}
@Override
public boolean canInsertItem(int p_102007_1_, ItemStack p_102007_2_, int p_102007_3_) {
return p_102007_2_.getItem() instanceof ILens;
}
@Override
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
return true;
}
}