package orangelight.meatplus.common;
import orangelight.meatplus.client.ClientProxyMeatplus;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "orangelight_meatplus", name = "meatplus", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Meatplus {
@SidedProxy(clientSide = "orangelight.meatplus.client.ClientProxyMeatplus",
serverSide = "orangelight.meatplus.common.CommonProxyMeatplus")
public static CommonProxyMeatplus proxy;
public static Block saltOre;
int saltOreID = 201;
@Init
public void load(FMLInitializationEvent event){
saltOre = new BlockSaltOre(saltOreID, 0, Material.iron).setBlockName("Salt Ore");
gameRegisters();
languageRegisters();
}
@PreInit
public void preLoad(FMLPreInitializationEvent event) {
proxy.registerRenders();
}
public void gameRegisters()
{
GameRegistry.registerBlock(saltOre, "Salt Ore");
}
public void languageRegisters()
{
LanguageRegistry.addName(saltOre, "Salt Ore");
}
}
Then either you got the texture location wrong or the preLoad method needs to be in front of the load method. (Did you edit the wrong spelled method inside your block class? public String getTextureFile()?)
Could you possibly do a forge liquids tutorial soon, it'll be much appreciated
I should be able to make this, so I might do it soon. But I haven't done it before so I don't know how the textures work yet. (I still know how to make a liquid)
yay ill be watching out for your liquids though i am manly worried about crafting recipes :/
I will come to those as well, don't worry it's quite easy. At least I think my method of it is quite easy, though it's quite different from what many else are using (that's how it seems at least).
is there any why you are suppose to put your .png in eclipse i have been working on this for and nothing works
I have never put my .png inside eclipse a single time, because I put it where I found out it works. MCP/jars/bin/minecraft/Tutorial/Blocks.png is the location outside of the code, at least what I'm using in the tutorial.
I also saw that your picture in eclipse had capital M in Meatplus, but in your block class there is written meatplus. You have to be accurate with the capitals.
or the preLoad method needs to be in front of the load method.
That makes no different in Java as the compiler works it out for you.
The Oracle convention tutorial says this: "These methods should be grouped by functionality rather than by scope or accessibility. For example, a private class method can be in between two public instance methods. The goal is to make reading and understanding the code easier."
I also saw that your picture in eclipse had capital M in Meatplus, but in your block class there is written meatplus. You have to be accurate with the capitals.
A good convention is to use short lowercase names both as the name of the file and when referencing the file in code. If you do not mind case sensitivity infringe on the cross-platform compatability offered by Java.
The Windows filesystem is not cAsE sEnSiTiVe while the one present in UNIX-based platforms such as Linux and Mac OS X is.
Rollback Post to RevisionRollBack
- Quote my post if you want to make sure I read it -
Any Item is as you can see put at index id + 256 when placed in the itemsList array.
That makes no different in Java as the compiler works it out for you.
The Oracle convention tutorial says this: "These methods should be grouped by functionality rather than by scope or accessibility. For example, a private class method can be in between two public instance methods. The goal is to make reading and understanding the code easier."
A good convention is to use short lowercase names both as the name of the file and when referencing the file in code. If you do not mind case sensitivity infringe on the cross-platform compatability offered by Java.
The Windows filesystem is not cAsE sEnSiTiVe while the one present in UNIX-based platforms such as Linux and Mac OS X is.
Metoden public String getTextureFile() ser ut til å se etter både små og store bokstaver. Jeg testet dette både med og uten stor bokstav og ente opp med forskjellige resultater hver gang. Med liten bokstav fikk jeg aldri noen texture mens med Stor bokstav gikk det som det skulle.
Når det gjelder det andre ser du ut til å ha helt rett og jeg beklager å ha tatt feil på disse punktene.
Metoden public String getTextureFile() ser ut til å se etter både små og store bokstaver. Jeg testet dette både med og uten stor bokstav og ente opp med forskjellige resultater hver gang. Med liten bokstav fikk jeg aldri noen texture mens med Stor bokstav gikk det som det skulle.
Når det gjelder det andre ser du ut til å ha helt rett og jeg beklager å ha tatt feil på disse punktene.
On which platform did you test that? I am curious to know whether I should be looking for something more texture specific next time :3
Rollback Post to RevisionRollBack
- Quote my post if you want to make sure I read it -
What exactly to i change to only generate a ore in the nether
For this you will need a new generation class than WorldGenMinable that makes it spawn in netherrack instead of stone. I might make a tutorial on that later.
I am running at windows, never had any other types.
That explains why different namings work for you. The filesystem on Windows is not cAsE seNsItIve, if you do not have matching names on UNIX-based platforms such as Linux and MacOS X it will not find the requested file.
Rollback Post to RevisionRollBack
- Quote my post if you want to make sure I read it -
how would you make a block drop a different item then itself?
I will put out a tutorial about that, but for now you have to add this to your block class:
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID == yourMainClass.yourBlock.blockID ? yourMainClass.yourItem.shiftedIndex : this.blockID;
}
Actually I'm not sure about the shiftedIndex part since someone says it is ItemId now. If shiftedIndex give you an error just change it to ItemId.
I will put out a tutorial about that, but for now you have to add this to your block class:
public int idDropped(int par1, Random par2Random, int par3) {
return this.blockID == yourMainClass.yourBlock.blockID ? yourMainClass.yourItem.shiftedIndex : this.blockID;
}
Actually I'm not sure about the shiftedIndex part since someone says it is ItemId now. If shiftedIndex give you an error just change it to ItemId.
To clarify I downloaded the latest mcp patch and found that the code I previously posted on this topic is now:
Great im getting more errors when i add an smelting recipe. i put every thing in the same package
Code
package orangelight.meatplus.common;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "orangelight_meatplus", name = "meatplus", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Meatplus {
@SidedProxy(clientSide = "orangelight.meatplus.client.ClientProxyMeatplus",
serverSide = "orangelight.meatplus.common.CommonProxyMeatplus")
public static CommonProxyMeatplus proxy;
public static Block saltOre;
int saltOreID = 201;
int lardItemID = 5000;
int saltItemID = 5001;
int rawsquidmeatItemID = 5002;
int squidmeatcookedItemID = 5003;
public static Item lardItem;
public static Item saltItem;
public static Item rawsquidmeatItem;
public static Item squidmeatcookedItem;
@PreInit
public void preLoad(FMLPreInitializationEvent event) {
proxy.registerRenderThings();
}
@Init
public void load(FMLInitializationEvent event){
saltOre = new BlockSaltOre(saltOreID, 0, Material.iron).setBlockName("Salt Ore");
lardItem = new ItemLard(5000).setItemName("lardItem").setIconIndex(0);
saltItem = new ItemSalt(5001).setItemName("saltItem").setIconIndex(7);
rawsquidmeatItem = new ItemRawSquidMeat(5002).setItemName("rawsquidmeatItem").setIconIndex(1);
squidmeatcookedItem = new ItemSquidMeatCooked(5003).setItemName("squidmeatcookedItem").setIconIndex(2);
GameRegistry.registerWorldGenerator(new WorldGeneratorOrangelight());
gameRegisters();
languageRegisters();
GameRegistry.addSmelting(rawsquidmeatItemID, new ItemStack(squidmeatcookedItem, 1), 0.3F);
}
public void gameRegisters()
{
GameRegistry.registerBlock(saltOre, "Salt Ore");
GameRegistry.registerBlock(saltOre, "Salt Ore");
GameRegistry.registerItem(lardItem, "Lard");
GameRegistry.registerItem(rawsquidmeatItem, "Raw Squid");
GameRegistry.registerItem(squidmeatcookedItem, "Cooked Squid");
GameRegistry.registerItem(saltItem, "Salt");
}
public void languageRegisters()
{
LanguageRegistry.addName(lardItem, "Lard");
LanguageRegistry.addName(saltOre, "Salt Ore");
LanguageRegistry.addName(rawsquidmeatItem, "Raw Squid");
LanguageRegistry.addName(squidmeatcookedItem, "Cooked Squid");
LanguageRegistry.addName(saltItem, "Salt");
}
}
package orangelight.meatplus.common;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxyMeatplus extends CommonProxyMeatplus {
public static void registerRenderThings() {
MinecraftForgeClient.preloadTexture("/Tutorial/Blocks.png");
MinecraftForgeClient.preloadTexture("/Tutorial/Items.png");
}
}
package orangelight.meatplus.common;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class CommonProxyMeatplus implements IGuiHandler {
public static void registerRenderThings() {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
}
Great im getting more errors when i add an smelting recipe. i put every thing in the same package
Code
package orangelight.meatplus.common;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
@Mod(modid = "orangelight_meatplus", name = "meatplus", version = "1.0")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class Meatplus {
@SidedProxy(clientSide = "orangelight.meatplus.client.ClientProxyMeatplus",
serverSide = "orangelight.meatplus.common.CommonProxyMeatplus")
public static CommonProxyMeatplus proxy;
public static Block saltOre;
int saltOreID = 201;
int lardItemID = 5000;
int saltItemID = 5001;
int rawsquidmeatItemID = 5002;
int squidmeatcookedItemID = 5003;
public static Item lardItem;
public static Item saltItem;
public static Item rawsquidmeatItem;
public static Item squidmeatcookedItem;
@PreInit
public void preLoad(FMLPreInitializationEvent event) {
proxy.registerRenderThings();
}
@Init
public void load(FMLInitializationEvent event){
saltOre = new BlockSaltOre(saltOreID, 0, Material.iron).setBlockName("Salt Ore");
lardItem = new ItemLard(5000).setItemName("lardItem").setIconIndex(0);
saltItem = new ItemSalt(5001).setItemName("saltItem").setIconIndex(7);
rawsquidmeatItem = new ItemRawSquidMeat(5002).setItemName("rawsquidmeatItem").setIconIndex(1);
squidmeatcookedItem = new ItemSquidMeatCooked(5003).setItemName("squidmeatcookedItem").setIconIndex(2);
GameRegistry.registerWorldGenerator(new WorldGeneratorOrangelight());
gameRegisters();
languageRegisters();
GameRegistry.addSmelting(rawsquidmeatItemID, new ItemStack(squidmeatcookedItem, 1), 0.3F);
}
public void gameRegisters()
{
GameRegistry.registerBlock(saltOre, "Salt Ore");
GameRegistry.registerBlock(saltOre, "Salt Ore");
GameRegistry.registerItem(lardItem, "Lard");
GameRegistry.registerItem(rawsquidmeatItem, "Raw Squid");
GameRegistry.registerItem(squidmeatcookedItem, "Cooked Squid");
GameRegistry.registerItem(saltItem, "Salt");
}
public void languageRegisters()
{
LanguageRegistry.addName(lardItem, "Lard");
LanguageRegistry.addName(saltOre, "Salt Ore");
LanguageRegistry.addName(rawsquidmeatItem, "Raw Squid");
LanguageRegistry.addName(squidmeatcookedItem, "Cooked Squid");
LanguageRegistry.addName(saltItem, "Salt");
}
}
package orangelight.meatplus.common;
import net.minecraftforge.client.MinecraftForgeClient;
public class ClientProxyMeatplus extends CommonProxyMeatplus {
public static void registerRenderThings() {
MinecraftForgeClient.preloadTexture("/Tutorial/Blocks.png");
MinecraftForgeClient.preloadTexture("/Tutorial/Items.png");
}
}
package orangelight.meatplus.common;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
public class CommonProxyMeatplus implements IGuiHandler {
public static void registerRenderThings() {
}
@Override
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
return null;
}
}
Last time I checked you added Smelting recipes like this:
GameRegistry.addSmelting(yourBlock.blockID, new ItemStack(yourOutcome, amount), float); // The float is the experience you get from smelting it.
Example:
GameRegistry.addSmelting(Block.cobblestone.blockID, new ItemStack(Block.stone, 1), 0.1F);
One last question for a while when i tried to make my block like sand it falls and stuff but when it falls the texture changes to stone do you know why?
Then either you got the texture location wrong or the preLoad method needs to be in front of the load method. (Did you edit the wrong spelled method inside your block class? public String getTextureFile()?)
I should be able to make this, so I might do it soon. But I haven't done it before so I don't know how the textures work yet. (I still know how to make a liquid)
I will come to those as well, don't worry it's quite easy. At least I think my method of it is quite easy, though it's quite different from what many else are using (that's how it seems at least).
I have never put my .png inside eclipse a single time, because I put it where I found out it works. MCP/jars/bin/minecraft/Tutorial/Blocks.png is the location outside of the code, at least what I'm using in the tutorial.
I also saw that your picture in eclipse had capital M in Meatplus, but in your block class there is written meatplus. You have to be accurate with the capitals.
Minecraft reserves an unsigned byte (256) ids to represent blocks, and they will not work even if they are in use because:
Any Item is as you can see put at index id + 256 when placed in the itemsList array.
That makes no different in Java as the compiler works it out for you.
The Oracle convention tutorial says this: "These methods should be grouped by functionality rather than by scope or accessibility. For example, a private class method can be in between two public instance methods. The goal is to make reading and understanding the code easier."
http://www.oracle.co...ions-150003.pdf
A good convention is to use short lowercase names both as the name of the file and when referencing the file in code. If you do not mind case sensitivity infringe on the cross-platform compatability offered by Java.
The Windows filesystem is not cAsE sEnSiTiVe while the one present in UNIX-based platforms such as Linux and Mac OS X is.
Metoden public String getTextureFile() ser ut til å se etter både små og store bokstaver. Jeg testet dette både med og uten stor bokstav og ente opp med forskjellige resultater hver gang. Med liten bokstav fikk jeg aldri noen texture mens med Stor bokstav gikk det som det skulle.
Når det gjelder det andre ser du ut til å ha helt rett og jeg beklager å ha tatt feil på disse punktene.
On which platform did you test that? I am curious to know whether I should be looking for something more texture specific next time :3
I checked it on eclipse. Just the debug button on the top you know. Kan sikkert vise det i videoen jeg skal lage om textures.
For this you will need a new generation class than WorldGenMinable that makes it spawn in netherrack instead of stone. I might make a tutorial on that later.
I mean are you running Windows, Linux or Mac OS X?
That explains why different namings work for you. The filesystem on Windows is not cAsE seNsItIve, if you do not have matching names on UNIX-based platforms such as Linux and MacOS X it will not find the requested file.
I will put out a tutorial about that, but for now you have to add this to your block class:
Actually I'm not sure about the shiftedIndex part since someone says it is ItemId now. If shiftedIndex give you an error just change it to ItemId.
To clarify I downloaded the latest mcp patch and found that the code I previously posted on this topic is now:
Yes, it seems they changed the field name to something more descriptive
Code
Last time I checked you added Smelting recipes like this:
Example: