Java Code Examples for net.minecraft.world.chunk.Chunk#getEntityLists()
The following examples show how to use
net.minecraft.world.chunk.Chunk#getEntityLists() .
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: MCNetworkState.java From Signals with GNU General Public License v3.0 | 5 votes |
public void onChunkUnload(Chunk chunk){ for(ClassInheritanceMultiMap<Entity> entities : chunk.getEntityLists()) { for(EntityMinecart cart : entities.getByClass(EntityMinecart.class)) { removeCart(cart); } } }
Example 2
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public boolean hasEntities(Chunk nmsChunk) { ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists(); for (int i = 0; i < entities.length; i++) { ClassInheritanceMultiMap<Entity> slice = entities[i]; if (slice != null && !slice.isEmpty()) { return true; } } return false; }
Example 3
Source File: SpongeQueue_1_11.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public boolean hasEntities(Chunk nmsChunk) { ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists(); for (int i = 0; i < entities.length; i++) { ClassInheritanceMultiMap<Entity> slice = entities[i]; if (slice != null && !slice.isEmpty()) { return true; } } return false; }
Example 4
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public boolean hasEntities(Chunk nmsChunk) { ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists(); for (int i = 0; i < entities.length; i++) { ClassInheritanceMultiMap<Entity> slice = entities[i]; if (slice != null && !slice.isEmpty()) { return true; } } return false; }
Example 5
Source File: SpongeQueue_1_12.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public boolean hasEntities(Chunk nmsChunk) { ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists(); for (int i = 0; i < entities.length; i++) { ClassInheritanceMultiMap<Entity> slice = entities[i]; if (slice != null && !slice.isEmpty()) { return true; } } return false; }
Example 6
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public boolean hasEntities(Chunk nmsChunk) { ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists(); for (int i = 0; i < entities.length; i++) { ClassInheritanceMultiMap<Entity> slice = entities[i]; if (slice != null && !slice.isEmpty()) { return true; } } return false; }
Example 7
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public boolean hasEntities(Chunk nmsChunk) { ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists(); for (int i = 0; i < entities.length; i++) { ClassInheritanceMultiMap<Entity> slice = entities[i]; if (slice != null && !slice.isEmpty()) { return true; } } return false; }
Example 8
Source File: ForgeQueue_All.java From FastAsyncWorldedit with GNU General Public License v3.0 | 5 votes |
public boolean hasEntities(Chunk nmsChunk) { ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists(); for (int i = 0; i < entities.length; i++) { ClassInheritanceMultiMap<Entity> slice = entities[i]; if (slice != null && !slice.isEmpty()) { return true; } } return false; }
Example 9
Source File: ClientStateMachine.java From malmo with MIT License | 4 votes |
@Override public void onMessage(MalmoMessageType messageType, Map<String, String> data) { super.onMessage(messageType, data); // This message will be sent to us once the server has decided the mission is over. if (messageType == MalmoMessageType.SERVER_STOPAGENTS) { this.quitCode = data.containsKey("QuitCode") ? data.get("QuitCode") : ""; try { // Save the quit code for anything that needs it: MalmoMod.getPropertiesForCurrentThread().put("QuitCode", this.quitCode); } catch (Exception e) { System.out.println("Failed to get properties - final reward may go missing."); } // Get the final reward data: ClientAgentConnection cac = currentMissionInit().getClientAgentConnection(); if (currentMissionBehaviour() != null && currentMissionBehaviour().rewardProducer != null && cac != null) currentMissionBehaviour().rewardProducer.getReward(currentMissionInit(), ClientStateMachine.this.finalReward); onMissionEnded(ClientState.MISSION_ENDED, null); } else if (messageType == MalmoMessageType.SERVER_GO) { // First, force all entities to get re-added to their chunks, clearing out any old entities in the process. // We need to do this because the process of teleporting all agents to their start positions, combined // with setting them to/from spectator mode, leaves the client chunk entity lists etc in a parlous state. List lel = Minecraft.getMinecraft().world.loadedEntityList; for (int i = 0; i < lel.size(); i++) { Entity entity = (Entity)lel.get(i); Chunk chunk = Minecraft.getMinecraft().world.getChunkFromChunkCoords(entity.chunkCoordX, entity.chunkCoordZ); List<Entity> entitiesToRemove = new ArrayList<Entity>(); for (int k = 0; k < chunk.getEntityLists().length; k++) { Iterator iterator = chunk.getEntityLists()[k].iterator(); while (iterator.hasNext()) { Entity chunkent = (Entity)iterator.next(); if (chunkent.getEntityId() == entity.getEntityId()) { entitiesToRemove.add(chunkent); } } } for (Entity removeEnt : entitiesToRemove) { chunk.removeEntity(removeEnt); } entity.addedToChunk = false; // Will force it to get re-added to the chunk list. if (entity instanceof EntityLivingBase) { // If we want the entities to be rendered with the correct yaw from the outset, // we need to set their render offset manually. // (Set the offset from the outset to avoid the onset of upset.) ((EntityLivingBase)entity).renderYawOffset = entity.rotationYaw; ((EntityLivingBase)entity).prevRenderYawOffset = entity.rotationYaw; } if (entity instanceof EntityPlayerSP) { // Although the following call takes place on the server, and should have taken effect already, // there is some discontinuity which is causing the effects to get lost, so we call it here too: entity.setInvisible(false); } } this.serverHasFiredStartingPistol = true; // GO GO GO! } }