Jump to content

Efficiency with block drops


xTekBlue

Recommended Posts

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);
    }

}

 

Link to comment
Share on other sites

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

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

2 hours ago, xTekBlue said:

set a hardness

setHardness() perhaps?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • the mods are crashing and I'm not sure why so heres everything  crash log https://pastebin.com/RxLKbMNR  L2 Library (12library) has failed to load correctly java.lang.NoClassDefFoundError: org/antarcticgardens/newage/content/energiser/EnergiserBlock L2 Screen Tracker (12screentracker) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.12library.base.L2Registrate Create: Interiors (interiors) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.tterrag.registrate.AbstractRegistrate L2 Damage Tracker (12damagetracker) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate Create Enchantment Industry (create_enchantment_industry) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.Createfiegistrate Create Crafts & Additions (createaddition) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.CreateRegistrate Create Slice & Dice (sliceanddice) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.CreateRegistrate L2 Tabs (12tabs) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate Modular Golems (modulargolems) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate Create: Steam 'n' FRails (railways) has failed to load correctly java.lang.NoClassDefFoundError : Could not initialize class com.simibubi.create.foundation.data.Createfregistrate Cuisine Delight (cuisinedelight) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.12library.base.L2Registrate Create (create) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.Create Guardian Beam Defense (creategbd) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class com.simibubi.create.foundation.data.CreateRegistrate L2 Item Selector (12itemselector) has failed to load correctly java.lang.NoClassDefFoundError: Could not initialize class dev.xkmc.l2library.base.L2Registrate
    • hey there, I have been using Forge for years without any problems, but for some time now I have been getting this error message when I click on “Installer” under the downloads. This happens on all versions. I have tried various things but have not gotten any results. If anyone has a solution, I would be very grateful!
    • I don't have mcreator installed.
    • the session has expired, what if the modified LAN Server displays the same screen after logging in as after logging in to the premium server from a non-premium account? Minecraft Forge 1.20.1 CurseForge. I also use Mod LAN World Plug n Play
    • Hello There! In today's video I will be showing you guys the Minecraft and Google Collaboration they are doing for the 15th anniversary for Minecraft! If you guys wanna try this out for yourself go to google and type in "Minecraft"!  
  • Topics

×
×
  • Create New...

Important Information

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