I learnt Java from TheNewBoston's tutorials, and I've learnt modding gradually through other tutorials, by looking at the code of ModLoader and Minecraft Forge and through experimentation
I followed your block metadata tutorial and it worked perfectly. Is it possible to have different resistance/hardness for each damage value, or do I have to use a tile entity or something complicated?
Rollback Post to RevisionRollBack
PLEASE! Learn to use spoiler tags, especially when posting crash reports: [spoiler]YOUR TEXT HERE[ /spoiler]
I followed your block metadata tutorial and it worked perfectly. Is it possible to have different resistance/hardness for each damage value, or do I have to use a tile entity or something complicated?
I'm fairly sure you can, but I don't think it's easy
Is the 8th tutorial ever going to come out or is this thread "dead", You claimed this tutorial was coming out "tomorrow" 2 weeks, ago.
Yeah, sorry about that. I was working on the ore generation tutorial, but it wouldn't work :/ I'll try to figure out how to do it another way, but for now I'll make a different tutorial, probably food
I'm fairly sure you can, but I don't think it's easy
Yeah, sorry about that. I was working on the ore generation tutorial, but it wouldn't work :/ I'll try to figure out how to do it another way, but for now I'll make a different tutorial, probably food
Actually, at the moment, I'm struggling to find time to make tutorials, instead you can ask questions in the comments and I'll write quick tutorials for the questions, it should work
I don't really know how to make it's block model change like cake, but you can do something similar with textures and metadata. Then you need to add this:
public boolean onBlockActivated(World world, int xPos, int yPos, int zPos, EntityPlayer player, int par6, float par7,
float par8, float par9){
if(!player.isSneaking()){ //This is for debugging purposes
if(player.canEat(false)){ //Checks if player hunger is full
player.getFoodStats().addStats(5, 1F); //First number is the hunger to be filled, 2.5, second is how long it lasts
world.setBlockAndMetadataWithNotify(xPos, yPos, zPos, blockID, world.getBlockMetadata(xPos, yPos, zPos)+1); //Increases metadata
if(world.getBlockMetadata(xPos, yPos, zPos)>3){ //Is metadata too high?
world.setBlockWithNotify(xPos, yPos, zPos, 0); //Set block to air
}
}
} else{ //If player is sneaking
player.getFoodStats().addStats(-4,0); //Remove hunger points
if(world.getBlockMetadata(xPos, yPos, zPos)>0){ //Stops major problems by keeping metadata above 0
world.setBlockAndMetadataWithNotify(xPos, yPos, zPos, blockID, world.getBlockMetadata(xPos, yPos, zPos)-1);
}
}
return true; //Stops you from placing blocks on it when right clicking
}
This is a very basic implementation, and it can definitely be improved upon
I have a problem with item textures. I have 5 items, and the 1st and 2nd item textures work, but for 3rd, 4th and 5th don't. Here is the code for 3rd item:
package HellOres.Common;
import net.minecraft.src.CreativeTabs;
import net.minecraft.src.Item;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
public class MercuryRings extends Item{
public MercuryRings(int par1){
super(par1);
maxStackSize = 64;
this.setTabToDisplayOn(CreativeTabs.tabMaterials);
}
@SideOnly(Side.CLIENT)
public String getTextureFile(){
return "/ModItems.png";
}
@SideOnly(Side.CLIENT)
public int getIconFromDamage(){
return 2;
}
}
In 4th and 5th item in the getIconFromDamage() method i have return 3; and return 4;.
You have great tutorials, they really helped me. Keep up the good work!
I'm not sure what the problem is, if you are putting the texture folder into the .jar, check that it is your most recent texture, if it is the most recent, but you are still having problems, send me a PM
I really liked the redstone interactions tutorial, though i'm confused on some parts XD. Can't wait for the next tutorial and glad you decided to continue!
I really liked the redstone interactions tutorial, though i'm confused on some parts XD. Can't wait for the next tutorial and glad you decided to continue!
I used exactly the same code you used for your metadata block tutorial. The blocks have the right textures in your inventory but when placed they all have the same (the first) texture.
Do you have setHasSubtypes in the block and the ItemBlock?
cpw.mods.fml.common.LoaderException: java.lang.NullPointerException at cpw.mods.fml.common.LoadController.transition(LoadController.java:106) at cpw.mods.fml.common.Loader.loadMods(Loader.java:421) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:192) at net.minecraft.client.Minecraft.startGame(Minecraft.java:402) at net.minecraft.client.Minecraft.run(Minecraft.java:734) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.NullPointerException at minecraftwero.common.BaconMod.<init>(BaconMod.java:108) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:284) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85) at cpw.mods.fml.common.Loader.loadMods(Loader.java:420) ... 4 more
i dont know what happened in here eclipse doesnt give me any errors
cpw.mods.fml.common.LoaderException: java.lang.NullPointerException at cpw.mods.fml.common.LoadController.transition(LoadController.java:106) at cpw.mods.fml.common.Loader.loadMods(Loader.java:421) at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:192) at net.minecraft.client.Minecraft.startGame(Minecraft.java:402) at net.minecraft.client.Minecraft.run(Minecraft.java:734) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.NullPointerException at minecraftwero.common.BaconMod.<init>(BaconMod.java:108) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:284) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69) at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300) at com.google.common.eventbus.EventBus.post(EventBus.java:268) at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85) at cpw.mods.fml.common.Loader.loadMods(Loader.java:420) ... 4 more
i dont know what happened in here eclipse doesnt give me any errors
Forge itself isn't terribly informative, but there is something about line 108 in your mod class, check there to start with
I'll work on it, I've done crops before, and cake like blocks should be easy enough
I'll work on them eventually, but I'm not too familiar with custom block renders
I learnt Java from TheNewBoston's tutorials, and I've learnt modding gradually through other tutorials, by looking at the code of ModLoader and Minecraft Forge and through experimentation
PLEASE! Learn to use spoiler tags, especially when posting crash reports: [spoiler]YOUR TEXT HERE[ /spoiler]
I'm fairly sure you can, but I don't think it's easy
Yeah, sorry about that. I was working on the ore generation tutorial, but it wouldn't work :/ I'll try to figure out how to do it another way, but for now I'll make a different tutorial, probably food
Actually, at the moment, I'm struggling to find time to make tutorials, instead you can ask questions in the comments and I'll write quick tutorials for the questions, it should work
I've already done that tutorial, tutorial 7
I don't really know how to make it's block model change like cake, but you can do something similar with textures and metadata. Then you need to add this:
This is a very basic implementation, and it can definitely be improved upon
I'm not sure what would cause that, try downloading the source and checking it out
I'm not sure what the problem is, if you are putting the texture folder into the .jar, check that it is your most recent texture, if it is the most recent, but you are still having problems, send me a PM
Glad you liked it
I'm actually preparing a tile entity tutorial, but I suppose I can do the crop one next, seeing as I was planning to do a food tutorial soon anyway
Do you have setHasSubtypes in the block and the ItemBlock?
Nvm, it's just in the ItemBlock, sorry...
cpw.mods.fml.common.LoaderException: java.lang.NullPointerException
at cpw.mods.fml.common.LoadController.transition(LoadController.java:106)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:421)
at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:192)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:402)
at net.minecraft.client.Minecraft.run(Minecraft.java:734)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.NullPointerException
at minecraftwero.common.BaconMod.<init>(BaconMod.java:108)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at cpw.mods.fml.common.FMLModContainer.constructMod(FMLModContainer.java:284)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:69)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:317)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:300)
at com.google.common.eventbus.EventBus.post(EventBus.java:268)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:85)
at cpw.mods.fml.common.Loader.loadMods(Loader.java:420)
... 4 more
Forge itself isn't terribly informative, but there is something about line 108 in your mod class, check there to start with