From b7c7f58f2c8cd6cc7d988dc3bb7584d27dabdf6b Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Thu, 21 Nov 2013 19:06:22 -0500 Subject: [PATCH] Fix up Robit pickup AI, and update donator cape list! Thanks ejmiv89! :) --- common/mekanism/common/Mekanism.java | 1 + common/mekanism/common/RobitAIPickup.java | 68 +++++++++++++---------- 2 files changed, 39 insertions(+), 30 deletions(-) diff --git a/common/mekanism/common/Mekanism.java b/common/mekanism/common/Mekanism.java index f33b0b315..9943df80e 100644 --- a/common/mekanism/common/Mekanism.java +++ b/common/mekanism/common/Mekanism.java @@ -1148,6 +1148,7 @@ public class Mekanism //Donators donators.add("mrgreaper"); + donators.add("ejmiv89"); //Load proxy proxy.registerRenderInformation(); diff --git a/common/mekanism/common/RobitAIPickup.java b/common/mekanism/common/RobitAIPickup.java index fc040bdb5..84049e832 100644 --- a/common/mekanism/common/RobitAIPickup.java +++ b/common/mekanism/common/RobitAIPickup.java @@ -11,15 +11,15 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +/* + * Written by pixlepix (I'm in mekanism! Yay!) + * Boilerplate copied from RobitAIFollow + */ public class RobitAIPickup extends EntityAIBase { - - //Written by pixlepix (I'm in mekanism! Yay!) - //Boilerplate copied from RobitAIFollow /** The robit entity. */ private EntityRobit theRobit; - /** The world the robit is located in. */ private World theWorld; @@ -32,8 +32,6 @@ public class RobitAIPickup extends EntityAIBase /** The ticker for updates. */ private int ticker; - - /** Whether or not this robit avoids water. */ private boolean avoidWater; private EntityItem closest; @@ -56,39 +54,51 @@ public class RobitAIPickup extends EntityAIBase { return false; } - if(!theRobit.getDropPickup()){ + + if(!theRobit.getDropPickup()) + { return false; } else if(theRobit.worldObj.provider.dimensionId != player.worldObj.provider.dimensionId) { return false; } - if(closest!=null&&closest.getDistanceSqToEntity(closest)>100&&this.thePathfinder.getPathToXYZ(closest.posX, closest.posY, closest.posZ)!=null){ + if(closest!=null&&closest.getDistanceSqToEntity(closest) > 100 && thePathfinder.getPathToXYZ(closest.posX, closest.posY, closest.posZ)!=null) + { return true; } - List items=theRobit.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(theRobit.posX-10, theRobit.posY-10, theRobit.posZ-10, theRobit.posX+10, theRobit.posY+10, theRobit.posZ+10)); + List items = theRobit.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(theRobit.posX-10, theRobit.posY-10, theRobit.posZ-10, theRobit.posX+10, theRobit.posY+10, theRobit.posZ+10)); Iterator iter=items.iterator(); //Cached for slight performance double closestDistance=-1; - while(iter.hasNext()){ - - EntityItem entity=(EntityItem) iter.next(); - double distance=theRobit.getDistanceSqToEntity(entity); - if(distance<100){ - if(closestDistance==-1||distance 3 || i1 > 3) && theWorld.doesBlockHaveSolidTopSurface(x + l, z - 1, y + i1) && !theWorld.isBlockNormalCube(x + l, z, y + i1) && !theWorld.isBlockNormalCube(x + l, z + 1, y + i1)) { - - System.out.println(7); theRobit.setLocationAndAngles((x + l) + 0.5F, z, (y + i1) + 0.5F, theRobit.rotationYaw, theRobit.rotationPitch); thePathfinder.clearPathEntity(); return;