A whole lot of formatting cleanup
Also changes NBTHolder to a standard Constants class with subclasses for each category
This commit is contained in:
parent
f9802900db
commit
34dee6447b
74 changed files with 861 additions and 662 deletions
|
@ -1,6 +1,6 @@
|
|||
package WayofTime.bloodmagic.item;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -13,12 +13,12 @@ import java.util.List;
|
|||
|
||||
public class ItemActivationCrystal extends ItemBindable {
|
||||
|
||||
public static String[] names = { "weak", "awakened", "creative" };
|
||||
public static String[] names = {"weak", "awakened", "creative"};
|
||||
|
||||
public ItemActivationCrystal() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".activationCrystal.");
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".activationCrystal.");
|
||||
setHasSubtypes(true);
|
||||
setEnergyUsed(100);
|
||||
}
|
||||
|
|
|
@ -2,9 +2,10 @@ package WayofTime.bloodmagic.item;
|
|||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||
import WayofTime.bloodmagic.api.NBTHolder;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import com.google.common.base.Strings;
|
||||
|
@ -32,30 +33,6 @@ public class ItemBindable extends Item implements IBindable {
|
|||
setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
NBTHolder.checkNBT(stack);
|
||||
|
||||
if (!Strings.isNullOrEmpty(stack.getTagCompound().getString(NBTHolder.NBT_OWNER)))
|
||||
tooltip.add(TextHelper.getFormattedText(String.format(StatCollector.translateToLocal("tooltip.BloodMagic.currentOwner"), stack.getTagCompound().getString(NBTHolder.NBT_OWNER))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
BindableHelper.checkAndSetItemOwner(stack, player);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
BindableHelper.checkAndSetItemOwner(stack, player);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean syphonBatteries(ItemStack stack, EntityPlayer player, int damageToBeDone) {
|
||||
if (!player.worldObj.isRemote) {
|
||||
return NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(BindableHelper.getOwnerName(stack), player.worldObj), damageToBeDone);
|
||||
|
@ -94,6 +71,30 @@ public class ItemBindable extends Item implements IBindable {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
if (!Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_NAME)))
|
||||
tooltip.add(TextHelper.getFormattedText(String.format(StatCollector.translateToLocal("tooltip.BloodMagic.currentOwner"), stack.getTagCompound().getString(Constants.NBT.OWNER_NAME))));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
BindableHelper.checkAndSetItemOwner(stack, player);
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
BindableHelper.checkAndSetItemOwner(stack, player);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void damagePlayer(World world, EntityPlayer player, int damage) {
|
||||
if (world != null) {
|
||||
double posX = player.posX;
|
||||
|
@ -127,9 +128,9 @@ public class ItemBindable extends Item implements IBindable {
|
|||
}
|
||||
|
||||
public String getBindableOwner(ItemStack stack) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
||||
return stack.getTagCompound().getString(NBTHolder.NBT_OWNER);
|
||||
return stack.getTagCompound().getString(Constants.NBT.OWNER_NAME);
|
||||
}
|
||||
|
||||
// IBindable
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package WayofTime.bloodmagic.item;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.NBTHolder;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.orb.BloodOrb;
|
||||
import WayofTime.bloodmagic.api.orb.IBloodOrb;
|
||||
|
@ -23,7 +22,7 @@ import java.util.List;
|
|||
public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable {
|
||||
|
||||
public ItemBloodOrb() {
|
||||
setUnlocalizedName(BloodMagic.MODID + ".orb.");
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".orb.");
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
|
@ -53,19 +52,19 @@ public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable {
|
|||
world.playSoundEffect((double) ((float) posX + 0.5F), (double) ((float) posY + 0.5F), (double) ((float) posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
// SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.getDimensionId(), 4, posX, posY, posZ);
|
||||
|
||||
if(PlayerHelper.isFakePlayer(player))
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return stack;
|
||||
|
||||
if (Strings.isNullOrEmpty(stack.getTagCompound().getString(NBTHolder.NBT_OWNER)))
|
||||
if (Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_NAME)))
|
||||
return stack;
|
||||
|
||||
if (world.isRemote)
|
||||
return stack;
|
||||
|
||||
if(stack.getTagCompound().getString(NBTHolder.NBT_OWNER).equals(PlayerHelper.getUsernameFromPlayer(player)))
|
||||
NetworkHelper.setMaxOrbToMax(NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(NBTHolder.NBT_OWNER), world), getOrbLevel(stack.getItemDamage()));
|
||||
if (stack.getTagCompound().getString(Constants.NBT.OWNER_NAME).equals(PlayerHelper.getUsernameFromPlayer(player)))
|
||||
NetworkHelper.setMaxOrbToMax(NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_NAME), world), getOrbLevel(stack.getItemDamage()));
|
||||
|
||||
NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(NBTHolder.NBT_OWNER), world).addLifeEssence(200, getMaxEssence(stack.getItemDamage()));
|
||||
NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_NAME), world).addLifeEssence(200, getMaxEssence(stack.getItemDamage()));
|
||||
hurtPlayer(player, 200);
|
||||
return stack;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package WayofTime.bloodmagic.item;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
|
@ -10,7 +11,7 @@ public class ItemBucketEssence extends ItemBucket {
|
|||
public ItemBucketEssence() {
|
||||
super(ModBlocks.lifeEssence);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".bucket.lifeEssence");
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".bucket.lifeEssence");
|
||||
setContainerItem(Items.bucket);
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package WayofTime.bloodmagic.item;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.DamageSourceBloodMagic;
|
||||
import WayofTime.bloodmagic.api.altar.IBloodAltar;
|
||||
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
|
||||
|
@ -30,7 +31,7 @@ public class ItemSacrificialDagger extends Item {
|
|||
public ItemSacrificialDagger() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".sacrificialDagger.");
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".sacrificialDagger.");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setHasSubtypes(true);
|
||||
setMaxStackSize(1);
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
package WayofTime.bloodmagic.item;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ItemTelepositionFocus extends ItemBindable {
|
||||
|
||||
public static String[] names = {"weak", "enhanced", "reinforced", "demonic"};
|
||||
|
||||
public ItemTelepositionFocus() {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".focus.");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
setMaxStackSize(1);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void getSubItems(Item id, CreativeTabs creativeTab, List list) {
|
||||
for (int i = 0; i < names.length; i++)
|
||||
list.add(new ItemStack(id, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (BindableHelper.checkAndSetItemOwner(stack, player))
|
||||
if (player.isSneaking())
|
||||
return stack;
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advanced) {
|
||||
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localize("tooltip.BloodMagic.telepositionfocus." + names[stack.getItemDamage()]))));
|
||||
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
BlockPos coords = getBlockPos(stack);
|
||||
|
||||
tooltip.add(String.format(StatCollector.translateToLocal("tooltip.alchemy.coords"), coords.getX(), coords.getY(), coords.getZ()));
|
||||
tooltip.add(String.format(StatCollector.translateToLocal("tooltip.alchemy.dimension"), tag.getInteger(Constants.NBT.DIMENSION_ID)));
|
||||
}
|
||||
|
||||
public World getWorld(ItemStack stack) {
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return DimensionManager.getWorld(stack.getTagCompound().getInteger(Constants.NBT.DIMENSION_ID));
|
||||
}
|
||||
|
||||
public BlockPos getBlockPos(ItemStack stack) {
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return new BlockPos(stack.getTagCompound().getInteger(Constants.NBT.X_COORD), stack.getTagCompound().getInteger(Constants.NBT.Y_COORD), stack.getTagCompound().getInteger(Constants.NBT.Z_COORD));
|
||||
}
|
||||
|
||||
public ItemStack setBlockPos(ItemStack stack, World world, BlockPos pos) {
|
||||
NBTTagCompound itemTag = stack.getTagCompound();
|
||||
itemTag.setInteger(Constants.NBT.X_COORD, pos.getX());
|
||||
itemTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
|
||||
itemTag.setInteger(Constants.NBT.Z_COORD, pos.getZ());
|
||||
itemTag.setInteger(Constants.NBT.DIMENSION_ID, world.provider.getDimensionId());
|
||||
return stack;
|
||||
}
|
||||
}
|
|
@ -1,37 +1,39 @@
|
|||
package WayofTime.bloodmagic.item.armour;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.registry.ModItems;
|
||||
|
||||
public class ItemLivingArmour extends ItemArmor {
|
||||
|
||||
public static String[] names = { "helmet", "chest", "legs", "boots" };
|
||||
public ItemLivingArmour(int armorType) {
|
||||
super(ItemArmor.ArmorMaterial.IRON, 0, armorType);
|
||||
setUnlocalizedName(BloodMagic.MODID + ".livingArmour.");
|
||||
setMaxDamage(250);
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
public static String[] names = {"helmet", "chest", "legs", "boots"};
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
if (this == ModItems.livingArmourChest
|
||||
|| this == ModItems.livingArmourHelmet
|
||||
|| this == ModItems.livingArmourBoots) {
|
||||
return "bloodmagic:models/armor/boundArmour_layer_1.png";
|
||||
}
|
||||
public ItemLivingArmour(int armorType) {
|
||||
super(ItemArmor.ArmorMaterial.IRON, 0, armorType);
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".livingArmour.");
|
||||
setMaxDamage(250);
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
||||
if (this == ModItems.livingArmourLegs) {
|
||||
return "bloodmagic:models/armor/boundArmour_layer_2.png";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
if (this == ModItems.livingArmourChest
|
||||
|| this == ModItems.livingArmourHelmet
|
||||
|| this == ModItems.livingArmourBoots) {
|
||||
return "bloodmagic:models/armor/boundArmour_layer_1.png";
|
||||
}
|
||||
|
||||
if (this == ModItems.livingArmourLegs) {
|
||||
return "bloodmagic:models/armor/boundArmour_layer_2.png";
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
return super.getUnlocalizedName(stack) + names[armorType];
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package WayofTime.bloodmagic.item.block;
|
||||
|
||||
import WayofTime.bloodmagic.block.BlockRitualStone;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.block.BlockRitualStone;
|
||||
|
||||
public class ItemBlockRitualStone extends ItemBlock {
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package WayofTime.bloodmagic.item.gear;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.NBTHolder;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarManipulator;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -23,7 +24,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator {
|
|||
public ItemPackSacrifice() {
|
||||
super(ArmorMaterial.CHAIN, 0, 1);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".pack.sacrifice");
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".pack.sacrifice");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
||||
|
@ -45,10 +46,10 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator {
|
|||
|
||||
TileAltar altar = (TileAltar) tile;
|
||||
|
||||
if(!altar.isActive()) {
|
||||
if (!altar.isActive()) {
|
||||
int amount = this.getStoredLP(stack);
|
||||
|
||||
if(amount > 0) {
|
||||
if (amount > 0) {
|
||||
int filledAmount = altar.fillMainTank(amount);
|
||||
amount -= filledAmount;
|
||||
setStoredLP(stack, amount);
|
||||
|
@ -63,19 +64,19 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator {
|
|||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return BloodMagic.DOMAIN + "models/armor/bloodPack_layer_1.png";
|
||||
return Constants.Mod.DOMAIN + "models/armor/bloodPack_layer_1.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
list.add(TextHelper.localize("tooltip.BloodMagic.pack.sacrifice.desc"));
|
||||
list.add(TextHelper.localize("tooltip.BloodMagic.pack.stored", getStoredLP(stack)));
|
||||
}
|
||||
|
||||
public void addLP(ItemStack stack, int toAdd) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
||||
if (toAdd < 0)
|
||||
toAdd = 0;
|
||||
|
@ -87,12 +88,12 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator {
|
|||
}
|
||||
|
||||
public void setStoredLP(ItemStack stack, int lp) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
stack.getTagCompound().setInteger(NBTHolder.NBT_STORED_LP, lp);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
stack.getTagCompound().setInteger(Constants.NBT.STORED_LP, lp);
|
||||
}
|
||||
|
||||
public int getStoredLP(ItemStack stack) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
return stack.getTagCompound().getInteger(NBTHolder.NBT_STORED_LP);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack.getTagCompound().getInteger(Constants.NBT.STORED_LP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
package WayofTime.bloodmagic.item.gear;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.NBTHolder;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.altar.IAltarManipulator;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||
import WayofTime.bloodmagic.tile.TileAltar;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
|
@ -16,7 +17,7 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulator{
|
||||
public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulator {
|
||||
|
||||
public final int CONVERSION = 100; // How much LP per half heart
|
||||
public final int CAPACITY = 10000; // Max LP storage
|
||||
|
@ -26,7 +27,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
|
|||
public ItemPackSelfSacrifice() {
|
||||
super(ArmorMaterial.CHAIN, 0, 1);
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".pack.selfSacrifice");
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".pack.selfSacrifice");
|
||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||
}
|
||||
|
||||
|
@ -48,10 +49,10 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
|
|||
|
||||
TileAltar altar = (TileAltar) tile;
|
||||
|
||||
if(!altar.isActive()) {
|
||||
if (!altar.isActive()) {
|
||||
int amount = this.getStoredLP(stack);
|
||||
|
||||
if(amount > 0) {
|
||||
if (amount > 0) {
|
||||
int filledAmount = altar.fillMainTank(amount);
|
||||
amount -= filledAmount;
|
||||
setStoredLP(stack, amount);
|
||||
|
@ -79,19 +80,19 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
|
|||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return BloodMagic.DOMAIN + "models/armor/bloodPack_layer_1.png";
|
||||
return Constants.Mod.DOMAIN + "models/armor/bloodPack_layer_1.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
list.add(TextHelper.localize("tooltip.BloodMagic.pack.selfSacrifice.desc"));
|
||||
list.add(TextHelper.localize("tooltip.BloodMagic.pack.stored", getStoredLP(stack)));
|
||||
}
|
||||
|
||||
public void addLP(ItemStack stack, int toAdd) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
|
||||
if (toAdd < 0)
|
||||
toAdd = 0;
|
||||
|
@ -103,12 +104,12 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
|
|||
}
|
||||
|
||||
public void setStoredLP(ItemStack stack, int lp) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
stack.getTagCompound().setInteger(NBTHolder.NBT_STORED_LP, lp);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
stack.getTagCompound().setInteger(Constants.NBT.STORED_LP, lp);
|
||||
}
|
||||
|
||||
public int getStoredLP(ItemStack stack) {
|
||||
stack = NBTHolder.checkNBT(stack);
|
||||
return stack.getTagCompound().getInteger(NBTHolder.NBT_STORED_LP);
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack.getTagCompound().getInteger(Constants.NBT.STORED_LP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.NBTHolder;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.ISigil;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
import WayofTime.bloodmagic.item.ItemBindable;
|
||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -20,14 +20,14 @@ import java.util.List;
|
|||
@Getter
|
||||
public class ItemSigilBase extends ItemBindable implements ISigil {
|
||||
|
||||
protected final String tooltipBase;
|
||||
private final String name;
|
||||
private boolean toggleable;
|
||||
protected final String tooltipBase;
|
||||
|
||||
public ItemSigilBase(String name, int energyUsed) {
|
||||
super();
|
||||
|
||||
setUnlocalizedName(BloodMagic.MODID + ".sigil." + name);
|
||||
setUnlocalizedName(Constants.Mod.MODID + ".sigil." + name);
|
||||
setEnergyUsed(energyUsed);
|
||||
|
||||
this.name = name;
|
||||
|
@ -68,15 +68,15 @@ public class ItemSigilBase extends ItemBindable implements ISigil {
|
|||
}
|
||||
|
||||
public boolean isUnusable(ItemStack stack) {
|
||||
NBTHolder.checkNBT(stack);
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
return stack.getTagCompound().getBoolean(NBTHolder.NBT_UNUSABLE);
|
||||
return stack.getTagCompound().getBoolean(Constants.NBT.UNUSABLE);
|
||||
}
|
||||
|
||||
public ItemStack setUnusable(ItemStack stack, boolean unusable) {
|
||||
NBTHolder.checkNBT(stack);
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
stack.getTagCompound().setBoolean(NBTHolder.NBT_UNUSABLE, unusable);
|
||||
stack.getTagCompound().setBoolean(Constants.NBT.UNUSABLE, unusable);
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@ public class ItemSigilLava extends ItemSigilBase {
|
|||
this.tryPlaceLava(world, blockpos1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -114,11 +113,9 @@ public class ItemSigilLava extends ItemSigilBase {
|
|||
public boolean canPlaceLava(World world, BlockPos blockPos) {
|
||||
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock().getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
else if ((world.getBlockState(blockPos).getBlock() == Blocks.lava || world.getBlockState(blockPos).getBlock() == Blocks.flowing_lava) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0) {
|
||||
} else if ((world.getBlockState(blockPos).getBlock() == Blocks.lava || world.getBlockState(blockPos).getBlock() == Blocks.flowing_lava) && world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos)) == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
world.setBlockState(blockPos, Blocks.lava.getBlockState().getBaseState());
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -47,8 +47,7 @@ public class ItemSigilVoid extends ItemSigilBase {
|
|||
return stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@ public class ItemSigilWater extends ItemSigilBase {
|
|||
this.tryPlaceWater(world, blockpos1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
@ -123,8 +122,7 @@ public class ItemSigilWater extends ItemSigilBase {
|
|||
|
||||
if (!worldIn.isAirBlock(pos) && !flag) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (worldIn.provider.doesWaterVaporize()) {
|
||||
int i = pos.getX();
|
||||
int j = pos.getY();
|
||||
|
@ -134,8 +132,7 @@ public class ItemSigilWater extends ItemSigilBase {
|
|||
for (int l = 0; l < 8; ++l) {
|
||||
worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D, 0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (!worldIn.isRemote && flag && !material.isLiquid()) {
|
||||
worldIn.destroyBlock(pos, true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue