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

View file

@ -1,64 +1,53 @@
package WayofTime.bloodmagic.item.block;
import WayofTime.bloodmagic.tile.TileAlchemyTable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.tile.TileAlchemyTable;
public class ItemBlockAlchemyTable extends ItemBlock
{
public ItemBlockAlchemyTable(Block block)
{
public class ItemBlockAlchemyTable extends ItemBlock {
public ItemBlockAlchemyTable(Block block) {
super(block);
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState)
{
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
float yaw = player.rotationYaw;
EnumFacing direction = EnumFacing.fromAngle(yaw);
if (direction.getFrontOffsetY() != 0)
{
if (direction.getFrontOffsetY() != 0) {
return false;
}
if (!world.isAirBlock(pos.offset(direction)))
{
if (!world.isAirBlock(pos.offset(direction))) {
return false;
}
// newState = block.getDefaultState().withProperty(BlockAlchemyTable.DIRECTION, direction).withProperty(BlockAlchemyTable.INVISIBLE, true);
if (!world.setBlockState(pos, newState, 3))
{
if (!world.setBlockState(pos, newState, 3)) {
return false;
}
if (!world.setBlockState(pos.offset(direction), newState, 3))
{
if (!world.setBlockState(pos.offset(direction), newState, 3)) {
return false;
}
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == this.block)
{
if (state.getBlock() == this.block) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileAlchemyTable)
{
if (tile instanceof TileAlchemyTable) {
((TileAlchemyTable) tile).setInitialTableParameters(direction, false, pos.offset(direction));
}
TileEntity slaveTile = world.getTileEntity(pos.offset(direction));
if (slaveTile instanceof TileAlchemyTable)
{
if (slaveTile instanceof TileAlchemyTable) {
((TileAlchemyTable) slaveTile).setInitialTableParameters(direction, true, pos);
}

View file

@ -6,8 +6,6 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.block.Block;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -15,53 +13,44 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.ICapabilityProvider;
import net.minecraftforge.fluids.*;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.templates.FluidHandlerItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class ItemBlockBloodTank extends ItemBlock
{
public ItemBlockBloodTank(Block block)
{
public class ItemBlockBloodTank extends ItemBlock {
public ItemBlockBloodTank(Block block) {
super(block);
setHasSubtypes(true);
}
@Override
public int getMetadata(int meta)
{
public int getMetadata(int meta) {
return meta;
}
@Override
public String getItemStackDisplayName(ItemStack stack)
{
public String getItemStackDisplayName(ItemStack stack) {
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(stack.getTagCompound());
if (fluidStack != null)
{
if (fluidStack != null) {
return super.getItemStackDisplayName(stack) + " " + TextHelper.localizeEffect("tooltip.bloodmagic.tier", stack.getItemDamage() + 1) + " (" + fluidStack.getLocalizedName() + ")";
}
else
{
} else {
return super.getItemStackDisplayName(stack) + " " + TextHelper.localizeEffect("tooltip.bloodmagic.tier", stack.getItemDamage() + 1);
}
}
@Override
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag)
{
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.tier", stack.getItemDamage() + 1));
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.capacity", getCapacity(stack)));
if (stack.hasTagCompound())
{
if (stack.hasTagCompound()) {
NBTTagCompound tag = stack.getTagCompound();
FluidStack fluidStack = FluidStack.loadFluidStackFromNBT(tag);
if (fluidStack != null)
{
if (fluidStack != null) {
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.type", fluidStack.getLocalizedName()));
tooltip.add(TextHelper.localizeEffect("tooltip.bloodmagic.fluid.amount", fluidStack.amount, getCapacity(stack)));
}
@ -70,23 +59,20 @@ public class ItemBlockBloodTank extends ItemBlock
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list)
{
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> list) {
if (!isInCreativeTab(creativeTab))
for (int i = 0; i < TileBloodTank.CAPACITIES.length; i++)
list.add(new ItemStack(this, 1, i));
for (int i = 0; i < TileBloodTank.CAPACITIES.length; i++)
list.add(new ItemStack(this, 1, i));
}
public int getCapacity(ItemStack container)
{
public int getCapacity(ItemStack container) {
int meta = MathHelper.clamp(container.getItemDamage(), 0, TileBloodTank.CAPACITIES.length - 1);
return !container.isEmpty() && Block.getBlockFromItem(container.getItem()) instanceof BlockBloodTank ? TileBloodTank.CAPACITIES[meta] * Fluid.BUCKET_VOLUME : 0;
}
@Override
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt)
{
public ICapabilityProvider initCapabilities(ItemStack stack, NBTTagCompound nbt) {
return new FluidHandlerItemStack(stack, getCapacity(stack));
}
}

View file

@ -14,34 +14,27 @@ import net.minecraft.world.World;
import java.util.Locale;
public class ItemBlockDemonCrystal extends ItemBlock
{
public ItemBlockDemonCrystal(Block block)
{
public class ItemBlockDemonCrystal extends ItemBlock {
public ItemBlockDemonCrystal(Block block) {
super(block);
setHasSubtypes(true);
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName(stack) + EnumDemonWillType.values()[stack.getItemDamage()].toString().toLowerCase(Locale.ENGLISH);
}
@Override
public int getMetadata(int meta)
{
public int getMetadata(int meta) {
return meta;
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState)
{
if (super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState))
{
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState) {
if (super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState)) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileDemonCrystal)
{
if (tile instanceof TileDemonCrystal) {
((TileDemonCrystal) tile).setPlacement(side);
}

View file

@ -6,11 +6,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.MathHelper;
public class ItemBlockEnum<E extends Enum<E> & IStringSerializable> extends ItemBlock
{
public class ItemBlockEnum<E extends Enum<E> & IStringSerializable> extends ItemBlock {
public ItemBlockEnum(BlockEnum<E> block)
{
public ItemBlockEnum(BlockEnum<E> block) {
super(block);
if (block.getTypes().length > 1)
@ -19,20 +17,17 @@ public class ItemBlockEnum<E extends Enum<E> & IStringSerializable> extends Item
@SuppressWarnings("unchecked")
@Override
public BlockEnum<E> getBlock()
{
public BlockEnum<E> getBlock() {
return (BlockEnum<E>) super.getBlock();
}
@Override
public String getUnlocalizedName(ItemStack stack)
{
public String getUnlocalizedName(ItemStack stack) {
return getBlock().getUnlocalizedName() + getBlock().getTypes()[MathHelper.clamp(stack.getItemDamage(), 0, 15)].getName();
}
@Override
public int getMetadata(int damage)
{
public int getMetadata(int damage) {
return damage;
}
}

View file

@ -10,7 +10,7 @@ public class ItemBlockString extends ItemBlock {
public ItemBlockString(BlockString block) {
super(block);
if (block.getTypes().length> 1)
if (block.getTypes().length > 1)
setHasSubtypes(true);
}