Jump to content

Recommended Posts

Posted

Hello.

 

I got Some problems with my Block Drops.

 

File:

 

 

package spmod.tools.src.blocks;

 

import java.util.Random;

 

import net.minecraft.src.Block;

import net.minecraft.src.EntityPlayer;

import net.minecraft.src.Item;

import net.minecraft.src.ItemStack;

import net.minecraft.src.Material;

 

public class BlockCustomDirt extends Block

{

    public BlockCustomDirt(int par1, int par2)

    {

        super(par1, par2, Material.ground);

        this.setHardness(0.5F);

    }

   

    public int idDropped(int par1, Random par2Random, int par3, EntityPlayer par4)

    {

        ItemStack par5 = par4.getCurrentEquippedItem();

        if(par5 != null && par5.itemID == Item.stick.shiftedIndex)

        {

        return par2Random.nextInt(10 - par3 * 3) == 0 ? Item.flint.shiftedIndex : this.blockID;

        }

        else

        {

        return this.blockID;

        }

    }

}

 

 

 

But it do not Drop Flint. What do i do wrong?

Posted

Did you tried to add messages to check what is going in the code?

 

System.out.println("This will appear in the console.");

 

Do you know what the par3 mean in the

idDropped()

?

 

Btw,the problem could be at par2Random.nextInt(10 - par3 * 3).

 

Check the Minecraft's source next time. (BlockGravel)

 

Add this snippet

if (par3 > 3)
        {
            par3 = 3;
        }

 

before

 

return par2Random.nextInt(10 - par3 * 3) == 0 ? Item.flint.shiftedIndex : this.blockID;

Posted

When i copy the code from gravel and paste it in my customdirt than it do drop flint. But the thing what does not work when i write the if(he has a stick in his hand) than he only drops dirt nothing else. same as change it (than he would drop only flint and sometimes dirt. but that didn't work too.

 

and no i do not know what par3 means. par1 is for the metadata but par3 idk.

 

befor i send this answer i tell you what i want to do.

 

Gravel is very rare at minecraft (At the start).

And my mod do need it at the start so without you are stuck.

To help the player i want that when the player holds a stick in his hand and mines dirt than he has a chance to get flint, and when i paste the gravelcode. and a technic moduser use my mod he has to much flint because a quarry mines everything.

Posted

The code did not work.

 

with this i override the dirt:

 

Block.blockslist[3] = null;

Block.blockslist[3] = new BlockCustomDirt(3, 2).setBlockName("dirt");

 

Here my code of the dirt

 

 

package spmod.tools.src.blocks;

 

import java.util.Random;

 

import net.minecraft.src.Block;

import net.minecraft.src.EntityPlayer;

import net.minecraft.src.Item;

import net.minecraft.src.ItemStack;

import net.minecraft.src.Material;

 

public class BlockCustomDirt extends Block

{

    public BlockCustomDirt(int par1, int par2)

    {

        super(par1, par2, Material.ground);

        this.setHardness(0.5F);

    }

   

    public int idDropped(int par1, Random par2Random, int par3, EntityPlayer par4)

    {

        ItemStack par5 = par4.getCurrentEquippedItem(); //to change to inventory didnt bring anything

        if(par5 != null && par5.itemID == Item.stick.shiftedIndex)

        {

          return par2Random.nextInt(10 - par3 * 3) == 0 ? Item.flint.shiftedIndex : this.blockID;

        }

        else

        {

          return this.blockID;

        }

    }

}

 

 

Posted

Ill change my workspace to 1.3.2 at the 1.2.2013.

But every event what forge add comes from the minecraft source and this is compatible to the most versions.

 

Try to use my code and finish it please. And please try to use only minecraft and no forge.

Posted

English is not my motherlanguage. I do not have the knowlegde to tell what i want to tell.

 

My mod tries to hold it self*.

 

*Does not need other mods and apis

 

And only 5 things does my mod uses from forge.

 

1st: Config File

2nd: Texture Provider

3rd: Furnace Recipes

4th: CraftDamage (Crafting Handler)

5th: ToolClass

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

    • I tried do download the essential mod to my mod pack but i didnt work. I paly on 1.21 and it should work. I use neoforge for my modding. The weird things is my friend somehow added the mod to his modpack and many others that I somehow can´t. Is there anything i can do? 
    • Thanks, I've now installed a slightly newer version and the server is at least starting up now.
    • i have the same issue. Found 1 Create mod class dependency(ies) in createdeco-1.3.3-1.19.2.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Found 11 Create mod class dependency(ies) in createaddition-fabric+1.19.2-20230723a.jar, which are missing from the current create-1.19.2-0.5.1.i.jar Detailed walkthrough of mods which rely on missing Create mod classes: Mod: createaddition-fabric+1.19.2-20230723a.jar Missing classes of create: com/simibubi/create/compat/jei/category/sequencedAssembly/JeiSequencedAssemblySubCategory com/simibubi/create/compat/recipeViewerCommon/SequencedAssemblySubCategoryType com/simibubi/create/compat/rei/CreateREI com/simibubi/create/compat/rei/EmptyBackground com/simibubi/create/compat/rei/ItemIcon com/simibubi/create/compat/rei/category/CreateRecipeCategory com/simibubi/create/compat/rei/category/WidgetUtil com/simibubi/create/compat/rei/category/animations/AnimatedBlazeBurner com/simibubi/create/compat/rei/category/animations/AnimatedKinetics com/simibubi/create/compat/rei/category/sequencedAssembly/ReiSequencedAssemblySubCategory com/simibubi/create/compat/rei/display/CreateDisplay Mod: createdeco-1.3.3-1.19.2.jar Missing classes of create: com/simibubi/create/content/kinetics/fan/SplashingRecipe
    • The crash points to moonlight lib - try other builds or make a test without this mod and the mods requiring it
    • Do you have shaders enabled? There is an issue with the mod simpleclouds - remove this mod or disable shaders, if enabled  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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