Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
src/main/java/WayofTime/bloodmagic/api/impl
|
@ -1,19 +1,16 @@
|
|||
package WayofTime.bloodmagic.api.impl;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||
|
||||
/**
|
||||
* Base class for all bindable items.
|
||||
*/
|
||||
public class ItemBindable extends Item implements IBindable
|
||||
{
|
||||
public ItemBindable()
|
||||
{
|
||||
public class ItemBindable extends Item implements IBindable {
|
||||
public ItemBindable() {
|
||||
super();
|
||||
|
||||
setMaxStackSize(1);
|
||||
|
@ -22,20 +19,17 @@ public class ItemBindable extends Item implements IBindable
|
|||
// IBindable
|
||||
|
||||
@Override
|
||||
public boolean onBind(EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
public boolean onBind(EntityPlayer player, ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnerName(ItemStack stack)
|
||||
{
|
||||
public String getOwnerName(ItemStack stack) {
|
||||
return !stack.isEmpty() ? stack.getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwnerUUID(ItemStack stack)
|
||||
{
|
||||
public String getOwnerUUID(ItemStack stack) {
|
||||
return !stack.isEmpty() ? stack.getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,26 +10,22 @@ import net.minecraft.world.World;
|
|||
/**
|
||||
* Base class for all (static) sigils.
|
||||
*/
|
||||
public class ItemSigil extends ItemBindable implements ISigil
|
||||
{
|
||||
public class ItemSigil extends ItemBindable implements ISigil {
|
||||
private int lpUsed;
|
||||
|
||||
public ItemSigil(int lpUsed)
|
||||
{
|
||||
public ItemSigil(int lpUsed) {
|
||||
super();
|
||||
|
||||
this.lpUsed = lpUsed;
|
||||
}
|
||||
|
||||
public boolean isUnusable(ItemStack stack)
|
||||
{
|
||||
public boolean isUnusable(ItemStack stack) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
return stack.getTagCompound().getBoolean(Constants.NBT.UNUSABLE);
|
||||
}
|
||||
|
||||
public ItemStack setUnusable(ItemStack stack, boolean unusable)
|
||||
{
|
||||
public ItemStack setUnusable(ItemStack stack, boolean unusable) {
|
||||
NBTHelper.checkNBT(stack);
|
||||
|
||||
stack.getTagCompound().setBoolean(Constants.NBT.UNUSABLE, unusable);
|
||||
|
@ -37,14 +33,12 @@ public class ItemSigil extends ItemBindable implements ISigil
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean performArrayEffect(World world, BlockPos pos)
|
||||
{
|
||||
public boolean performArrayEffect(World world, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasArrayEffect()
|
||||
{
|
||||
public boolean hasArrayEffect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,24 +21,19 @@ import net.minecraft.world.World;
|
|||
/**
|
||||
* Base class for all toggleable sigils.
|
||||
*/
|
||||
public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
||||
{
|
||||
public ItemSigilToggleable(int lpUsed)
|
||||
{
|
||||
public class ItemSigilToggleable extends ItemSigil implements IActivatable {
|
||||
public ItemSigilToggleable(int lpUsed) {
|
||||
super(lpUsed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getActivated(ItemStack stack)
|
||||
{
|
||||
public boolean getActivated(ItemStack stack) {
|
||||
return !stack.isEmpty() && NBTHelper.checkNBT(stack).getTagCompound().getBoolean(Constants.NBT.ACTIVATED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack setActivatedState(ItemStack stack, boolean activated)
|
||||
{
|
||||
if (!stack.isEmpty())
|
||||
{
|
||||
public ItemStack setActivatedState(ItemStack stack, boolean activated) {
|
||||
if (!stack.isEmpty()) {
|
||||
NBTHelper.checkNBT(stack).getTagCompound().setBoolean(Constants.NBT.ACTIVATED, activated);
|
||||
return stack;
|
||||
}
|
||||
|
@ -47,16 +42,14 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
||||
|
||||
if (!world.isRemote && !isUnusable(stack))
|
||||
{
|
||||
if (!world.isRemote && !isUnusable(stack)) {
|
||||
if (player.isSneaking())
|
||||
setActivatedState(stack, !getActivated(stack));
|
||||
if (getActivated(stack) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||
|
@ -67,8 +60,7 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
if (stack.getItem() instanceof ISigil.Holding)
|
||||
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
||||
|
@ -78,20 +70,15 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
return (NetworkHelper.getSoulNetwork(getOwnerUUID(player.getHeldItem(hand))).syphonAndDamage(player, getLpUsed()) && onSigilUse(player.getHeldItem(hand), player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
public boolean onSigilUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public boolean onSigilUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected)
|
||||
{
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityPlayerMP && getActivated(stack))
|
||||
{
|
||||
if (entityIn.ticksExisted % 100 == 0)
|
||||
{
|
||||
if (!NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage((EntityPlayer) entityIn, getLpUsed()))
|
||||
{
|
||||
public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
|
||||
if (!worldIn.isRemote && entityIn instanceof EntityPlayerMP && getActivated(stack)) {
|
||||
if (entityIn.ticksExisted % 100 == 0) {
|
||||
if (!NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).syphonAndDamage((EntityPlayer) entityIn, getLpUsed())) {
|
||||
setActivatedState(stack, false);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +87,6 @@ public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
|||
}
|
||||
}
|
||||
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue