use of net.minecraft.util.ActionResult in project LogisticsPipes by RS485.
the class ItemHUDArmor method onItemRightClick.
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand handIn) {
ItemStack stack = player.getHeldItem(handIn);
if (MainProxy.isClient(world)) {
return new ActionResult<>(EnumActionResult.PASS, stack);
}
useItem(player, world);
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
use of net.minecraft.util.ActionResult in project LogisticsPipes by RS485.
the class ItemPipeController method onItemRightClick.
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand handIn) {
ItemStack stack = player.getHeldItem(handIn);
if (MainProxy.isClient(world)) {
return new ActionResult<>(EnumActionResult.PASS, stack);
}
useItem(player, world);
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
use of net.minecraft.util.ActionResult in project ImmersiveEngineering by BluSunrize.
the class ItemSkyhook method onItemRightClick.
/*@Override
public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
{
Multimap multimap = super.getAttributeModifiers(slot, stack);
if(slot == EntityEquipmentSlot.MAINHAND)
{
float dmg = 5 + ItemNBTHelper.getFloat(stack, "fallDamageBoost");
multimap.put(SharedMonsterAttributes.ATTACK_DAMAGE.getName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Weapon modifier", dmg, 0));
}
return multimap;
}*/
@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (player.getCooldownTracker().hasCooldown(this))
return new ActionResult<>(EnumActionResult.PASS, stack);
if (player.isSneaking()) {
boolean limitSpeed = toggleSpeedLimit(stack);
if (limitSpeed)
player.sendStatusMessage(new TextComponentTranslation("chat.immersiveengineering.info.skyhookLimited"), true);
else
player.sendStatusMessage(new TextComponentTranslation("chat.immersiveengineering.info.skyhookUnlimited"), true);
} else {
SkyhookUserData data = player.getCapability(SKYHOOK_USER_DATA, EnumFacing.UP);
assert data != null;
if (data.hook != null && !world.isRemote) {
data.dismount();
IELogger.logger.info("Player left voluntarily");
} else {
data.startHolding();
player.setActiveHand(hand);
}
}
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
use of net.minecraft.util.ActionResult in project ICBM-Classic by BuiltBrokenModding.
the class ItemAntidote method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
ItemStack itemstack = playerIn.getHeldItem(handIn);
playerIn.setActiveHand(handIn);
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
}
use of net.minecraft.util.ActionResult in project ICBM-Classic by BuiltBrokenModding.
the class ItemRadarGun method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand handIn) {
if (// also clear the gps coord if the play is shift-rightclicking in the air
player.isSneaking()) {
if (!world.isRemote) {
ItemStack stack = player.getHeldItem(handIn);
stack.setTagCompound(null);
stack.setItemDamage(0);
LanguageUtility.addChatToPlayer(player, "gps.cleared.name");
player.inventoryContainer.detectAndSendChanges();
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(handIn));
}
if (world.isRemote) {
RayTraceResult objectMouseOver = player.rayTrace(200, 1);
if (objectMouseOver.typeOfHit != RayTraceResult.Type.MISS) {
// TODO add message saying that the gps target is out of range.
final TileEntity tileEntity = world.getTileEntity(objectMouseOver.getBlockPos());
if (!(ICBMClassicHelpers.isLauncher(tileEntity, null))) {
ICBMClassic.packetHandler.sendToServer(new PacketPlayerItem(player).addData(objectMouseOver.getBlockPos()));
}
}
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(handIn));
}
Aggregations