2015-11-02 20:39:44 +00:00
|
|
|
package WayofTime.bloodmagic.item.sigil;
|
2015-10-30 05:05:00 +00:00
|
|
|
|
2018-02-06 01:04:38 +00:00
|
|
|
import WayofTime.bloodmagic.apibutnotreally.iface.IAltarReader;
|
|
|
|
import WayofTime.bloodmagic.apibutnotreally.iface.ISigil;
|
|
|
|
import WayofTime.bloodmagic.apibutnotreally.util.helper.NetworkHelper;
|
|
|
|
import WayofTime.bloodmagic.apibutnotreally.util.helper.PlayerHelper;
|
2017-08-16 04:30:48 +00:00
|
|
|
import WayofTime.bloodmagic.util.ChatUtil;
|
2016-03-18 19:00:23 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.util.ActionResult;
|
2016-11-12 00:57:50 +00:00
|
|
|
import net.minecraft.util.EnumActionResult;
|
2016-03-18 19:00:23 +00:00
|
|
|
import net.minecraft.util.EnumHand;
|
|
|
|
import net.minecraft.util.math.RayTraceResult;
|
|
|
|
import net.minecraft.util.text.ITextComponent;
|
2016-04-03 01:44:50 +00:00
|
|
|
import net.minecraft.util.text.TextComponentTranslation;
|
2016-03-18 19:00:23 +00:00
|
|
|
import net.minecraft.world.World;
|
2015-10-30 05:05:00 +00:00
|
|
|
|
2017-08-16 04:30:48 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
public class ItemSigilDivination extends ItemSigilBase implements IAltarReader {
|
|
|
|
public ItemSigilDivination() {
|
2015-10-30 05:05:00 +00:00
|
|
|
super("divination");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-16 04:30:48 +00:00
|
|
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
2016-10-22 20:52:35 +00:00
|
|
|
// if (world instanceof WorldServer)
|
|
|
|
// {
|
|
|
|
// System.out.println("Testing...");
|
|
|
|
//// BuildTestStructure s = new BuildTestStructure();
|
|
|
|
//// s.placeStructureAtPosition(new Random(), Rotation.CLOCKWISE_180, (WorldServer) world, player.getPosition(), 0);
|
|
|
|
// DungeonTester.testDungeonElementWithOutput((WorldServer) world, player.getPosition());
|
|
|
|
// }
|
2016-09-13 21:20:35 +00:00
|
|
|
|
2016-09-22 18:20:05 +00:00
|
|
|
// if (!world.isRemote)
|
|
|
|
// {
|
|
|
|
// EntityCorruptedSheep fred = new EntityCorruptedSheep(world, EnumDemonWillType.DESTRUCTIVE);
|
|
|
|
// fred.setPosition(player.posX, player.posY, player.posZ);
|
|
|
|
// world.spawnEntityInWorld(fred);
|
|
|
|
// }
|
2017-01-02 08:10:28 +00:00
|
|
|
ItemStack stack = player.getHeldItem(hand);
|
2017-03-15 02:33:13 +00:00
|
|
|
if (stack.getItem() instanceof ISigil.Holding)
|
|
|
|
stack = ((Holding) stack.getItem()).getHeldItem(stack, player);
|
2016-08-22 18:22:18 +00:00
|
|
|
|
2016-11-12 00:57:50 +00:00
|
|
|
if (PlayerHelper.isFakePlayer(player))
|
|
|
|
return ActionResult.newResult(EnumActionResult.FAIL, stack);
|
|
|
|
|
2017-08-16 04:30:48 +00:00
|
|
|
if (!world.isRemote) {
|
2017-01-02 08:10:28 +00:00
|
|
|
super.onItemRightClick(world, player, hand);
|
2016-04-03 01:44:50 +00:00
|
|
|
|
2016-04-24 17:06:28 +00:00
|
|
|
RayTraceResult position = rayTrace(world, player, false);
|
2015-10-30 05:05:00 +00:00
|
|
|
|
2017-08-16 04:30:48 +00:00
|
|
|
if (position == null) {
|
2016-02-11 20:44:32 +00:00
|
|
|
int currentEssence = NetworkHelper.getSoulNetwork(getOwnerUUID(stack)).getCurrentEssence();
|
2016-03-18 19:00:23 +00:00
|
|
|
List<ITextComponent> toSend = new ArrayList<ITextComponent>();
|
2016-02-06 02:05:44 +00:00
|
|
|
if (!getOwnerName(stack).equals(PlayerHelper.getUsernameFromPlayer(player)))
|
2016-04-03 01:44:50 +00:00
|
|
|
toSend.add(new TextComponentTranslation(tooltipBase + "otherNetwork", getOwnerName(stack)));
|
|
|
|
toSend.add(new TextComponentTranslation(tooltipBase + "currentEssence", currentEssence));
|
2016-03-18 19:00:23 +00:00
|
|
|
ChatUtil.sendNoSpam(player, toSend.toArray(new ITextComponent[toSend.size()]));
|
2015-10-30 05:05:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-02 08:10:28 +00:00
|
|
|
return super.onItemRightClick(world, player, hand);
|
2015-10-30 05:05:00 +00:00
|
|
|
}
|
|
|
|
}
|