Called when an entity is spawned in the world. This includes players.
(Entity entityIn)
| 1142 | * Called when an entity is spawned in the world. This includes players. |
| 1143 | */ |
| 1144 | public boolean spawnEntityInWorld(Entity entityIn) |
| 1145 | { |
| 1146 | int i = MathHelper.floor_double(entityIn.posX / 16.0D); |
| 1147 | int j = MathHelper.floor_double(entityIn.posZ / 16.0D); |
| 1148 | boolean flag = entityIn.forceSpawn; |
| 1149 | |
| 1150 | if (entityIn instanceof EntityPlayer) |
| 1151 | { |
| 1152 | flag = true; |
| 1153 | } |
| 1154 | |
| 1155 | if (!flag && !this.isChunkLoaded(i, j, true)) |
| 1156 | { |
| 1157 | return false; |
| 1158 | } |
| 1159 | else |
| 1160 | { |
| 1161 | if (entityIn instanceof EntityPlayer) |
| 1162 | { |
| 1163 | EntityPlayer entityplayer = (EntityPlayer)entityIn; |
| 1164 | this.playerEntities.add(entityplayer); |
| 1165 | this.updateAllPlayersSleepingFlag(); |
| 1166 | } |
| 1167 | |
| 1168 | this.getChunkFromChunkCoords(i, j).addEntity(entityIn); |
| 1169 | this.loadedEntityList.add(entityIn); |
| 1170 | this.onEntityAdded(entityIn); |
| 1171 | return true; |
| 1172 | } |
| 1173 | } |
| 1174 | |
| 1175 | protected void onEntityAdded(Entity entityIn) |
| 1176 | { |
no test coverage detected