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

I was about to add bear meat to Polar Bears, but it didn't drop any meat at all! (Just some fish according to the vanilla game)

Here's the code for it:

    @SubscribeEvent
    public static void onLivingDeathEvent(LivingDeathEvent event) {
        Level level = event.getEntity().level();
        BlockPos pos = event.getEntity().blockPosition();
        Entity entity = event.getSource().getEntity();
        try {
            if (SmiffleModConfig.ENABLE_POLAR_BEAR_MEAT.get() && entity instanceof PolarBear) {
                int i = event.getEntity().level().getRandom().nextInt(2);
                if (i == 1) {
                    ItemEntity itemEntity = new ItemEntity(EntityType.ITEM, level);
                    itemEntity.setPos(pos.getX() + 0.5D, pos.getY() + 0.2D, pos.getZ() + 0.5D);
                    itemEntity.setItem(SmiffleModItems.BEAR_MEAT.get().getDefaultInstance());
                    event.getEntity().level().addFreshEntity(itemEntity);
                }
            }
        } catch(Exception e){
            SmiffleMod.LOGGER.warn("Tried to add unique behaviors to vanilla mobs when slain and encountered an error");
        }
    }

Hope you guys can fix this for me in time.

could it be something whit the SmiffleModConfig.ENABLE_POLAR_BEAR_MEAT.get()

or could be coze onLivingDeathEvent has two entities

 

 

	@SubscribeEvent
public static void onLivingDeathEvent(LivingDeathEvent event) {
Level level = event.getEntity().level();
Entity target = event.getEntity();
Entity entity = event.getSource().getEntity();

if(!level.isClientSide() && target != null && entity != null ){
System.out.println("onLivingDeathEvent(" + entity.getDisplayName().getString() + ", " + target.getDisplayName().getString() + ")");
BlockPos pos = entity.blockPosition();
	

 Villager['Butcher'/47, l='ServerLevel[New World]', x=41.51, y=72.00, z=84.30] died, message: 'Butcher was slain by Zombie'
onLivingDeathEvent(Zombie, Butcher)

 

 

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.