Ocelots now sit on top of IronChests again!
This commit is contained in:
parent
bb8cb4ff98
commit
4d145cd90b
|
@ -64,7 +64,7 @@ public class IronChest
|
|||
ChestChangerType.generateRecipes();
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);
|
||||
proxy.registerRenderInformation();
|
||||
// FIXME: MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new OcelotsSitOnChestsHandler());
|
||||
MinecraftForge.EVENT_BUS.register(IronChestEventHandler.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,37 @@
|
|||
package cpw.mods.ironchest;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.entity.ai.EntityAIOcelotSit;
|
||||
import net.minecraft.entity.ai.EntityAITasks.EntityAITaskEntry;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class OcelotsSitOnChestsHandler
|
||||
{
|
||||
@SubscribeEvent
|
||||
public void changeSittingTaskForOcelots(LivingEvent.LivingUpdateEvent evt)
|
||||
public void changeSittingTaskForOcelots(LivingUpdateEvent evt)
|
||||
{
|
||||
if (evt.getEntityLiving().ticksExisted < 5 && evt.getEntityLiving() instanceof EntityOcelot)
|
||||
{
|
||||
// EntityOcelot ocelot = (EntityOcelot) evt.entityLiving;
|
||||
// Set<EntityAITasks.EntityAITaskEntry> tasks = ocelot.tasks.taskEntries;
|
||||
HashSet<EntityAITaskEntry> hashset = new HashSet<EntityAITaskEntry>();
|
||||
|
||||
// for (EntityAITasks.EntityAITaskEntry task : tasks)
|
||||
// {
|
||||
// if (task.priority == 6 && (task.action instanceof EntityAIOcelotSit) && !(task.action instanceof IronChestAIOcelotSit))
|
||||
// {
|
||||
// task.action = new IronChestAIOcelotSit(ocelot, 0.4F);
|
||||
// }
|
||||
// }
|
||||
EntityOcelot ocelot = (EntityOcelot) evt.getEntityLiving();
|
||||
|
||||
for (EntityAITaskEntry task : ocelot.tasks.taskEntries)
|
||||
{
|
||||
if (task.action.getClass() == EntityAIOcelotSit.class)
|
||||
{
|
||||
hashset.add(task);
|
||||
}
|
||||
}
|
||||
|
||||
for (EntityAITaskEntry task : hashset)
|
||||
{
|
||||
ocelot.tasks.removeTask(task.action);
|
||||
ocelot.tasks.addTask(task.priority, new IronChestAIOcelotSit(ocelot, 0.4F));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue