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.

making an ore drop a different item based on the players Item (MC 1.7.10)

Featured Replies

Posted

Ok so I am currently writing a basic ore doubling tool that will act sort of like a pickaxe however instead of dropping he block as an ore I want it to drop 2 dusts instead.

 

My question is how would I make the block drop the dusts when the player is using tmy doubling item but still act normally when using any other normal pickaxe.

 

Thanks for any help with this

  • Author

Ok I got some of the block class setup and it now responds whenever a player breaks a block...but it isn't realising that the player is using my item to perform the code...here's what I have so far, and i'm almost 90% certain it's something super simple i've overlooked...it always is

 

package handlers;

 

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import items.daftcraftItems;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.init.Blocks;

import net.minecraft.item.ItemStack;

import net.minecraftforge.event.world.BlockEvent;

import net.minecraftforge.oredict.OreDictionary;

 

public class BlockBreakEvent

{

  @SubscribeEvent

  public void onBreak(BlockEvent.HarvestDropsEvent event)

  {

 

      if(event.harvester!=null)

      {

        EntityPlayer player=event.harvester;

        System.out.println("there was a harvester");

        if(player.getCurrentEquippedItem()== new ItemStack(daftcraftItems.doubler,1,OreDictionary.WILDCARD_VALUE))

//1 ore doubler any damage?

        {

            System.out.println("you used the ore doubler");

            if(event.block== Blocks.iron_ore)

            {

              event.drops.clear();//will this permenantly clear the items when used by doubler once?

              event.drops.add(new ItemStack(daftcraftItems.ironDust));

            }

            else  if(event.block== Blocks.gold_ore)

            {

              event.drops.clear();

              event.drops.add(new ItemStack(daftcraftItems.goldDust));

            }

                  else  if(event.block== Blocks.diamond_ore)

                  {

                    event.drops.clear();

                    event.drops.add(new ItemStack(daftcraftItems.diamondDust));

                  }

        }

        else

        {

            System.out.println("you used item " + event.harvester.getHeldItem());

        }

      }

  }

 

}//class

 

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.