private void sendPlayerPermissionLevel(EntityPlayerMP player, int permLevel) { if (player != null && player.connection != null) { byte b0; if (permLevel <= 0) { b0 = 24; } else if (permLevel >= 4) { b0 = 28; } else { b0 = (byte)(24 + permLevel); } player.connection.sendPacket(new SPacketEntityStatus(player, b0)); } }
/** * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death), * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...) */ public void handleEntityStatus(SPacketEntityStatus packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = packetIn.getEntity(this.clientWorldController); if (entity != null) { if (packetIn.getOpCode() == 21) { this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian)entity)); } else { entity.handleStatusUpdate(packetIn.getOpCode()); } } }
@Inject(method = "handleEntityStatus", at = @At("HEAD"), cancellable = true) private void preHandleEntityStatus(SPacketEntityStatus packet, CallbackInfo ci) { if (mc.world == null) return; Entity entity = packet.getEntity(mc.world); // noinspection ConstantConditions if (entity == null) return; EntityStatusEvent event = new EntityStatusEvent(EventState.PRE, entity, packet.getOpCode()); ClientAPI.EVENT_BUS.post(event); if (event.isCancelled()) ci.cancel(); }
@Inject(method = "handleEntityStatus", at = @At("RETURN")) private void postHandleEntityStatus(SPacketEntityStatus packet, CallbackInfo ci) { if (mc.world == null) return; Entity entity = packet.getEntity(mc.world); // noinspection ConstantConditions if (entity == null) return; ClientAPI.EVENT_BUS.post(new EntityStatusEvent(EventState.POST, entity, packet.getOpCode())); }
/** * Used for when item use count runs out, ie: eating completed */ protected void onItemUseFinish() { if (!this.activeItemStack.func_190926_b() && this.isHandActive()) { this.connection.sendPacket(new SPacketEntityStatus(this, (byte)9)); super.onItemUseFinish(); } }
/** * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death), * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...) */ public void handleEntityStatus(SPacketEntityStatus packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = packetIn.getEntity(this.clientWorldController); if (entity != null) { if (packetIn.getOpCode() == 21) { this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian)entity)); } else if (packetIn.getOpCode() == 35) { int i = 40; this.gameController.effectRenderer.func_191271_a(entity, EnumParticleTypes.TOTEM, 30); this.clientWorldController.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.field_191263_gW, entity.getSoundCategory(), 1.0F, 1.0F, false); if (entity == this.gameController.player) { this.gameController.entityRenderer.func_190565_a(new ItemStack(Items.field_190929_cY)); } } else { entity.handleStatusUpdate(packetIn.getOpCode()); } } }
/** * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death), * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...) */ public void handleEntityStatus(SPacketEntityStatus packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); Entity entity = packetIn.getEntity(this.clientWorldController); if (entity != null) { if (packetIn.getOpCode() == 21) { this.gameController.getSoundHandler().playSound(new GuardianSound((EntityGuardian)entity)); } else if (packetIn.getOpCode() == 35) { int i = 40; this.gameController.effectRenderer.func_191271_a(entity, EnumParticleTypes.TOTEM, 30); this.clientWorldController.playSound(entity.posX, entity.posY, entity.posZ, SoundEvents.field_191263_gW, entity.getSoundCategory(), 1.0F, 1.0F, false); if (entity == this.gameController.player) { if (!Hacks.findMod(AntiTotemAnimation.class).isEnabled()) { this.gameController.entityRenderer.func_190565_a(new ItemStack(Items.field_190929_cY)); } } } else { entity.handleStatusUpdate(packetIn.getOpCode()); } } }
public static void notifyGameRuleChange(GameRules rules, String p_184898_1_, MinecraftServer server) { if ("reducedDebugInfo".equals(p_184898_1_)) { byte b0 = (byte)(rules.getBoolean(p_184898_1_) ? 22 : 23); for (EntityPlayerMP entityplayermp : server.getPlayerList().getPlayerList()) { entityplayermp.connection.sendPacket(new SPacketEntityStatus(entityplayermp, b0)); } } }
/** * Used for when item use count runs out, ie: eating completed */ protected void onItemUseFinish() { if (this.activeItemStack != null && this.isHandActive()) { this.connection.sendPacket(new SPacketEntityStatus(this, (byte)9)); super.onItemUseFinish(); } }
public static void func_175773_a(GameRules p_175773_0_, String p_175773_1_) { if ("reducedDebugInfo".equals(p_175773_1_)) { byte b0 = (byte) (p_175773_0_.getBoolean(p_175773_1_) ? 22 : 23); for (EntityPlayerMP entityplayermp : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayers()) { entityplayermp.connection.sendPacket(new SPacketEntityStatus(entityplayermp, b0)); } } }
static void notifyGameRuleChange(GameRules rules, String key, World world) { if (key.equals("reducedDebugInfo")) { byte opCode = (byte)(rules.getBoolean(key) ? 22 : 23); for (EntityPlayerMP player : world.getPlayers(EntityPlayerMP.class, Predicates.alwaysTrue())) { player.connection.sendPacket(new SPacketEntityStatus(player, opCode)); } } }
private void sendPlayerPermissionLevel(EntityPlayerMP player, int permLevel) { if (player != null && player.connection != null) { byte b; if (permLevel <= 0) b = 24; else if (permLevel >= 4) b = 28; else b = (byte) (24 + permLevel); player.connection.sendPacket(new SPacketEntityStatus(player, b)); } }
@Override public int executeActivateBehavior(TileEntityTrophy tile, EntityPlayer player) { if (player instanceof EntityPlayerMP) { ((EntityPlayerMP)player).connection.sendPacket(new SPacketEntityStatus(player, (byte)35)); } return 100; }
/** * sends a Packet 38 (Entity Status) to all tracked players of that entity */ public void setEntityState(Entity entityIn, byte state) { this.getEntityTracker().sendToTrackingAndSelf(entityIn, new SPacketEntityStatus(entityIn, state)); }
/** * Invokes the entities' handleUpdateHealth method which is implemented in LivingBase (hurt/death), * MinecartMobSpawner (spawn delay), FireworkRocket & MinecartTNT (explosion), IronGolem (throwing,...), Witch * (spawn particles), Zombie (villager transformation), Animal (breeding mode particles), Horse (breeding/smoke * particles), Sheep (...), Tameable (...), Villager (particles for breeding mode, angry and happy), Wolf (...) */ void handleEntityStatus(SPacketEntityStatus packetIn);