Move some base classes into the API
Add Javadocs for API classes that didn't already have them Redo 'nother redo Another redo Update ItemSigil.java Last one, I swear Fix
This commit is contained in:
parent
6a40dbab0a
commit
0383f0fb31
|
@ -1,5 +1,9 @@
|
||||||
package WayofTime.bloodmagic.api.altar;
|
package WayofTime.bloodmagic.api.altar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of different components used to construct
|
||||||
|
* different tiers of altars.
|
||||||
|
*/
|
||||||
public enum EnumAltarComponent
|
public enum EnumAltarComponent
|
||||||
{
|
{
|
||||||
GLOWSTONE,
|
GLOWSTONE,
|
||||||
|
|
|
@ -14,10 +14,16 @@ public class BoundToolEvent extends Event
|
||||||
this.player = player;
|
this.player = player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is called when a {@link WayofTime.bloodmagic.item.ItemBoundTool}
|
||||||
|
* is being charged.
|
||||||
|
*
|
||||||
|
* If canceled, will result in the charging being canceled.
|
||||||
|
*/
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class Charge extends BoundToolEvent
|
public static class Charge extends BoundToolEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
public ItemStack result;
|
public ItemStack result;
|
||||||
|
|
||||||
public Charge(EntityPlayer player, ItemStack result)
|
public Charge(EntityPlayer player, ItemStack result)
|
||||||
|
@ -27,10 +33,16 @@ public class BoundToolEvent extends Event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is called when a {@link WayofTime.bloodmagic.item.ItemBoundTool}'s
|
||||||
|
* charge is released.
|
||||||
|
*
|
||||||
|
* If canceled, will result in the charge not being released.
|
||||||
|
*/
|
||||||
|
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class Release extends BoundToolEvent
|
public static class Release extends BoundToolEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
public final ItemStack boundTool;
|
public final ItemStack boundTool;
|
||||||
public int charge;
|
public int charge;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,18 @@ public class ItemBindEvent extends Event
|
||||||
public String key;
|
public String key;
|
||||||
public ItemStack itemStack;
|
public ItemStack itemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is called whenever a player attempts to bind a {@link WayofTime.bloodmagic.api.iface.IBindable} item.
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* The player doing the binding
|
||||||
|
* @param key
|
||||||
|
* The UUID of the player doing the binding
|
||||||
|
* @param itemStack
|
||||||
|
* The {@link ItemStack} that the player is binding
|
||||||
|
*
|
||||||
|
* This event is {@link Cancelable}.<br>
|
||||||
|
*/
|
||||||
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack)
|
public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
|
@ -55,7 +55,6 @@ public class RitualEvent extends Event
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class RitualRunEvent extends RitualEvent
|
public static class RitualRunEvent extends RitualEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
public RitualRunEvent(IMasterRitualStone mrs, String owner, Ritual ritual)
|
public RitualRunEvent(IMasterRitualStone mrs, String owner, Ritual ritual)
|
||||||
{
|
{
|
||||||
super(mrs, owner, ritual);
|
super(mrs, owner, ritual);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package WayofTime.bloodmagic.api.event;
|
package WayofTime.bloodmagic.api.event;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
|
@ -13,6 +14,23 @@ public class SacrificeKnifeUsedEvent extends Event
|
||||||
public boolean shouldDrainHealth;
|
public boolean shouldDrainHealth;
|
||||||
public boolean shouldFillAltar;
|
public boolean shouldFillAltar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is called whenever a player attempts to use a {@link WayofTime.bloodmagic.item.ItemSacrificialDagger}
|
||||||
|
* to self-sacrifice near an altar.
|
||||||
|
*
|
||||||
|
* @param player
|
||||||
|
* The player doing the sacrificing
|
||||||
|
* @param shouldDrainHealth
|
||||||
|
* Determines whether or not health is lost
|
||||||
|
* @param shouldFillAltar
|
||||||
|
* Determines whether or not an altar should be filled
|
||||||
|
* @param hp
|
||||||
|
* Amount of health lost
|
||||||
|
* @param lpAdded
|
||||||
|
* Amount of LP added to the altar
|
||||||
|
*
|
||||||
|
* This event is {@link Cancelable}.<br>
|
||||||
|
*/
|
||||||
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp, int lpAdded)
|
public SacrificeKnifeUsedEvent(EntityPlayer player, boolean shouldDrainHealth, boolean shouldFillAltar, int hp, int lpAdded)
|
||||||
{
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
|
@ -5,21 +5,32 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base event class for Soul Network related events.
|
||||||
|
*
|
||||||
|
* {@link #ownerUUID} contains the owner's UUID
|
||||||
|
* {@link #syphon} contains the amount of LP to be drained
|
||||||
|
*/
|
||||||
public class SoulNetworkEvent extends Event
|
public class SoulNetworkEvent extends Event
|
||||||
{
|
{
|
||||||
public final String ownerName;
|
public final String ownerUUID;
|
||||||
public int syphon;
|
public int syphon;
|
||||||
|
|
||||||
public SoulNetworkEvent(String ownerName, int syphon)
|
public SoulNetworkEvent(String ownerUUID, int syphon)
|
||||||
{
|
{
|
||||||
this.ownerName = ownerName;
|
this.ownerUUID = ownerUUID;
|
||||||
this.syphon = syphon;
|
this.syphon = syphon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is called when an {@link WayofTime.bloodmagic.api.impl.ItemBindable}
|
||||||
|
* is being drained inside of a {@link net.minecraft.tileentity.TileEntity}.
|
||||||
|
*
|
||||||
|
* If canceled, the drain will not be executed.
|
||||||
|
*/
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class ItemDrainInContainerEvent extends SoulNetworkEvent
|
public static class ItemDrainInContainerEvent extends SoulNetworkEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
public ItemStack stack;
|
public ItemStack stack;
|
||||||
|
|
||||||
public ItemDrainInContainerEvent(ItemStack stack, String ownerName, int syphon)
|
public ItemDrainInContainerEvent(ItemStack stack, String ownerName, int syphon)
|
||||||
|
@ -29,10 +40,15 @@ public class SoulNetworkEvent extends Event
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This event is called when a {@link EntityPlayer}
|
||||||
|
* drains the Soul Network
|
||||||
|
*
|
||||||
|
* If canceled, the drain will not be executed.
|
||||||
|
*/
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class PlayerDrainNetworkEvent extends SoulNetworkEvent
|
public static class PlayerDrainNetworkEvent extends SoulNetworkEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
public final EntityPlayer player;
|
public final EntityPlayer player;
|
||||||
// If true, will damage regardless of if the network had enough inside it
|
// If true, will damage regardless of if the network had enough inside it
|
||||||
public boolean shouldDamage;
|
public boolean shouldDamage;
|
||||||
|
@ -48,7 +64,6 @@ public class SoulNetworkEvent extends Event
|
||||||
@Cancelable
|
@Cancelable
|
||||||
public static class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent
|
public static class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent
|
||||||
{
|
{
|
||||||
|
|
||||||
public final ItemStack itemStack;
|
public final ItemStack itemStack;
|
||||||
/**
|
/**
|
||||||
* Amount of damage that would incur if the network could not drain
|
* Amount of damage that would incur if the network could not drain
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package WayofTime.bloodmagic.api.iface;
|
package WayofTime.bloodmagic.api.iface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Any item that implements this interface will not be pulled into the Altar on
|
||||||
|
* right click.
|
||||||
|
*/
|
||||||
public interface IAltarReader
|
public interface IAltarReader
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package WayofTime.bloodmagic.api.iface;
|
package WayofTime.bloodmagic.api.iface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used for all {@link WayofTime.bloodmagic.api.impl.ItemSigil}
|
||||||
|
* <b>EXCEPT</b> Sigils of Holdings.
|
||||||
|
*/
|
||||||
public interface ISigil
|
public interface ISigil
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
package WayofTime.bloodmagic.api.impl;
|
||||||
|
|
||||||
|
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()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
setMaxStackSize(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IBindable
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBind(EntityPlayer player, ItemStack stack)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnerName(ItemStack stack)
|
||||||
|
{
|
||||||
|
return stack != null ? NBTHelper.checkNBT(stack).getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnerUUID(ItemStack stack)
|
||||||
|
{
|
||||||
|
return stack != null ? NBTHelper.checkNBT(stack).getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
|
||||||
|
}
|
||||||
|
}
|
38
src/main/java/WayofTime/bloodmagic/api/impl/ItemSigil.java
Normal file
38
src/main/java/WayofTime/bloodmagic/api/impl/ItemSigil.java
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
package WayofTime.bloodmagic.api.impl;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.iface.ISigil;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Base class for all (static) sigils.
|
||||||
|
*/
|
||||||
|
public class ItemSigil extends ItemBindable implements ISigil
|
||||||
|
{
|
||||||
|
@Getter
|
||||||
|
private int lpUsed;
|
||||||
|
|
||||||
|
public ItemSigil(int lpUsed)
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.lpUsed = lpUsed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isUnusable(ItemStack stack)
|
||||||
|
{
|
||||||
|
NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
|
return stack.getTagCompound().getBoolean(Constants.NBT.UNUSABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack setUnusable(ItemStack stack, boolean unusable)
|
||||||
|
{
|
||||||
|
NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
|
stack.getTagCompound().setBoolean(Constants.NBT.UNUSABLE, unusable);
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,8 +1,7 @@
|
||||||
package WayofTime.bloodmagic.item.sigil;
|
package WayofTime.bloodmagic.api.impl;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.iface.IActivatable;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
@ -13,32 +12,36 @@ import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
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;
|
* Base class for all toggleable sigils.
|
||||||
|
*/
|
||||||
import WayofTime.bloodmagic.item.ItemBindable;
|
public class ItemSigilToggleable extends ItemSigil implements IActivatable
|
||||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
|
||||||
|
|
||||||
public class ItemSigilToggleable extends ItemSigilBase
|
|
||||||
{
|
{
|
||||||
public ItemSigilToggleable(String name, int lpUsed)
|
private boolean toggleable;
|
||||||
|
|
||||||
|
public ItemSigilToggleable(int lpUsed)
|
||||||
{
|
{
|
||||||
super(name, lpUsed);
|
super(lpUsed);
|
||||||
setToggleable();
|
setToggleable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setToggleable()
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
|
||||||
{
|
{
|
||||||
super.addInformation(stack, player, tooltip, advanced);
|
this.toggleable = true;
|
||||||
if (getActivated(stack))
|
}
|
||||||
tooltip.add(TextHelper.localize("tooltip.BloodMagic.activated"));
|
|
||||||
else
|
public boolean getActivated(ItemStack stack)
|
||||||
tooltip.add(TextHelper.localize("tooltip.BloodMagic.deactivated"));
|
{
|
||||||
|
return stack.getItemDamage() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack setActivatedState(ItemStack stack, boolean activated)
|
||||||
|
{
|
||||||
|
if (this.toggleable)
|
||||||
|
stack.setItemDamage(activated ? 1 : 0);
|
||||||
|
|
||||||
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,8 +50,8 @@ public class ItemSigilToggleable extends ItemSigilBase
|
||||||
if (!world.isRemote && !isUnusable(stack))
|
if (!world.isRemote && !isUnusable(stack))
|
||||||
{
|
{
|
||||||
if (player.isSneaking())
|
if (player.isSneaking())
|
||||||
setActivated(stack, !getActivated(stack));
|
setActivatedState(stack, !getActivated(stack));
|
||||||
if (getActivated(stack) && ItemBindable.syphonNetwork(stack, player, getLPUsed()))
|
if (getActivated(stack) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +61,7 @@ public class ItemSigilToggleable extends ItemSigilBase
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
|
||||||
{
|
{
|
||||||
return (ItemBindable.syphonNetwork(stack, player, getLPUsed()) && onSigilUse(stack, player, world, pos, side, hitX, hitY, hitZ)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
return (NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && onSigilUse(stack, 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)
|
||||||
|
@ -73,9 +76,9 @@ public class ItemSigilToggleable extends ItemSigilBase
|
||||||
{
|
{
|
||||||
if (worldIn.getWorldTime() % 100 == 0)
|
if (worldIn.getWorldTime() % 100 == 0)
|
||||||
{
|
{
|
||||||
if (!ItemBindable.syphonNetwork(stack, (EntityPlayer) entityIn, getLPUsed()))
|
if (!NetworkHelper.getSoulNetwork((EntityPlayerMP) entityIn).syphonAndDamage((EntityPlayer) entityIn, getLpUsed()))
|
||||||
{
|
{
|
||||||
setActivated(stack, false);
|
setActivatedState(stack, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,13 +89,4 @@ public class ItemSigilToggleable extends ItemSigilBase
|
||||||
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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<Pair<Integer, String>> getVariants()
|
|
||||||
{
|
|
||||||
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
|
||||||
ret.add(new ImmutablePair<Integer, String>(0, "active=false"));
|
|
||||||
ret.add(new ImmutablePair<Integer, String>(1, "active=true"));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -10,7 +10,6 @@ import WayofTime.bloodmagic.api.registry.OrbRegistry;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.MinecraftServer;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
@ -223,7 +222,7 @@ public class NetworkHelper
|
||||||
if (MinecraftForge.EVENT_BUS.post(event))
|
if (MinecraftForge.EVENT_BUS.post(event))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
int drainAmount = syphonFromNetwork(event.ownerName, event.syphon);
|
int drainAmount = syphonFromNetwork(event.ownerUUID, event.syphon);
|
||||||
|
|
||||||
if (drainAmount == 0 || event.shouldDamage)
|
if (drainAmount == 0 || event.shouldDamage)
|
||||||
hurtPlayer(player, event.syphon);
|
hurtPlayer(player, event.syphon);
|
||||||
|
@ -254,7 +253,7 @@ public class NetworkHelper
|
||||||
if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY)
|
if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return syphonFromNetwork(event.ownerName, event.syphon) >= syphon;
|
return syphonFromNetwork(event.ownerUUID, event.syphon) >= syphon;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
|
|
@ -6,6 +6,5 @@ import java.util.List;
|
||||||
|
|
||||||
public interface IVariantProvider
|
public interface IVariantProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
List<Pair<Integer, String>> getVariants();
|
List<Pair<Integer, String>> getVariants();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemActivationCrystal extends ItemBindable implements IVariantProvider
|
public class ItemActivationCrystal extends ItemBindableBase implements IVariantProvider
|
||||||
{
|
{
|
||||||
public static String[] names = { "weak", "awakened", "creative" };
|
public static String[] names = { "weak", "awakened", "creative" };
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@ public class ItemActivationCrystal extends ItemBindable implements IVariantProvi
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".activationCrystal.");
|
setUnlocalizedName(Constants.Mod.MODID + ".activationCrystal.");
|
||||||
setRegistryName(Constants.BloodMagicItem.ACTIVATION_CRYSTAL.getRegName());
|
setRegistryName(Constants.BloodMagicItem.ACTIVATION_CRYSTAL.getRegName());
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setLPUsed(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,190 +0,0 @@
|
||||||
package WayofTime.bloodmagic.item;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.init.SoundEvents;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.SoundCategory;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
||||||
import WayofTime.bloodmagic.BloodMagic;
|
|
||||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
|
||||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
|
||||||
import WayofTime.bloodmagic.api.network.SoulNetwork;
|
|
||||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
|
||||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
|
||||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
|
||||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
|
||||||
|
|
||||||
public class ItemBindable extends Item implements IBindable
|
|
||||||
{
|
|
||||||
private int lpUsed;
|
|
||||||
|
|
||||||
public ItemBindable()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
|
|
||||||
setCreativeTab(BloodMagic.tabBloodMagic);
|
|
||||||
setMaxStackSize(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Syphons from the owner's network if possible - if not enough LP is found,
|
|
||||||
* it will instead take the LP from the holder of the item.
|
|
||||||
*
|
|
||||||
* @param stack
|
|
||||||
* - The ItemStack to syphon from
|
|
||||||
* @param player
|
|
||||||
* - The Player using the item
|
|
||||||
* @param lpUsed
|
|
||||||
* - The amount of LP to syphon
|
|
||||||
*
|
|
||||||
* @return Whether syphoning was successful or not
|
|
||||||
*/
|
|
||||||
public static boolean syphonNetwork(ItemStack stack, EntityPlayer player, int lpUsed)
|
|
||||||
{
|
|
||||||
if (player == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!player.worldObj.isRemote)
|
|
||||||
{
|
|
||||||
if (stack != null && stack.getItem() instanceof IBindable)
|
|
||||||
{
|
|
||||||
IBindable itemBindable = (IBindable) stack.getItem();
|
|
||||||
String owner = itemBindable.getOwnerUUID(stack);
|
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(owner))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
SoulNetwork network = NetworkHelper.getSoulNetwork(owner);
|
|
||||||
return NetworkHelper.syphonAndDamage(network, player, lpUsed);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
// SpellHelper.sendIndexedParticleToAllAround(player.worldObj, posX,posY, posZ, 20, player.worldObj.provider.getDimensionId(), 4, posX, posY, posZ);
|
|
||||||
player.worldObj.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.8F);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This method is to be used for when you want to drain from a network
|
|
||||||
* without an online player. This will not take health from the owner if it
|
|
||||||
* fails to find sufficient LP.
|
|
||||||
*
|
|
||||||
* @param stack
|
|
||||||
* - The ItemStack to syphon from.
|
|
||||||
* @param lpUsed
|
|
||||||
* - The amount of LP to syphon
|
|
||||||
*
|
|
||||||
* @return - If syphoning was successful or not
|
|
||||||
*/
|
|
||||||
public static boolean syphonNetwork(ItemStack stack, int lpUsed)
|
|
||||||
{
|
|
||||||
if (stack.getItem() instanceof IBindable)
|
|
||||||
{
|
|
||||||
IBindable bindable = (IBindable) stack.getItem();
|
|
||||||
return !Strings.isNullOrEmpty(bindable.getOwnerUUID(stack)) && NetworkHelper.syphonFromContainer(stack, lpUsed);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canSyphonFromNetwork(ItemStack stack, int lpRequested)
|
|
||||||
{
|
|
||||||
if (stack.getItem() instanceof IBindable)
|
|
||||||
{
|
|
||||||
IBindable bindable = (IBindable) stack.getItem();
|
|
||||||
return !Strings.isNullOrEmpty(bindable.getOwnerUUID(stack)) && NetworkHelper.canSyphonFromContainer(stack, lpRequested);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void hurtPlayer(EntityPlayer user, int lpSyphoned)
|
|
||||||
{
|
|
||||||
if (user != null)
|
|
||||||
{
|
|
||||||
if (lpSyphoned < 100 && lpSyphoned > 0)
|
|
||||||
{
|
|
||||||
if (!user.capabilities.isCreativeMode)
|
|
||||||
{
|
|
||||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 0F); // Emulate an attack
|
|
||||||
user.setHealth(user.getHealth() - 1);
|
|
||||||
|
|
||||||
if (user.getHealth() <= 0.0005f)
|
|
||||||
user.onDeath(BloodMagicAPI.getDamageSource());
|
|
||||||
}
|
|
||||||
} else if (lpSyphoned >= 100)
|
|
||||||
{
|
|
||||||
if (!user.capabilities.isCreativeMode)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < ((lpSyphoned + 99) / 100); i++)
|
|
||||||
{
|
|
||||||
user.attackEntityFrom(BloodMagicAPI.getDamageSource(), 0F); // Emulate an attack
|
|
||||||
user.setHealth(user.getHealth() - 1);
|
|
||||||
|
|
||||||
if (user.getHealth() <= 0.0005f)
|
|
||||||
{
|
|
||||||
user.onDeath(BloodMagicAPI.getDamageSource());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
|
||||||
{
|
|
||||||
NBTHelper.checkNBT(stack);
|
|
||||||
|
|
||||||
if (!Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)))
|
|
||||||
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.currentOwner", PlayerHelper.getUsernameFromStack(stack)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLPUsed()
|
|
||||||
{
|
|
||||||
return this.lpUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setLPUsed(int lpUsed)
|
|
||||||
{
|
|
||||||
this.lpUsed = lpUsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBindableOwner(ItemStack stack)
|
|
||||||
{
|
|
||||||
stack = NBTHelper.checkNBT(stack);
|
|
||||||
|
|
||||||
return stack.getTagCompound().getString(Constants.NBT.OWNER_UUID);
|
|
||||||
}
|
|
||||||
|
|
||||||
// IBindable
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onBind(EntityPlayer player, ItemStack stack)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnerName(ItemStack stack)
|
|
||||||
{
|
|
||||||
return stack != null ? NBTHelper.checkNBT(stack).getTagCompound().getString(Constants.NBT.OWNER_NAME) : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnerUUID(ItemStack stack)
|
|
||||||
{
|
|
||||||
return stack != null ? NBTHelper.checkNBT(stack).getTagCompound().getString(Constants.NBT.OWNER_UUID) : null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package WayofTime.bloodmagic.item;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.BloodMagic;
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.impl.ItemBindable;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||||
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ItemBindableBase extends ItemBindable
|
||||||
|
{
|
||||||
|
public ItemBindableBase()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
|
||||||
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||||
|
{
|
||||||
|
NBTHelper.checkNBT(stack);
|
||||||
|
|
||||||
|
if (!Strings.isNullOrEmpty(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)))
|
||||||
|
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.currentOwner", PlayerHelper.getUsernameFromStack(stack)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,7 +24,7 @@ import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable
|
public class ItemBloodOrb extends ItemBindableBase implements IBloodOrb, IBindable
|
||||||
{
|
{
|
||||||
public ItemBloodOrb()
|
public ItemBloodOrb()
|
||||||
{
|
{
|
||||||
|
@ -51,12 +51,9 @@ public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
||||||
{
|
{
|
||||||
if (world == null)
|
if (world == null)
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, null, player, hand);
|
||||||
|
|
||||||
double posX = player.posX;
|
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||||
double posY = player.posY;
|
|
||||||
double posZ = player.posZ;
|
|
||||||
world.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
|
||||||
// SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ,
|
// SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ,
|
||||||
// 20, world.provider.getDimensionId(), 4, posX, posY, posZ);
|
// 20, world.provider.getDimensionId(), 4, posX, posY, posZ);
|
||||||
|
|
||||||
|
@ -78,7 +75,7 @@ public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable
|
||||||
NetworkHelper.setMaxOrb(NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)), getOrbLevel(stack.getItemDamage()));
|
NetworkHelper.setMaxOrb(NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)), getOrbLevel(stack.getItemDamage()));
|
||||||
|
|
||||||
NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)).addLifeEssence(200, getMaxEssence(stack.getItemDamage()));
|
NetworkHelper.getSoulNetwork(stack.getTagCompound().getString(Constants.NBT.OWNER_UUID)).addLifeEssence(200, getMaxEssence(stack.getItemDamage()));
|
||||||
hurtPlayer(player, 200);
|
NetworkHelper.getSoulNetwork(player).hurtPlayer(player, 200);
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,10 +60,7 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
|
||||||
|
|
||||||
if (findAndFillAltar(attacker.worldObj, target, lifeEssence))
|
if (findAndFillAltar(attacker.worldObj, target, lifeEssence))
|
||||||
{
|
{
|
||||||
double posX = target.posX;
|
target.worldObj.playSound(null, target.posX, target.posY, target.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (target.worldObj.rand.nextFloat() - target.worldObj.rand.nextFloat()) * 0.8F);
|
||||||
double posY = target.posY;
|
|
||||||
double posZ = target.posZ;
|
|
||||||
target.worldObj.playSound((EntityPlayer) null, target.posX, target.posY, target.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (target.worldObj.rand.nextFloat() - target.worldObj.rand.nextFloat()) * 0.8F);
|
|
||||||
target.setHealth(-1);
|
target.setHealth(-1);
|
||||||
target.onDeath(new DamageSourceBloodMagic());
|
target.onDeath(new DamageSourceBloodMagic());
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import WayofTime.bloodmagic.block.BlockRitualStone;
|
||||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
public class ItemInscriptionTool extends ItemBindable implements IVariantProvider
|
public class ItemInscriptionTool extends ItemBindableBase implements IVariantProvider
|
||||||
{
|
{
|
||||||
public ItemInscriptionTool()
|
public ItemInscriptionTool()
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,6 @@ public class ItemInscriptionTool extends ItemBindable implements IVariantProvide
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".scribe.");
|
setUnlocalizedName(Constants.Mod.MODID + ".scribe.");
|
||||||
setRegistryName(Constants.BloodMagicItem.INSCRIPTION_TOOL.getRegName());
|
setRegistryName(Constants.BloodMagicItem.INSCRIPTION_TOOL.getRegName());
|
||||||
setHasSubtypes(true);
|
setHasSubtypes(true);
|
||||||
setLPUsed(100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,6 +3,7 @@ package WayofTime.bloodmagic.item;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.MobEffects;
|
import net.minecraft.init.MobEffects;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
|
@ -19,20 +20,19 @@ import WayofTime.bloodmagic.client.IVariantProvider;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
|
||||||
public class ItemLavaCrystal extends ItemBindable implements IFuelHandler, IVariantProvider
|
public class ItemLavaCrystal extends ItemBindableBase implements IFuelHandler, IVariantProvider
|
||||||
{
|
{
|
||||||
public ItemLavaCrystal()
|
public ItemLavaCrystal()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".lavaCrystal");
|
setUnlocalizedName(Constants.Mod.MODID + ".lavaCrystal");
|
||||||
setRegistryName(Constants.BloodMagicItem.LAVA_CRYSTAL.getRegName());
|
setRegistryName(Constants.BloodMagicItem.LAVA_CRYSTAL.getRegName());
|
||||||
setLPUsed(25);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getContainerItem(ItemStack itemStack)
|
public ItemStack getContainerItem(ItemStack itemStack)
|
||||||
{
|
{
|
||||||
syphonNetwork(itemStack, getLPUsed());
|
NetworkHelper.getSoulNetwork(this.getOwnerName(itemStack)).syphon(25);
|
||||||
ItemStack copiedStack = itemStack.copy();
|
ItemStack copiedStack = itemStack.copy();
|
||||||
copiedStack.setItemDamage(copiedStack.getItemDamage());
|
copiedStack.setItemDamage(copiedStack.getItemDamage());
|
||||||
copiedStack.stackSize = 1;
|
copiedStack.stackSize = 1;
|
||||||
|
@ -63,14 +63,14 @@ public class ItemLavaCrystal extends ItemBindable implements IFuelHandler, IVari
|
||||||
// return 200;
|
// return 200;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (canSyphonFromNetwork(fuel, getLPUsed()))
|
if (NetworkHelper.canSyphonFromContainer(fuel, 25))
|
||||||
{
|
{
|
||||||
return 200;
|
return 200;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (!Strings.isNullOrEmpty(getBindableOwner(fuel)))
|
if (!Strings.isNullOrEmpty(this.getOwnerUUID(fuel)))
|
||||||
{
|
{
|
||||||
EntityPlayer player = PlayerHelper.getPlayerFromUUID(getBindableOwner(fuel));
|
EntityPlayer player = PlayerHelper.getPlayerFromUUID(this.getOwnerUUID(fuel));
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
player.addPotionEffect(new PotionEffect(MobEffects.confusion, 99));
|
player.addPotionEffect(new PotionEffect(MobEffects.confusion, 99));
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class ItemSacrificialDagger extends Item implements IVariantProvider
|
||||||
double posX = player.posX;
|
double posX = player.posX;
|
||||||
double posY = player.posY;
|
double posY = player.posY;
|
||||||
double posZ = player.posZ;
|
double posZ = player.posZ;
|
||||||
world.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
world.playSound(null, posX, posY, posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||||
|
|
||||||
for (int l = 0; l < 8; ++l)
|
for (int l = 0; l < 8; ++l)
|
||||||
world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), 0, 0, 0);
|
world.spawnParticle(EnumParticleTypes.REDSTONE, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), 0, 0, 0);
|
||||||
|
|
|
@ -26,7 +26,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemTelepositionFocus extends ItemBindable implements IVariantProvider
|
public class ItemTelepositionFocus extends ItemBindableBase implements IVariantProvider
|
||||||
{
|
{
|
||||||
public static String[] names = { "weak", "enhanced", "reinforced", "demonic" };
|
public static String[] names = { "weak", "enhanced", "reinforced", "demonic" };
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.item.sigil;
|
package WayofTime.bloodmagic.item.sigil;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -37,12 +38,12 @@ public class ItemSigilAir extends ItemSigilBase
|
||||||
player.motionY = vec.yCoord * wantedVelocity;
|
player.motionY = vec.yCoord * wantedVelocity;
|
||||||
player.motionZ = vec.zCoord * wantedVelocity;
|
player.motionZ = vec.zCoord * wantedVelocity;
|
||||||
player.velocityChanged = true;
|
player.velocityChanged = true;
|
||||||
world.playSound((EntityPlayer) null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.block_fire_extinguish, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||||
|
|
||||||
player.fallDistance = 0;
|
player.fallDistance = 0;
|
||||||
|
|
||||||
if (!player.capabilities.isCreativeMode)
|
if (!player.capabilities.isCreativeMode)
|
||||||
this.setUnusable(stack, !syphonNetwork(stack, player, getLPUsed()));
|
this.setUnusable(stack, !NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
|
|
|
@ -4,12 +4,10 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.impl.ItemSigil;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ActionResult;
|
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -17,25 +15,20 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.api.iface.ISigil;
|
|
||||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
|
||||||
import WayofTime.bloodmagic.client.IVariantProvider;
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||||
import WayofTime.bloodmagic.item.ItemBindable;
|
|
||||||
import WayofTime.bloodmagic.util.helper.TextHelper;
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class ItemSigilBase extends ItemBindable implements ISigil, IVariantProvider
|
public class ItemSigilBase extends ItemSigil implements IVariantProvider
|
||||||
{
|
{
|
||||||
protected final String tooltipBase;
|
protected final String tooltipBase;
|
||||||
private final String name;
|
private final String name;
|
||||||
private boolean toggleable;
|
|
||||||
|
|
||||||
public ItemSigilBase(String name, int lpUsed)
|
public ItemSigilBase(String name, int lpUsed)
|
||||||
{
|
{
|
||||||
super();
|
super(lpUsed);
|
||||||
|
|
||||||
setUnlocalizedName(Constants.Mod.MODID + ".sigil." + name);
|
setUnlocalizedName(Constants.Mod.MODID + ".sigil." + name);
|
||||||
setLPUsed(lpUsed);
|
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.tooltipBase = "tooltip.BloodMagic.sigil." + name + ".";
|
this.tooltipBase = "tooltip.BloodMagic.sigil." + name + ".";
|
||||||
|
@ -46,12 +39,6 @@ public class ItemSigilBase extends ItemBindable implements ISigil, IVariantProvi
|
||||||
this(name, 0);
|
this(name, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
|
|
||||||
{
|
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||||
|
@ -69,37 +56,4 @@ public class ItemSigilBase extends ItemBindable implements ISigil, IVariantProvi
|
||||||
ret.add(new ImmutablePair<Integer, String>(0, "type=normal"));
|
ret.add(new ImmutablePair<Integer, String>(0, "type=normal"));
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToggleable()
|
|
||||||
{
|
|
||||||
this.toggleable = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUnusable(ItemStack stack)
|
|
||||||
{
|
|
||||||
NBTHelper.checkNBT(stack);
|
|
||||||
|
|
||||||
return stack.getTagCompound().getBoolean(Constants.NBT.UNUSABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack setUnusable(ItemStack stack, boolean unusable)
|
|
||||||
{
|
|
||||||
NBTHelper.checkNBT(stack);
|
|
||||||
|
|
||||||
stack.getTagCompound().setBoolean(Constants.NBT.UNUSABLE, unusable);
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getActivated(ItemStack stack)
|
|
||||||
{
|
|
||||||
return stack.getItemDamage() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemStack setActivated(ItemStack stack, boolean activated)
|
|
||||||
{
|
|
||||||
if (this.toggleable)
|
|
||||||
stack.setItemDamage(activated ? 1 : 0);
|
|
||||||
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class ItemSigilBloodLight extends ItemSigilBase
|
||||||
{
|
{
|
||||||
world.setBlockState(blockPos, ModBlocks.bloodLight.getDefaultState());
|
world.setBlockState(blockPos, ModBlocks.bloodLight.getDefaultState());
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLPUsed());
|
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLpUsed());
|
||||||
resetCooldown(stack);
|
resetCooldown(stack);
|
||||||
player.swingArm(hand);
|
player.swingArm(hand);
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
|
@ -55,7 +55,7 @@ public class ItemSigilBloodLight extends ItemSigilBase
|
||||||
if (!world.isRemote)
|
if (!world.isRemote)
|
||||||
{
|
{
|
||||||
world.spawnEntityInWorld(new EntityBloodLight(world, player));
|
world.spawnEntityInWorld(new EntityBloodLight(world, player));
|
||||||
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLPUsed());
|
NetworkHelper.syphonAndDamage(NetworkHelper.getSoulNetwork(player), player, getLpUsed());
|
||||||
}
|
}
|
||||||
resetCooldown(stack);
|
resetCooldown(stack);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemSigilCompression extends ItemSigilToggleable
|
public class ItemSigilCompression extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilCompression()
|
public ItemSigilCompression()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
|
||||||
public class ItemSigilElementalAffinity extends ItemSigilToggleable
|
public class ItemSigilElementalAffinity extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilElementalAffinity()
|
public ItemSigilElementalAffinity()
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.registry.ModPotions;
|
import WayofTime.bloodmagic.registry.ModPotions;
|
||||||
|
|
||||||
public class ItemSigilEnderSeverance extends ItemSigilToggleable
|
public class ItemSigilEnderSeverance extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilEnderSeverance()
|
public ItemSigilEnderSeverance()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
|
||||||
public class ItemSigilFastMiner extends ItemSigilToggleable
|
public class ItemSigilFastMiner extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilFastMiner()
|
public ItemSigilFastMiner()
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ import net.minecraftforge.common.IPlantable;
|
||||||
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
import WayofTime.bloodmagic.api.BloodMagicAPI;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
|
||||||
public class ItemSigilGreenGrove extends ItemSigilToggleable
|
public class ItemSigilGreenGrove extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilGreenGrove()
|
public ItemSigilGreenGrove()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemSigilHaste extends ItemSigilToggleable
|
public class ItemSigilHaste extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilHaste()
|
public ItemSigilHaste()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.item.sigil;
|
package WayofTime.bloodmagic.item.sigil;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
|
@ -60,7 +61,7 @@ public class ItemSigilLava extends ItemSigilBase
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.canPlaceLava(world, blockpos1) && syphonNetwork(stack, player, getLPUsed()) && this.tryPlaceLava(world, blockpos1))
|
if (this.canPlaceLava(world, blockpos1) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceLava(world, blockpos1))
|
||||||
{
|
{
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +90,7 @@ public class ItemSigilLava extends ItemSigilBase
|
||||||
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
|
FluidStack fluid = new FluidStack(FluidRegistry.LAVA, 1000);
|
||||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||||
|
|
||||||
if (amount > 0 && syphonNetwork(stack, player, getLPUsed()))
|
if (amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
{
|
{
|
||||||
((IFluidHandler) tile).fill(side, fluid, true);
|
((IFluidHandler) tile).fill(side, fluid, true);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +108,7 @@ public class ItemSigilLava extends ItemSigilBase
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.canPlaceLava(world, newPos) && syphonNetwork(stack, player, getLPUsed()))
|
if (this.canPlaceLava(world, newPos) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
{
|
{
|
||||||
return this.tryPlaceLava(world, newPos) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
return this.tryPlaceLava(world, newPos) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
|
||||||
public class ItemSigilMagnetism extends ItemSigilToggleable
|
public class ItemSigilMagnetism extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilMagnetism()
|
public ItemSigilMagnetism()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.world.World;
|
||||||
import WayofTime.bloodmagic.api.Constants;
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.registry.ModBlocks;
|
import WayofTime.bloodmagic.registry.ModBlocks;
|
||||||
|
|
||||||
public class ItemSigilPhantomBridge extends ItemSigilToggleable
|
public class ItemSigilPhantomBridge extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilPhantomBridge()
|
public ItemSigilPhantomBridge()
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ import WayofTime.bloodmagic.api.Constants;
|
||||||
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
import WayofTime.bloodmagic.tile.TileSpectralBlock;
|
||||||
import WayofTime.bloodmagic.util.Utils;
|
import WayofTime.bloodmagic.util.Utils;
|
||||||
|
|
||||||
public class ItemSigilSuppression extends ItemSigilToggleable
|
public class ItemSigilSuppression extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilSuppression()
|
public ItemSigilSuppression()
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package WayofTime.bloodmagic.item.sigil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.Constants;
|
||||||
|
import WayofTime.bloodmagic.api.impl.ItemSigilToggleable;
|
||||||
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
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.util.helper.TextHelper;
|
||||||
|
|
||||||
|
public class ItemSigilToggleableBase extends ItemSigilToggleable implements IVariantProvider
|
||||||
|
{
|
||||||
|
protected final String tooltipBase;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public ItemSigilToggleableBase(String name, int lpUsed)
|
||||||
|
{
|
||||||
|
super(lpUsed);
|
||||||
|
setToggleable();
|
||||||
|
|
||||||
|
setUnlocalizedName(Constants.Mod.MODID + ".sigil." + name);
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
this.tooltipBase = "tooltip.BloodMagic.sigil." + name + ".";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||||||
|
{
|
||||||
|
super.addInformation(stack, player, tooltip, advanced);
|
||||||
|
if (getActivated(stack))
|
||||||
|
tooltip.add(TextHelper.localize("tooltip.BloodMagic.activated"));
|
||||||
|
else
|
||||||
|
tooltip.add(TextHelper.localize("tooltip.BloodMagic.deactivated"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Pair<Integer, String>> getVariants()
|
||||||
|
{
|
||||||
|
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
||||||
|
ret.add(new ImmutablePair<Integer, String>(0, "active=false"));
|
||||||
|
ret.add(new ImmutablePair<Integer, String>(1, "active=true"));
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package WayofTime.bloodmagic.item.sigil;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.effect.EntityLightningBolt;
|
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||||
|
@ -73,7 +74,7 @@ public class ItemSigilTransposition extends ItemSigilBase
|
||||||
{
|
{
|
||||||
if (rightClickedBlock.getBlock().getPlayerRelativeBlockHardness(state, player, world, blockPos) >= 0 && rightClickedBlock.getBlock().getBlockHardness(state, world, blockPos) >= 0)
|
if (rightClickedBlock.getBlock().getPlayerRelativeBlockHardness(state, player, world, blockPos) >= 0 && rightClickedBlock.getBlock().getBlockHardness(state, world, blockPos) >= 0)
|
||||||
{
|
{
|
||||||
int cost = getLPUsed();
|
int cost = getLpUsed();
|
||||||
|
|
||||||
NBTTagCompound tileNBTTag = new NBTTagCompound();
|
NBTTagCompound tileNBTTag = new NBTTagCompound();
|
||||||
String blockName = rightClickedBlock.getBlock().getRegistryName();
|
String blockName = rightClickedBlock.getBlock().getRegistryName();
|
||||||
|
@ -94,7 +95,7 @@ public class ItemSigilTransposition extends ItemSigilBase
|
||||||
stack.getTagCompound().setByte(Constants.NBT.CONTAINED_BLOCK_META, metadata);
|
stack.getTagCompound().setByte(Constants.NBT.CONTAINED_BLOCK_META, metadata);
|
||||||
stack.getTagCompound().setTag(Constants.NBT.CONTAINED_TILE_ENTITY, tileNBTTag);
|
stack.getTagCompound().setTag(Constants.NBT.CONTAINED_TILE_ENTITY, tileNBTTag);
|
||||||
|
|
||||||
syphonNetwork(stack, player, cost);
|
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, cost);
|
||||||
lightning(world, blockPos);
|
lightning(world, blockPos);
|
||||||
|
|
||||||
world.removeTileEntity(blockPos);
|
world.removeTileEntity(blockPos);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.item.sigil;
|
package WayofTime.bloodmagic.item.sigil;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -56,7 +57,7 @@ public class ItemSigilVoid extends ItemSigilBase
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlockState(blockpos).getBlock().getMaterial(world.getBlockState(blockpos)).isLiquid() && syphonNetwork(stack, player, getLPUsed()))
|
if (world.getBlockState(blockpos).getBlock().getMaterial(world.getBlockState(blockpos)).isLiquid() && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
{
|
{
|
||||||
world.setBlockToAir(blockpos);
|
world.setBlockToAir(blockpos);
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
|
@ -68,7 +69,7 @@ public class ItemSigilVoid extends ItemSigilBase
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!player.capabilities.isCreativeMode)
|
if (!player.capabilities.isCreativeMode)
|
||||||
this.setUnusable(stack, !syphonNetwork(stack, player, getLPUsed()));
|
this.setUnusable(stack, !NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
|
@ -92,7 +93,7 @@ public class ItemSigilVoid extends ItemSigilBase
|
||||||
{
|
{
|
||||||
FluidStack amount = ((IFluidHandler) tile).drain(side, 1000, false);
|
FluidStack amount = ((IFluidHandler) tile).drain(side, 1000, false);
|
||||||
|
|
||||||
if (amount != null && amount.amount > 0 && syphonNetwork(stack, player, getLPUsed()))
|
if (amount != null && amount.amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
{
|
{
|
||||||
((IFluidHandler) tile).drain(side, 1000, true);
|
((IFluidHandler) tile).drain(side, 1000, true);
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
|
@ -108,7 +109,7 @@ public class ItemSigilVoid extends ItemSigilBase
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlockState(newPos).getBlock() instanceof IFluidBlock && syphonNetwork(stack, player, getLPUsed()))
|
if (world.getBlockState(newPos).getBlock() instanceof IFluidBlock && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
{
|
{
|
||||||
world.setBlockToAir(newPos);
|
world.setBlockToAir(newPos);
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package WayofTime.bloodmagic.item.sigil;
|
package WayofTime.bloodmagic.item.sigil;
|
||||||
|
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
import net.minecraft.block.BlockCauldron;
|
import net.minecraft.block.BlockCauldron;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -57,7 +58,7 @@ public class ItemSigilWater extends ItemSigilBase
|
||||||
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack))
|
if (!player.canPlayerEdit(blockpos1, movingobjectposition.sideHit, stack))
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
|
|
||||||
if (this.canPlaceWater(world, blockpos1) && syphonNetwork(stack, player, getLPUsed()) && this.tryPlaceWater(world, blockpos1))
|
if (this.canPlaceWater(world, blockpos1) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceWater(world, blockpos1))
|
||||||
return super.onItemRightClick(stack, world, player, hand);
|
return super.onItemRightClick(stack, world, player, hand);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,19 +82,19 @@ public class ItemSigilWater extends ItemSigilBase
|
||||||
FluidStack fluid = new FluidStack(FluidRegistry.WATER, 1000);
|
FluidStack fluid = new FluidStack(FluidRegistry.WATER, 1000);
|
||||||
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
int amount = ((IFluidHandler) tile).fill(side, fluid, false);
|
||||||
|
|
||||||
if (amount > 0 && syphonNetwork(stack, player, getLPUsed()))
|
if (amount > 0 && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
((IFluidHandler) tile).fill(side, fluid, true);
|
((IFluidHandler) tile).fill(side, fluid, true);
|
||||||
return EnumActionResult.FAIL;
|
return EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (world.getBlockState(blockPos).getBlock() == Blocks.cauldron && syphonNetwork(stack, player, getLPUsed()))
|
if (world.getBlockState(blockPos).getBlock() == Blocks.cauldron && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()))
|
||||||
{
|
{
|
||||||
world.setBlockState(blockPos, Blocks.cauldron.getDefaultState().withProperty(BlockCauldron.LEVEL, 3));
|
world.setBlockState(blockPos, Blocks.cauldron.getDefaultState().withProperty(BlockCauldron.LEVEL, 3));
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockPos newPos = blockPos.offset(side);
|
BlockPos newPos = blockPos.offset(side);
|
||||||
return (player.canPlayerEdit(newPos, side, stack) && this.canPlaceWater(world, newPos) && syphonNetwork(stack, player, getLPUsed()) && this.tryPlaceWater(world, newPos)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
return (player.canPlayerEdit(newPos, side, stack) && this.canPlaceWater(world, newPos) && NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, getLpUsed()) && this.tryPlaceWater(world, newPos)) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlaceWater(World world, BlockPos blockPos)
|
public boolean canPlaceWater(World world, BlockPos blockPos)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemSigilWhirlwind extends ItemSigilToggleable
|
public class ItemSigilWhirlwind extends ItemSigilToggleableBase
|
||||||
{
|
{
|
||||||
public ItemSigilWhirlwind()
|
public ItemSigilWhirlwind()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,8 +6,8 @@ import WayofTime.bloodmagic.api.event.TeleposeEvent;
|
||||||
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
|
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
|
||||||
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
|
||||||
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
|
||||||
|
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||||
import WayofTime.bloodmagic.block.BlockTeleposer;
|
import WayofTime.bloodmagic.block.BlockTeleposer;
|
||||||
import WayofTime.bloodmagic.item.ItemBindable;
|
|
||||||
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
|
||||||
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
import WayofTime.bloodmagic.ritual.portal.Teleports;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
@ -86,8 +86,7 @@ public class TileTeleposer extends TileInventory implements ITickable
|
||||||
final int focusLevel = (teleposer.getStackInSlot(0).getItemDamage() + 1);
|
final int focusLevel = (teleposer.getStackInSlot(0).getItemDamage() + 1);
|
||||||
final int lpToBeDrained = (int) (0.5F * Math.sqrt((pos.getX() - focusPos.getX()) * (pos.getX() - focusPos.getX()) + (pos.getY() - focusPos.getY() + 1) * (pos.getY() - focusPos.getY() + 1) + (pos.getZ() - focusPos.getZ()) * (pos.getZ() - focusPos.getZ())));
|
final int lpToBeDrained = (int) (0.5F * Math.sqrt((pos.getX() - focusPos.getX()) * (pos.getX() - focusPos.getX()) + (pos.getY() - focusPos.getY() + 1) * (pos.getY() - focusPos.getY() + 1) + (pos.getZ() - focusPos.getZ()) * (pos.getZ() - focusPos.getZ())));
|
||||||
|
|
||||||
//TODO MAKE THIS SYPHON LP BETTER
|
if (NetworkHelper.getSoulNetwork(focus.getOwnerUUID(focusStack)).syphonAndDamage(PlayerHelper.getPlayerFromUUID(focus.getOwnerUUID(focusStack)), lpToBeDrained * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1)))
|
||||||
if (ItemBindable.syphonNetwork(teleposer.getStackInSlot(0), lpToBeDrained * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1)))
|
|
||||||
{
|
{
|
||||||
int blocksTransported = 0;
|
int blocksTransported = 0;
|
||||||
|
|
||||||
|
@ -156,7 +155,7 @@ public class TileTeleposer extends TileInventory implements ITickable
|
||||||
|
|
||||||
private boolean canInitiateTeleport(TileTeleposer teleposer)
|
private boolean canInitiateTeleport(TileTeleposer teleposer)
|
||||||
{
|
{
|
||||||
return teleposer.getStackInSlot(0) != null && teleposer.getStackInSlot(0).getItem() instanceof ItemTelepositionFocus && !Strings.isNullOrEmpty(((ItemTelepositionFocus) teleposer.getStackInSlot(0).getItem()).getBindableOwner(teleposer.getStackInSlot(0)));
|
return teleposer.getStackInSlot(0) != null && teleposer.getStackInSlot(0).getItem() instanceof ItemTelepositionFocus && !Strings.isNullOrEmpty(((ItemTelepositionFocus) teleposer.getStackInSlot(0).getItem()).getOwnerName(teleposer.getStackInSlot(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean teleportBlocks(Object caller, World initialWorld, BlockPos initialPos, World finalWorld, BlockPos finalPos)
|
public static boolean teleportBlocks(Object caller, World initialWorld, BlockPos initialPos, World finalWorld, BlockPos finalPos)
|
||||||
|
|
Loading…
Reference in a new issue