2012-07-12 07:54:11 +02:00
|
|
|
package cpw.mods.ironchest;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2012-08-14 15:40:04 +02:00
|
|
|
import net.minecraft.src.EntityAIOcelotSit;
|
2012-08-13 07:24:25 +02:00
|
|
|
import net.minecraft.src.EntityAITaskEntry;
|
2012-07-12 07:54:11 +02:00
|
|
|
import net.minecraft.src.EntityOcelot;
|
2012-08-13 07:24:25 +02:00
|
|
|
import net.minecraftforge.event.ForgeSubscribe;
|
|
|
|
import net.minecraftforge.event.entity.living.LivingEvent;
|
|
|
|
import net.minecraftforge.event.entity.living.LivingSpecialSpawnEvent;
|
2012-07-12 07:54:11 +02:00
|
|
|
|
2012-08-13 07:24:25 +02:00
|
|
|
public class OcelotsSitOnChestsHandler {
|
|
|
|
@ForgeSubscribe
|
|
|
|
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt) {
|
|
|
|
if (evt.entityLiving instanceof EntityOcelot && evt.entityLiving.ticksExisted < 5)
|
|
|
|
{
|
|
|
|
EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
List<EntityAITaskEntry> tasks = ocelot.tasks.field_75782_a;
|
|
|
|
|
|
|
|
for (int i=0; i<tasks.size(); i++)
|
|
|
|
{
|
|
|
|
EntityAITaskEntry task = tasks.get(i);
|
2012-08-14 15:40:04 +02:00
|
|
|
if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit))
|
2012-08-13 07:24:25 +02:00
|
|
|
{
|
|
|
|
task.action = new IronChestAIOcelotSit(ocelot, 0.4F);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-07-12 07:54:11 +02:00
|
|
|
}
|