Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

What I actually want is spawn some item one second after entity death but I don't know how. Here is my code:

package net.some_more_boss.handler;   

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.client.Minecraft;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntityDamageSource;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraft.item.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.some_more_boss.TestBoss;
import net.some_more_boss.TestBoss.EntityCustom;


import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;


import net.minecraftforge.fml.common.gameevent.TickEvent;
public class bossEvent {
    @SubscribeEvent
     public void bossDeath(LivingDeathEvent event){
        if (!(event.getEntityLiving() instanceof TestBoss.EntityCustom))

            return;    
        if (event.getEntityLiving() instanceof TestBoss.EntityCustom){
            EntityCustom boss = (EntityCustom)event.getEntityLiving();
            EntityPlayer player = Minecraft.getMinecraft().player;     
            int X = Minecraft.getMinecraft().player.getPosition().getX();
            int Y = Minecraft.getMinecraft().player.getPosition().getY();
            int Z = Minecraft.getMinecraft().player.getPosition().getZ();
            World world = (World)boss.getEntityWorld();
            if (event.getSource().getTrueSource() instanceof EntityPlayer){
                 //wait some tick here
                world.spawnEntity(new  EntityItem(world, X, Y, Z, new ItemStack(Items.DIAMOND_SWORD, 1)));
                world.spawnEntity(new  EntityItem(world, X, Y, Z, new ItemStack(Items.DIAMOND_HELMET, 1)));
                world.spawnEntity(new  EntityItem(world, X, Y, Z, new ItemStack(Items.WOODEN_AXE, 1)));     
            }
        }
    }
}

Edited by Randomboy

  • Randomboy changed the title to Need help with Entity Death Event (forge 1.12.2)

The version you are using is no longer supported on this forum.

Please update to a modern version of Minecraft to receive support.

Currently supported versions are 1.19.2 (Latest) and 1.18.2 (LTS).

Guest
This topic is now closed to further replies.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.