Спавн Entity через определённое время

Версия Minecraft
1.7.10
34
0
Как сделать чтобы энтити можно было спавнить через определённое время, например 5 секунд. Спавн через предмет. У эндер перла в 1.7.10 нет задержки.
 
Решение
спавнить через определённое время
Накалякал быстренько, вроде рабочий код. Попробуй.
Java:
     public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
         if (!world.isRemote) {
             if (stack.hasTagCompound() && stack.getTagCompound().hasKey("time", NBT.TAG_LONG)) {
                 if (world.getTotalWorldTime() >= stack.getTagCompound().getLong("time")) {
                     //Задержка указывается в тиках, 20 тиков - 1 секунда.
                     stack.getTagCompound().setLong("time", (long) (world.getTotalWorldTime() + 100));
                     System.out.println("start");
                     player.addChatMessage(new ChatComponentText("§8[§cМалышка§8] §8Лиза §8: " +...
241
20
75
спавнить через определённое время
Накалякал быстренько, вроде рабочий код. Попробуй.
Java:
     public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
         if (!world.isRemote) {
             if (stack.hasTagCompound() && stack.getTagCompound().hasKey("time", NBT.TAG_LONG)) {
                 if (world.getTotalWorldTime() >= stack.getTagCompound().getLong("time")) {
                     //Задержка указывается в тиках, 20 тиков - 1 секунда.
                     stack.getTagCompound().setLong("time", (long) (world.getTotalWorldTime() + 100));
                     System.out.println("start");
                     player.addChatMessage(new ChatComponentText("§8[§cМалышка§8] §8Лиза §8: " + "§astart"));
                 }
                 else {
                     System.out.println("execution");
                     player.addChatMessage(new ChatComponentText("§8[§cМалышка§8] §8Лиза §8: " + "§aexecution"));
                 }
             } else {
                 NBTTagCompound nbt = new NBTTagCompound();
                 nbt.setLong("time", (long) (world.getTotalWorldTime() + 100));
                 stack.setTagCompound(nbt);
             }
             }
            return stack;
     }
     public void onUpdate(ItemStack stack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_) {
         EntityPlayer player = Minecraft.getMinecraft().thePlayer;
         if (!world.isRemote && entity instanceof EntityLivingBase) {
             if (stack.hasTagCompound() && stack.getTagCompound().hasKey("time", NBT.TAG_LONG)) {
                 if (world.getTotalWorldTime() == stack.getTagCompound().getLong("time")) {
                     //Код, который будет выполняться после задержки.
                     System.out.println("end");
                     player.addChatMessage(new ChatComponentText("§8[§cМалышка§8] §8Лиза §8: " + "§aend"));
                     --stack.stackSize;
                 }
             }
         }
     }
 
Сверху