@Override public void onRender(float partialTicks) { boolean found = false; for(Object entity : WMinecraft.getWorld().loadedEntityList) if(entity instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP player = (EntityOtherPlayerMP)entity; if(player.getName().equals(playerName)) { ChatUtils.message( "Showing inventory of " + player.getName() + "."); mc.displayGuiScreen(new GuiInventory(player)); found = true; } } if(!found) ChatUtils.error("Player not found."); playerName = null; wurst.events.remove(RenderListener.class, this); }
/** * Handles the creation of a nearby player entity, sets the position and held item */ public void handleSpawnPlayer(SPacketSpawnPlayer packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); double d0 = packetIn.getX(); double d1 = packetIn.getY(); double d2 = packetIn.getZ(); float f = (float)(packetIn.getYaw() * 360) / 256.0F; float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.world, this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile()); entityotherplayermp.prevPosX = d0; entityotherplayermp.lastTickPosX = d0; entityotherplayermp.prevPosY = d1; entityotherplayermp.lastTickPosY = d1; entityotherplayermp.prevPosZ = d2; entityotherplayermp.lastTickPosZ = d2; EntityTracker.updateServerPosition(entityotherplayermp, d0, d1, d2); entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp); List < EntityDataManager.DataEntry<? >> list = packetIn.getDataManagerEntries(); if (list != null) { entityotherplayermp.getDataManager().setEntryValues(list); } }
/** * Handles the creation of a nearby player entity, sets the position and held item */ public void handleSpawnPlayer(SPacketSpawnPlayer packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); double d0 = packetIn.getX(); double d1 = packetIn.getY(); double d2 = packetIn.getZ(); float f = (float)(packetIn.getYaw() * 360) / 256.0F; float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getUniqueId()).getGameProfile()); entityotherplayermp.prevPosX = d0; entityotherplayermp.lastTickPosX = d0; entityotherplayermp.prevPosY = d1; entityotherplayermp.lastTickPosY = d1; entityotherplayermp.prevPosZ = d2; entityotherplayermp.lastTickPosZ = d2; EntityTracker.updateServerPosition(entityotherplayermp, d0, d1, d2); entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp); List < EntityDataManager.DataEntry<? >> list = packetIn.getDataManagerEntries(); if (list != null) { entityotherplayermp.getDataManager().setEntryValues(list); } }
@Override public void onRender() { boolean found = false; for (Object entity : Minecraft.getMinecraft().theWorld.loadedEntityList) { if (entity instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity; if (player.getName().equals(playerName)) { WurstClient.INSTANCE.chat.message("Showing inventory of " + player.getName() + "."); Minecraft.getMinecraft().displayGuiScreen(new GuiInventory(player)); found = true; } } } if (!found) WurstClient.INSTANCE.chat.error("Player not found."); playerName = null; WurstClient.INSTANCE.events.remove(RenderListener.class, this); }
@Override public void onEnable() { if (EntityUtils.getClosestEntityRaw(false) == null) { WurstClient.INSTANCE.chat.message("There is no nearby entity."); setEnabled(false); return; } oldX = Minecraft.getMinecraft().thePlayer.posX; oldY = Minecraft.getMinecraft().thePlayer.posY; oldZ = Minecraft.getMinecraft().thePlayer.posZ; oldYaw = Minecraft.getMinecraft().thePlayer.rotationYaw; oldPitch = Minecraft.getMinecraft().thePlayer.rotationPitch; Minecraft.getMinecraft().thePlayer.noClip = true; if (otherID == null) otherID = EntityUtils.getClosestEntityRaw(false).getUniqueID(); otherView = EntityUtils.searchEntityByIdRaw(otherID); wasInvisible = otherView.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer); EntityOtherPlayerMP fakePlayer = new EntityOtherPlayerMP(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getGameProfile()); fakePlayer.clonePlayer(Minecraft.getMinecraft().thePlayer, true); fakePlayer.copyLocationAndAnglesFrom(Minecraft.getMinecraft().thePlayer); fakePlayer.rotationYawHead = Minecraft.getMinecraft().thePlayer.rotationYawHead; Minecraft.getMinecraft().theWorld.addEntityToWorld(-69, fakePlayer); WurstClient.INSTANCE.chat.message("Now viewing " + otherView.getName() + "."); WurstClient.INSTANCE.events.add(UpdateListener.class, this); }
@SubscribeEvent public void onTick(ClientTickEvent event) { if(event.phase == TickEvent.Phase.START && mc.theWorld != null) { if(pingDelay <= -10.0D) { pingDelay = 63.0D; } pingDelay -= 1.0D; entityList = mc.theWorld.loadedEntityList; ArrayList<String> newInRangePlayers = new ArrayList(); for(Object o : entityList) { if(o instanceof EntityOtherPlayerMP) { newInRangePlayers.add(((EntityOtherPlayerMP)o).getName()); } } ArrayList<String> temp = (ArrayList)newInRangePlayers.clone(); newInRangePlayers.removeAll(inRangePlayers); for(String name : newInRangePlayers) { mc.theWorld.playSound(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, "minecraft:note.pling", config.getPingVolume(), 1.0F, false); } inRangePlayers = temp; } }
@Override public void onEnable() { try{ Resilience.getInstance().getValues().freecamEnabled = true; Resilience.getInstance().getEventManager().register(this); freecamX = invoker.getPosX(); freecamY = invoker.getPosY(); freecamZ = invoker.getPosZ(); freecamPitch = invoker.getRotationPitch(); freecamYaw = invoker.getRotationYaw(); entity = new EntityOtherPlayerMP(Resilience.getInstance().getWrapper().getWorld(), new GameProfile("",Resilience.getInstance().getValues().nameProtectEnabled ? Resilience.getInstance().getValues().nameProtectAlias.getValue() : invoker.getSessionUsername())); invoker.setPositionAndRotation(entity, invoker.getPosX(), invoker.getPosY() - invoker.getEntityHeight(Resilience.getInstance().getWrapper().getPlayer()) + 0.17, invoker.getPosZ(), invoker.getRotationYaw(), invoker.getRotationPitch()); invoker.copyInventory(entity, Resilience.getInstance().getWrapper().getPlayer()); invoker.addEntityToWorld(entity, 69); }catch(Exception e){} }
@Override public boolean recieveCommand(String cmd) throws Exception { String args[] = cmd.split("invsee "); for(Object o : Resilience.getInstance().getInvoker().getEntityList()){ if(o instanceof EntityOtherPlayerMP){ EntityOtherPlayerMP player = (EntityOtherPlayerMP)o; if(Resilience.getInstance().getInvoker().getPlayerName(player).equalsIgnoreCase(args[1].trim())){ Resilience.getInstance().getWrapper().getInGameGui().displayInv(player); Resilience.getInstance().getLogger().infoChat("Now viewing "+args[1]); return true; } } } Resilience.getInstance().getLogger().warningChat("Error! Player "+args[1]+" not found."); return true; }
@Override public boolean recieveCommand(String cmd) throws Exception { if(mc.renderViewEntity != mc.thePlayer){ mc.renderViewEntity = mc.thePlayer; Resilience.getInstance().getLogger().infoChat("Now viewing from your player"); return true; } String args[] = cmd.split("remoteview "); for(Object o : Resilience.getInstance().getInvoker().getEntityList()){ if(o instanceof EntityOtherPlayerMP){ EntityOtherPlayerMP otherPlayer = (EntityOtherPlayerMP) o; if(Resilience.getInstance().getInvoker().getPlayerName(otherPlayer).equalsIgnoreCase(args[1].trim())){ mc.renderViewEntity = otherPlayer; Resilience.getInstance().getLogger().infoChat("Now viewing from \247b"+Resilience.getInstance().getInvoker().getPlayerName(otherPlayer)+"\247f's perspective"); return true; } } } Resilience.getInstance().getLogger().warningChat("Error, player not found"); return false; }
public Set<AbstractClientPlayer> getPlayers(final PlayerTeam team) { try { return playerList.get(team, new Callable<Set<AbstractClientPlayer>>() { @Override public Set<AbstractClientPlayer> call() throws Exception { Set<AbstractClientPlayer> players = new LinkedHashSet(); Minecraft mc = Minecraft.getMinecraft(); players.add(new EntityOtherPlayerMP(mc.theWorld, new GameProfile(team.getOwner(), getUsernameFromID(team.getOwner())))); if (!team.isOwner(mc.thePlayer)) players.add(mc.thePlayer); for (UUID uuid : team.getMembers()) { if (uuid.equals(PlayerHelper.getUUIDForPlayer(mc.thePlayer))) continue; else { players.add(new EntityOtherPlayerMP(mc.theWorld, new GameProfile(uuid, getUsernameFromID(uuid)))); } } return players; } }); } catch (Exception e) { return new LinkedHashSet(); } }
public void func_72518_a(Packet20NamedEntitySpawn p_72518_1_) { double var2 = (double)p_72518_1_.field_73515_c / 32.0D; double var4 = (double)p_72518_1_.field_73512_d / 32.0D; double var6 = (double)p_72518_1_.field_73513_e / 32.0D; float var8 = (float)(p_72518_1_.field_73510_f * 360) / 256.0F; float var9 = (float)(p_72518_1_.field_73511_g * 360) / 256.0F; EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.field_72563_h.field_71441_e, p_72518_1_.field_73514_b); var10.field_70169_q = var10.field_70142_S = (double)(var10.field_70118_ct = p_72518_1_.field_73515_c); var10.field_70167_r = var10.field_70137_T = (double)(var10.field_70117_cu = p_72518_1_.field_73512_d); var10.field_70166_s = var10.field_70136_U = (double)(var10.field_70116_cv = p_72518_1_.field_73513_e); int var11 = p_72518_1_.field_73518_h; if(var11 == 0) { var10.field_71071_by.field_70462_a[var10.field_71071_by.field_70461_c] = null; } else { var10.field_71071_by.field_70462_a[var10.field_71071_by.field_70461_c] = new ItemStack(var11, 1, 0); } var10.func_70080_a(var2, var4, var6, var8, var9); this.field_72564_i.func_73027_a(p_72518_1_.field_73516_a, var10); List var12 = p_72518_1_.func_73509_c(); if(var12 != null) { var10.func_70096_w().func_75687_a(var12); } }
public void func_72524_a(Packet18Animation p_72524_1_) { Entity var2 = this.func_72545_a(p_72524_1_.field_73470_a); if(var2 != null) { if(p_72524_1_.field_73469_b == 1) { EntityLivingBase var3 = (EntityLivingBase)var2; var3.func_71038_i(); } else if(p_72524_1_.field_73469_b == 2) { var2.func_70057_ab(); } else if(p_72524_1_.field_73469_b == 3) { EntityPlayer var4 = (EntityPlayer)var2; var4.func_70999_a(false, false, false); } else if(p_72524_1_.field_73469_b != 4) { if(p_72524_1_.field_73469_b == 6) { this.field_72563_h.field_71452_i.func_78873_a(new EntityCrit2FX(this.field_72563_h.field_71441_e, var2)); } else if(p_72524_1_.field_73469_b == 7) { EntityCrit2FX var5 = new EntityCrit2FX(this.field_72563_h.field_71441_e, var2, "magicCrit"); this.field_72563_h.field_71452_i.func_78873_a(var5); } else if(p_72524_1_.field_73469_b == 5 && var2 instanceof EntityOtherPlayerMP) { ; } } } }
@SubscribeEvent public void playerTick(PlayerTickEvent event) { if(event.player.world.isRemote) { if(!event.player.getEntityData().hasKey("harshenInventory") && !(event.player instanceof EntityOtherPlayerMP)) HarshenNetwork.sendToServer(new MessagePacketRequestInv()); } if(!tickMap.containsKey(event.player)) tickMap.put(event.player, 0); tickMap.put(event.player, tickMap.get(event.player) + 1); HarshenItemStackHandler handler = HarshenUtils.getHandler(event.player); ArrayList<ItemStack> prevInv = event.side.isServer() ? prevInvServer : prevInvClient; if(prevInv.size() != 0) for(int slot = 0; slot < handler.getSlots(); slot++) if(!prevInv.get(slot).isItemEqual(handler.getStackInSlot(slot)) && handler.getStackInSlot(slot).getItem() instanceof IHarshenProvider) ((IHarshenProvider)handler.getStackInSlot(slot).getItem()).onAdd(event.player, slot); else if(!prevInv.get(slot).isEmpty() && handler.getStackInSlot(slot).isEmpty() && prevInv.get(slot).getItem() instanceof IHarshenProvider) ((IHarshenProvider)prevInv.get(slot).getItem()).onRemove(event.player, slot); ArrayList<ItemStack> tickHandlerInventory = new ArrayList<>(); for(int slot = 0; slot < handler.getSlots(); slot++) { if(handler.getStackInSlot(slot).getItem() instanceof IHarshenProvider) ((IHarshenProvider)handler.getStackInSlot(slot).getItem()).onTick(event.player, tickMap.get(event.player)); tickHandlerInventory.add(handler.getStackInSlot(slot)); } prevInv.clear(); prevInv.addAll(tickHandlerInventory); }
@Override public void onEnabled() { if(MC.player != null) { isRidingEntity = MC.player.getRidingEntity() != null; if (MC.player.getRidingEntity() == null) { posX = MC.player.posX; posY = MC.player.posY; posZ = MC.player.posZ; } else { ridingEntity = MC.player.getRidingEntity(); MC.player.dismountRidingEntity(); } pitch = MC.player.rotationPitch; yaw = MC.player.rotationYaw; clonedPlayer = new EntityOtherPlayerMP(MC.world, MC.getSession().getProfile()); clonedPlayer.copyLocationAndAnglesFrom(MC.player); clonedPlayer.rotationYawHead = MC.player.rotationYawHead; MC.world.addEntityToWorld(-100, clonedPlayer); MC.player.capabilities.isFlying = true; MC.player.capabilities.setFlySpeed(speed.getAsFloat()); MC.player.noClip = true; } }
@Override protected void onEnable() { if (!(Wrapper.theWorld() instanceof WorldClient) || Wrapper.thePlayer() == null || Wrapper.theWorld() == null) { setEnabled(false); return; } super.onEnable(); keybinds[0] = Wrapper.keybindJump().func_151463_i(); keybinds[1] = Wrapper.keybindAttack().func_151463_i(); keybinds[2] = Wrapper.keybindInventory().func_151463_i(); keybinds[3] = Wrapper.keybindForward().func_151463_i(); keybinds[4] = Wrapper.keybindUseItem().func_151463_i(); keybinds[5] = Wrapper.keybindBack().func_151463_i(); keybinds[6] = Wrapper.keybindLeft().func_151463_i(); keybinds[7] = Wrapper.keybindRight().func_151463_i(); keybinds[8] = Wrapper.keybindShift().func_151463_i(); bind(Wrapper.keybindJump(), 0); bind(Wrapper.keybindAttack(), 0); bind(Wrapper.keybindInventory(), 0); bind(Wrapper.keybindForward(), 0); bind(Wrapper.keybindUseItem(), 0); bind(Wrapper.keybindBack(), 0); bind(Wrapper.keybindLeft(), 0); bind(Wrapper.keybindRight(), 0); bind(Wrapper.keybindShift(), 0); this.entity = new EntityOtherPlayerMP(Wrapper.theWorld(), Wrapper.thePlayer().func_146103_bH()); this.entity.func_70080_a(Wrapper.getPosX(Wrapper.thePlayer()), Wrapper.getPosY(Wrapper.thePlayer()), Wrapper.getPosZ(Wrapper.thePlayer()), Wrapper.player_rotationYaw(), Wrapper.player_rotationPitch()); Wrapper.theWorld().func_73027_a(-420, this.entity); Wrapper.getMinecraft().field_71451_h = this.entity; }
/** * Handles the creation of a nearby player entity, sets the position and held item */ public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); double d0 = (double)packetIn.getX() / 32.0D; double d1 = (double)packetIn.getY() / 32.0D; double d2 = (double)packetIn.getZ() / 32.0D; float f = (float)(packetIn.getYaw() * 360) / 256.0F; float f1 = (float)(packetIn.getPitch() * 360) / 256.0F; EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getPlayer()).getGameProfile()); entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double)(entityotherplayermp.serverPosX = packetIn.getX()); entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double)(entityotherplayermp.serverPosY = packetIn.getY()); entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double)(entityotherplayermp.serverPosZ = packetIn.getZ()); int i = packetIn.getCurrentItemID(); if (i == 0) { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null; } else { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(Item.getItemById(i), 1, 0); } entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp); List<DataWatcher.WatchableObject> list = packetIn.func_148944_c(); if (list != null) { entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list); } }
@Override public void onEnable() { if (this.mc.thePlayer == null) { return; } this.playerCopy = new EntityOtherPlayerMP((World)this.mc.theWorld, this.mc.thePlayer.getGameProfile()); this.playerCopy.inventory = this.mc.thePlayer.inventory; this.playerCopy.inventoryContainer = this.mc.thePlayer.inventoryContainer; this.playerCopy.setPositionAndRotation(this.mc.thePlayer.posX, this.mc.thePlayer.posY, this.mc.thePlayer.posZ, this.mc.thePlayer.rotationYaw, this.mc.thePlayer.rotationPitch); this.playerCopy.rotationYawHead = this.mc.thePlayer.rotationYawHead; this.mc.theWorld.addEntityToWorld(-1, (Entity)this.playerCopy); super.onEnable(); }
public int getPlayerPing(final String name) { final EntityPlayer player = this.mc.theWorld.getPlayerEntityByName(name); if (player instanceof EntityOtherPlayerMP) { return ((EntityOtherPlayerMP)player).playerInfo.getResponseTime(); } return 0; }
/** * Handles the creation of a nearby player entity, sets the position and held * item */ public void handleSpawnPlayer(S0CPacketSpawnPlayer packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController); double d0 = (double) packetIn.getX() / 32.0D; double d1 = (double) packetIn.getY() / 32.0D; double d2 = (double) packetIn.getZ() / 32.0D; float f = (float) (packetIn.getYaw() * 360) / 256.0F; float f1 = (float) (packetIn.getPitch() * 360) / 256.0F; EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, this.getPlayerInfo(packetIn.getPlayer()).getGameProfile()); entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double) (entityotherplayermp.serverPosX = packetIn .getX()); entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double) (entityotherplayermp.serverPosY = packetIn .getY()); entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double) (entityotherplayermp.serverPosZ = packetIn .getZ()); int i = packetIn.getCurrentItemID(); if (i == 0) { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null; } else { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack( Item.getItemById(i), 1, 0); } entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); this.clientWorldController.addEntityToWorld(packetIn.getEntityID(), entityotherplayermp); List<DataWatcher.WatchableObject> list = packetIn.func_148944_c(); if (list != null) { entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list); } }
public static IEntity getEntityFromName(String username) { for (Entity entity : Minecraft.getMinecraft().world.loadedEntityList) { if (entity instanceof EntityOtherPlayerMP) { EntityOtherPlayerMP player = (EntityOtherPlayerMP) entity; if (player.getName().toLowerCase().equals(username.toLowerCase())) { return new IEntity(player); } } } return null; }
@SideOnly(Side.CLIENT) public boolean addToBlacklist(ItemStack stack){ if(stack.useItemRightClick(Minecraft.getMinecraft().world, new EntityOtherPlayerMP(Minecraft.getMinecraft().world, new GameProfile(null, "fake")), EnumHand.MAIN_HAND).getType()!=EnumActionResult.PASS){ Property blackList=conf.get("config", "Blacklist items", new String[0]); blackList.set(Arrays.copyOf(blackList.getStringList(),blackList.getStringList().length+1)); blackList.getStringList()[blackList.getStringList().length-1]=stack.getItem().getRegistryName().toString(); syncConfig(); return true; } return false; }
public static void registerEntityRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityTier1Rocket.class, new RenderTier1Rocket(new ModelRocketTier1(), GalacticraftCore.ASSET_PREFIX, "rocketT1")); RenderingRegistry.registerEntityRenderingHandler(EntityEvolvedSpider.class, new RenderEvolvedSpider()); RenderingRegistry.registerEntityRenderingHandler(EntityEvolvedZombie.class, new RenderEvolvedZombie()); RenderingRegistry.registerEntityRenderingHandler(EntityEvolvedCreeper.class, new RenderEvolvedCreeper()); RenderingRegistry.registerEntityRenderingHandler(EntityEvolvedSkeleton.class, new RenderEvolvedSkeleton()); RenderingRegistry.registerEntityRenderingHandler(EntitySkeletonBoss.class, new RenderEvolvedSkeletonBoss()); RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor()); RenderingRegistry.registerEntityRenderingHandler(EntityBuggy.class, new RenderBuggy()); RenderingRegistry.registerEntityRenderingHandler(EntityMeteorChunk.class, new RenderMeteorChunk()); RenderingRegistry.registerEntityRenderingHandler(EntityFlag.class, new RenderFlag()); RenderingRegistry.registerEntityRenderingHandler(EntityParachest.class, new RenderParaChest()); RenderingRegistry.registerEntityRenderingHandler(EntityAlienVillager.class, new RenderAlienVillager()); // RenderingRegistry.registerEntityRenderingHandler(EntityBubble.class, new RenderBubble(0.25F, 0.25F, 1.0F)); RenderingRegistry.registerEntityRenderingHandler(EntityLander.class, new RenderLander()); RenderingRegistry.registerEntityRenderingHandler(EntityCelestialFake.class, new RenderEntityFake()); if (Loader.isModLoaded("RenderPlayerAPI")) { ModelPlayerAPI.register(Constants.MOD_ID_CORE, ModelPlayerBaseGC.class); RenderPlayerAPI.register(Constants.MOD_ID_CORE, RenderPlayerBaseGC.class); } else { RenderingRegistry.registerEntityRenderingHandler(EntityPlayerSP.class, new RenderPlayerGC()); RenderingRegistry.registerEntityRenderingHandler(EntityOtherPlayerMP.class, new RenderPlayerGC()); } }
@Override public void onEnable() { fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile()); if(mc.inGameHasFocus){ oldX = mc.thePlayer.posX; oldY = mc.thePlayer.posY; oldZ = mc.thePlayer.posZ; fakePlayer.setEntityId(-1881); fakePlayer.clonePlayer(mc.thePlayer, true); fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer); fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead; mc.theWorld.addEntityToWorld(fakePlayer.getEntityId(), fakePlayer); } }
@Override public void onEnable() { oldX = Minecraft.getMinecraft().thePlayer.posX; oldY = Minecraft.getMinecraft().thePlayer.posY; oldZ = Minecraft.getMinecraft().thePlayer.posZ; fakePlayer = new EntityOtherPlayerMP(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getGameProfile()); fakePlayer.clonePlayer(Minecraft.getMinecraft().thePlayer, true); fakePlayer.copyLocationAndAnglesFrom(Minecraft.getMinecraft().thePlayer); fakePlayer.rotationYawHead = Minecraft.getMinecraft().thePlayer.rotationYawHead; Minecraft.getMinecraft().theWorld.addEntityToWorld(-69, fakePlayer); WurstClient.INSTANCE.events.add(UpdateListener.class, this); }
@Override public void onEnable() { lastTime = System.currentTimeMillis(); oldX = Minecraft.getMinecraft().thePlayer.posX; oldY = Minecraft.getMinecraft().thePlayer.posY; oldZ = Minecraft.getMinecraft().thePlayer.posZ; fakePlayer = new EntityOtherPlayerMP(Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer.getGameProfile()); fakePlayer.clonePlayer(Minecraft.getMinecraft().thePlayer, true); fakePlayer.copyLocationAndAnglesFrom(Minecraft.getMinecraft().thePlayer); fakePlayer.rotationYawHead = Minecraft.getMinecraft().thePlayer.rotationYawHead; Minecraft.getMinecraft().theWorld.addEntityToWorld(-69, fakePlayer); }
private void drawRadarIcons() { if(entityList == null) { return; } for(Object o : entityList) { Entity e = (Entity) o; int playerPosX = (int) mc.thePlayer.posX; int playerPosZ = (int) mc.thePlayer.posZ; int entityPosX = (int) e.posX; int entityPosZ = (int) e.posZ; int displayPosX = playerPosX - entityPosX; int displayPosZ = playerPosZ - entityPosZ; if(e != mc.thePlayer) { if(e instanceof EntityItem) { EntityItem item = (EntityItem) e; if(config.isRender(EntityItem.class)) { renderItemIcon(displayPosX, displayPosZ, item.getEntityItem()); } } else if(e instanceof EntityOtherPlayerMP) { if(config.isRender(EntityPlayer.class)) { EntityOtherPlayerMP eop = (EntityOtherPlayerMP) e; try { renderPlayerHeadIcon(displayPosX, displayPosZ, eop); } catch (Exception ex) { ex.printStackTrace(); } } } else if(e instanceof EntityMinecart) { if(config.isRender(EntityMinecart.class)) { ItemStack cart = new ItemStack(Items.minecart); renderItemIcon(displayPosX, displayPosZ, cart); } } else if(config.isRender(o.getClass())) { renderIcon(displayPosX, displayPosZ, config.getMob(o.getClass()).getResource()); } } } }
private void renderPlayerHeadIcon(int x, int y, EntityOtherPlayerMP player) throws Exception { GL11.glColor4f(1.0F, 1.0F, 1.0F, config.getRadarOpacity() + 0.5F); GL11.glEnable(3042); GL11.glPushMatrix(); GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(x + 1, y + 1, 0.0F); GL11.glRotatef(mc.thePlayer.rotationYaw, 0.0F, 0.0F, 1.0F); mc.getTextureManager().bindTexture(new ResourceLocation("civRadar/icons/player.png")); drawModalRectWithCustomSizedTexture(-8, -8, 0, 0, 16, 16, 16, 16); GL11.glTranslatef(-x -1, -y -1, 0.0F); GL11.glScalef(2.0F, 2.0F, 2.0F); GL11.glDisable(2896); GL11.glDisable(3042); GL11.glPopMatrix(); if(config.isPlayerNames()) { GL11.glPushMatrix(); GL11.glScalef(0.5F, 0.5F, 0.5F); GL11.glTranslatef(x, y, 0.0F); GL11.glRotatef(mc.thePlayer.rotationYaw, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-x - 8, -y, 0.0F); String playerName = player.getName(); if(config.isExtraPlayerInfo()) { playerName += " (" + (int) mc.thePlayer.getDistanceToEntity(player) + "m)(Y" + (int) player.posY + ")"; } int yOffset = config.getNameLocation() == NameLocation.below ? 10 : -10; drawCenteredString(mc.fontRendererObj, playerName, x + 8, y + yOffset, Color.WHITE.getRGB()); GL11.glScalef(2.0F, 2.0F, 2.0F); GL11.glPopMatrix(); } }
@Override public void onUpdate(EventOnUpdate event){ for(Object o : invoker.getEntityList()){ if(o instanceof EntityOtherPlayerMP){ EntityOtherPlayerMP player = (EntityOtherPlayerMP) o; if(invoker.getPlayerName(player).equalsIgnoreCase(Resilience.getInstance().getValues().trackName)){ Resilience.getInstance().getValues().trackPosList.add(new Double[]{invoker.getPosX(player), invoker.getPosY(player), invoker.getPosZ(player)}); } } } }
public void onRender(EventOnRender event){ for(Object o : invoker.getEntityList()){ if(o instanceof EntityOtherPlayerMP){ EntityOtherPlayerMP player = (EntityOtherPlayerMP) o; double posX = invoker.getLastTickPosX(player) - RenderManager.renderPosX; double posY = invoker.getLastTickPosY(player) - RenderManager.renderPosY; double posZ = invoker.getLastTickPosZ(player) - RenderManager.renderPosZ; boolean friend = entityUtils.isEntityFriend(player); boolean enemy = entityUtils.isEntityEnemy(player); RenderUtils.drawTracer(0, 0, 0, posX, posY+invoker.getEntityHeight(player)/2, posZ, friend ? 0 : 1, (friend || enemy) ? 0 : 1, enemy ? 0 : 1, 1); } } }
@Override public void onClick(EventOnClick event){ if(event.getButton() == 2){ MovingObjectPosition obj = invoker.getObjectMouseOver(); if(obj != null){ if(obj.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY){ Entity e = obj.entityHit; if(e instanceof EntityOtherPlayerMP){ EntityOtherPlayerMP player = (EntityOtherPlayerMP) e; for(Friend friend : Friend.friendList){ if(friend.getName().equalsIgnoreCase(invoker.getPlayerName(player))){ Friend.friendList.remove(Friend.friendList.indexOf(friend)); Resilience.getInstance().getFileManager().saveFriends(); return; } } for(Enemy enemy : Enemy.enemyList){ if(enemy.getName().equalsIgnoreCase(invoker.getPlayerName(player))){ Enemy.enemyList.remove(Enemy.enemyList.indexOf(enemy)); Resilience.getInstance().getFileManager().saveEnemies(); break; } } Friend.friendList.add(new Friend(invoker.getPlayerName(player), invoker.getPlayerName(player))); Resilience.getInstance().getFileManager().saveFriends(); } } } } }
public boolean isEntityFriend(Entity e){ if(e instanceof EntityOtherPlayerMP){ EntityOtherPlayerMP player = (EntityOtherPlayerMP) e; return FriendManager.isFriend(invoker.getPlayerName(player)); } return false; }
public boolean isEntityEnemy(Entity e){ if(e instanceof EntityOtherPlayerMP){ EntityOtherPlayerMP player = (EntityOtherPlayerMP) e; return EnemyManager.isEnemy(invoker.getPlayerName(player)); } return false; }
/** * Handles the creation of a nearby player entity, sets the position and held item */ public void handleSpawnPlayer(S0CPacketSpawnPlayer p_147237_1_) { double var2 = (double)p_147237_1_.func_148942_f() / 32.0D; double var4 = (double)p_147237_1_.func_148949_g() / 32.0D; double var6 = (double)p_147237_1_.func_148946_h() / 32.0D; float var8 = (float)(p_147237_1_.func_148941_i() * 360) / 256.0F; float var9 = (float)(p_147237_1_.func_148945_j() * 360) / 256.0F; EntityOtherPlayerMP var10 = new EntityOtherPlayerMP(this.gameController.theWorld, p_147237_1_.func_148948_e()); var10.prevPosX = var10.lastTickPosX = (double)(var10.serverPosX = p_147237_1_.func_148942_f()); var10.prevPosY = var10.lastTickPosY = (double)(var10.serverPosY = p_147237_1_.func_148949_g()); var10.prevPosZ = var10.lastTickPosZ = (double)(var10.serverPosZ = p_147237_1_.func_148946_h()); int var11 = p_147237_1_.func_148947_k(); if (var11 == 0) { var10.inventory.mainInventory[var10.inventory.currentItem] = null; } else { var10.inventory.mainInventory[var10.inventory.currentItem] = new ItemStack(Item.getItemById(var11), 1, 0); } var10.setPositionAndRotation(var2, var4, var6, var8, var9); this.clientWorldController.addEntityToWorld(p_147237_1_.func_148943_d(), var10); List var12 = p_147237_1_.func_148944_c(); if (var12 != null) { var10.getDataWatcher().updateWatchedObjectsFromList(var12); } }
/** * @return A list of all player's as EntityPlayers. Relies on the * list of playerEntities in the current world. */ public static List<EntityPlayer> getPlayersFromWorld() { ArrayList<EntityPlayer> players = new ArrayList<EntityPlayer>(); for (Object player : Main.mc.theWorld.playerEntities) { if (player instanceof EntityClientPlayerMP) continue; players.add(Main.mc.theWorld.getPlayerEntityByName(((EntityOtherPlayerMP)player).getDisplayName().replaceAll("\u00A7.(.*)", "$1"))); } return players; }
public void handleSpawnPlayer(S0CPacketSpawnPlayer p_147237_1_) { double d0 = (double)p_147237_1_.func_148942_f() / 32.0D; double d1 = (double)p_147237_1_.func_148949_g() / 32.0D; double d2 = (double)p_147237_1_.func_148946_h() / 32.0D; float f = (float)(p_147237_1_.func_148941_i() * 360) / 256.0F; float f1 = (float)(p_147237_1_.func_148945_j() * 360) / 256.0F; GameProfile gameprofile = p_147237_1_.func_148948_e(); EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.gameController.theWorld, p_147237_1_.func_148948_e()); entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double)(entityotherplayermp.serverPosX = p_147237_1_.func_148942_f()); entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double)(entityotherplayermp.serverPosY = p_147237_1_.func_148949_g()); entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double)(entityotherplayermp.serverPosZ = p_147237_1_.func_148946_h()); int i = p_147237_1_.func_148947_k(); if (i == 0) { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null; } else { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(Item.getItemById(i), 1, 0); } entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); this.clientWorldController.addEntityToWorld(p_147237_1_.func_148943_d(), entityotherplayermp); List list = p_147237_1_.func_148944_c(); if (list != null) { entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list); } }
public void handleNamedEntitySpawn(Packet20NamedEntitySpawn par1Packet20NamedEntitySpawn) { double d0 = (double)par1Packet20NamedEntitySpawn.xPosition / 32.0D; double d1 = (double)par1Packet20NamedEntitySpawn.yPosition / 32.0D; double d2 = (double)par1Packet20NamedEntitySpawn.zPosition / 32.0D; float f = (float)(par1Packet20NamedEntitySpawn.rotation * 360) / 256.0F; float f1 = (float)(par1Packet20NamedEntitySpawn.pitch * 360) / 256.0F; EntityOtherPlayerMP entityotherplayermp = new EntityOtherPlayerMP(this.mc.theWorld, par1Packet20NamedEntitySpawn.name); entityotherplayermp.prevPosX = entityotherplayermp.lastTickPosX = (double)(entityotherplayermp.serverPosX = par1Packet20NamedEntitySpawn.xPosition); entityotherplayermp.prevPosY = entityotherplayermp.lastTickPosY = (double)(entityotherplayermp.serverPosY = par1Packet20NamedEntitySpawn.yPosition); entityotherplayermp.prevPosZ = entityotherplayermp.lastTickPosZ = (double)(entityotherplayermp.serverPosZ = par1Packet20NamedEntitySpawn.zPosition); int i = par1Packet20NamedEntitySpawn.currentItem; if (i == 0) { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = null; } else { entityotherplayermp.inventory.mainInventory[entityotherplayermp.inventory.currentItem] = new ItemStack(i, 1, 0); } entityotherplayermp.setPositionAndRotation(d0, d1, d2, f, f1); this.worldClient.addEntityToWorld(par1Packet20NamedEntitySpawn.entityId, entityotherplayermp); List list = par1Packet20NamedEntitySpawn.getWatchedMetadata(); if (list != null) { entityotherplayermp.getDataWatcher().updateWatchedObjectsFromList(list); } }