Run formatter

This commit is contained in:
Nicholas Ignoffo 2017-08-15 21:30:48 -07:00
parent 61c44a831b
commit 08258fd6ef
606 changed files with 13464 additions and 22975 deletions
src/main/java/WayofTime/bloodmagic/item/alchemy

View file

@ -1,8 +1,11 @@
package WayofTime.bloodmagic.item.alchemy;
import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.iface.ICustomAlchemyConsumable;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@ -12,26 +15,18 @@ import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.iface.ICustomAlchemyConsumable;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomAlchemyConsumable
{
private static ArrayList<String> names = new ArrayList<String>();
import java.util.ArrayList;
import java.util.List;
public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomAlchemyConsumable {
public static final String BASIC = "basicCuttingFluid";
public static final String EXPLOSIVE = "explosive";
private static ArrayList<String> names = new ArrayList<String>();
public ItemCuttingFluid()
{
public ItemCuttingFluid() {
super();
setUnlocalizedName(BloodMagic.MODID + ".cuttingFluid.");
@ -44,30 +39,26 @@ public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomA
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
{
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
if (!stack.hasTagCompound())
return;
int max = getMaxUsesForFluid(stack);
tooltip.add(TextHelper.localize("tooltip.bloodmagic.cuttingFluidRatio", max - getDamageOfFluid(stack), max));
}
private void buildItemList()
{
private void buildItemList() {
names.add(0, BASIC);
names.add(1, EXPLOSIVE);
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName(stack) + names.get(stack.getItemDamage());
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list)
{
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
if (!isInCreativeTab(creativeTab))
return;
@ -75,73 +66,63 @@ public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomA
list.add(new ItemStack(this, 1, i));
}
public static ItemStack getStack(String name)
{
return new ItemStack(RegistrarBloodMagicItems.CUTTING_FLUID, 1, names.indexOf(name));
}
@Override
public List<Pair<Integer, String>> getVariants()
{
public List<Pair<Integer, String>> getVariants() {
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
for (String name : names)
ret.add(new ImmutablePair<Integer, String>(names.indexOf(name), "type=" + name));
return ret;
}
public int getDamageOfFluid(ItemStack stack)
{
public int getDamageOfFluid(ItemStack stack) {
NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
return tag.getInteger("used");
}
public void applyDamageToFluid(ItemStack stack)
{
public void applyDamageToFluid(ItemStack stack) {
int damage = Math.min(getDamageOfFluid(stack) + 1, getMaxUsesForFluid(stack));
NBTTagCompound tag = stack.getTagCompound();
tag.setInteger("used", damage);
}
public int getMaxUsesForFluid(ItemStack stack)
{
switch (stack.getMetadata())
{
case 0:
return 16;
case 1:
return 64;
default:
return 1;
public int getMaxUsesForFluid(ItemStack stack) {
switch (stack.getMetadata()) {
case 0:
return 16;
case 1:
return 64;
default:
return 1;
}
}
@Override
public double getDurabilityForDisplay(ItemStack stack)
{
public double getDurabilityForDisplay(ItemStack stack) {
return (double) (getDamageOfFluid(stack)) / (double) (getMaxUsesForFluid(stack));
}
@Override
public boolean showDurabilityBar(ItemStack stack)
{
public boolean showDurabilityBar(ItemStack stack) {
return getDamageOfFluid(stack) > 0;
}
@Override
public ItemStack drainUseOnAlchemyCraft(ItemStack stack)
{
public ItemStack drainUseOnAlchemyCraft(ItemStack stack) {
applyDamageToFluid(stack);
if (getDamageOfFluid(stack) >= getMaxUsesForFluid(stack))
{
if (getDamageOfFluid(stack) >= getMaxUsesForFluid(stack)) {
return ItemStack.EMPTY;
}
return stack;
}
public static ItemStack getStack(String name) {
return new ItemStack(RegistrarBloodMagicItems.CUTTING_FLUID, 1, names.indexOf(name));
}
public static ArrayList<String> getNames() {
return names;
}