Jump to content
  • Home
  • Files
  • Docs
All Content
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Efficiency with block drops
  • Announcements

    • LexManos

      Forge 1.12 and Announcement   06/17/17

      Please read this: http://www.minecraftforge.net/forum/topic/58706-regarding-minecraft-112-and-policy-changes/  
Sign in to follow this  
Followers 0
xTekBlue

Efficiency with block drops

Started by xTekBlue, Tuesday at 03:56 AM

6 posts in this topic

xTekBlue    0

xTekBlue

xTekBlue    0

  • Tree Puncher
  • xTekBlue
  • Members
  • 0
  • 14 posts
  • Report post
Posted Tuesday at 03:56 AM

I am posting this before i sleep so i will not be responding back for a while. Other news, i can not figure out where the method is for allowing efficiency on my block and where to add fortune to my block. Here is my code that I've been messing with. 

package xtekblue.mod.objects.blocks;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import xtekblue.mod.Main;
import xtekblue.mod.init.ItemInit;
import xtekblue.mod.util.IHasExtra;
import xtekblue.mod.util.IHasModel;

public class BlockRGLit extends BlockBase {


	public BlockRGLit(String name) {
		super(name, Material.REDSTONE_LIGHT);
		
		setSoundType(SoundType.GLASS);
		setHardness(0.5F);
		setLightLevel(8.0F);
		setResistance(1.5F);
		setHarvestLevel("pickaxe", 0);
	}

	/**
	* Returns the quantity of items to drop on block destruction.
	*/
	public int quantityDropped(Random rand) {
		return rand.nextInt(4) + 1;
	}
	
	@Override
	public Item getItemDropped(IBlockState state, Random rand, int fortune) {
	    return ItemInit.MIX_REDSTONE_GLOWSTONE;
	}
	
	@Override
	protected ItemStack getSilkTouchDrop(IBlockState state) {
        Item item = Item.getItemFromBlock(this);
        int i = 0;

        if (item.getHasSubtypes()) {
            i = this.getMetaFromState(state);
        }

        return new ItemStack(item, 1, i);
    }

}

 

Share this post


Link to post
Share on other sites

Draco18s    1777

Draco18s

Draco18s    1777

  • Reality Controller
  • Draco18s
  • Members
  • 1777
  • 11638 posts
  • Report post
Posted Tuesday at 05:30 AM

Try maybe using the version of quantityDropped that passes in an int fortune parameter?

Share this post


Link to post
Share on other sites

xTekBlue    0

xTekBlue

xTekBlue    0

  • Tree Puncher
  • xTekBlue
  • Members
  • 0
  • 14 posts
  • Report post
Posted Tuesday at 03:26 PM
9 hours ago, Draco18s said:

Try maybe using the version of quantityDropped that passes in an int fortune parameter?

Got it, but how would i allow efficiency or set a hardness for efficiency levels on pickaxes. I removed the setHarvestLevel("pickaxe", 0); because it made pickaxes break it instantly just about. I'm trying to make the Pickaxe mine the block just as slow but when the Pickaxe has efficiency then it can mine it a tiny bit quicker.

Share this post


Link to post
Share on other sites

Draco18s    1777

Draco18s

Draco18s    1777

  • Reality Controller
  • Draco18s
  • Members
  • 1777
  • 11638 posts
  • Report post
Posted Tuesday at 05:54 PM

The efficiency enchantment is automatic. You don't need to do anything.

2 hours ago, xTekBlue said:

set a hardness

setHardness() perhaps?

Share this post


Link to post
Share on other sites

xTekBlue    0

xTekBlue

xTekBlue    0

  • Tree Puncher
  • xTekBlue
  • Members
  • 0
  • 14 posts
  • Report post
Posted Wednesday at 03:16 PM

hmm, I have tried setting hardness and such, maybe its because of the

Material.REDSTONE_LIGHT

Because i have made another block the exact same but set Material to IRON and efficiency works on it. I'm going to do further testing. :P

Share this post


Link to post
Share on other sites

Draco18s    1777

Draco18s

Draco18s    1777

  • Reality Controller
  • Draco18s
  • Members
  • 1777
  • 11638 posts
  • Report post
Posted Wednesday at 06:27 PM

Redstone materials break instantly, yes. They bypass the hardness check.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0
Go To Topic Listing Modder Support

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • diesieben07
      how do i start making a mod

      By diesieben07 · Posted 1 hour ago

      When using Powershell you need to do .\gradlew.
    • DaMarionTDW
      how do i start making a mod

      By DaMarionTDW · Posted 1 hour ago

      i tried to follow the steps of staring out and tried opening a windows power shell and typing this gradlew setupDecompWorkspace like it said and this happened gradlew : The term 'gradlew' is not recognized as the name of a cmdlet, function, script file, or operable program.
      Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:1
      + gradlew setupDecompWorkspace
      + ~~~~~~~
          + CategoryInfo          : ObjectNotFound: (gradlew:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
    • diesieben07
      Minecraft Texture doesnt work

      By diesieben07 · Posted 1 hour ago

      Post your code properly not as a zip file.
    • diesieben07
      minecraft forge server not starting

      By diesieben07 · Posted 1 hour ago

      1.7.10 is no longer supported on this forum.
    • jredfox
      Probable Bug Resource Packs Are unable To Override Modded Lang

      By jredfox · Posted 3 hours ago

      ? is this a bug or not?
  • Topics

    • DaMarionTDW
      1
      how do i start making a mod

      By DaMarionTDW
      Started 1 hour ago

    • webdesigner01
      1
      Minecraft Texture doesnt work

      By webdesigner01
      Started 5 hours ago

    • robotboy3001
      5
      minecraft forge server not starting

      By robotboy3001
      Started 18 hours ago

    • jredfox
      2
      Probable Bug Resource Packs Are unable To Override Modded Lang

      By jredfox
      Started Wednesday at 06:54 AM

    • Raspomain
      0
      Install Forge - "libraries failed to download" Scala - Raspberry Pi Raspbian

      By Raspomain
      Started 5 hours ago

  • Who's Online (See full list)

    • Firefox9206
    • Terrails
    • ptolemy2002
    • larsgerrits
    • Cadiboo
    • mickkay
    • Raspomain
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Efficiency with block drops
  • Theme
  • Contact Us

Copyright © 2017 ForgeDevelopment LLC Powered by Invision Community