@Override protected boolean processInteract(EntityPlayer player, EnumHand hand) { if(!player.isSneaking()) { player.startRiding(this); return true; } return false; }
public void setRidingPlayer(EntityPlayer player) { L.trace("setRidingPlayer({})", player.getName()); player.rotationYaw = rotationYaw; player.rotationPitch = rotationPitch; player.startRiding(this); }
@Override public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) { World world = entity.getEntityWorld(); // if (world.isRemote) { return false; } player.startRiding(entity, true); super.onUse(stack, player, world, hand); return true; }
@Override public boolean processInitialInteract(EntityPlayer player, EnumHand hand) { if (!this.world.isRemote && !isBeingRidden() && !player.isSneaking()) { player.startRiding(this); lastMounted = player; } return true; }
@Override public boolean processInitialInteract(EntityPlayer player, EnumHand hand) { if (!world.isRemote) { if (!player.isSneaking() && !(player.getRidingEntity() == this)) { player.startRiding(this); } } return true; }
public static void createSeatAndSit(World worldIn, BlockPos pos, EntityPlayer playerIn, double yOffset) { List<EntitySeat> seats = worldIn.getEntitiesWithinAABB(EntitySeat.class, new AxisAlignedBB(pos)); if(!seats.isEmpty()) { EntitySeat seat = seats.get(0); if(seat.getRidingEntity() == null) { playerIn.startRiding(seat); } } else { EntitySeat seat = new EntitySeat(worldIn, pos, yOffset); worldIn.spawnEntity(seat); playerIn.startRiding(seat); } } }
public static boolean sitOnBlockWithRotationOffset(World world, double x, double y, double z, EntityPlayer player, double yOffset, int metadata, double rotationOffset) { if(!world.isRemote && !player.isSneaking() && !checkForExistingSeat(world, x, y, z, player)) { EntitySeat seat = new EntitySeat(world, x, y, z, yOffset, metadata, rotationOffset); world.spawnEntity(seat); player.startRiding(seat); } return true; }
public static boolean sitOnBlock(World world, double x, double y, double z, EntityPlayer player, double yOffset) { if(!world.isRemote && !player.isSneaking() && !checkForExistingSeat(world, x, y, z, player)) { EntitySeat seat = new EntitySeat(world, x, y, z, yOffset); world.spawnEntity(seat); player.startRiding(seat); } return true; }
@Override public boolean processInitialInteract(EntityPlayer player, EnumHand hand) { if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, player, hand))) return true; if (player.isSneaking()) { return false; } else if (this.isBeingRidden()) { return true; } else { if (!this.world.isRemote) { player.startRiding(this); } return true; } }
private static boolean checkForExistingSeat(World world, double x, double y, double z, EntityPlayer player) { if(!world.isRemote) { List<EntitySeat> seats = world.getEntitiesWithinAABB(EntitySeat.class, new AxisAlignedBB(x, y, z, x + 1.0D, y + 1.0D, z + 1.0D).grow(1D)); for(EntitySeat seat : seats) { if(seat.blockPosX == x && seat.blockPosY == y && seat.blockPosZ == z) { if(!seat.isBeingRidden()) { player.startRiding(seat); } return true; } } } return false; }
public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); boolean flag = itemstack.getItem() == Items.NAME_TAG || itemstack.getItem() == Items.LEAD; if (flag) { itemstack.interactWithEntity(player, this, hand); return true; } if (!super.processInteract(player, hand)) { player.startRiding(this); return true; } return true; }
@Override public void updateTask() { // catch owner in flight if possible if (!dragon.isFlying()) { dragon.liftOff(); } // mount owner if close enough, otherwise move to owner if (dragon.getDistanceToEntity(owner) < dragon.width) { owner.startRiding(dragon); } else { dragon.getNavigator().tryMoveToEntityLiving(owner, 1); } } }
public boolean interact(EntityPlayer player) { if (player.world.isRemote) { return true; } if (!player.isSneaking() && !vehicle.isBeingRidden()) { player.startRiding(vehicle); return true; } else if (player.isSneaking()) { NetworkHandler.INSTANCE.openGui(player, NetworkHandler.GUI_VEHICLE_INVENTORY, vehicle.getEntityId()); } else if (vehicle.isBeingRidden() && vehicle.getPassengers().get(0) instanceof NpcBase) { NpcBase npc = (NpcBase) vehicle.getPassengers().get(0); npc.dismountRidingEntity(); } return true; }
@Override public void onCollideWithPlayer(EntityPlayer player) { super.onCollideWithPlayer(player); if (player.isSneaking()) player.setSneaking(false); if (!getEntityWorld().isRemote && !player.capabilities.isCreativeMode && !captured() && rand.nextInt(20) == 0 && !getDropped()) { player.startRiding(this, true); pickupHeight = posY; setPosition(posX, player.posY + getYOffset(), posZ); setCountdown(60); } }
public boolean processInteract(EntityPlayer player, EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); if (this.getWormAge() > 4 && !player.isRiding() && player.getHeldItemMainhand().getItem() == Items.FISHING_ROD && player.getHeldItemOffhand().getItem() == Items.FISHING_ROD && !this.world.isRemote) { player.startRiding(this); return true; } return super.processInteract(player, hand); }
@Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) { ItemStack itemStackIn = playerIn.getHeldItem(hand); worldIn.playSound((EntityPlayer) null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F)); playerIn.getCooldownTracker().setCooldown(this, cooldown); if (!worldIn.isRemote) { EntityEnderPearl entityenderpearl = new EntityEnderPearl(worldIn, playerIn); //func_184538_a entityenderpearl.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F); worldIn.spawnEntity(entityenderpearl); if (orbType == OrbType.MOUNTED) { playerIn.dismountRidingEntity(); playerIn.startRiding(entityenderpearl); } } super.onUse(itemStackIn, playerIn, worldIn, hand); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn); }
@Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { ItemStack stack = player.getHeldItem(hand); if (!world.isRemote && player.getRidingEntity() == null && !player.isSneaking()) { player.posY += Y_SPAWN_OFFSET; EntityBroom entityBroom = new EntityBroom(world, player.posX, player.posY, player.posZ); entityBroom.setBroomStack(stack); entityBroom.rotationYaw = player.rotationYaw; // Spawn and mount the broom world.spawnEntity(entityBroom); player.startRiding(entityBroom); stack.shrink(1); } return MinecraftHelpers.successAction(stack); }
@Override public boolean processInitialInteract(EntityPlayer player, EnumHand hand) { if (player.getLowestRidingEntity() == super.getLowestRidingEntity()) { onRiderInteract(player, player.getHeldItem(hand), hand); } else { player.startRiding(this); PhysicsWrapperEntity wrapper = getParentShip(); if (wrapper != null) { Vector posInLocal = new Vector(this); Vector passengerOffset = getRiderPositionOffset(); // double[] rotationMatricesCompensation = RotationMatrices.getRotationMatrix(0, 45D, 0); // RotationMatrices.applyTransform(rotationMatricesCompensation, passengerOffset); wrapper.wrapping.coordTransform.fromGlobalToLocal(posInLocal); posInLocal.add(passengerOffset); wrapper.wrapping.fixEntity(player, posInLocal); } } return false; }
@Override public boolean processInitialInteract(EntityPlayer player, EnumHand hand) { if (!world.isRemote) { if (player.getRidingEntity() == this) { ItemStack currentStack = this.dataManager.get(RECORD_ITEM); ItemStack stack = player.getHeldItem(hand); if (stack.getItem() instanceof ItemRecord || stack.isEmpty()) { this.dataManager.set(RECORD_ITEM, stack); player.setHeldItem(hand, currentStack); if (!stack.isEmpty()) { JurassiCraft.NETWORK_WRAPPER.sendToAll(new CarEntityPlayRecord(this, stack)); } } } else if (!player.isSneaking()) { player.startRiding(this); } } return true; }
@Override public void onCollideWithPlayer(EntityPlayer player) { super.onCollideWithPlayer(player); if (player.isSneaking()) player.setSneaking(false); byte duration = 0; if (!getEntityWorld().isRemote && player.getEntityBoundingBox().maxY >= getEntityBoundingBox().minY && player.getEntityBoundingBox().minY <= getEntityBoundingBox().maxY && captured()) if (getEntityWorld().getDifficulty().ordinal() > 1) if (getEntityWorld().getDifficulty() == EnumDifficulty.NORMAL) duration = 5; else if (getEntityWorld().getDifficulty() == EnumDifficulty.HARD) duration = 10; if (duration > 0 && rand.nextInt(50) == 0) { player.addPotionEffect(new PotionEffect(MobEffects.POISON, duration * 20, 0)); setisStinging(true); getEntityWorld().playSound(null, getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_SWEEP, SoundCategory.HOSTILE, 0.5F, 2F); } if (!player.capabilities.isCreativeMode && !getEntityWorld().isRemote && !captured()) if(getEntitySenses().canSee(player)) player.startRiding(this, true); }