Jump to content

Recommended Posts

Posted

hello, i'm working on a flower that only can placed on (FarmField) a few of weeks but i'm stuck atm

 

@Override

protected boolean canThisPlantGrowOnThisBlockID(int i)

            {        

   

        return i == Mod_Mark136.FarmField.blockID;

    }

 

this should override the methode in the block flower class, but it does'nt, it combines

so you can also place my flower on grass/dirt/tilledfield, but i only want that it can be placed on the farmfield Block

 

can somebody help me?

(if you need more info, say what you need and i'll post it)

 

Mark136

 

 

 

 

my Mod: Extended RPG [W.I.P]

Posted

I 'd like to say that you should Override your EnumPlantType to cave in your Seeds class.After this you can grow it everywhere.

 

 

@Override

    public EnumPlantType getPlantType(World world, int x, int y, int z)

    {

        return EnumPlantType.Cave;

    }

Posted

it won't work, and it's not a seed but a flower/sapling

and i DON'T want to just place it everywhere, i only want my flower/sapling on my FarmField block

 

here is some codes from my modcorefile and my block flower.class , i dont write everything because i don't want to hurt your eyes.

look at it if you want

 

core mod file

 

****************

public static Block FarmField;

public static BlockMFlower Mark136Fl;

****************

public void load(FMLInitializationEvent ****)

****************

FarmField = new BlockMark136(191, 1, Material.rock).setStepSound(Block.soundStoneFootstep)    .setBlockName("Mark's Farm").setHardness(4.5F).setResistance(5F).setLightValue(0.25F);

 

Mark136Fl = (BlockMFlower) new BlockMFlower(204, 14).setStepSound(Block.soundGrassFootstep).setBlockName("Mark's flower") .setHardness(0.15F).setResistance(5F).setLightValue(0.375F);

****************

LanguageRegistry.addName(FarmField, "Mark's FarmField");

LanguageRegistry.addName(Mark136Fl, "Mark's Flower");

 

*************************************************

 

i think the BlockMark136.class is'nt interesting because it acts like a normal block

but the BlockMFlower.class maybe

 

 

package com.Mark136.ModMark136;

 

import java.util.Random;

 

import net.minecraft.src.Block;

import net.minecraft.src.BlockFlower;

import net.minecraft.src.CreativeTabs;

import net.minecraft.src.Material;

import net.minecraft.src.World;

 

 

public class BlockMFlower extends BlockFlower

{

 

    protected BlockMFlower(int par1, int par2)

    {

        super(par1, par2, Material.vine);

        float var3 = 0.4F;

        this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, var3 * 2.0F, 0.5F + var3);

        this.setCreativeTab(CreativeTabs.tabDecorations);       

    }

   

            @Override

    protected boolean canThisPlantGrowOnThisBlockID(int i)

    {

        return i == Mod_Mark136.FarmField.blockID;

    }

   

    public int getBlockTextureFromSideAndMetadata(int par1, int par2)

    {

        return this.blockIndexInTexture;

    }

   

   

    public String getTextureFile()

    {

    return "/Mark136/Mark136Blocks.png" ;

   

    }

    public int quantityDropped(int par1)

    {

            return (1);

    }

 

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

    {

            return Mod_Mark136.Mark1361.shiftedIndex;

    }

my Mod: Extended RPG [W.I.P]

Posted

Change "protected boolean canThisPlantGrowOnThisBlockID(int i)" to "public boolean canThisPlantGrowOnThisBlockID(int i)"

Protip: try and find answers yourself before asking on the forum.

It's pretty likely that there is an answer.

 

Was I helpful? Give me a thank you!

 

 

width=635 height=903http://bit.ly/HZ03zy[/img]

 

 

Tired of waiting for mods to port to bukkit?

use BukkitForge! (now with a working version of WorldEdit!)

Posted

I see it.What you need to do is 2 things:

1.build a seed item extends ItemSeed.there will be ItemSeed(int,int,int),the first is itemID ,second is blockID of your crop,the 3rd is the soil blockID beneath it.in that class you should Override EnumPlantType to cave.

2.In blockyourcrop Class you should let canThisPlantGrowOnThisBlockID return your soil.

 

It works for me and I have many different plants that grows on plank,stone,etc.

Posted

or you should then use Onneighbourblockchange to examine can it exist.

for me,in your seed class you check the blockID you are using the seeds.if it is your soil return super,else return false.

Posted

i dont want to create a seed item, i want a SAPLING please reed before answer

 

i want that my SAPLING can ONLY be planted on my block

 

can someone please help me with this

 

please give  no useless reactions

 

 

EDIT: i got it almost, i only need to get public EnumPlantType getPlantType(World world, int x, int y, int z)

return false, but i don't know how   

my Mod: Extended RPG [W.I.P]

  • 2 weeks later...
Posted

please help me

 

also, i want to add something like a suprise box

i want to let it drop some items randomly, i only can let it drop 1 thing

i want that it will drop items with degrees

 

like 45% dirt, 25% cobble stone 20% sand    5% iron ingot    2% coal  2% gold and 1% diamond

 

i think i must put something in this method

 

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

{

        //but what????????????????

}

 

 

please can someone help me

 

thanks and merry christmas

 

Mark136

my Mod: Extended RPG [W.I.P]

Posted

public int idDropped(int par1, Random par2Random, int par3){

int derp = par2Random.nextInt(99);

if(derp<45){

return this.dirt.blockId;

}else{

if(derp<70){

return this.cobblestone.blockId;

}else{

if(derp<90){

return this.sand.blockId

}else{

if(derp<95){

return iron.itemId;

}else{

if(derp<97){

return item.coal.itemId;

}else{

if(derp<99){

return item.gold.itemId;

}else{

return item.diamond.itemId;

}

}

}

}

}

}

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Posted

I looked in BlockFlower.java and found:

public boolean canPlace(World world, int i, int j, int k) {

    return super.canPlace(world, i, j, k) && this.d_(world.getTypeId(i, j - 1, k));

}

protected boolean d_(int i) {

    return i == Block.GRASS.id || i == Block.DIRT.id || i == Block.SOIL.id;

}

 

I'm not sure if d_ is still called that in forge now, but one of those functions is what you want to override.

 

(I'm at work now and can't access forge. If you need more help, I'll check it when I get home.)

Posted

You were on the right track with the first thing you tried. You just need to add on to your if statement when it checks the ID of the block you are clicking on.

 

You need to make it so that it will check to make sure that they block you are clicking on is your FarmField, and check that it is not Grass or Dirt

 

it would look something like this

 

protected boolean canThisPlantGrowOnThisBlockID(int i)

      {   

          return i == Mod_Mark136.FarmField.blockID i != Block.Dirt && i != Block.Grass;

      }

 

I'm not sure if that is exactly correct, but it will be something like that.

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 checked the hash like you said and it came back as OK each time, also may I ask what you mean by debug mode during installation?  
    • My name is Clara Bennett, and I almost let cryptocurrency destroy me.  Two years ago, after selling my green e-commerce startup, I plunged headfirst into the crypto world. yield farming , I was all in. I believed I wasn’t just investing; I was participating in the next great technological revolution. Within months, my portfolio skyrocketed to $200,000. I even started sketching ideas for a blockchain-based microloan platform to empower small entrepreneurs around the world. Crypto felt like pure freedom and limitless potential. I thought I was untouchable. I thought wrong. It happened through a single email. It looked like a standard security update from my wallet provider polished, routine, and harmless. I interacted with it briefly, thinking it was legitimate. Hours later, I checked my account and realized my entire wallet had been drained. Every token, every coin, gone. I sat there in disbelief, replaying the moment over and over. I had built my career on being cautious with technology, yet somehow, I had still been compromised. The blockchain’s promise of "irreversible transactions" now felt like a cruel joke  .Devastated and desperate, I scoured forums for solutions. Most people told me there was no hope once crypto is gone, it’s gone. Still, I refused to give up. That’s when I stumbled across FUNDS RETRIEVER ENGINEER . I decided to reach out. From the beginning, they were empathetic, and honest about the challenges. They explained their process step-by-step, focusing on tracing transactions, tracking down phishing operators, and leveraging advanced blockchain analytics. It wasn't an overnight fix. It took weeks of meticulous investigation, technical recovery work, and legal coordination .But in the end, their persistence paid off. FUNDS RETRIEVER ENGINEER  was able to trace the stolen funds across multiple wallets and exchanges. Through a combination of technical expertise and strategic action, they managed to recover the full amount I had lost. Today, my crypto portfolio is intact once again. More importantly, I’ve regained my confidence though I am now much wiser and far more cautious. I learned the hard way that while crypto offers incredible opportunities, it also demands extreme vigilance. Thanks to FUNDS RETRIEVER ENGINEER , I recovered my lost funds and  also reclaimed my future in the digital economy. For help  W H A T S A P P:  +1  8  0 2 9 5 2 3 4 7 0 E   m  a I L       F U N D S R  E T R  I E V E R  [@]  E  N  G  I  N  E  E  R.  C  O  M
    • 1. Did you try to remove your system cache or something? 2. Also check jar hash before installing (if it's ok): sha1sum jar_name.jar > jar_name.jar.sha1 sha1sum -c jar_name.jar.sha1 Do this a few times with some interval. This can find out if your hash can be different somehow (garbage files inside).  Also try using sha224sum / sha256sum / sha384sum / sha512sum / shasum. And do you have any debug mode during installation?   UPDATED: and it can be just fixing by chmod'ing jar file. Check its -lZ 
    • I get these errors when trying to install any version (this ones for 47.3.33 for instance):  Processor failed, invalid outputs:     /home/user/.local/share/FreesmLauncher/instances/1.20.1/minecraft/libraries/net/minecraft/server/1.20.1-20230612.114412/server-1.20.1-20230612.114412-slim.jar       Expected: 9e06bdd77ca6d95b2cced0bf372245f753eeb16a       Actual:   f1e5a0cc3c9f7c58f26524a43c5badc06ca0bac4     /home/user/.local/share/FreesmLauncher/instances/1.20.1/minecraft/libraries/net/minecraft/server/1.20.1-20230612.114412/server-1.20.1-20230612.114412-extra.jar       Expected: 13522e3278befd103064d91a199451df4cd2633f       Actual:   eb1dafb7bee2ace5d55d90b65e73c2196b1991f3 I've tried sklauncher and freesm launcher and they throw the same error, tried installing it with the official forge installer too but same error. Also tried different versions of java: 17, 21, 24. Forge for previous versions install fine, I'm on Linux CachyOS.  
  • Topics

×
×
  • Create New...

Important Information

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