Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void postEntInit(EntityLiving entityliving) {
- int i = entityliving.worldObj.loadedEntityList.size();
- for(theplayer = null; theplayer == null; theplayer = ModLoader.getMinecraftInstance().thePlayer) {
- worldRef = ModLoader.getMinecraftInstance().theWorld;
- }
- System.out.println((new StringBuilder()).append("EntCount").append(i).toString());
- for(int j = 0; j < i; j++) {
- Entity entity = (Entity)entityliving.worldObj.loadedEntityList.get(j);
- if(!(entity instanceof EntityLiving)) {
- continue;
- }
- EntityLiving entityliving1 = (EntityLiving)entity;
- if(entityliving1.uID == -1) {
- entityliving1.uID = getUniqueEntID();
- }
- if(entityliving1.guardEntID != -1) {
- EntityLiving entityliving2 = getEnt(entityliving1.guardEntID);
- if(entityliving2 != null) {
- if(entityliving2 != entityliving1 && entityliving1.guardEntID != entityliving1.uID) {
- System.out.println((new StringBuilder()).append("GuardEnt found!: ").append(entityliving1.uID).append(" guarding ").append(entityliving1.guardEntID).toString());
- entityliving1.guardEnt = entityliving2;
- } else {
- entityliving1.uID = getUniqueEntID();
- }
- } else {
- entityliving1.guardEnt = theplayer;
- }
- } else {
- entityliving1.guardEnt = theplayer;
- }
- if(entityliving1.mountEntID == -1) {
- continue;
- }
- EntityLiving entityliving3 = getEnt(entityliving1.mountEntID);
- if(entityliving3 == null) {
- continue;
- }
- if(entityliving3 != entityliving1 && entityliving1.mountEntID != entityliving1.uID) {
- System.out.println((new StringBuilder()).append("Stack found!: ").append(entityliving1.uID).append(" onto ").append(entityliving1.mountEntID).toString());
- entityliving1.mountEntity(entityliving3);
- } else {
- entityliving1.uID = getUniqueEntID();
- }
- }
- }
- public static EntityLiving getEnt(long l) {
- int i = worldRef.loadedEntityList.size();
- Object obj = null;
- for(int j = 0; j < i; j++) {
- Entity entity = (Entity)worldRef.loadedEntityList.get(j);
- if(!(entity instanceof EntityLiving)) {
- continue;
- }
- EntityLiving entityliving = (EntityLiving)entity;
- if((long)entityliving.uID == l) {
- return entityliving;
- }
- }
- return null;
- }
- public static int getUniqueEntID() {
- boolean flag = true;
- int i = worldRef.loadedEntityList.size();
- int j = 0;
- for(boolean flag1 = true; flag1;) {
- flag1 = false;
- for(int k = 0; k < i; k++) {
- Entity entity = (Entity)worldRef.loadedEntityList.get(k);
- if(!(entity instanceof EntityLiving)) {
- continue;
- }
- EntityLiving entityliving = (EntityLiving)entity;
- if(entityliving.uID != j) {
- continue;
- }
- flag1 = true;
- break;
- }
- if(!flag1 || j >= i) {
- flag1 = false;
- j--;
- }
- j++;
- }
- return j;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement