Added a check for illegal block items around the Pure Daisy. Fixes a weird crash.

This commit is contained in:
Vasco Lavos committed 2014-05-18 15:17:21 +01:00
1 parent f2999c30cd
commit a1f5c83bcb
1 file changed
+20 -16
@@ -13,6 +13,7 @@ package vazkii.botania.common.block.subtile;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates;
@@ -57,27 +58,30 @@ public class SubTilePureDaisy extends SubTileEntity {
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord + acoords[0], supertile.yCoord + acoords[1], supertile.zCoord + acoords[2]);
Block block = supertile.getWorldObj().getBlock(coords.posX, coords.posY, coords.posZ);
if(block != Blocks.air) {
String oredict = OreDictionary.getOreName(OreDictionary.getOreID(new ItemStack(block, 1, supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ))));
Block output = oredict.equals("stone") ? ModBlocks.livingrock : oredict.endsWith("logWood") ? ModBlocks.livingwood : null;
if(output != null) {
ticksRemaining[positionAt] = ticksRemaining[positionAt] - 1;
Item item = Item.getItemFromBlock(block);
if(item != null) {
String oredict = OreDictionary.getOreName(OreDictionary.getOreID(new ItemStack(item, 1, supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ))));
Block output = oredict.equals("stone") ? ModBlocks.livingrock : oredict.endsWith("logWood") ? ModBlocks.livingwood : null;
if(output != null) {
ticksRemaining[positionAt] = ticksRemaining[positionAt] - 1;
Botania.proxy.sparkleFX(supertile.getWorldObj(), coords.posX + Math.random(), coords.posY + Math.random(), coords.posZ + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5);
Botania.proxy.sparkleFX(supertile.getWorldObj(), coords.posX + Math.random(), coords.posY + Math.random(), coords.posZ + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5);
if(ticksRemaining[positionAt] <= 0) {
supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, output);
ticksRemaining[positionAt] = 200;
if(ticksRemaining[positionAt] <= 0) {
supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, output);
ticksRemaining[positionAt] = 200;
for(int i = 0; i < 25; i++) {
double x = coords.posX + Math.random();
double y = coords.posY + Math.random() + 0.5;
double z = coords.posZ + Math.random();
for(int i = 0; i < 25; i++) {
double x = coords.posX + Math.random();
double y = coords.posY + Math.random() + 0.5;
double z = coords.posZ + Math.random();
Botania.proxy.wispFX(supertile.getWorldObj(), x, y, z, 1F, 1F, 1F, (float) Math.random() / 2F);
Botania.proxy.wispFX(supertile.getWorldObj(), x, y, z, 1F, 1F, 1F, (float) Math.random() / 2F);
}
supertile.getWorldObj().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(block) + (supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ) << 12));
}
supertile.getWorldObj().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(block) + (supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ) << 12));
}
} else ticksRemaining[positionAt] = 200;
} else ticksRemaining[positionAt] = 200;
}
}
}