Jump to content

Recommended Posts

Posted

I don't know why, but when I right click on farmland with Tomato Seed, game crashed;

 

Codes:

 

Item;

	public static Item tomatoSeed;
tomatoSeed = new addseed(64, "tomatoseed", blockref.tomatoCrop, EnumPlantType.Crop);

 

Block;

	public static Block tomatoCrop;
	this.tomatoCrop = new addcrop("tomato", itemref.tomatoSeed, foodref.vegTomato, 7, 2, true);

 

addseed;

package net.extend.mod.functions;

import javax.swing.text.TabableView;

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.extend.mod.ref;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.util.ForgeDirection;

public class addseed extends Item implements IPlantable {
private Block field_150925_a;
private Block par2Block;
private EnumPlantType Type;

public addseed(int stack, String name, Block par1, EnumPlantType type) {

	this.setMaxStackSize(stack);
	this.setCreativeTab(CreativeTabs.tabMaterials);
	this.setUnlocalizedName(name);
	this.field_150925_a = par1;
	this.par2Block = Blocks.farmland;
	this.Type = type;
	GameRegistry.registerItem(this, name);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg) {
	this.itemIcon = reg.registerIcon(ref.uid + ":" + (this.getUnlocalizedName().substring(5)));
}


    public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
        if (p_77648_7_ != 1) { return false; }
        else if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) {
            if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_).canSustainPlant(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, ForgeDirection.UP, this) && p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) {
            	p_77648_3_.setBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_, this.field_150925_a);
                --p_77648_1_.stackSize;
                return true;
            } else { return false; }
        } else { return false; }
    }

@Override
public Block getPlant(IBlockAccess arg0, int arg1, int arg2, int arg3) {
	return field_150925_a;
}

@Override
public int getPlantMetadata(IBlockAccess arg0, int arg1, int arg2, int arg3) {
        return 0;
}

@Override
public EnumPlantType getPlantType(IBlockAccess arg0, int arg1, int arg2, int arg3) {
        return this.Type;
}

}

 

addcrop;

package net.extend.mod.functions;

import java.math.MathContext;
import java.util.ArrayList;
import java.util.Random;

import scala.reflect.reify.phases.Calculate;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.extend.mod.blockref;
import net.extend.mod.foodref;
import net.extend.mod.itemref;
import net.extend.mod.ref;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

public class addcrop extends BlockCrops {
@SideOnly(Side.CLIENT)
private IIcon[] cropIcon;
private Item Seed;
private Item Crop;
private int MaxSeed;
private int MaxCrop;
private boolean SeedReturn;

public addcrop(String name, Item seed, Item crop, int maxseed, int maxcrop, boolean seedreturn) {
	this.Seed = seed;
	this.Crop = crop;
	this.MaxSeed = maxseed;
	this.MaxCrop = maxcrop;
	this.SeedReturn = seedreturn;
//       this.setTickRandomly(true);
	this.setBlockName(name);
	this.setStepSound(soundTypeGrass);
	this.setHardness(0.0F);
	GameRegistry.registerBlock(this, name);
}

    protected boolean canThisPlantGrowOnThisBlock(Block par1) {
        return par1 == Blocks.farmland;
    }

@SideOnly(Side.CLIENT)
public IIcon getIIcon(int par1, int par2) {
	if ((par2 < 0) || (par2 > this.MaxSeed)) {
		par2 = this.MaxSeed;
	}
	return this.cropIcon[par2];
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg) {
	int MaxSeedx = this.MaxSeed;
	MaxSeedx++;
	this.cropIcon = new IIcon[MaxSeedx];
	for (int i = 0; i < this.cropIcon.length; i++) {
		this.cropIcon[i] = reg.registerIcon(ref.uid + ":textures/blocks/crop/" + (this.getUnlocalizedName().substring(5)) + "_" + i);
	}
}

/*
    public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
        super.updateTick(par1World, par2, par3, par4, par5Random);

        if (par1World.getBlockLightValue(par2, par3 + 1, par4) >= 9) {
            int l = par1World.getBlockMetadata(par2, par3, par4);

            if (l < this.MaxSeed) {
                float f = this.r(par1World, par2, par3, par4);

                if (par5Random.nextInt((int)(25.0F / f) + 1) == 0)
                {
                    ++l;
                    par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2);
                }
            }
        }
    }
*/

public void fertilize(World par1, int par2, int par3, int par4) {
        int l = par1.getBlockMetadata(par2, par3, par4) + MathHelper.getRandomIntegerInRange(par1.rand, 2, 5);

	if (l > this.MaxSeed) { l = this.MaxSeed; }
	par1.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
}

public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
	ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
	if (metadata < this.MaxSeed) {
		ret.add(new ItemStack(this.Seed, 1));			
	} else if (metadata >= this.MaxSeed) {
		if (this.SeedReturn) {
			for (int i = 0; i < 3 + fortune; i++) {
				if (world.rand.nextInt(15) <= metadata) {
					ret.add(new ItemStack(this.Seed, 1));
				}
			}
		}

		if ((metadata >= 3) && (metadata <= this.MaxSeed)) {
			for (int n = 0; n < 3 + fortune; n++) {
				if (world.rand.nextInt(15) <= metadata) {
					ret.add(new ItemStack(this.Crop, this.MaxCrop, 1));
				}
			}
		}
	}		
	return ret;
}
}

Posted

This is the problem my made, normally client say caused by ... but this time it isn't or maybe I couldn't see it. Anyway if you want I can copy for you.

 

---- Minecraft Crash Report ----
// Daisy, daisy...

Time: 24.08.2014 06:04
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(SourceFile:57)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:595)
at net.minecraft.world.World.setBlock(World.java:441)
at net.minecraft.world.World.setBlock(World.java:576)
at net.extend.mod.functions.addseed.onItemUse(addseed.java:48)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:127)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:353)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1436)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1942)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:962)
at net.minecraft.client.Minecraft.run(Minecraft.java:887)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at GradleStart.bounce(GradleStart.java:107)
at GradleStart.startClient(GradleStart.java:100)
at GradleStart.main(GradleStart.java:55)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(SourceFile:57)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:595)
at net.minecraft.world.World.setBlock(World.java:441)
at net.minecraft.world.World.setBlock(World.java:576)
at net.extend.mod.functions.addseed.onItemUse(addseed.java:48)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:127)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:353)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1436)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['ForgeDevName'/267, l='MpServer', x=1032,24, y=5,62, z=-565,69]]
Chunk stats: MultiplayerChunkCache: 65, 65
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options: 
Level spawn location: World: (1143,4,-606), Chunk: (at 7,0,2 in 71,-38; contains blocks 1136,0,-608 to 1151,255,-593), Region: (2,-2; contains chunks 64,-64 to 95,-33, blocks 1024,0,-1024 to 1535,255,-513)
Level time: 45829 game time, 53221 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 81 total; [EntityPig['Pig'/143, l='MpServer', x=1089,25, y=4,00, z=-614,06], EntityCow['Cow'/8, l='MpServer', x=971,22, y=4,00, z=-509,38], EntityChicken['Chicken'/129, l='MpServer', x=1083,44, y=4,00, z=-560,56], EntityPig['Pig'/128, l='MpServer', x=1079,22, y=4,00, z=-569,13], EntityPig['Pig'/131, l='MpServer', x=1085,97, y=4,00, z=-544,03], EntityItem['item.item.egg'/130, l='MpServer', x=1072,47, y=4,13, z=-567,59], EntitySlime['Slime'/12, l='MpServer', x=986,13, y=4,47, z=-614,97], EntitySlime['Slime'/133, l='MpServer', x=1085,78, y=4,57, z=-559,82], EntityChicken['Chicken'/13, l='MpServer', x=977,69, y=4,00, z=-605,69], EntityChicken['Chicken'/132, l='MpServer', x=1077,53, y=4,00, z=-558,31], EntitySlime['Slime'/135, l='MpServer', x=1081,40, y=5,24, z=-508,70], EntitySlime['Slime'/14, l='MpServer', x=979,14, y=4,85, z=-604,07], EntityXPOrb['Experience Orb'/15, l='MpServer', x=976,75, y=4,23, z=-578,75], EntitySlime['Slime'/134, l='MpServer', x=1075,32, y=4,00, z=-539,37], EntityChicken['Chicken'/17, l='MpServer', x=990,59, y=4,00, z=-559,38], EntityCow['Cow'/16, l='MpServer', x=983,53, y=4,00, z=-573,59], EntitySlime['Slime'/19, l='MpServer', x=980,56, y=4,00, z=-525,50], EntitySlime['Slime'/18, l='MpServer', x=990,72, y=4,69, z=-549,91], EntitySheep['Sheep'/21, l='MpServer', x=986,19, y=4,00, z=-505,19], EntityClientPlayerMP['ForgeDevName'/267, l='MpServer', x=1032,24, y=5,62, z=-565,69], EntitySheep['Sheep'/20, l='MpServer', x=988,78, y=4,00, z=-498,06], EntityXPOrb['Experience Orb'/23, l='MpServer', x=1007,41, y=4,36, z=-612,07], EntitySheep['Sheep'/144, l='MpServer', x=1098,72, y=4,00, z=-615,50], EntityPig['Pig'/25, l='MpServer', x=1007,84, y=4,00, z=-586,06], EntitySheep['Sheep'/145, l='MpServer', x=1100,03, y=4,00, z=-616,41], EntityChicken['Chicken'/24, l='MpServer', x=1004,47, y=4,00, z=-588,59], EntityPig['Pig'/146, l='MpServer', x=1101,66, y=4,00, z=-606,09], EntityItem['item.item.egg'/27, l='MpServer', x=1005,38, y=4,13, z=-552,09], EntitySlime['Slime'/147, l='MpServer', x=1098,60, y=4,83, z=-554,14], EntityItem['item.item.rottenFlesh'/26, l='MpServer', x=1005,47, y=4,13, z=-557,41], EntityItem['item.item.rottenFlesh'/29, l='MpServer', x=1003,03, y=4,13, z=-528,25], EntityChicken['Chicken'/28, l='MpServer', x=996,81, y=4,00, z=-532,34], EntityPig['Pig'/31, l='MpServer', x=991,91, y=4,00, z=-506,25], EntityPig['Pig'/30, l='MpServer', x=1000,13, y=4,00, z=-535,28], EntityCow['Cow'/32, l='MpServer', x=1004,09, y=4,00, z=-509,06], EntityItem['item.item.arrow'/42, l='MpServer', x=1013,66, y=4,13, z=-546,56], EntityPig['Pig'/43, l='MpServer', x=1017,97, y=4,00, z=-532,03], EntityItem['item.item.egg'/40, l='MpServer', x=1021,69, y=4,13, z=-592,16], EntityPig['Pig'/41, l='MpServer', x=1018,94, y=4,00, z=-597,97], EntitySlime['Slime'/44, l='MpServer', x=1010,14, y=5,06, z=-527,10], EntitySlime['Slime'/51, l='MpServer', x=1032,00, y=4,00, z=-622,53], EntityChicken['Chicken'/50, l='MpServer', x=1030,59, y=4,00, z=-608,41], EntityChicken['Chicken'/55, l='MpServer', x=1026,44, y=4,00, z=-591,47], EntityXPOrb['Experience Orb'/54, l='MpServer', x=1039,47, y=4,25, z=-579,96], EntityXPOrb['Experience Orb'/53, l='MpServer', x=1034,75, y=4,25, z=-587,91], EntityXPOrb['Experience Orb'/52, l='MpServer', x=1030,50, y=4,07, z=-576,64], EntityPig['Pig'/58, l='MpServer', x=1025,41, y=4,00, z=-544,75], EntitySlime['Slime'/57, l='MpServer', x=1030,84, y=4,00, z=-548,00], EntitySlime['Slime'/56, l='MpServer', x=1039,22, y=4,00, z=-565,16], EntityCow['Cow'/68, l='MpServer', x=1048,66, y=4,00, z=-615,13], EntityItem['item.item.egg'/69, l='MpServer', x=1044,00, y=4,13, z=-616,00], EntityItem['item.item.egg'/70, l='MpServer', x=1050,91, y=4,13, z=-611,09], EntityChicken['Chicken'/71, l='MpServer', x=1043,41, y=4,00, z=-611,44], EntityItem['item.item.arrow'/76, l='MpServer', x=1045,75, y=4,13, z=-517,19], EntityItem['item.item.bone'/72, l='MpServer', x=1052,47, y=4,13, z=-597,56], EntityChicken['Chicken'/73, l='MpServer', x=1054,41, y=4,00, z=-604,59], EntityItem['item.item.arrow'/74, l='MpServer', x=1043,53, y=4,13, z=-568,03], EntityCow['Cow'/75, l='MpServer', x=1044,91, y=4,00, z=-568,09], EntityPig['Pig'/93, l='MpServer', x=1066,72, y=4,00, z=-604,22], EntityChicken['Chicken'/92, l='MpServer', x=1058,56, y=4,00, z=-622,66], EntityPig['Pig'/95, l='MpServer', x=1069,91, y=4,00, z=-598,44], EntityCow['Cow'/94, l='MpServer', x=1057,44, y=4,00, z=-601,75], EntityChicken['Chicken'/91, l='MpServer', x=1059,09, y=4,00, z=-621,41], EntityPig['Pig'/90, l='MpServer', x=1062,66, y=4,00, z=-618,78], EntityItem['item.item.bone'/102, l='MpServer', x=1060,28, y=4,13, z=-536,84], EntityChicken['Chicken'/103, l='MpServer', x=1056,38, y=4,00, z=-498,19], EntityItem['item.item.egg'/100, l='MpServer', x=1070,78, y=4,13, z=-550,75], EntityItem['item.item.arrow'/101, l='MpServer', x=1059,91, y=4,13, z=-536,94], EntityItem['item.item.chickenRaw'/98, l='MpServer', x=1065,56, y=4,13, z=-573,91], EntityChicken['Chicken'/99, l='MpServer', x=1070,19, y=4,00, z=-551,38], EntityXPOrb['Experience Orb'/96, l='MpServer', x=1063,46, y=4,25, z=-576,28], EntityItem['item.item.feather'/97, l='MpServer', x=1067,13, y=4,13, z=-573,75], EntitySlime['Slime'/104, l='MpServer', x=1060,37, y=4,91, z=-496,91], EntitySlime['Slime'/127, l='MpServer', x=1081,32, y=4,00, z=-575,87], EntitySlime['Slime'/126, l='MpServer', x=1076,61, y=4,00, z=-588,11], EntityChicken['Chicken'/125, l='MpServer', x=1073,47, y=4,00, z=-595,56], EntitySheep['Sheep'/124, l='MpServer', x=1084,78, y=4,00, z=-596,75], EntitySlime['Slime'/123, l='MpServer', x=1075,60, y=4,00, z=-623,81], EntitySheep['Sheep'/122, l='MpServer', x=1083,97, y=4,00, z=-611,03], EntityPig['Pig'/121, l='MpServer', x=1073,19, y=4,00, z=-617,41], EntityPig['Pig'/120, l='MpServer', x=1078,59, y=4,00, z=-618,81]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:373)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2433)
at net.minecraft.client.Minecraft.run(Minecraft.java:916)
at net.minecraft.client.main.Main.main(SourceFile:148)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at GradleStart.bounce(GradleStart.java:107)
at GradleStart.startClient(GradleStart.java:100)
at GradleStart.main(GradleStart.java:55)

-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_45, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 808602952 bytes (771 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v9.05 FML v7.10.25.1205 Minecraft Forge 10.13.0.1205 4 mods loaded, 4 mods active
mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
FML{7.10.25.1205} [Forge Mod Loader] (forgeBin-1.7.10-10.13.0.1205.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.0.1205} [Minecraft Forge] (forgeBin-1.7.10-10.13.0.1205.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
extend{0.0.1} [Extend] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.7.10
LWJGL: 2.9.1
OpenGL: Intel(R) HD Graphics Family GL version 3.1.0 - Build 8.15.10.2476, Intel
GL Caps: Using GL 1.3 multitexturing.
Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.
Anisotropic filtering is supported and maximum anisotropy is 16.
Shaders are available because OpenGL 2.1 is supported.

Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: []
Current Language: English (US)
Profiler Position: N/A (disabled)
Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
Anisotropic Filtering: Off (1)

Posted

java.lang.NullPointerException: Unexpected error
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(SourceFile:57)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:595)
at net.minecraft.world.World.setBlock(World.java:441)
at net.minecraft.world.World.setBlock(World.java:576)
at net.extend.mod.functions.addseed.onItemUse(addseed.java:48)

What's on line 48 in the addseed class?

 

BTW, You might want to look at some Java Coding Conventions, cause your naming is horrible.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

All I can see from a cursory look is that you neglect to call your superclass constructors. This is normally a serious omission.

 

Also, you have no naming convention being used in your mod code. Variable have Searge names, or uppercase names, and classes have any case (upper, lower, whatever) that happens to hit your fancy names. Yeah, this is a hodge-podge of bad code that will always be hard to understand or debug.

 

Frankly, I don't think you understand how the seed / plant interfaces even work.

Registering a block or item should not be done in the constructor. Do it after constructing your item/block, then you have a reference to use or compare against.

Did you even use the FMLPreinitialization event to create your block and item? One thing to note, is your method leads to recursive nullity either you create your seed with a null plant black, or you create your plant with a null seed item. Either way, your gonna fail.

A seed item has to be associated with a plant block. I don't see that here (plant block created after seed registers it), and so it seems something is trying to place a null block in the world. I recon it's your seed,

 

Posted

Pretty much half the people trying to implement crops have this problem (null pointer when they actually try to plant) because they assign the block to the seed before the block instance is initialized so they are setting up the seed to plant a null.

 

You need to make sure the block is fully initialized (not just declared) by time you create the item seed.

 

To confirm this is the problem, right before you assign your tomatoSeed, test if blockref.tomatoCrop == null.  I'm pretty sure you'll find it is.

 

The solution is you have to make sure that the block instance is created before the seed item.  I think you may have some trouble in your approach because you have your addCrop method take in the seed item, which is backwards (the block will be created after the seed).

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

java.lang.NullPointerException: Unexpected error
at net.minecraft.world.chunk.storage.ExtendedBlockStorage.func_150818_a(SourceFile:57)
at net.minecraft.world.chunk.Chunk.func_150807_a(Chunk.java:595)
at net.minecraft.world.World.setBlock(World.java:441)
at net.minecraft.world.World.setBlock(World.java:576)
at net.extend.mod.functions.addseed.onItemUse(addseed.java:48)

What's on line 48 in the addseed class?

 

BTW, You might want to look at some Java Coding Conventions, cause your naming is horrible.

 

    public boolean onItemUse(ItemStack p_77648_1_, EntityPlayer p_77648_2_, World p_77648_3_, int p_77648_4_, int p_77648_5_, int p_77648_6_, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
        if (p_77648_7_ != 1) { return false; }
        else if (p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_, p_77648_6_, p_77648_7_, p_77648_1_) && p_77648_2_.canPlayerEdit(p_77648_4_, p_77648_5_ + 1, p_77648_6_, p_77648_7_, p_77648_1_)) {
            if (p_77648_3_.getBlock(p_77648_4_, p_77648_5_, p_77648_6_).canSustainPlant(p_77648_3_, p_77648_4_, p_77648_5_, p_77648_6_, ForgeDirection.UP, this) && p_77648_3_.isAirBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_)) {
            	p_77648_3_.setBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_, this.field_150925_a);
                --p_77648_1_.stackSize;
                return true;
            } else { return false; }
        } else { return false; }
    }

 

Line 48:

            	p_77648_3_.setBlock(p_77648_4_, p_77648_5_ + 1, p_77648_6_, this.field_150925_a);

 

All I can see from a cursory look is that you neglect to call your superclass constructors. This is normally a serious omission.

 

Also, you have no naming convention being used in your mod code. Variable have Searge names, or uppercase names, and classes have any case (upper, lower, whatever) that happens to hit your fancy names. Yeah, this is a hodge-podge of bad code that will always be hard to understand or debug.

 

Frankly, I don't think you understand how the seed / plant interfaces even work.

Registering a block or item should not be done in the constructor. Do it after constructing your item/block, then you have a reference to use or compare against.

Did you even use the FMLPreinitialization event to create your block and item? One thing to note, is your method leads to recursive nullity either you create your seed with a null plant black, or you create your plant with a null seed item. Either way, your gonna fail.

A seed item has to be associated with a plant block. I don't see that here (plant block created after seed registers it), and so it seems something is trying to place a null block in the world. I recon it's your seed,

 

Yes i don't really understand honestly, I'm starting to coding maybe 3 months and maybe open eclipse 4 or 5 times because I don't have time so much.

 

I have preinit;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {

	configref.Settings(event);
	new itemref();
	new armorref();
	new foodref();
	new blockref();
	new reciperef();
        
        //Generation
        GameRegistry.registerWorldGenerator(new generation(), 1);
}

 

All the registries in *ref classes. The first code I gave at my first post is from itemref()

 

package net.extend.mod;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.EnumPlantType;
import net.extend.mod.functions.addaxe;
import net.extend.mod.functions.addbattleaxe;
import net.extend.mod.functions.addbow;
import net.extend.mod.functions.addcrop;
import net.extend.mod.functions.adddisc;
import net.extend.mod.functions.addfishingrod;
import net.extend.mod.functions.addhoe;
import net.extend.mod.functions.additem;
import net.extend.mod.functions.addpickaxe;
import net.extend.mod.functions.addseed;
import net.extend.mod.functions.addshovel;
import net.extend.mod.functions.addsword;

public class itemref {

//Items
public static Item stoneBow;
public static Item ironBow;
public static Item goldBow;
public static Item diamondBow;
public static Item blackDiamond;
public static Item blackDiamondSword;
public static Item blackDiamondAxe;
public static Item blackDiamondBow;
public static Item blackDiamondHoe;
public static Item blackDiamondPickaxe;
public static Item blackDiamondShovel;
public static Item nightIngot;
public static Item nightSword;
public static Item nightAxe;
public static Item nightBow;
public static Item nightHoe;
public static Item nightPickaxe;
public static Item nightShovel;
public static Item blackDiamondBattleAxe;
public static Item diamondBattleAxe;
public static Item goldBattleAxe;
public static Item ironBattleAxe;
public static Item stoneBattleAxe;
public static Item woodBattleAxe;
public static Item nightBattleAxe;
public static Item cup;
public static Item discWish;
public static Item discJingle;
public static Item discCarol;
public static Item discBirGorusKabininde;
public static Item discAhSensiz;
public static Item discKoNewYear;
public static Item discNumb;
public static Item discBeautifulMind;
public static Item discSomebodyToldMe;
public static Item discKids;
public static Item discGhostsNStuff;
public static Item discVivaLaVida;
public static Item discApplause;
public static Item discDiamonds;
public static Item discMovesLikeJagger;
public static Item discRapGod;
public static Item discSetFireToRain;
public static Item discSurvival;
public static Item stoneFishingRod;
public static Item ironFishingRod;
public static Item goldFishingRod;
public static Item diamondFishingRod;
public static Item blackDiamondFishingRod;
public static Item nightFishingRod;
public static Item fishBones;
public static Item tinCan;
public static Item boundLeather;
public static Item tannedLeather;
public static Item zombieLeather;

public static Item tomatoSeed;

public itemref() {

        //Add Item
	stoneBow = new addbow("stonebow", ToolMaterial.STONE);
	ironBow = new addbow("ironbow", ToolMaterial.IRON);
	goldBow = new addbow("goldbow", ToolMaterial.GOLD);
	diamondBow = new addbow("diamondbow", ToolMaterial.EMERALD);
	blackDiamondBow = new addbow("blackdiamondbow", extend.ToolMaterial_BLACKDIAMOND);
	blackDiamond = new additem(64, "blackdiamond", CreativeTabs.tabMaterials, false);
	blackDiamondSword = new addsword("blackdiamondsword", extend.ToolMaterial_BLACKDIAMOND);
	blackDiamondAxe = new addaxe("blackdiamondaxe", extend.ToolMaterial_BLACKDIAMOND);
	blackDiamondHoe = new addhoe("blackdiamondhoe", extend.ToolMaterial_BLACKDIAMOND);
	blackDiamondPickaxe = new addpickaxe("blackdiamondpickaxe", extend.ToolMaterial_BLACKDIAMOND);
	blackDiamondShovel = new addshovel("blackdiamondshovel", extend.ToolMaterial_BLACKDIAMOND);
	nightIngot = new additem(64, "nightingot", CreativeTabs.tabMaterials, false);
	nightSword = new addsword("nightsword", extend.ToolMaterial_NIGHT);
	nightAxe = new addaxe("nightaxe", extend.ToolMaterial_NIGHT);
	nightBow = new addbow("nightbow", extend.ToolMaterial_NIGHT);
	nightHoe = new addhoe("nighthoe", extend.ToolMaterial_NIGHT);
	nightPickaxe = new addpickaxe("nightpickaxe", extend.ToolMaterial_NIGHT);
	nightShovel = new addshovel("nightshovel", extend.ToolMaterial_NIGHT);
	blackDiamondBattleAxe = new addbattleaxe("blackdiamondbattleaxe", extend.ToolMaterial_BLACKDIAMOND);
	diamondBattleAxe = new addbattleaxe("diamondbattleaxe", ToolMaterial.EMERALD);
	goldBattleAxe = new addbattleaxe("goldbattleaxe", ToolMaterial.GOLD);
	ironBattleAxe = new addbattleaxe("ironbattleaxe", ToolMaterial.IRON);
	stoneBattleAxe = new addbattleaxe("stonebattleaxe", ToolMaterial.STONE);
	woodBattleAxe = new addbattleaxe("woodbattleaxe", ToolMaterial.WOOD);
	nightBattleAxe = new addbattleaxe("nightbattleaxe", extend.ToolMaterial_NIGHT);
	cup = new additem(64, "cup", CreativeTabs.tabMisc, false);
	discWish = new adddisc("discwish", "wish");
	discJingle = new adddisc("discjingle", "jingle");
	discCarol = new adddisc("disccarol", "carol");
	discBirGorusKabininde = new adddisc("discbirgoruskabininde", "birgoruskabininde");
	discAhSensiz = new adddisc("discahsensiz", "ahsensiz");
	discKoNewYear = new adddisc("disckonewyear", "konewyear");
	discNumb = new adddisc("discnumb", "numb");
	discBeautifulMind = new adddisc("discbeautifulmind", "beautifulmind");
	discSomebodyToldMe = new adddisc("discsomebodytoldme", "somebodytoldme");
	discKids = new adddisc("disckids", "kids");
	discGhostsNStuff = new adddisc("discghostsnstuff", "ghostsnstuff");
	discVivaLaVida = new adddisc("discvivalavida", "vivalavida");
	discApplause = new adddisc("discapplause", "applause");
	discDiamonds = new adddisc("discdiamonds", "diamonds");
	discMovesLikeJagger = new adddisc("discmoveslikejagger", "moveslikejagger");
	discRapGod = new adddisc("discrapgod", "rapgod");
	discSetFireToRain = new adddisc("discsetfiretorain", "setfiretorain");
	discSurvival = new adddisc("discsurvival", "survival");
	stoneFishingRod = new addfishingrod("stonefishingrod", ToolMaterial.STONE);
	ironFishingRod = new addfishingrod("ironfishingrod", ToolMaterial.IRON);
	goldFishingRod = new addfishingrod("goldfishingrod", ToolMaterial.GOLD);
	diamondFishingRod = new addfishingrod("diamondfishingrod", ToolMaterial.EMERALD);
	blackDiamondFishingRod = new addfishingrod("blackdiamondfishingrod", extend.ToolMaterial_BLACKDIAMOND);
	nightFishingRod = new addfishingrod("nightfishingrod", extend.ToolMaterial_NIGHT);
	fishBones = new additem(64, "fishbones", CreativeTabs.tabMisc, false);
	tinCan = new additem(64, "tincan", CreativeTabs.tabMisc, false);
	boundLeather = new additem(64, "boundleather", CreativeTabs.tabMisc, false);
	tannedLeather = new additem(64, "tannedleather", CreativeTabs.tabMisc, false);
	zombieLeather = new additem(64, "zombieleather", CreativeTabs.tabMisc, false);
	tomatoSeed = new addseed(64, "tomatoseed", blockref.tomatoCrop, EnumPlantType.Crop);
}
}

 

And also blockref;

package net.extend.mod;

import net.extend.mod.functions.addblock;
import net.extend.mod.functions.addcrop;
import net.extend.mod.functions.addore;
import net.extend.mod.functions.addstair;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.common.MinecraftForge;
import net.extend.mod.itemref;

public class blockref {

//Blocks
public static Block acidBlock;
public static Block acidOre;
public static Block blackDiamondOre;
public static Block blackDiamondBlock;
public static Block nightOre;
public static Block nightBlock;
public static Block nightStair;
/*	public static Block owen;
public static Block owenActive; */
public static Block tomatoCrop;

public blockref() {
	//Add Block
	/*this.acidBlock = new addblock(configref.acidBlockID, "acidblock", Material.rock , Block.soundStoneFootstep, 2.0F);
	MinecraftForge.setBlockHarvestLevel(acidBlock, "pickaxe", 2);
	this.acidOre = new addore(configref.acidOreID, "acidore", Block.soundStoneFootstep, 2.0F);
	MinecraftForge.setBlockHarvestLevel(acidOre, "pickaxe", 3);*/
	this.blackDiamondBlock = new addblock("blackdiamondblock", Material.iron, Block.soundTypeStone, 2.0F, "pickaxe", 2);
       	this.blackDiamondOre = new addore("blackdiamondore", Block.soundTypeStone, 4.0F, "pickaxe", 2);
       	this.nightOre = new addore("nightore", Block.soundTypeStone, 4.0F, "pickaxe", 2);
       	this.nightBlock = new addblock("nightblock", Material.iron, Block.soundTypeStone, 2.0F, "pickaxe", 2);
       	this.nightStair = new addstair("nightstair", this.nightBlock, 0, "pickaxe", 2);
	this.tomatoCrop = new addcrop("tomato", itemref.tomatoSeed, foodref.vegTomato, 7, 2, true);
}
}

Posted

First, go follow some coding conventions.

 

 

If you've done that, move your

new blockref();

before the

new itemref();

call.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Ok, now I fixed it, I don't know how because I tried many things in same time sorry. However, I think maybe @larsgerrits way is my solution.

 

Anyway, I have a problem about return items;

 

When I type foodref.vegTomato at func_149865_P() it return but when I type this.Crop which is protected Item and equals to crop (foodref.vegTomato) it isn't return.

 

I couldn't explain well, I can try to give an example;

 

Not Return:

    protected Item func_149865_P() {
        return this.Crop;
    }

 

Return:

    protected Item func_149865_P() {
        return foodref.vegTomato;
    }

 

Update: when I try to see String.valueOf(crop) it returns null. I think this is my problem.

 

Second Update: I find the problem about crash and the problem is blockref(); place. And when I did @larsgerrits it solved. Maybe someone still have a problem like this, this can help them.

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

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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