remove out commentec code

run SA
This commit is contained in:
Martin Robertz committed 2022-11-08 19:34:25 +01:00
1 parent b846e30b67
commit 2b27b551a3
795 files changed
+33663 -37253

No files matched your search

@@ -1,11 +1,14 @@
package WayofTime.alchemicalWizardry.api.items;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.api.spell.SpellEffect;
import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -24,20 +27,14 @@ import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.ForgeDirection;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.api.spell.SpellEffect;
import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool;
public class ItemSpellMultiTool extends Item
{
public class ItemSpellMultiTool extends Item {
private static final String harvestLevelSuffix = "harvestLvl";
private static final String digLevelSuffix = "digLvl";
private static final String tagName = "BloodMagicTool";
private Random rand = new Random();
public ItemSpellMultiTool()
{
public ItemSpellMultiTool() {
super();
this.setMaxDamage(0);
this.setMaxStackSize(1);
@@ -45,39 +42,37 @@ public class ItemSpellMultiTool extends Item
}
@Override
public void registerIcons(IIconRegister iconRegister)
{
public void registerIcons(IIconRegister iconRegister) {
this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundTool");
}
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase)
{
public boolean hitEntity(
ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) {
float damage = this.getCustomItemAttack(par1ItemStack);
float f = (float)par3EntityLivingBase.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
float f = (float) par3EntityLivingBase
.getEntityAttribute(SharedMonsterAttributes.attackDamage)
.getAttributeValue();
SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack);
if (parad != null)
{
if (parad != null) {
parad.onLeftClickEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase);
}
damage += parad.getAddedDamageForEntity(par2EntityLivingBase);
if (rand.nextFloat() < this.getCritChance(par1ItemStack))
{
if (rand.nextFloat() < this.getCritChance(par1ItemStack)) {
damage *= 1.75f;
}
damage *= f;
if (par3EntityLivingBase instanceof EntityPlayer)
{
par2EntityLivingBase.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) par3EntityLivingBase), damage);
} else
{
if (par3EntityLivingBase instanceof EntityPlayer) {
par2EntityLivingBase.attackEntityFrom(
DamageSource.causePlayerDamage((EntityPlayer) par3EntityLivingBase), damage);
} else {
par2EntityLivingBase.attackEntityFrom(DamageSource.causeMobDamage(par3EntityLivingBase), damage);
}
@@ -85,12 +80,10 @@ public class ItemSpellMultiTool extends Item
}
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
SpellParadigmTool parad = this.loadParadigmFromStack(stack);
if (parad != null && entity instanceof EntityLivingBase)
{
if (parad != null && entity instanceof EntityLivingBase) {
parad.onLeftClickEntity(stack, (EntityLivingBase) entity, player);
}
@@ -98,21 +91,17 @@ public class ItemSpellMultiTool extends Item
}
@Override
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player)
{
if (player.worldObj.isRemote)
{
public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
if (player.worldObj.isRemote) {
return false;
}
if (!stack.hasTagCompound())
return false;
if (!stack.hasTagCompound()) return false;
World world = player.worldObj;
Block block = player.worldObj.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if (block == null || block == Blocks.air)
return false;
if (block == null || block == Blocks.air) return false;
int hlvl = -1;
float blockHardness = block.getBlockHardness(world, x, y, z);
@@ -121,54 +110,51 @@ public class ItemSpellMultiTool extends Item
Block localBlock = world.getBlock(x, y, z);
int localMeta = world.getBlockMetadata(x, y, z);
String toolClass = block.getHarvestTool(meta);
if (toolClass != null && this.getHarvestLevel(stack, toolClass) != -1)
hlvl = block.getHarvestLevel(meta);
if (toolClass != null && this.getHarvestLevel(stack, toolClass) != -1) hlvl = block.getHarvestLevel(meta);
int toolLevel = this.getHarvestLevel(stack, toolClass);
float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z);
if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness)
{
if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness) {
boolean cancelHarvest = false;
if (!cancelHarvest)
{
if (localBlock != null && !(localHardness < 0))
{
if (!cancelHarvest) {
if (localBlock != null && !(localHardness < 0)) {
boolean isEffective = false;
String localToolClass = this.getToolClassForMaterial(localBlock.getMaterial());
if (localToolClass != null && this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localMeta))
{
if (localToolClass != null
&& this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localMeta)) {
isEffective = true;
}
if (localBlock.getMaterial().isToolNotRequired())
{
if (localBlock.getMaterial().isToolNotRequired()) {
isEffective = true;
}
if (!player.capabilities.isCreativeMode)
{
if (isEffective)
{
if (localBlock.removedByPlayer(world, player, x, y, z, true))
{
if (!player.capabilities.isCreativeMode) {
if (isEffective) {
if (localBlock.removedByPlayer(world, player, x, y, z, true)) {
localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta);
}
localBlock.onBlockHarvested(world, x, y, z, localMeta, player);
if (blockHardness > 0f)
onBlockDestroyed(stack, world, localBlock, x, y, z, player);
if (blockHardness > 0f) onBlockDestroyed(stack, world, localBlock, x, y, z, player);
List<ItemStack> items = APISpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, this.getSilkTouch(stack), this.getFortuneLevel(stack));
List<ItemStack> items = APISpellHelper.getItemsFromBlock(
world,
localBlock,
x,
y,
z,
localMeta,
this.getSilkTouch(stack),
this.getFortuneLevel(stack));
SpellParadigmTool parad = this.loadParadigmFromStack(stack);
List<ItemStack> newItems = parad.handleItemList(stack, items);
if (!world.isRemote)
{
if (!world.isRemote) {
APISpellHelper.spawnItemListInWorld(newItems, world, x + 0.5f, y + 0.5f, z + 0.5f);
}
@@ -176,22 +162,29 @@ public class ItemSpellMultiTool extends Item
int cost = 0;
cost += parad.digSurroundingArea(stack, world, player, mop, localToolClass, localHardness, toolLevel, this);
cost += parad.digSurroundingArea(
stack, world, player, mop, localToolClass, localHardness, toolLevel, this);
cost += parad.onBreakBlock(stack, world, player, localBlock, localMeta, x, y, z, ForgeDirection.getOrientation(mop.sideHit));
cost += parad.onBreakBlock(
stack,
world,
player,
localBlock,
localMeta,
x,
y,
z,
ForgeDirection.getOrientation(mop.sideHit));
if (cost > 0)
{
SoulNetworkHandler.syphonAndDamageFromNetwork(stack, player, cost);
if (cost > 0) {
SoulNetworkHandler.syphonAndDamageFromNetwork(stack, player, cost);
}
} else
{
} else {
world.setBlockToAir(x, y, z);
world.func_147479_m(x, y, z);
}
} else
{
} else {
world.setBlockToAir(x, y, z);
world.func_147479_m(x, y, z);
}
@@ -199,56 +192,54 @@ public class ItemSpellMultiTool extends Item
}
}
// if (!world.isRemote)
// world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
// if (!world.isRemote)
// world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
return true;
}
public Material[] getMaterialsForToolclass(String toolClass)
{
if ("pickaxe".equals(toolClass))
{
return new Material[]{Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.circuits};
} else if ("shovel".equals(toolClass))
{
return new Material[]{Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay};
} else if ("axe".equals(toolClass))
{
return new Material[]{Material.wood, Material.vine, Material.circuits, Material.cactus};
public Material[] getMaterialsForToolclass(String toolClass) {
if ("pickaxe".equals(toolClass)) {
return new Material[] {
Material.rock,
Material.iron,
Material.ice,
Material.glass,
Material.piston,
Material.anvil,
Material.circuits
};
} else if ("shovel".equals(toolClass)) {
return new Material[] {
Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay
};
} else if ("axe".equals(toolClass)) {
return new Material[] {Material.wood, Material.vine, Material.circuits, Material.cactus};
}
return new Material[0];
}
public String getToolClassForMaterial(Material mat)
{
public String getToolClassForMaterial(Material mat) {
String testString = "pickaxe";
Material[] matList = this.getMaterialsForToolclass(testString);
for (int i = 0; i < matList.length; i++)
{
if (matList[i] == mat)
{
for (int i = 0; i < matList.length; i++) {
if (matList[i] == mat) {
return testString;
}
}
testString = "shovel";
matList = this.getMaterialsForToolclass(testString);
for (int i = 0; i < matList.length; i++)
{
if (matList[i] == mat)
{
for (int i = 0; i < matList.length; i++) {
if (matList[i] == mat) {
return testString;
}
}
testString = "axe";
matList = this.getMaterialsForToolclass(testString);
for (int i = 0; i < matList.length; i++)
{
if (matList[i] == mat)
{
for (int i = 0; i < matList.length; i++) {
if (matList[i] == mat) {
return testString;
}
}
@@ -256,22 +247,18 @@ public class ItemSpellMultiTool extends Item
return null;
}
public Set<String> getToolClasses(ItemStack stack)
{
public Set<String> getToolClasses(ItemStack stack) {
Set<String> set = new HashSet();
if (this.getHarvestLevel(stack, "pickaxe") > -1)
{
if (this.getHarvestLevel(stack, "pickaxe") > -1) {
set.add("pickaxe");
}
if (this.getHarvestLevel(stack, "axe") > -1)
{
if (this.getHarvestLevel(stack, "axe") > -1) {
set.add("axe");
}
if (this.getHarvestLevel(stack, "shovel") > -1)
{
if (this.getHarvestLevel(stack, "shovel") > -1) {
set.add("shovel");
}
@@ -279,70 +266,56 @@ public class ItemSpellMultiTool extends Item
}
@Override
public float getDigSpeed(ItemStack stack, Block block, int meta)
{
public float getDigSpeed(ItemStack stack, Block block, int meta) {
String toolClass = block.getHarvestTool(meta);
if (toolClass == null || toolClass.equals(""))
{
toolClass = getToolClassOfMaterial(block.getMaterial());
if(toolClass == "")
{
if (toolClass == null || toolClass.equals("")) {
toolClass = getToolClassOfMaterial(block.getMaterial());
if (toolClass == "") {
return 1.0f;
}
}
}
{
if (stack.hasTagCompound())
{
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getFloat(digLevelSuffix + toolClass);
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
}
}
return 1.0f;
}
public String getToolClassOfMaterial(Material mat)
{
if(mat == Material.iron || mat == Material.anvil || mat == Material.rock)
{
return "pickaxe";
public String getToolClassOfMaterial(Material mat) {
if (mat == Material.iron || mat == Material.anvil || mat == Material.rock) {
return "pickaxe";
}
if(mat == Material.wood || mat == Material.plants || mat == Material.vine)
{
return "axe";
if (mat == Material.wood || mat == Material.plants || mat == Material.vine) {
return "axe";
}
if(mat == Material.ground || mat == Material.grass)
{
return "shovel";
if (mat == Material.ground || mat == Material.grass) {
return "shovel";
}
return "";
return "";
}
@Override
public int getHarvestLevel(ItemStack stack, String toolClass)
{
if (stack.hasTagCompound())
{
public int getHarvestLevel(ItemStack stack, String toolClass) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
if (tag.hasKey(harvestLevelSuffix + toolClass))
{
if (tag.hasKey(harvestLevelSuffix + toolClass)) {
return tag.getInteger(harvestLevelSuffix + toolClass);
} else
{
} else {
return -1;
}
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
}
@@ -350,23 +323,19 @@ public class ItemSpellMultiTool extends Item
}
@Override
public boolean canHarvestBlock(Block par1Block, ItemStack itemStack)
{
public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) {
return true;
}
@Override
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack)
{
public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) {
return false;
}
@Override
public void onUpdate(ItemStack toolStack, World world, Entity par3Entity, int par4, boolean par5)
{
if (world.isRemote)
{
public void onUpdate(ItemStack toolStack, World world, Entity par3Entity, int par4, boolean par5) {
if (world.isRemote) {
return;
}
@@ -378,8 +347,7 @@ public class ItemSpellMultiTool extends Item
int duration = Math.max(this.getDuration(toolStack, world), 0);
if (duration <= 0 && par3Entity instanceof EntityPlayer)
{
if (duration <= 0 && par3Entity instanceof EntityPlayer) {
int banishCost = parad.onBanishTool(toolStack, world, par3Entity, par4, par5);
SoulNetworkHandler.syphonAndDamageFromNetwork(toolStack, (EntityPlayer) par3Entity, banishCost);
((EntityPlayer) par3Entity).inventory.mainInventory[par4] = this.getContainedCrystal(toolStack);
@@ -387,10 +355,8 @@ public class ItemSpellMultiTool extends Item
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par3EntityPlayer.isSneaking())
{
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if (par3EntityPlayer.isSneaking()) {
par3EntityPlayer.setCurrentItemOrArmor(0, this.getContainedCrystal(par1ItemStack));
return par1ItemStack;
}
@@ -401,36 +367,29 @@ public class ItemSpellMultiTool extends Item
int cost = 0;
if (mop != null && mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK))
{
if (mop != null && mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) {
cost = parad.onRightClickBlock(par1ItemStack, par3EntityPlayer, par2World, mop);
} else
{
} else {
cost = parad.onRightClickAir(par1ItemStack, par2World, par3EntityPlayer);
}
if (cost > 0)
{
SoulNetworkHandler.syphonAndDamageFromNetwork(par1ItemStack, par3EntityPlayer, cost);
if (cost > 0) {
SoulNetworkHandler.syphonAndDamageFromNetwork(par1ItemStack, par3EntityPlayer, cost);
}
return par1ItemStack;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
par3List.add("A mace filled with ancient alchemy");
if (!(par1ItemStack.getTagCompound() == null))
{
if (!par1ItemStack.getTagCompound().getString("ownerName").equals(""))
{
if (!(par1ItemStack.getTagCompound() == null)) {
if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) {
par3List.add("Current owner: " + par1ItemStack.getTagCompound().getString("ownerName"));
}
for (String str : this.getToolListString(par1ItemStack))
{
for (String str : this.getToolListString(par1ItemStack)) {
par3List.add(str);
}
@@ -442,19 +401,16 @@ public class ItemSpellMultiTool extends Item
}
}
//--------------Custom methods--------------//
// --------------Custom methods--------------//
public void setHarvestLevel(ItemStack stack, String toolClass, int harvestLevel)
{
if (stack.hasTagCompound())
{
public void setHarvestLevel(ItemStack stack, String toolClass, int harvestLevel) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setInteger(harvestLevelSuffix + toolClass, Math.max(-1, harvestLevel));
stack.getTagCompound().setTag(tagName, tag);
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
@@ -465,17 +421,14 @@ public class ItemSpellMultiTool extends Item
}
}
public void setDigSpeed(ItemStack stack, String toolClass, float digSpeed)
{
if (stack.hasTagCompound())
{
public void setDigSpeed(ItemStack stack, String toolClass, float digSpeed) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setFloat(digLevelSuffix + toolClass, digSpeed);
stack.getTagCompound().setTag(tagName, tag);
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
@@ -486,32 +439,26 @@ public class ItemSpellMultiTool extends Item
}
}
public float getDigSpeed(ItemStack stack, String toolClass)
{
if (stack.hasTagCompound())
{
public float getDigSpeed(ItemStack stack, String toolClass) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getFloat(digLevelSuffix + toolClass);
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
return 0.0f;
}
}
public void setItemAttack(ItemStack stack, float damage)
{
if (stack.hasTagCompound())
{
public void setItemAttack(ItemStack stack, float damage) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setFloat("itemAttack", Math.max(damage, 0.0f));
stack.getTagCompound().setTag(tagName, tag);
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
@@ -522,40 +469,33 @@ public class ItemSpellMultiTool extends Item
}
}
public float getCustomItemAttack(ItemStack stack)
{
if (stack.hasTagCompound())
{
public float getCustomItemAttack(ItemStack stack) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getFloat("itemAttack");
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
return 0.0f;
}
}
public ItemStack getContainedCrystal(ItemStack container)
{
if (container.hasTagCompound())
{
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName).getCompoundTag("heldItem");
public ItemStack getContainedCrystal(ItemStack container) {
if (container.hasTagCompound()) {
NBTTagCompound tag =
container.getTagCompound().getCompoundTag(tagName).getCompoundTag("heldItem");
return ItemStack.loadItemStackFromNBT(tag);
} else
{
} else {
container.setTagCompound(new NBTTagCompound());
return null;
}
}
public void setContainedCrystal(ItemStack container, ItemStack crystal)
{
if (container.hasTagCompound())
{
public void setContainedCrystal(ItemStack container, ItemStack crystal) {
if (container.hasTagCompound()) {
NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName);
NBTTagCompound tag = compTag.getCompoundTag("heldItem");
@@ -563,8 +503,7 @@ public class ItemSpellMultiTool extends Item
compTag.setTag("heldItem", tag);
container.getTagCompound().setTag(tagName, compTag);
} else
{
} else {
container.setTagCompound(new NBTTagCompound());
NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName);
@@ -577,25 +516,20 @@ public class ItemSpellMultiTool extends Item
}
}
public void setDuration(ItemStack container, World world, int duration)
{
if (world.isRemote)
{
public void setDuration(ItemStack container, World world, int duration) {
if (world.isRemote) {
return;
} else
{
} else {
World overWorld = DimensionManager.getWorld(0);
long worldtime = overWorld.getTotalWorldTime();
if (container.hasTagCompound())
{
if (container.hasTagCompound()) {
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
tag.setLong("duration", Math.max(duration + worldtime, worldtime));
container.getTagCompound().setTag(tagName, tag);
} else
{
} else {
container.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
@@ -607,23 +541,18 @@ public class ItemSpellMultiTool extends Item
}
}
public int getDuration(ItemStack container, World world)
{
if (world.isRemote)
{
public int getDuration(ItemStack container, World world) {
if (world.isRemote) {
return 0;
} else
{
} else {
World overWorld = DimensionManager.getWorld(0);
long worldtime = overWorld.getTotalWorldTime();
if (container.hasTagCompound())
{
if (container.hasTagCompound()) {
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
return (int) (tag.getLong("duration") - worldtime);
} else
{
} else {
container.setTagCompound(new NBTTagCompound());
return 0;
@@ -631,10 +560,8 @@ public class ItemSpellMultiTool extends Item
}
}
public void loadParadigmIntoStack(ItemStack container, List<SpellEffect> list)
{
if (!container.hasTagCompound())
{
public void loadParadigmIntoStack(ItemStack container, List<SpellEffect> list) {
if (!container.hasTagCompound()) {
container.setTagCompound(new NBTTagCompound());
}
@@ -642,8 +569,7 @@ public class ItemSpellMultiTool extends Item
NBTTagList effectList = new NBTTagList();
for (SpellEffect eff : list)
{
for (SpellEffect eff : list) {
effectList.appendTag(eff.getTag());
}
@@ -652,10 +578,8 @@ public class ItemSpellMultiTool extends Item
container.getTagCompound().setTag(tagName, tagiest);
}
public SpellParadigmTool loadParadigmFromStack(ItemStack container)
{
if (!container.hasTagCompound())
{
public SpellParadigmTool loadParadigmFromStack(ItemStack container) {
if (!container.hasTagCompound()) {
container.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName);
@@ -663,13 +587,11 @@ public class ItemSpellMultiTool extends Item
NBTTagList tagList = tagiest.getTagList("Effects", Constants.NBT.TAG_COMPOUND);
List<SpellEffect> spellEffectList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
SpellEffect eff = SpellEffect.getEffectFromTag(tag);
if (eff != null)
{
if (eff != null) {
spellEffectList.add(eff);
}
}
@@ -677,17 +599,14 @@ public class ItemSpellMultiTool extends Item
return SpellParadigmTool.getParadigmForEffectArray(spellEffectList);
}
public void setSilkTouch(ItemStack stack, boolean silkTouch)
{
if (stack.hasTagCompound())
{
public void setSilkTouch(ItemStack stack, boolean silkTouch) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setBoolean("silkTouch", silkTouch);
stack.getTagCompound().setTag(tagName, tag);
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
@@ -698,32 +617,26 @@ public class ItemSpellMultiTool extends Item
}
}
public boolean getSilkTouch(ItemStack stack)
{
if (stack.hasTagCompound())
{
public boolean getSilkTouch(ItemStack stack) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getBoolean("silkTouch");
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
return false;
}
}
public void setFortuneLevel(ItemStack stack, int fortune)
{
if (stack.hasTagCompound())
{
public void setFortuneLevel(ItemStack stack, int fortune) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
tag.setInteger("fortuneLevel", Math.max(fortune, 0));
stack.getTagCompound().setTag(tagName, tag);
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
@@ -734,25 +647,20 @@ public class ItemSpellMultiTool extends Item
}
}
public int getFortuneLevel(ItemStack stack)
{
if (stack.hasTagCompound())
{
public int getFortuneLevel(ItemStack stack) {
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName);
return tag.getInteger("fortuneLevel");
} else
{
} else {
stack.setTagCompound(new NBTTagCompound());
return 0;
}
}
public List<String> getToolListString(ItemStack container)
{
if (!container.hasTagCompound())
{
public List<String> getToolListString(ItemStack container) {
if (!container.hasTagCompound()) {
container.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName);
@@ -760,13 +668,11 @@ public class ItemSpellMultiTool extends Item
NBTTagList tagList = tagiest.getTagList("ToolTips", Constants.NBT.TAG_COMPOUND);
List<String> toolTipList = new LinkedList();
for (int i = 0; i < tagList.tagCount(); i++)
{
for (int i = 0; i < tagList.tagCount(); i++) {
NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
String str = tag.getString("tip");
if (str != null)
{
if (str != null) {
toolTipList.add(str);
}
}
@@ -774,10 +680,8 @@ public class ItemSpellMultiTool extends Item
return toolTipList;
}
public void setToolListString(ItemStack container, List<String> toolTipString)
{
if (!container.hasTagCompound())
{
public void setToolListString(ItemStack container, List<String> toolTipString) {
if (!container.hasTagCompound()) {
container.setTagCompound(new NBTTagCompound());
}
@@ -785,8 +689,7 @@ public class ItemSpellMultiTool extends Item
NBTTagList stringList = new NBTTagList();
for (String str : toolTipString)
{
for (String str : toolTipString) {
NBTTagCompound tag = new NBTTagCompound();
tag.setString("tip", str);
@@ -798,17 +701,14 @@ public class ItemSpellMultiTool extends Item
container.getTagCompound().setTag(tagName, tagiest);
}
public void setCritChance(ItemStack container, float chance)
{
if (container.hasTagCompound())
{
public void setCritChance(ItemStack container, float chance) {
if (container.hasTagCompound()) {
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
tag.setFloat("critChance", Math.max(chance, 0));
container.getTagCompound().setTag(tagName, tag);
} else
{
} else {
container.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
@@ -819,18 +719,15 @@ public class ItemSpellMultiTool extends Item
}
}
public float getCritChance(ItemStack container)
{
if (container.hasTagCompound())
{
public float getCritChance(ItemStack container) {
if (container.hasTagCompound()) {
NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName);
return tag.getFloat("critChance");
} else
{
} else {
container.setTagCompound(new NBTTagCompound());
return 0;
}
}
}
}