The Meaning of Life, the Universe, and Everything.
Join Date:
1/2/2012
Posts:
55
Member Details
I've never posted a topic before, so I apologize for any inconveniences in advance.
I am having a few problems with code, (I'm pretty new at this,)
and I was wondering if anyone new how to do a few things I really wanna know.
Q1. How do you make a block that halves fall damage?
Q2. How do you make a block that you can move through?
Q3. How do you make an item replace itself with another item? Is it possible?
Q4. How do you add a random decider? I.e. Randomly picks 1-2, or generates a random number between 1 and 10. Q5. Is it possible to link Q3-Q4? how?
Thanks for your time,
Yoshi-Tamer.
(The censor 'll think I'm swearing without the -.)
I forgot to mention I'm using forge. Is this code forge compatible?
(Having problems)
It is just Minecraft code. What is the error?
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
The Meaning of Life, the Universe, and Everything.
Join Date:
1/2/2012
Posts:
55
Member Details
using Eclipse, the code comes up withe the following errors: (The notes will be next to the code with the error.)
AxisAlignedBB getCollisionBoundingBoxFromPool(<-- smicolon ExpectedWorld par1World <-- Duplacate local Var par1World, Par2, and par3, int par2, int par3, int i ) <-- semicolon expected insted of )
{
return null; <-- Void methods cannot return a value
}
And when I test it:
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; Unexpected error
A full error report has been saved to C:\Users\Skyler's\Desktop\Skyler's antics\Minecraft related\MCP\jars\.\crash-reports\crash-2013-02-10_10.09.39-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash
--- BEGIN ERROR REPORT 9d934c7f --------
Full report at:
C:\Users\Skyler's\Desktop\Skyler's antics\Minecraft related\MCP\jars\.\crash-reports\crash-2013-02-10_10.09.39-client.txt
Please show that file to Mojang, NOT just this screen!
Generated 2/10/13 10:09 AM
-- Head --
Stacktrace:
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot™ Client VM (mixed mode), Oracle Corporation
Memory: 866470808 bytes (826 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 21640 (1211840 bytes; 1 MB) allocated, 261 (14616 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Elements [Terracross] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
LWJGL: 2.4.2
OpenGL: Intel 965/963 Graphics Media Accelerator GL version 2.0.0 - Build 8.14.10.1930, Intel
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: 60 (3360 bytes; 0 MB) allocated, 60 (3360 bytes; 0 MB) used
java.lang.Error: Unresolved compilation problems:
Syntax error on token "(", ; expected
Duplicate local variable par1World
Syntax error on token ",", ; expected
Duplicate local variable par2
Syntax error on token ",", ; expected
Duplicate local variable par3
Syntax error on token ",", ; expected
Syntax error on token ")", ; expected
Void methods cannot return a value
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1896)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:846)
at net.minecraft.client.Minecraft.run(Minecraft.java:771)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 3cdfe2fa ----------
Blockstraw is the block I using this code with.
And, The Actual FILE.
---- Minecraft Crash Report ----
// Ooh. Shiny.
Time: 2/10/13 10:09 AM
Description: Unexpected error
java.lang.Error: Unresolved compilation problems:
Syntax error on token "(", ; expected
Duplicate local variable par1World
Syntax error on token ",", ; expected
Duplicate local variable par2
Syntax error on token ",", ; expected
Duplicate local variable par3
Syntax error on token ",", ; expected
Syntax error on token ")", ; expected
Void methods cannot return a value
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1896)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:846)
at net.minecraft.client.Minecraft.run(Minecraft.java:771)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
Check that all your brackets are closed. Especially { and }. If you can't find it, post your code.
Rollback Post to RevisionRollBack
“Computers are incredibly fast, accurate and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination."
Q1. How do you make a block that halves fall damage?
Not sure if forge or something has a hook for that, I believe fall damage used to be handled in the player class based on your velocity when you fall so "halving" it would involve either some kind of hack to halve your velocity before collision or to make the actual damage method do half damage on collision with a particular block. A little searching would probably give better insight.
Post your actual block code, it's pretty obvious you formatted it wrong.
Not sure if forge or something has a hook for that, I believe fall damage used to be handled in the player class based on your velocity when you fall so "halving" it would involve either some kind of hack to halve your velocity before collision or to make the actual damage method do half damage on collision with a particular block. A little searching would probably give better insight.
I think we went over returning no bounding box for it.
When? When you use it? When it breaks? You're being vague, and the answer is probably yes.
Import and use random like Minecraft does a billion times?
[/size][size=medium]Use rand.. whenever it happens.[/size]
I am know you don't need to 'hack' the Player class to either remove fall damage, half it or w/e. I might be wrong but TickHandlers might help.
As with any other object, just initiate it. It's good it check out the Javadocs if you don't know much about an object, like Random. http://docs.oracle.com/javase/7/docs/api/java/util/Random.html
Look at the constructors. Unless you want to specify a seed, the constructor takes no arguments.
The Meaning of Life, the Universe, and Everything.
Join Date:
1/2/2012
Posts:
55
Member Details
Still having a bit of trouble with initiating a random. I feel I'm close, but just need that extra push.
I'm trying to peice together how to randomly decide a number between 0 and 2. I also want to call on the random, by right clicking an item, to do somthing depending on the number. The number would re-generate every time I right click.
For the number, I have this:
int bagNum = generator.nextInt(2);
Is generator in place of types of generators I can use?
Also, how do I add sub-text? I have:
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List)
{
par3List.add("Basic");
}
And, as for Self-Replacing items, I mean:
Right-click With a certain Item, and It changes into another.
(As if the ID was changed in-game.)
I am having a few problems with code, (I'm pretty new at this,)
and I was wondering if anyone new how to do a few things I really wanna know.
Q1. How do you make a block that halves fall damage?
Q2. How do you make a block that you can move through?
Q3. How do you make an item replace itself with another item? Is it possible?
Q4. How do you add a random decider?
I.e. Randomly picks 1-2, or generates a random number between 1 and 10.
Q5. Is it possible to link Q3-Q4? how?
Thanks for your time,
Yoshi-Tamer.
(The censor 'll think I'm swearing without the -.)
Q2: Add this to your blocks class. It pretty much removes the collision box.
Farewell everyone o/
(Having problems)
It is just Minecraft code. What is the error?
together they are powerful beyond imagination."
As TG said above this is generic minecraft code. What error are you getting?
Farewell everyone o/
AxisAlignedBB getCollisionBoundingBoxFromPool(<-- smicolon ExpectedWorld par1World <-- Duplacate local Var par1World, Par2, and par3, int par2, int par3, int i ) <-- semicolon expected insted of )
{
return null; <-- Void methods cannot return a value
}
And when I test it:
Minecraft has crashed!
----------------------
Minecraft has stopped running because it encountered a problem; Unexpected error
A full error report has been saved to C:\Users\Skyler's\Desktop\Skyler's antics\Minecraft related\MCP\jars\.\crash-reports\crash-2013-02-10_10.09.39-client.txt - Please include a copy of that file (Not this screen!) if you report this crash to anyone; without it, they will not be able to help fix the crash
--- BEGIN ERROR REPORT 9d934c7f --------
Full report at:
C:\Users\Skyler's\Desktop\Skyler's antics\Minecraft related\MCP\jars\.\crash-reports\crash-2013-02-10_10.09.39-client.txt
Please show that file to Mojang, NOT just this screen!
Generated 2/10/13 10:09 AM
-- Head --
Stacktrace:
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player93'/25, l='MpServer', x=1104.55, y=57.72, z=-108.72]]
Chunk stats: MultiplayerChunkCache: 240
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (1105,4,-108), Chunk: (at 1,0,4 in 69,-7; contains blocks 1104,0,-112 to 1119,255,-97), Region: (2,-1; contains chunks 64,-32 to 95,-1, blocks 1024,0,-512 to 1535,255,-1)
Level time: 209699 game time, 184475 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: 17 total; [EntityItemFrame['entity.ItemFrame.name'/0, l='MpServer', x=1100.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/1, l='MpServer', x=1102.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/2, l='MpServer', x=1103.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/3, l='MpServer', x=1101.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/5, l='MpServer', x=1104.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/6, l='MpServer', x=1105.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/7, l='MpServer', x=1106.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/8, l='MpServer', x=1107.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/9, l='MpServer', x=1108.50, y=55.50, z=-104.06], EntityPig['Pig'/10, l='MpServer', x=1128.13, y=54.00, z=-84.16], EntityPig['Pig'/11, l='MpServer', x=1131.77, y=54.00, z=-40.58], EntityPig['Pig'/12, l='MpServer', x=1121.22, y=54.00, z=-29.16], EntityPig['Pig'/13, l='MpServer', x=1143.21, y=54.00, z=-95.71], EntityPig['Pig'/14, l='MpServer', x=1151.78, y=54.00, z=-33.38], EntityChicken['Chicken'/17, l='MpServer', x=1159.56, y=54.00, z=-78.34], EntityPig['Pig'/16, l='MpServer', x=1159.09, y=54.00, z=-97.75], EntityClientPlayerMP['Player93'/25, l='MpServer', x=1104.55, y=57.72, z=-108.72]]
Retry entities: 0 total; []
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2401)
at net.minecraft.client.Minecraft.run(Minecraft.java:794)
at java.lang.Thread.run(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot™ Client VM (mixed mode), Oracle Corporation
Memory: 866470808 bytes (826 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 21640 (1211840 bytes; 1 MB) allocated, 261 (14616 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Elements [Terracross] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
LWJGL: 2.4.2
OpenGL: Intel 965/963 Graphics Media Accelerator GL version 2.0.0 - Build 8.14.10.1930, Intel
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: 60 (3360 bytes; 0 MB) allocated, 60 (3360 bytes; 0 MB) used
java.lang.Error: Unresolved compilation problems:
Syntax error on token "(", ; expected
Duplicate local variable par1World
Syntax error on token ",", ; expected
Duplicate local variable par2
Syntax error on token ",", ; expected
Duplicate local variable par3
Syntax error on token ",", ; expected
Syntax error on token ")", ; expected
Void methods cannot return a value
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1896)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:846)
at net.minecraft.client.Minecraft.run(Minecraft.java:771)
at java.lang.Thread.run(Unknown Source)
--- END ERROR REPORT 3cdfe2fa ----------
Blockstraw is the block I using this code with.
And, The Actual FILE.
---- Minecraft Crash Report ----
// Ooh. Shiny.
Time: 2/10/13 10:09 AM
Description: Unexpected error
java.lang.Error: Unresolved compilation problems:
Syntax error on token "(", ; expected
Duplicate local variable par1World
Syntax error on token ",", ; expected
Duplicate local variable par2
Syntax error on token ",", ; expected
Duplicate local variable par3
Syntax error on token ",", ; expected
Syntax error on token ")", ; expected
Void methods cannot return a value
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
at net.minecraft.client.Minecraft.runTick(Minecraft.java:1896)
at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:846)
at net.minecraft.client.Minecraft.run(Minecraft.java:771)
at java.lang.Thread.run(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at DNDMmod.BlockStraw.randomDisplayTick(BlockStraw.java:37)
at net.minecraft.client.multiplayer.WorldClient.func_73029_E(WorldClient.java:369)
-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityClientPlayerMP['Player93'/25, l='MpServer', x=1104.55, y=57.72, z=-108.72]]
Chunk stats: MultiplayerChunkCache: 240
Level seed: 0
Level generator: ID 01 - flat, ver 0. Features enabled: false
Level generator options:
Level spawn location: World: (1105,4,-108), Chunk: (at 1,0,4 in 69,-7; contains blocks 1104,0,-112 to 1119,255,-97), Region: (2,-1; contains chunks 64,-32 to 95,-1, blocks 1024,0,-512 to 1535,255,-1)
Level time: 209699 game time, 184475 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: 17 total; [EntityItemFrame['entity.ItemFrame.name'/0, l='MpServer', x=1100.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/1, l='MpServer', x=1102.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/2, l='MpServer', x=1103.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/3, l='MpServer', x=1101.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/5, l='MpServer', x=1104.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/6, l='MpServer', x=1105.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/7, l='MpServer', x=1106.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/8, l='MpServer', x=1107.50, y=55.50, z=-104.06], EntityItemFrame['entity.ItemFrame.name'/9, l='MpServer', x=1108.50, y=55.50, z=-104.06], EntityPig['Pig'/10, l='MpServer', x=1128.13, y=54.00, z=-84.16], EntityPig['Pig'/11, l='MpServer', x=1131.77, y=54.00, z=-40.58], EntityPig['Pig'/12, l='MpServer', x=1121.22, y=54.00, z=-29.16], EntityPig['Pig'/13, l='MpServer', x=1143.21, y=54.00, z=-95.71], EntityPig['Pig'/14, l='MpServer', x=1151.78, y=54.00, z=-33.38], EntityChicken['Chicken'/17, l='MpServer', x=1159.56, y=54.00, z=-78.34], EntityPig['Pig'/16, l='MpServer', x=1159.09, y=54.00, z=-97.75], EntityClientPlayerMP['Player93'/25, l='MpServer', x=1104.55, y=57.72, z=-108.72]]
Retry entities: 0 total; []
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:440)
at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2401)
at net.minecraft.client.Minecraft.run(Minecraft.java:794)
at java.lang.Thread.run(Unknown Source)
-- System Details --
Details:
Minecraft Version: 1.4.7
Operating System: Windows 7 (x86) version 6.1
Java Version: 1.7.0_09, Oracle Corporation
Java VM Version: Java HotSpot(TM) Client VM (mixed mode), Oracle Corporation
Memory: 866470808 bytes (826 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)
JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
AABB Pool Size: 21640 (1211840 bytes; 1 MB) allocated, 261 (14616 bytes; 0 MB) used
Suspicious classes: FML and Forge are installed
IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
FML: MCP v7.26 FML v4.7.4.520 Minecraft Forge 6.6.0.497 4 mods loaded, 4 mods active
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
Elements [Terracross] (bin) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available
LWJGL: 2.4.2
OpenGL: Intel 965/963 Graphics Media Accelerator GL version 2.0.0 - Build 8.14.10.1930, Intel
Is Modded: Definitely; Client brand changed to 'forge,fml'
Type: Client (map_client.txt)
Texture Pack: Default
Profiler Position: N/A (disabled)
Vec3 Pool Size: 60 (3360 bytes; 0 MB) allocated, 60 (3360 bytes; 0 MB) used
I don't know if I've said it yet, but thanks for helping.
together they are powerful beyond imagination."
Not sure if forge or something has a hook for that, I believe fall damage used to be handled in the player class based on your velocity when you fall so "halving" it would involve either some kind of hack to halve your velocity before collision or to make the actual damage method do half damage on collision with a particular block. A little searching would probably give better insight.
I think we went over returning no bounding box for it.
When? When you use it? When it breaks? You're being vague, and the answer is probably yes.
Import and use random like Minecraft does a billion times?
Use rand.. whenever it happens.
I am know you don't need to 'hack' the Player class to either remove fall damage, half it or w/e. I might be wrong but TickHandlers might help.
Also, as the newcomer/idiot I am, I am clueless about using the "Random" Java util.
Help?
Then declare a new Random like any other object
Importing is fine and simple, but the part I need help with, is declaring a random.
http://docs.oracle.com/javase/7/docs/api/java/util/Random.html
Look at the constructors. Unless you want to specify a seed, the constructor takes no arguments.
I'm trying to peice together how to randomly decide a number between 0 and 2. I also want to call on the random, by right clicking an item, to do somthing depending on the number. The number would re-generate every time I right click.
For the number, I have this:
Is generator in place of types of generators I can use?
Also, how do I add sub-text? I have:
And, as for Self-Replacing items, I mean:
Right-click With a certain Item, and It changes into another.
(As if the ID was changed in-game.)