/** * Removes the leash from this entity */ public void clearLeashed(boolean sendPacket, boolean dropLead) { if (this.isLeashed) { this.isLeashed = false; this.leashedToEntity = null; if (!this.worldObj.isRemote && dropLead) { this.dropItem(Items.lead, 1); } if (!this.worldObj.isRemote && sendPacket && this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new S1BPacketEntityAttach(1, this, (Entity)null)); } } }
/** * Removes the leash from this entity. Second parameter tells whether to send a packet to surrounding players. */ public void clearLeashed(boolean par1, boolean par2) { if (this.isLeashed) { this.isLeashed = false; this.leashedToEntity = null; if (!this.worldObj.isClient && par2) { this.func_145779_a(Items.lead, 1); } if (!this.worldObj.isClient && par1 && this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S1BPacketEntityAttach(1, this, (Entity)null)); } } }
public void clearLeashed(boolean p_110160_1_, boolean p_110160_2_) { if (this.isLeashed) { this.isLeashed = false; this.leashedToEntity = null; if (!this.worldObj.isRemote && p_110160_2_) { this.dropItem(Items.lead, 1); } if (!this.worldObj.isRemote && p_110160_1_ && this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S1BPacketEntityAttach(1, this, (Entity)null)); } } }
public void setPassengerOf(Entity entity) { // mount(null) doesn't really fly for overloaded methods, // so this method is needed Entity currentVehicle = this.ridingEntity; super.setPassengerOf(entity); // Check if the vehicle actually changed. if (currentVehicle != this.ridingEntity) { this.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this, this.ridingEntity)); this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } // CraftBukkit end }
/** * Sets the entity to be leashed to. */ public void setLeashedToEntity(Entity entityIn, boolean sendAttachNotification) { this.isLeashed = true; this.leashedToEntity = entityIn; if (!this.worldObj.isRemote && sendAttachNotification && this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().sendToAllTrackingEntity(this, new S1BPacketEntityAttach(1, this, this.leashedToEntity)); } }
/** * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. */ public void mountEntity(Entity entityIn) { Entity entity = this.ridingEntity; super.mountEntity(entityIn); if (entityIn != entity) { this.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this, this.ridingEntity)); this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); } }
public void sendFairyMount(final Entity rider, final Entity vehicle) { final Entity newVehicle; if (rider.ridingEntity != null && rider.ridingEntity == vehicle) { newVehicle = null; } else { newVehicle = vehicle; } final S1BPacketEntityAttach packet = new S1BPacketEntityAttach(0, rider, newVehicle); sendToAllPlayers(packet); if (!(rider instanceof FairyEntityFishHook)) { rider.mountEntity(newVehicle); } }
/** * Called when a player mounts an entity. e.g. mounts a pig, mounts a boat. */ public void mountEntity(Entity par1Entity) { super.mountEntity(par1Entity); this.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this, this.ridingEntity)); this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); }
public void setLeashedToEntity(Entity p_110162_1_, boolean p_110162_2_) { this.isLeashed = true; this.leashedToEntity = p_110162_1_; if (!this.worldObj.isRemote && p_110162_2_ && this.worldObj instanceof WorldServer) { ((WorldServer)this.worldObj).getEntityTracker().func_151247_a(this, new S1BPacketEntityAttach(1, this, this.leashedToEntity)); } }
public void handleEntityAttach(S1BPacketEntityAttach packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId()); if (packetIn.getLeash() == 0) { boolean flag = false; if (packetIn.getEntityId() == this.gameController.thePlayer.getEntityId()) { entity = this.gameController.thePlayer; if (entity1 instanceof EntityBoat) { ((EntityBoat)entity1).setIsBoatEmpty(false); } flag = entity.ridingEntity == null && entity1 != null; } else if (entity1 instanceof EntityBoat) { ((EntityBoat)entity1).setIsBoatEmpty(true); } if (entity == null) { return; } entity.mountEntity(entity1); if (flag) { GameSettings gamesettings = this.gameController.gameSettings; this.gameController.ingameGUI.setRecordPlaying(I18n.format("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindSneak.getKeyCode())}), false); } } else if (packetIn.getLeash() == 1 && entity instanceof EntityLiving) { if (entity1 != null) { ((EntityLiving)entity).setLeashedToEntity(entity1, false); } else { ((EntityLiving)entity).clearLeashed(false, false); } } }
public void handleEntityAttach(S1BPacketEntityAttach packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId()); Entity entity1 = this.clientWorldController.getEntityByID(packetIn.getVehicleEntityId()); if (packetIn.getLeash() == 0) { boolean flag = false; if (packetIn.getEntityId() == this.gameController.thePlayer.getEntityId()) { entity = this.gameController.thePlayer; if (entity1 instanceof EntityBoat) { ((EntityBoat) entity1).setIsBoatEmpty(false); } flag = entity.ridingEntity == null && entity1 != null; } else if (entity1 instanceof EntityBoat) { ((EntityBoat) entity1).setIsBoatEmpty(true); } if (entity == null) { return; } entity.mountEntity(entity1); if (flag) { GameSettings gamesettings = this.gameController.gameSettings; this.gameController.ingameGUI.setRecordPlaying( I18n.format("mount.onboard", new Object[] { GameSettings.getKeyDisplayString(gamesettings.keyBindSneak.getKeyCode()) }), false); } } else if (packetIn.getLeash() == 1 && entity instanceof EntityLiving) { if (entity1 != null) { ((EntityLiving) entity).setLeashedToEntity(entity1, false); } else { ((EntityLiving) entity).clearLeashed(false, false); } } }
public void handleEntityAttach(S1BPacketEntityAttach p_147243_1_) { Object var2 = this.clientWorldController.getEntityByID(p_147243_1_.func_149403_d()); Entity var3 = this.clientWorldController.getEntityByID(p_147243_1_.func_149402_e()); if (p_147243_1_.func_149404_c() == 0) { boolean var4 = false; if (p_147243_1_.func_149403_d() == this.gameController.thePlayer.getEntityId()) { var2 = this.gameController.thePlayer; if (var3 instanceof EntityBoat) { ((EntityBoat)var3).setIsBoatEmpty(false); } var4 = ((Entity)var2).ridingEntity == null && var3 != null; } else if (var3 instanceof EntityBoat) { ((EntityBoat)var3).setIsBoatEmpty(true); } if (var2 == null) { return; } ((Entity)var2).mountEntity(var3); if (var4) { GameSettings var5 = this.gameController.gameSettings; this.gameController.ingameGUI.func_110326_a(I18n.format("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(var5.keyBindSneak.getKeyCode())}), false); } } else if (p_147243_1_.func_149404_c() == 1 && var2 != null && var2 instanceof EntityLiving) { if (var3 != null) { ((EntityLiving)var2).setLeashedToEntity(var3, false); } else { ((EntityLiving)var2).clearLeashed(false, false); } } }
public final boolean interactFirst(EntityPlayer p_130002_1_) { if (this.getLeashed() && this.getLeashedToEntity() == p_130002_1_) { // CraftBukkit start if (CraftEventFactory.callPlayerUnleashEntityEvent(this, p_130002_1_).isCancelled()) { ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this, this.getLeashedToEntity())); return false; } // CraftBukkit end this.clearLeashed(true, !p_130002_1_.capabilities.isCreativeMode); return true; } else { ItemStack itemstack = p_130002_1_.inventory.getCurrentItem(); if (itemstack != null && itemstack.getItem() == Items.lead && this.allowLeashing()) { if (!(this instanceof EntityTameable) || !((EntityTameable)this).isTamed()) { // CraftBukkit start if (CraftEventFactory.callPlayerLeashEntityEvent(this, p_130002_1_, p_130002_1_).isCancelled()) { ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this, this.getLeashedToEntity())); return false; } // CraftBukkit end this.setLeashedToEntity(p_130002_1_, true); --itemstack.stackSize; return true; } if (((EntityTameable)this).func_152114_e(p_130002_1_)) { // CraftBukkit start if (CraftEventFactory.callPlayerLeashEntityEvent(this, p_130002_1_, p_130002_1_).isCancelled()) { ((EntityPlayerMP) p_130002_1_).playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(1, this, this.getLeashedToEntity())); return false; } // CraftBukkit end this.setLeashedToEntity(p_130002_1_, true); --itemstack.stackSize; return true; } } return this.interact(p_130002_1_) ? true : super.interactFirst(p_130002_1_); } }
public void handleEntityAttach(S1BPacketEntityAttach p_147243_1_) { Object object = this.clientWorldController.getEntityByID(p_147243_1_.func_149403_d()); Entity entity = this.clientWorldController.getEntityByID(p_147243_1_.func_149402_e()); if (p_147243_1_.func_149404_c() == 0) { boolean flag = false; if (p_147243_1_.func_149403_d() == this.gameController.thePlayer.getEntityId()) { object = this.gameController.thePlayer; if (entity instanceof EntityBoat) { ((EntityBoat)entity).setIsBoatEmpty(false); } flag = ((Entity)object).ridingEntity == null && entity != null; } else if (entity instanceof EntityBoat) { ((EntityBoat)entity).setIsBoatEmpty(true); } if (object == null) { return; } ((Entity)object).mountEntity(entity); if (flag) { GameSettings gamesettings = this.gameController.gameSettings; this.gameController.ingameGUI.func_110326_a(I18n.format("mount.onboard", new Object[] {GameSettings.getKeyDisplayString(gamesettings.keyBindSneak.getKeyCode())}), false); } } else if (p_147243_1_.func_149404_c() == 1 && object != null && object instanceof EntityLiving) { if (entity != null) { ((EntityLiving)object).setLeashedToEntity(entity, false); } else { ((EntityLiving)object).clearLeashed(false, false); } } }
public void mountEntity(Entity p_70078_1_) { super.mountEntity(p_70078_1_); this.playerNetServerHandler.sendPacket(new S1BPacketEntityAttach(0, this, this.ridingEntity)); this.playerNetServerHandler.setPlayerLocation(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch); }
void handleEntityAttach(S1BPacketEntityAttach packetIn);
void handleEntityAttach(S1BPacketEntityAttach var1);
void handleEntityAttach(S1BPacketEntityAttach p_147243_1_);