Not onItemRightClick, you would over-ride onItemUse in your item class.
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float hitX, float hitY, float hitZ)
You can do everything here. posX/Y/Z will give you the full x,y,z of the block the player was aiming at when they use it. "side" will be the number of the side of the block - I'm not sure of the numbers on this sorry, I guess it would range from 0-5 (one for each side of the block) - but you can test this yourself easily to discover (just print to console). Finally, hitX/Y/Z is not needed often - from what I know, I think it's they tell you the exact spot of where on the target block it was used - for getting fine-tuned location if you want different areas of a block to do different things or whatever (like the top half of a block for example).
I don't have example code, I have not used this personally. Maybe someone else can help more if you still can't figure it out.
public class ItemStructureHouseSpawn extends Item {
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float hitX, float hitY, float hitZ)
{
int i = posX;
int j = posZ;
int k = world.getHeightValue(i, j);
new StructureHouse().generate(world, null, i, k, j);
return true;
}
public ItemStructureHouseSpawn() {
this.setFull3D();
this.setMaxStackSize(1);
this.setMaxDamage(1);}
What do you mean not working? Simply nothing happens or it crashes?
I dunno what world.getHeightValue(i, j); is, but maybe you should be using .getTopSolidOrLiquidBlock instead. Or not at all, and just use posY (or posY+1)?
Oh well, I'll try, thanks... How do I discover these things without asking any1? Is there any site or something that explains all methods and arguments? xD
Nah not really, there are event lists but they can't be guaranteed to be up-to-date or even complete.
Just type "world." and wait after you type the period (.), Eclipse will popup a list that you can browse clicking on one of them once often has some description text to go along with it, called "Java Doc".
java.lang.NullPointerException: Unexpected error
at pedro7967.testmod.StructureHouse.generate(StructureHouse.java:76)
at pedro7967.testmod.ItemStructureHouseSpawn.onItemUse(ItemStructureHouseSpawn.java:16)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:145)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:407)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2044)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
at net.minecraft.client.Minecraft.run(Minecraft.java:961)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at pedro7967.testmod.StructureHouse.generate(StructureHouse.java:76)
at pedro7967.testmod.ItemStructureHouseSpawn.onItemUse(ItemStructureHouseSpawn.java:16)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:145)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:407)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529)
public class ItemStructureHouseSpawn extends Item {
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float hitX, float hitY, float hitZ)
{
int i = posX;
int j = posZ;
int k = posY;
new StructureHouse().generate(world, null, i, k, j);
return true;
}
public ItemStructureHouseSpawn() {
this.setFull3D();
this.setMaxStackSize(1);
this.setMaxDamage(1);}
Ok it's a problem with StructureHouse class, can you post that too please?
My guess is, I think you'd need to instantiate your class before actually generating (notice the extra parentheses):
(new StructureHouse()).generate(world, null, i, k, j);
And if I have to nitpick, the variables are the wrong order x,y,z should be i,j,k (or just remove the assignment completely, it's not needed):
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float hitX, float hitY, float hitZ)
{
(new StructureHouse()).generate(world, null, posX, posY, posZ);
return true;
}
The structure is generating in the world, but I want to make an item that spawns it hahah
Can someone help me please? Thanks
Could you send me an example of the code? Where do I put it? I have to put "this.onItemRightClick(...);" before, right?
Sorry, I've just started to learn Java xD hahah
You can do everything here. posX/Y/Z will give you the full x,y,z of the block the player was aiming at when they use it. "side" will be the number of the side of the block - I'm not sure of the numbers on this sorry, I guess it would range from 0-5 (one for each side of the block) - but you can test this yourself easily to discover (just print to console). Finally, hitX/Y/Z is not needed often - from what I know, I think it's they tell you the exact spot of where on the target block it was used - for getting fine-tuned location if you want different areas of a block to do different things or whatever (like the top half of a block for example).
I don't have example code, I have not used this personally. Maybe someone else can help more if you still can't figure it out.
My code:
package pedro7967.testmod;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemStructureHouseSpawn extends Item {
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float hitX, float hitY, float hitZ)
{
int i = posX;
int j = posZ;
int k = world.getHeightValue(i, j);
new StructureHouse().generate(world, null, i, k, j);
return true;
}
public ItemStructureHouseSpawn() {
this.setFull3D();
this.setMaxStackSize(1);
this.setMaxDamage(1);}
}
I dunno what world.getHeightValue(i, j); is, but maybe you should be using .getTopSolidOrLiquidBlock instead. Or not at all, and just use posY (or posY+1)?
Just type "world." and wait after you type the period (.), Eclipse will popup a list that you can browse clicking on one of them once often has some description text to go along with it, called "Java Doc".
Hey it's not working. It crashes when I right-click
Here is my crash report:
// You're mean.
Time: 04/09/14 22:21
Description: Unexpected error
java.lang.NullPointerException: Unexpected error
at pedro7967.testmod.StructureHouse.generate(StructureHouse.java:76)
at pedro7967.testmod.ItemStructureHouseSpawn.onItemUse(ItemStructureHouseSpawn.java:16)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:145)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:407)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:2044)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1039)
at net.minecraft.client.Minecraft.run(Minecraft.java:961)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at pedro7967.testmod.StructureHouse.generate(StructureHouse.java:76)
at pedro7967.testmod.ItemStructureHouseSpawn.onItemUse(ItemStructureHouseSpawn.java:16)
at net.minecraft.item.ItemStack.tryPlaceItemIntoWorld(ItemStack.java:145)
at net.minecraft.client.multiplayer.PlayerControllerMP.onPlayerRightClick(PlayerControllerMP.java:407)
at net.minecraft.client.Minecraft.func_147121_ag(Minecraft.java:1529)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player439'/420, l='MpServer', x=110,05, y=72,28, z=252,15]]
Chunk stats: MultiplayerChunkCache: 200, 200
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: World: (136,64,256), Chunk: (at 8,4,0 in 8,16; contains blocks 128,0,256 to 143,255,271), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
Level time: 1419 game time, 1419 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: 148 total; [EntityZombie['Zombie'/275, l='MpServer', x=152,50, y=14,00, z=295,50], EntityZombie['Zombie'/274, l='MpServer', x=153,22, y=13,00, z=294,53], EntityZombie['Zombie'/273, l='MpServer', x=153,28, y=13,00, z=289,78], EntityZombie['Zombie'/272, l='MpServer', x=154,53, y=13,00, z=293,84], EntityZombie['Zombie'/279, l='MpServer', x=157,88, y=15,00, z=297,00], EntityCreeper['Creeper'/278, l='MpServer', x=149,50, y=14,00, z=290,50], EntitySkeleton['Skeleton'/277, l='MpServer', x=154,34, y=15,00, z=297,75], EntitySkeleton['Skeleton'/276, l='MpServer', x=153,47, y=15,00, z=297,16], EntitySkeleton['Skeleton'/283, l='MpServer', x=153,88, y=31,00, z=328,84], EntityZombie['Zombie'/282, l='MpServer', x=158,50, y=16,00, z=295,31], EntityZombie['Zombie'/281, l='MpServer', x=158,69, y=15,00, z=297,69], EntityWitch['Witch'/280, l='MpServer', x=152,50, y=14,00, z=296,59], EntityZombie['Zombie'/262, l='MpServer', x=160,46, y=52,59, z=248,29], EntityZombie['Zombie'/263, l='MpServer', x=158,25, y=53,00, z=250,47], EntityZombie['Zombie'/266, l='MpServer', x=159,78, y=52,00, z=244,53], EntityCow['Cow'/267, l='MpServer', x=151,81, y=81,00, z=267,44], EntitySkeleton['Skeleton'/264, l='MpServer', x=145,13, y=48,00, z=240,38], EntityCreeper['Creeper'/265, l='MpServer', x=156,97, y=51,00, z=246,34], EntityCow['Cow'/270, l='MpServer', x=145,09, y=80,00, z=279,94], EntityCow['Cow'/271, l='MpServer', x=156,31, y=81,00, z=277,69], EntityCow['Cow'/268, l='MpServer', x=146,38, y=82,00, z=261,59], EntitySkeleton['Skeleton'/269, l='MpServer', x=149,50, y=14,00, z=282,50], EntityBat['Bat'/305, l='MpServer', x=169,91, y=25,45, z=264,48], EntityZombie['Zombie'/304, l='MpServer', x=163,03, y=54,00, z=247,41], EntitySkeleton['Skeleton'/315, l='MpServer', x=185,50, y=47,00, z=234,03], EntitySkeleton['Skeleton'/314, l='MpServer', x=189,31, y=41,00, z=237,31], EntitySpider['Spider'/317, l='MpServer', x=182,56, y=16,00, z=253,78], EntityCreeper['Creeper'/319, l='MpServer', x=176,50, y=16,00, z=256,50], EntityCreeper['Creeper'/299, l='MpServer', x=168,00, y=32,00, z=249,75], EntityZombie['Zombie'/63, l='MpServer', x=31,75, y=42,00, z=260,84], EntitySkeleton['Skeleton'/300, l='MpServer', x=168,97, y=33,00, z=250,69], EntityPig['Pig'/62, l='MpServer', x=31,91, y=64,00, z=228,94], EntitySkeleton['Skeleton'/301, l='MpServer', x=160,66, y=52,00, z=244,50], EntityZombie['Zombie'/302, l='MpServer', x=160,50, y=53,00, z=243,09], EntityZombie['Zombie'/303, l='MpServer', x=161,44, y=53,00, z=240,88], EntityBat['Bat'/343, l='MpServer', x=187,14, y=31,57, z=259,55], EntitySkeleton['Skeleton'/69, l='MpServer', x=31,50, y=46,00, z=284,31], EntityZombie['Zombie'/76, l='MpServer', x=33,50, y=42,00, z=237,50], EntityPig['Pig'/77, l='MpServer', x=37,94, y=63,00, z=232,97], EntityPig['Pig'/78, l='MpServer', x=37,44, y=63,00, z=236,34], EntityPig['Pig'/79, l='MpServer', x=38,56, y=63,00, z=239,63], EntityCreeper['Creeper'/74, l='MpServer', x=32,50, y=30,00, z=207,50], EntitySkeleton['Skeleton'/75, l='MpServer', x=33,09, y=43,00, z=235,47], EntitySkeleton['Skeleton'/326, l='MpServer', x=177,47, y=22,00, z=276,56], EntityZombie['Zombie'/327, l='MpServer', x=179,72, y=77,00, z=278,94], EntitySkeleton['Skeleton'/84, l='MpServer', x=46,03, y=42,00, z=245,50], EntityPig['Pig'/324, l='MpServer', x=187,19, y=81,00, z=264,50], EntityBat['Bat'/87, l='MpServer', x=35,53, y=44,39, z=266,73], EntityPig['Pig'/325, l='MpServer', x=185,44, y=85,00, z=262,06], EntityZombie['Zombie'/86, l='MpServer', x=39,50, y=42,00, z=259,50], EntityBat['Bat'/322, l='MpServer', x=181,58, y=28,84, z=257,32], EntityZombie['Zombie'/81, l='MpServer', x=36,50, y=42,00, z=253,50], EntityBat['Bat'/323, l='MpServer', x=182,78, y=31,60, z=255,37], EntitySkeleton['Skeleton'/80, l='MpServer', x=39,50, y=59,00, z=233,50], EntityZombie['Zombie'/320, l='MpServer', x=185,69, y=30,00, z=259,69], EntityBat['Bat'/83, l='MpServer', x=42,47, y=47,00, z=245,14], EntityZombie['Zombie'/321, l='MpServer', x=180,31, y=28,00, z=258,69], EntityZombie['Zombie'/82, l='MpServer', x=43,09, y=41,00, z=248,97], EntityZombie['Zombie'/93, l='MpServer', x=32,44, y=50,00, z=288,84], EntityPig['Pig'/89, l='MpServer', x=38,97, y=63,00, z=268,06], EntityPig['Pig'/88, l='MpServer', x=42,22, y=63,00, z=267,66], EntityPig['Pig'/328, l='MpServer', x=179,94, y=79,00, z=272,06], EntityPig['Pig'/91, l='MpServer', x=47,50, y=63,00, z=270,50], EntityPig['Pig'/329, l='MpServer', x=183,47, y=79,00, z=272,47], EntityPig['Pig'/90, l='MpServer', x=45,50, y=63,00, z=268,50], EntityItem['item.item.doorWood'/110, l='MpServer', x=57,50, y=65,13, z=257,81], EntityItem['item.item.seeds'/111, l='MpServer', x=50,16, y=62,13, z=297,53], EntityItem['item.item.doorWood'/108, l='MpServer', x=55,75, y=65,13, z=258,88], EntityItem['item.item.doorWood'/109, l='MpServer', x=56,75, y=65,13, z=257,13], EntityItem['item.item.doorWood'/106, l='MpServer', x=49,66, y=66,13, z=209,97], EntityItem['item.item.doorWood'/107, l='MpServer', x=51,03, y=66,13, z=210,13], EntityItem['item.item.doorWood'/105, l='MpServer', x=49,94, y=66,13, z=211,88], EntityCreeper['Creeper'/119, l='MpServer', x=71,38, y=48,00, z=201,28], EntitySquid['Squid'/114, l='MpServer', x=51,23, y=60,38, z=305,32], EntitySquid['Squid'/113, l='MpServer', x=52,05, y=60,13, z=303,56], EntitySquid['Squid'/112, l='MpServer', x=60,96, y=60,00, z=293,67], EntitySquid['Squid'/126, l='MpServer', x=66,50, y=59,34, z=289,96], EntitySquid['Squid'/125, l='MpServer', x=68,03, y=59,40, z=287,77], EntitySquid['Squid'/124, l='MpServer', x=68,66, y=59,04, z=285,51], EntityBat['Bat'/123, l='MpServer', x=69,30, y=31,78, z=277,64], EntityBat['Bat'/122, l='MpServer', x=68,98, y=42,74, z=261,14], EntityBat['Bat'/121, l='MpServer', x=67,88, y=33,10, z=239,38], EntityCreeper['Creeper'/120, l='MpServer', x=65,97, y=41,00, z=219,63], EntitySkeleton['Skeleton'/152, l='MpServer', x=87,50, y=37,00, z=218,50], EntityCreeper['Creeper'/153, l='MpServer', x=89,50, y=26,00, z=235,50], EntityZombie['Zombie'/154, l='MpServer', x=80,50, y=28,00, z=235,50], EntityZombie['Zombie'/155, l='MpServer', x=81,50, y=37,00, z=228,50], EntityZombie['Zombie'/156, l='MpServer', x=80,50, y=35,00, z=234,84], EntityBat['Bat'/157, l='MpServer', x=90,70, y=23,79, z=248,78], EntityZombie['Zombie'/158, l='MpServer', x=80,97, y=42,00, z=241,50], EntitySpider['Spider'/159, l='MpServer', x=85,19, y=41,00, z=243,88], EntityPig['Pig'/145, l='MpServer', x=94,66, y=69,00, z=180,91], EntityPig['Pig'/146, l='MpServer', x=93,69, y=69,00, z=179,41], EntityPig['Pig'/147, l='MpServer', x=93,50, y=70,00, z=184,13], EntitySkeleton['Skeleton'/148, l='MpServer', x=97,46, y=16,79, z=191,98], EntityItem['item.item.doorWood'/149, l='MpServer', x=94,13, y=65,13, z=202,88], EntityItem['item.item.doorWood'/150, l='MpServer', x=95,38, y=65,13, z=201,31], EntityItem['item.item.doorWood'/151, l='MpServer', x=94,66, y=65,13, z=201,91], EntitySkeleton['Skeleton'/171, l='MpServer', x=90,50, y=14,00, z=328,53], EntityCreeper['Creeper'/170, l='MpServer', x=93,59, y=16,00, z=319,25], EntityCreeper['Creeper'/169, l='MpServer', x=83,16, y=65,00, z=294,88], EntityBat['Bat'/168, l='MpServer', x=82,34, y=24,62, z=272,40], EntityZombie['Zombie'/163, l='MpServer', x=88,22, y=49,00, z=272,00], EntityZombie['Zombie'/162, l='MpServer', x=88,69, y=49,00, z=271,06], EntityBat['Bat'/161, l='MpServer', x=94,75, y=25,00, z=261,75], EntityBat['Bat'/160, l='MpServer', x=87,79, y=29,32, z=265,89], EntityBat['Bat'/167, l='MpServer', x=87,64, y=17,53, z=279,72], EntityItem['item.item.doorWood'/166, l='MpServer', x=83,22, y=65,13, z=266,13], EntityItem['item.item.doorWood'/165, l='MpServer', x=84,31, y=65,13, z=266,19], EntityItem['item.item.doorWood'/164, l='MpServer', x=84,34, y=65,13, z=267,53], EntityPig['Pig'/186, l='MpServer', x=98,81, y=66,00, z=193,81], EntitySheep['Sheep'/187, l='MpServer', x=106,97, y=68,00, z=228,03], EntityPig['Pig'/184, l='MpServer', x=106,63, y=65,00, z=196,88], EntityPig['Pig'/185, l='MpServer', x=106,09, y=64,00, z=194,47], EntityPig['Pig'/190, l='MpServer', x=101,28, y=71,00, z=317,22], EntitySkeleton['Skeleton'/191, l='MpServer', x=98,47, y=16,00, z=320,66], EntityBat['Bat'/188, l='MpServer', x=98,69, y=49,10, z=257,44], EntityPig['Pig'/189, l='MpServer', x=105,50, y=76,00, z=318,50], EntityPig['Pig'/182, l='MpServer', x=106,50, y=69,00, z=184,47], EntityClientPlayerMP['Player439'/420, l='MpServer', x=110,05, y=72,28, z=252,15], EntityPig['Pig'/183, l='MpServer', x=100,81, y=70,00, z=183,84], EntityZombie['Zombie'/181, l='MpServer', x=99,53, y=17,00, z=176,91], EntityCreeper['Creeper'/193, l='MpServer', x=99,41, y=16,00, z=322,59], EntityCreeper['Creeper'/192, l='MpServer', x=99,41, y=16,00, z=320,00], EntityPig['Pig'/195, l='MpServer', x=111,38, y=71,00, z=332,50], EntityPig['Pig'/194, l='MpServer', x=104,50, y=71,00, z=321,69], EntityItem['item.tile.gravel'/220, l='MpServer', x=124,13, y=40,13, z=275,19], EntityItem['item.tile.gravel'/221, l='MpServer', x=124,88, y=40,13, z=275,53], EntitySkeleton['Skeleton'/216, l='MpServer', x=122,50, y=41,00, z=259,50], EntitySkeleton['Skeleton'/217, l='MpServer', x=121,50, y=41,00, z=265,50], EntitySkeleton['Skeleton'/218, l='MpServer', x=121,64, y=41,00, z=257,09], EntitySkeleton['Skeleton'/219, l='MpServer', x=123,08, y=41,00, z=257,90], EntitySkeleton['Skeleton'/212, l='MpServer', x=120,30, y=45,17, z=231,30], EntityZombie['Zombie'/213, l='MpServer', x=119,50, y=46,00, z=231,25], EntitySheep['Sheep'/214, l='MpServer', x=113,13, y=70,00, z=230,06], EntitySheep['Sheep'/215, l='MpServer', x=118,94, y=69,00, z=225,03], EntitySheep['Sheep'/210, l='MpServer', x=114,53, y=68,00, z=218,56], EntityCreeper['Creeper'/211, l='MpServer', x=118,00, y=45,00, z=231,47], EntityZombie['Zombie'/239, l='MpServer', x=143,69, y=36,00, z=263,63], EntityCreeper['Creeper'/238, l='MpServer', x=129,31, y=47,00, z=241,31], EntityCreeper['Creeper'/237, l='MpServer', x=131,06, y=50,00, z=235,59], EntityCreeper['Creeper'/236, l='MpServer', x=132,56, y=4
8,88, z=235,42], EntityItem['item.tile.mushroom'/244, l='MpServer', x=141,88, y=11,13, z=276,13], EntitySkeleton['Skeleton'/245, l='MpServer', x=136,31, y=31,00, z=272,22], EntityPig['Pig'/242, l='MpServer', x=130,50, y=69,00, z=257,28], EntityPig['Pig'/243, l='MpServer', x=139,50, y=80,00, z=263,50], EntityPig['Pig'/240, l='MpServer', x=129,19, y=69,00, z=261,63], EntityPig['Pig'/241, l='MpServer', x=134,09, y=71,00, z=266,66]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:417)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2568)
at net.minecraft.client.Minecraft.run(Minecraft.java:990)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
-- System Details --
Details:
Minecraft Version: 1.7.10
Operating System: Windows 7 (amd64) version 6.1
Java Version: 1.7.0_67, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 453457816 bytes (432 MB) / 579862528 bytes (553 MB) up to 1905262592 bytes (1817 MB)
JVM Flags: 0 total;
AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
IntCache: cache: 0, tcache: 0, allocated: 13, tallocated: 95
FML: MCP v9.05 FML v7.10.25.1208 Minecraft Forge 10.13.0.1208 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.1208} [Forge Mod Loader] (forgeSrc-1.7.10-10.13.0.1208.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Forge{10.13.0.1208} [Minecraft Forge] (forgeSrc-1.7.10-10.13.0.1208.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
tsm{1.0} [Test Mod] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
Launched Version: 1.6
LWJGL: 2.9.1
OpenGL: GeForce GT 330M/PCIe/SSE2 GL version 3.3.0, NVIDIA Corporation
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)
And my Code:
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ItemStructureHouseSpawn extends Item {
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int posX, int posY, int posZ, int side, float hitX, float hitY, float hitZ)
{
int i = posX;
int j = posZ;
int k = posY;
new StructureHouse().generate(world, null, i, k, j);
return true;
}
public ItemStructureHouseSpawn() {
this.setFull3D();
this.setMaxStackSize(1);
this.setMaxDamage(1);}
}
My guess is, I think you'd need to instantiate your class before actually generating (notice the extra parentheses):
And if I have to nitpick, the variables are the wrong order x,y,z should be i,j,k (or just remove the assignment completely, it's not needed):