From e9517194f9cb7679b8db82bd5675d8cd23da7fbe Mon Sep 17 00:00:00 2001 From: WayofTime Date: Thu, 22 Sep 2016 15:37:11 -0400 Subject: [PATCH] Fixed the Sigil of Translocation so that it does not crash when picking up certain blocks. Also removed the damned lightning. #918 --- changelog.txt | 1 + .../WayofTime/bloodmagic/api/BlockStack.java | 1 - .../item/sigil/ItemSigilTransposition.java | 20 +++++++------------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/changelog.txt b/changelog.txt index 9ebd36a8..7f7d96e8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -5,6 +5,7 @@ Version 2.1.0-64 - Changed the recipe of the Acceleration rune so that it is a T4 rune. - Added the Charging rune, which accumulates charge by using the LP from the Blood Altar (1 charge = 1 LP always). If enough charge is stored when crafting, the crafting occurs instantly. - Added the entries for the Rune of Augmented Capacity, Charging Rune, and Rune of Acceleration +- Fixed the Sigil of Translocation so that it does not crash when picking up certain blocks. Also removed the damned lightning. ------------------------------------------------------ Version 2.1.0-63 diff --git a/src/main/java/WayofTime/bloodmagic/api/BlockStack.java b/src/main/java/WayofTime/bloodmagic/api/BlockStack.java index e0a20b44..fe2e9341 100644 --- a/src/main/java/WayofTime/bloodmagic/api/BlockStack.java +++ b/src/main/java/WayofTime/bloodmagic/api/BlockStack.java @@ -7,7 +7,6 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.common.registry.GameData; @Getter @EqualsAndHashCode(exclude = { "state" }) diff --git a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTransposition.java b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTransposition.java index 3746b32f..3db64229 100644 --- a/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTransposition.java +++ b/src/main/java/WayofTime/bloodmagic/item/sigil/ItemSigilTransposition.java @@ -2,12 +2,8 @@ package WayofTime.bloodmagic.item.sigil; import java.util.List; -import WayofTime.bloodmagic.BloodMagic; -import WayofTime.bloodmagic.api.BloodMagicAPI; -import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.effect.EntityLightningBolt; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -23,8 +19,10 @@ import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import WayofTime.bloodmagic.ConfigHandler; import WayofTime.bloodmagic.api.BlockStack; +import WayofTime.bloodmagic.api.BloodMagicAPI; import WayofTime.bloodmagic.api.Constants; import WayofTime.bloodmagic.api.util.helper.NBTHelper; +import WayofTime.bloodmagic.api.util.helper.NetworkHelper; public class ItemSigilTransposition extends ItemSigilBase { @@ -60,7 +58,11 @@ public class ItemSigilTransposition extends ItemSigilBase if (tag.hasKey(Constants.NBT.CONTAINED_BLOCK_NAME) && tag.hasKey(Constants.NBT.CONTAINED_BLOCK_META)) { BlockStack blockStack = new BlockStack(ForgeRegistries.BLOCKS.getValue(new ResourceLocation(tag.getString(Constants.NBT.CONTAINED_BLOCK_NAME))), tag.getByte(Constants.NBT.CONTAINED_BLOCK_META)); - return super.getItemStackDisplayName(stack) + " (" + blockStack.getItemStack().getDisplayName() + ")"; + if (blockStack.getItemStack() != null && blockStack.getItemStack().getItem() != null) //TODO: Figure out why it's a null item. This is a patchwork solution. + { + return super.getItemStackDisplayName(stack) + " (" + blockStack.getItemStack().getDisplayName() + ")"; + } + } return super.getItemStackDisplayName(stack); } @@ -103,7 +105,6 @@ public class ItemSigilTransposition extends ItemSigilBase stack.getTagCompound().setTag(Constants.NBT.CONTAINED_TILE_ENTITY, tileNBTTag); NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, cost); - lightning(world, blockPos); world.removeTileEntity(blockPos); world.setBlockToAir(blockPos); @@ -142,7 +143,6 @@ public class ItemSigilTransposition extends ItemSigilBase stack.getTagCompound().removeTag(Constants.NBT.CONTAINED_BLOCK_META); stack.getTagCompound().removeTag(Constants.NBT.CONTAINED_TILE_ENTITY); - lightning(world, blockPos); return EnumActionResult.SUCCESS; } } @@ -150,10 +150,4 @@ public class ItemSigilTransposition extends ItemSigilBase } return EnumActionResult.FAIL; } - - public void lightning(World world, BlockPos blockPos) - { - world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY(), blockPos.getZ(), true)); - } - }