Java Code Examples for net.minecraft.client.multiplayer.WorldClient#getEntityByID()
The following examples show how to use
net.minecraft.client.multiplayer.WorldClient#getEntityByID() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PlayerChunkViewer.java From ChickenChunks with MIT License | 6 votes |
public TicketInfo(PacketCustom packet, WorldClient world) { ID = packet.readInt(); modId = packet.readString(); if(packet.readBoolean()) player = packet.readString(); type = net.minecraftforge.common.ForgeChunkManager.Type.values()[packet.readUByte()]; if(type == net.minecraftforge.common.ForgeChunkManager.Type.ENTITY) entity = world.getEntityByID(packet.readInt()); int chunks = packet.readUShort(); chunkSet = new HashSet<ChunkCoordIntPair>(chunks); for(int i = 0; i < chunks; i++) { chunkSet.add(new ChunkCoordIntPair(packet.readInt(), packet.readInt())); } }
Example 2
Source File: WRAddonCPH.java From WirelessRedstone with MIT License | 5 votes |
private void throwTracker(WorldClient world, EntityPlayer player, int entityID, int throwerID, int freq) { Entity thrower = world.getEntityByID(throwerID); if (throwerID == player.getEntityId()) thrower = player; if (thrower != null && thrower instanceof EntityLiving) { EntityWirelessTracker tracker = new EntityWirelessTracker(world, 0, (EntityLiving) thrower); tracker.setEntityId(entityID); world.addEntityToWorld(entityID, tracker); world.playSoundAtEntity(thrower, "random.bow", 0.5F, 0.4F / (world.rand.nextFloat() * 0.4F + 0.8F)); } }
Example 3
Source File: WRAddonCPH.java From WirelessRedstone with MIT License | 5 votes |
private void throwREP(int entityID, int throwerID, WorldClient world, EntityPlayer player) { Entity thrower = world.getEntityByID(throwerID); if (throwerID == player.getEntityId()) thrower = player; if (thrower != null && thrower instanceof EntityLivingBase) { EntityREP rep = new EntityREP(world, (EntityLivingBase) thrower); rep.setEntityId(entityID); world.addEntityToWorld(entityID, rep); } }
Example 4
Source File: WRAddonCPH.java From WirelessRedstone with MIT License | 4 votes |
private void processTrackerUpdate(PacketCustom packet, WorldClient world, EntityPlayer player) { int entityID = packet.readInt(); int freq = packet.readUShort(); boolean attached = packet.readBoolean(); Entity e = world.getEntityByID(entityID); if (e != null && e.isDead) e = null; if (!(e instanceof EntityWirelessTracker)) { if (e != null) throw new IllegalStateException("EntityID mapped to non tracker"); e = new EntityWirelessTracker(world, freq); e.setEntityId(entityID); world.addEntityToWorld(entityID, e); } EntityWirelessTracker tracker = (EntityWirelessTracker) e; if (attached) { int attachedEntityID = packet.readInt(); Entity attachedEntity; if (attachedEntityID == player.getEntityId()) attachedEntity = player; else attachedEntity = world.getEntityByID(attachedEntityID); if (attachedEntity == null) { return; } tracker.attached = true; tracker.attachedEntity = attachedEntity; tracker.attachedX = packet.readFloat(); tracker.attachedY = packet.readFloat(); tracker.attachedZ = packet.readFloat(); tracker.attachedYaw = packet.readFloat(); } else { tracker.attachedEntity = null; tracker.attached = false; tracker.posX = packet.readFloat(); tracker.posY = packet.readFloat(); tracker.posZ = packet.readFloat(); tracker.motionX = packet.readFloat(); tracker.motionY = packet.readFloat(); tracker.motionZ = packet.readFloat(); tracker.setPosition(tracker.posX, tracker.posY, tracker.posZ); tracker.setVelocity(tracker.motionX, tracker.motionY, tracker.motionZ); tracker.attachmentCounter = packet.readUShort(); tracker.item = packet.readBoolean(); } }