Jump to content

Recommended Posts

Posted

I have been working on a glowstone like block but i cant seem to get the block to drop the item i want it to when its broken. Also i cant seem to control the amount of that item to be dropped when its broken. I would like for the block to drop 2-4 of the item when broken randomly.

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.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import xtekblue.mod.init.ItemInit;

public class BlockRGLit extends BlockBase {

	private final int dropAmount = 1;

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

	//No idea if these even works because i haven't seemed to figure out how to get the items to be dropped when the block is broken.
	public int quantityDropped(Random random)
	{
	            return dropAmount;
	}

}

 

Posted

You probably want to override another method. One that says "this is the item that's dropped." Like how Glowstone and Redstone Ore do.

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.

Posted
  On 4/16/2018 at 7:01 PM, Draco18s said:

You probably want to override another method. One that says "this is the item that's dropped." Like how Glowstone and Redstone Ore do.

Expand  

I've tried that but i've seen in other posts that override does not work and is actually recommended to no do it.

Posted
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.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import xtekblue.mod.init.ItemInit;

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

	/**
	* Returns the quantity of items to drop on block destruction.
	*/
	public int quantityDropped(Random p_149745_1_)
	{
		return 4;
	}

	public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
	{
		return Item.getItemFromBlock(this);
	}
	

}

This is the code i am currently testing but i have noticed that the quantityDropped is working but the getItemDropped is not exactly. I have tried setting the Item.getItemFromBlock() to ItemInit.MIX_REDSTONE_GLOWSTONE but that doesnt seem to change the item being dropped. 

Posted

Put @override on the method you are overriding. If Eclipse says "this isn't overriding anything" then you have the wrong method signature. The fix is not to remove the annotation, but to fix the method signature so it DOES override something.

 

As for Item.getItemFromBlock(this);, that will make the block drop itself. If you want it to drop a different thing, you tell it to drop a different thing. ItemInit.MIX_REDSTONE_GLOWSTONE sounds like your custom drop, so use that.

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.

Posted (edited)

That's just it, when i @override on the method i'm using it doesn't say "this isn't overriding anything" it says to add it to my blockbase class. but if i do this, it will drop that item for all the blocks i have created. Correct?

Should i be overriding this?

//This says to override this method you need to implement a supertype
@Override	
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
	{
		return ItemInit.MIX_REDSTONE_GLOWSTONE;
	}

 

Edited by xTekBlue
Posted
  On 4/16/2018 at 8:31 PM, xTekBlue said:

//This says to override this method you need to implement a supertype

Expand  

That would be "your method signature is wrong" as I said.

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.

Posted (edited)
  On 4/16/2018 at 10:20 PM, Draco18s said:

That would be "your method signature is wrong" as I said.

Expand  

Okay so i changed a few things and i have no idea what i'm doing so bare with me :P

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.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 implements IHasExtra{


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

	/**
	* Returns the quantity of items to drop on block destruction.
	*/
	public int quantityDropped(Random p_149745_1_)
	{
		return 4;
	}

	@Override
	public Item getItemDropped(int par1, Random rand, int par2) {
		return ItemInit.MIX_REDSTONE_GLOWSTONE;
	}
	

}

So i implemented IHasExtra (Interface) which looks like this to remove the @Override ERROR

package xtekblue.mod.util;

import java.util.Random;

import net.minecraft.item.Item;

public interface IHasExtra {

	Item getItemDropped(int par1, Random rand, int par2);

}

Still does not seem to work. I have tried about 100 different combinations of moving stuff to different places, i'm new with java and used to doing Lua. I am trying to learn java the same way i learned Java (Self taught with help of the internet) Thanks for helping me thus far.

Edited by xTekBlue
Posted

Paris_Tuileries_Garden_Facepalm_statue-6

 

Jesus Christ

 

YOU NEED TO OVERRIDE THE CORRECT METHOD FROM THE BLOCK CLASS.

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.

Posted (edited)

Would you mind posting your BlockBase class or possibly putting your mod on github and linking it?

Took me too long to boot up my own IDE and notice the signature disparity

Edited by DaemonUmbra

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Posted

I am so bad at this xD. Figured it out and from this i will learn. Thank you so much with struggling to help me do this. Especially without just saying the right code. <3

	@Override
	public Item getItemDropped(IBlockState state, Random rand, int fortune) {
	    return ItemInit.MIX_REDSTONE_GLOWSTONE;
	}

 

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

    • If you're looking to save big on your next Temu purchase, using a Temu coupon code 70% off [ALF401700] is your best option. With this powerful discount code, you can enjoy massive savings on thousands of items across Temu’s platform. One of the most effective codes to use is [ALF401700], which brings exceptional value to shoppers across the USA, Canada, Middle East, and European countries. This code is ideal for unlocking exclusive offers tailored to these regions. For those who have shopped on Temu before, the Temu coupon code 2025 for existing customers and Temu 70% discount coupon can help reduce your expenses on your next order significantly. What Is The Temu coupon code 70% off? Both new and existing customers can take advantage of the Temu coupon 70% off offer on the official Temu website and app. By applying the 70% off Temu coupon code, you unlock steep discounts and bundle deals that maximize your budget. [ALF401700] – 70% off for new users [ALF401700] – 70% extra off for existing users [ALF401700] – Flat $100 off for new Temu users [ALF401700] – $100 coupon pack for multiple uses [ALF401700] – $100 coupon for USA/Canada/European users Temu coupon code 70% off For New Users New users can enjoy the biggest rewards when using the Temu coupon 70% off code for the first time. Even returning customers using the Temu coupon code 70% off for existing users can tap into exciting benefits. [ALF401700] – Flat 70% discount for new users [ALF401700] – 70% extra discount for old users [ALF401700] – $100 coupon bundle for new customers [ALF401700] – Up to $100 coupon bundle for multiple uses [ALF401700] – Free shipping to 68 countries [ALF401700] – Extra 70% off on any purchase for first-time users How To Redeem The Temu 70% Off Coupon Code For New Customers? To get your Temu 70% off as a new user, follow the steps below. Applying the Temu 70% off coupon code is fast, simple, and guarantees big savings: Visit the official Temu website or open the app. Sign up using your email or mobile number. Browse through the product listings and add your favorites to the cart. Go to checkout and look for the "Apply Coupon" field. Enter the code [ALF401700] and click "Apply." Your discount will be reflected instantly, and you can proceed to place the order. Temu coupon code 70% off For Existing Users Even if you’re a loyal Temu shopper, you’re still eligible to unlock offers using the Temu 70% off coupon code. With our special Temu coupon code for existing customers, you can cut down your costs even more. [ALF401700] – 70% extra discount for existing Temu users [ALF401700] – $100 coupon bundle for multiple purchases [ALF401700] – Free gift with express shipping across the USA and Canada [ALF401700] – Extra 70% off on top of existing discounts [ALF401700] – Free shipping to 68 countries How To Use The Temu coupon code 70% off For Existing Customers? Using the Temu coupon code 70% off is just as simple for returning users. Here's how to apply the Temu discount code for existing users: Open the Temu app or visit the official website. Log in using your existing credentials. Add items to your cart and go to the checkout page. Enter [ALF401700] in the promo code section. Click apply to see the discount activated before completing your purchase. How To Find The Temu coupon code 70% off? If you’re wondering where to get the Temu coupon code 70% off first order or searching for the latest Temu coupons 70% off, we’ve got you covered. Subscribe to Temu’s newsletter for verified offers directly in your inbox. We also recommend checking out Temu’s official Facebook, Instagram, and Twitter pages for limited-time promotions. You can always visit trusted coupon sites like ours to find hand-verified working deals. How Does Temu 70% Off Coupon Work? The Temu coupon code 70% off first-time user and Temu coupon code 70% percent off provide percentage-based discounts that reduce the total amount of your order instantly. Once applied, these codes automatically deduct the eligible amount from your subtotal, whether it’s a flat discount or a bundle of coupon savings for new and returning users. Temu’s system will calculate the eligible discount and apply it during checkout. This code works on a wide variety of items and has no category limitations, making it a valuable way to save across the entire platform. What Are The Advantages Of Using Temu 70% Off Coupons? Using the Temu 70% off coupon code legit and coupon code for Temu 70% off offers you various exciting perks: 70% discount on the first order $100 coupon bundle for multiple uses 70% discount on trending and popular items Extra 70% off for existing Temu customers Up to 70% off on selected items Free gift for new users Free delivery to 68 countries worldwide Temu Free Gift And Special Discount For New And Existing Users When you use our Temu 70% off coupon code and 70% off Temu coupon code, you unlock more than just discounts. You gain access to exclusive bundles, free gifts, and global shipping. [ALF401700] – 70% extra discount for first order [ALF401700] – Extra 70% off on any item [ALF401700] – Free gift for new Temu users [ALF401700] – Up to 70% discount on any item on the Temu app [ALF401700] – Free gift with free shipping in 68 countries including the USA and UK Terms And Conditions Of The Temu 70% Off Coupon Code In 2025 Read these important points regarding the Temu coupon code 70% off free shipping and Temu coupon code 70% off Reddit before applying: No expiration date on this coupon code Valid for both new and existing users Available across 68 countries including USA, UK, Canada, and Europe No minimum purchase required Cannot be stacked with other promo codes Final Note The Temu coupon code 70% off is your best chance to save more and shop smarter on Temu. Don’t miss this opportunity to stretch your dollar across fashion, electronics, home decor, and more. Using the Temu 70% off coupon also gives you access to free gifts, exclusive bundles, and global delivery perks. Shop now and enjoy more value with less spending. FAQs Of Temu 70% Off Coupon What is the best Temu coupon code for 70% off? The best code is [ALF401700], which gives up to 70% off and includes extra perks like free shipping and free gifts. Can existing users use the Temu 70% off coupon code? Yes, both new and existing users can use [ALF401700] to enjoy 70% off and multiple-use coupon bundles. Is there a minimum order value for this coupon? No, the Temu 70% off coupon code does not require any minimum purchase amount. Does this coupon work worldwide? Yes, this code is valid in 68 countries, including the USA, UK, Canada, and most European and Middle Eastern countries. Can I use the 70% off coupon more than once? The code can be reused through bundle coupons and referrals, although single-use may apply per account.
    • If you're looking to save big on your next Temu purchase, using a Temu coupon code 70% off [ALF401700] is your best option. With this powerful discount code, you can enjoy massive savings on thousands of items across Temu’s platform. One of the most effective codes to use is [ALF401700], which brings exceptional value to shoppers across the USA, Canada, Middle East, and European countries. This code is ideal for unlocking exclusive offers tailored to these regions. For those who have shopped on Temu before, the Temu coupon code 2025 for existing customers and Temu 70% discount coupon can help reduce your expenses on your next order significantly. What Is The Temu coupon code 70% off? Both new and existing customers can take advantage of the Temu coupon 70% off offer on the official Temu website and app. By applying the 70% off Temu coupon code, you unlock steep discounts and bundle deals that maximize your budget. [ALF401700] – 70% off for new users [ALF401700] – 70% extra off for existing users [ALF401700] – Flat $100 off for new Temu users [ALF401700] – $100 coupon pack for multiple uses [ALF401700] – $100 coupon for USA/Canada/European users Temu coupon code 70% off For New Users New users can enjoy the biggest rewards when using the Temu coupon 70% off code for the first time. Even returning customers using the Temu coupon code 70% off for existing users can tap into exciting benefits. [ALF401700] – Flat 70% discount for new users [ALF401700] – 70% extra discount for old users [ALF401700] – $100 coupon bundle for new customers [ALF401700] – Up to $100 coupon bundle for multiple uses [ALF401700] – Free shipping to 68 countries [ALF401700] – Extra 70% off on any purchase for first-time users How To Redeem The Temu 70% Off Coupon Code For New Customers? To get your Temu 70% off as a new user, follow the steps below. Applying the Temu 70% off coupon code is fast, simple, and guarantees big savings: Visit the official Temu website or open the app. Sign up using your email or mobile number. Browse through the product listings and add your favorites to the cart. Go to checkout and look for the "Apply Coupon" field. Enter the code [ALF401700] and click "Apply." Your discount will be reflected instantly, and you can proceed to place the order. Temu coupon code 70% off For Existing Users Even if you’re a loyal Temu shopper, you’re still eligible to unlock offers using the Temu 70% off coupon code. With our special Temu coupon code for existing customers, you can cut down your costs even more. [ALF401700] – 70% extra discount for existing Temu users [ALF401700] – $100 coupon bundle for multiple purchases [ALF401700] – Free gift with express shipping across the USA and Canada [ALF401700] – Extra 70% off on top of existing discounts [ALF401700] – Free shipping to 68 countries How To Use The Temu coupon code 70% off For Existing Customers? Using the Temu coupon code 70% off is just as simple for returning users. Here's how to apply the Temu discount code for existing users: Open the Temu app or visit the official website. Log in using your existing credentials. Add items to your cart and go to the checkout page. Enter [ALF401700] in the promo code section. Click apply to see the discount activated before completing your purchase. How To Find The Temu coupon code 70% off? If you’re wondering where to get the Temu coupon code 70% off first order or searching for the latest Temu coupons 70% off, we’ve got you covered. Subscribe to Temu’s newsletter for verified offers directly in your inbox. We also recommend checking out Temu’s official Facebook, Instagram, and Twitter pages for limited-time promotions. You can always visit trusted coupon sites like ours to find hand-verified working deals. How Does Temu 70% Off Coupon Work? The Temu coupon code 70% off first-time user and Temu coupon code 70% percent off provide percentage-based discounts that reduce the total amount of your order instantly. Once applied, these codes automatically deduct the eligible amount from your subtotal, whether it’s a flat discount or a bundle of coupon savings for new and returning users. Temu’s system will calculate the eligible discount and apply it during checkout. This code works on a wide variety of items and has no category limitations, making it a valuable way to save across the entire platform. What Are The Advantages Of Using Temu 70% Off Coupons? Using the Temu 70% off coupon code legit and coupon code for Temu 70% off offers you various exciting perks: 70% discount on the first order $100 coupon bundle for multiple uses 70% discount on trending and popular items Extra 70% off for existing Temu customers Up to 70% off on selected items Free gift for new users Free delivery to 68 countries worldwide Temu Free Gift And Special Discount For New And Existing Users When you use our Temu 70% off coupon code and 70% off Temu coupon code, you unlock more than just discounts. You gain access to exclusive bundles, free gifts, and global shipping. [ALF401700] – 70% extra discount for first order [ALF401700] – Extra 70% off on any item [ALF401700] – Free gift for new Temu users [ALF401700] – Up to 70% discount on any item on the Temu app [ALF401700] – Free gift with free shipping in 68 countries including the USA and UK Terms And Conditions Of The Temu 70% Off Coupon Code In 2025 Read these important points regarding the Temu coupon code 70% off free shipping and Temu coupon code 70% off Reddit before applying: No expiration date on this coupon code Valid for both new and existing users Available across 68 countries including USA, UK, Canada, and Europe No minimum purchase required Cannot be stacked with other promo codes Final Note The Temu coupon code 70% off is your best chance to save more and shop smarter on Temu. Don’t miss this opportunity to stretch your dollar across fashion, electronics, home decor, and more. Using the Temu 70% off coupon also gives you access to free gifts, exclusive bundles, and global delivery perks. Shop now and enjoy more value with less spending. FAQs Of Temu 70% Off Coupon What is the best Temu coupon code for 70% off? The best code is [ALF401700], which gives up to 70% off and includes extra perks like free shipping and free gifts. Can existing users use the Temu 70% off coupon code? Yes, both new and existing users can use [ALF401700] to enjoy 70% off and multiple-use coupon bundles. Is there a minimum order value for this coupon? No, the Temu 70% off coupon code does not require any minimum purchase amount. Does this coupon work worldwide? Yes, this code is valid in 68 countries, including the USA, UK, Canada, and most European and Middle Eastern countries. Can I use the 70% off coupon more than once? The code can be reused through bundle coupons and referrals, although single-use may apply per account.
    • You need a new "items" folder at  resources/assets/yourmodid/ there you add for every item model a .json file with the exact item/block name and fill it like this if it's an item: { "model": { "type": "minecraft:model", "model": "yourmodid:item/youritem" } } and so if its a block: { "model": { "type": "minecraft:model", "model": "yourmodid:block/youritem" } } There is also a generator for it you can do namy crazy things with it which replaces the previous hard coded Item Properties implementaion method (Bow pulling animation for example). https://misode.github.io/assets/item/
    • Hello! I'm playing a modpack (custom made) with some friends, and we have the server running on BisectHosting. We encountered a bug with an entity from The Box Of Horrors mod, that would crash the game whenever someone nearby it would log in. We tried to fix it by: 1) Editing the player.dat files to change the location of the affected players (something I had done successfully previously) 2) Updating the version of the mod we had (0.0.8.2) to the latest alpha version (0.0.8.3 However, after doing both of those, none of us are able to join the server, and we get the following errors: Server side: https://pastebin.com/J5sc3VQN Client side: Internal Server Error (that's basically all I've gotten) Please help! I've tried restoring the player data to how it was before I made the changes (Bisect allows you to restore deleted files) and deleting all of my player data files and I still get the same error. Deleting Box Of Horrors causes the error: Failed to load datapacks, cannot continue with server load.
  • Topics

×
×
  • Create New...

Important Information

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