use of net.minecraft.item.ItemNameTag in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class EventsCommon method onRightClickBlock.
@SubscribeEvent()
public void onRightClickBlock(RightClickBlock event) {
if (!event.getWorld().isRemote) {
ItemStack stack = event.getItemStack();
if (stack != null && stack.getItem() instanceof ItemNameTag) {
BlockPos posAt = event.getPos();
EntityPlayer player = event.getEntityPlayer();
World world = event.getWorld();
PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(world, posAt);
if (wrapper != null) {
wrapper.setCustomNameTag(stack.getDisplayName());
--stack.stackSize;
event.setCanceled(true);
}
}
}
}
use of net.minecraft.item.ItemNameTag in project ArsMagica2 by Mithion.
the class EntityLightMage method interact.
@Override
protected boolean interact(EntityPlayer player) {
if (worldObj.isRemote)
return false;
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemNameTag)
return false;
if (SkillData.For(player).isEntryKnown(SkillTreeManager.instance.getSkillTreeEntry(SkillManager.instance.getSkill("MageBandI")))) {
if (EntityUtilities.isSummon(this)) {
player.addChatMessage(new ChatComponentText(String.format("\247o%s", StatCollector.translateToLocal("am2.npc.partyleave"))));
EntityUtilities.revertAI(this);
} else {
if (ExtendedProperties.For(player).getCanHaveMoreSummons()) {
if (ExtendedProperties.For(player).getMagicLevel() - 5 >= ExtendedProperties.For(this).getMagicLevel()) {
player.addChatMessage(new ChatComponentText(String.format("\247o%s", StatCollector.translateToLocal("am2.npc.partyjoin"))));
EntityUtilities.setOwner(this, player);
EntityUtilities.makeSummon_PlayerFaction(this, player, true);
EntityUtilities.setSummonDuration(this, -1);
} else {
player.addChatMessage(new ChatComponentText(String.format("\247o%s", StatCollector.translateToLocal("am2.npc.partyrefuse"))));
}
} else {
player.addChatMessage(new ChatComponentText(String.format("\247o%s", StatCollector.translateToLocal("am2.npc.partyfull"))));
}
}
} else {
player.addChatMessage(new ChatComponentText(String.format("\247o%s", StatCollector.translateToLocal("am2.npc.nopartyskill"))));
}
return false;
}
Aggregations