Everything posted by Moritz
-
Giving different names to damage values
Hmmm there is an other way to get a name to the item. but this need itemmetadata. it comes from the item itself. and i do not know if its language config compatibel is. but here is the code. it comes in the itemwhatever class. public String getItemDisplayName(ItemStack par0) { String par1 = ""; switch(par0.getItemDamage()) { case 0 : par1 = "Item1 Damage 0"; break; case 2000: par1 = "Whatever"; break; default: "Everthing else than 1 and 2000"; } return par1; } This is the code. i use it by my self. and it work with metadata items very good and its very easy to extend it. but ever case need a break. default not. i hope i could help. and when not then no problem.
-
Boolean
Ok but how can i solve my problem when he is hitting a block that the boolean goes to true?
-
Boolean
Hello. Here is the code. and here is the tool: how can i make it that the boolean will be on both sides true if its mining.
-
[Request] Gun tutorial Forge
ok no problem.. You have to change some things. The item which is an arrow (mod_KingdomAge.gunFood.shiftedIndex In to your own item. The texture File and the Most importent thing The EntityExplodeArrow. I can post the entityexplode arrow if you want it. Or download and modifine it from minecraftModdingMadeEasy (there are some mistakes it i changed allready in my file (only delete Every .setEntityDead()) the only thing i counld test the recharging function ingame (but for that i have my testers). if it does not work tell it please And i try to change it.
-
ore Dictonary
Ok First of All the item Checker is only to check item is a fake or is an original... Secend one i already Importet all OreDictonary Classes. Third one i do not Need Sharpless Recipes. I need only Sharped Recipes. forth one. The public void Load is only for recipes and the public mod_KingdomAge for the rest (kinda sorting). but at all thanks now im testing it and tomorow you get an other answer...
-
ore Dictonary
Ok i understand it right now i try gameRegistry... If it make fail i change back to modloader... the only thing what i use on modloader is RegisterBlock and AddRecipe
-
[Request] Gun tutorial Forge
here is The code of my gun (i made an EntityExplodeArrow for this... you can copy it if you want) package net.minecraft.src; import net.minecraft.src.forge.*; public class ItemOldGun extends Item implements ITextureProvider { public ItemOldGun(int par1) { super(par1); this.maxStackSize = 1; this.setMaxDamage(5); } public String getItemDisplayName(int var1) { return "Rifle"; } /** * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount */ public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { if (!ForgeHooks.onArrowLoose(par1ItemStack, par2World, par3EntityPlayer, this.getMaxItemUseDuration(par1ItemStack) - par4)) { boolean var5 = par3EntityPlayer.capabilities.isCreativeMode; if (var5 || par3EntityPlayer.inventory.hasItem(mod_KingdomAge.gunFood.shiftedIndex)) { int var6 = this.getMaxItemUseDuration(par1ItemStack) - par4; float var7 = (float)var6 / 20.0F; var7 = (var7 * var7 + var7 * 2.0F) / 3.0F; if ((double)var7 < 0.1D) { return; } if (var7 > 1.0F) { var7 = 1.0F; } EntityExplosiveArrow var8 = new EntityExplosiveArrow(par2World, par3EntityPlayer, var7 * 2.0F); par1ItemStack.damageItem(1, par3EntityPlayer); par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + var7 * 0.5F); if (!var5) { par3EntityPlayer.inventory.consumeInventoryItem(mod_KingdomAge.gunFood.shiftedIndex); } else { var8.doesArrowBelongToPlayer = false; } if (!par2World.isRemote) { par2World.spawnEntityInWorld(var8); } } } } public ItemStack onFoodEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { return par1ItemStack; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 1000000; } /** * returns the action that specifies what animation to play when the items is being used */ public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.bow; } /** * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer */ public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { ItemStack var4 = ForgeHooks.onArrowNock(par1ItemStack, par2World, par3EntityPlayer); if(par1ItemStack.getItemDamage() == 0) { if(par3EntityPlayer.inventory.hasItem(Item.gunpowder.shiftedIndex)) { par1ItemStack.damageItem(5, par3EntityPlayer); par3EntityPlayer.inventory.consumeInventoryItem(Item.gunpowder.shiftedIndex); } else { par3EntityPlayer.addChatMessage("You need more Gunpowder"); } return par1ItemStack; } if (var4 != null) { return var4; } else { if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(mod_KingdomAge.gunFood.shiftedIndex) && par1ItemStack.getItemDamage() > 0) { par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack)); } return par1ItemStack; } } /** * Return the enchantability factor of the item, most of the time is based on material. */ @Override public String getTextureFile() { return "/Spmod/KingdomAge/items.png"; } } This Code Work i test it...
-
ore Dictonary
Thanks. My modfile will be for only 3 days on the next post downloadfile... sry i can not post with my ipod touch(G2) on github... I use dropbox to share my code.. and why i do not use minecraft 1.3.1 because i make some of my mods for friends an they use 1.2.5. And i have to read the changes and that does need more time for mod which is at a testing phase... When its at the realease Time i update the mod... Thanks to the answer
-
ore Dictonary
If you want to try it yourself. I give you my code...
-
[Request] Gun tutorial Forge
do you mean the block or an item? because i have made a gun which is rechargabel (consum gunpowder) . if you mean the Item i give you my sourceCode... If you mean the block. i search about something else but its really hard to create. look at the BlockDispenser.java . i hope it help a little bit...
-
ore Dictonary
I tried Every OreDictonary Tutorial I found (from the inet and from the source codes)... Emm i don't know what i can do... to get it work...
-
ore Dictonary
Sry but i tried and it failed too!!
-
ore Dictonary
This code Is my modFile... I hope you can help me because i can't make recipes with oredictonary... I deleted all recipe because this comes at my last test when i release a test version Now the Code of the items ItemCopperIngot.java
-
ore Dictonary
the code what you gave me is does not work on my mod.. (Errors 5 i think) i tried the code directly out of the mod redpower to test it. this code did not make a error, crash, and now the bad thing no recipe... i do not know how i can fix that.... I poste my codes. maybe this helps out..
-
[1.3.2][Solved]Crafting recipes like vannila repair recipes
Forgot it i change my idea (Speigers DynamicTools mod) But all work. And Lex I made a metadata Tool And it works.... Thanks for reading. Speiger
-
ore Dictonary
if this work with modloader than thanks
-
ore Dictonary
i cant use gameregistry because the data in cpw.fml.common do not exsist...
-
ore Dictonary
I use ordictonary and it fail... Im so sad... Because nothing work. not the source of elorams redpower. not the source out of Forestry. not the source out of universal eletricty... (I only use the source to get inspiration how to things work) here is the recipe (when i use it it will crash the game at start) ModLoader.addRecipe(new ItemStack(mod_KingdomAge.copperIngot, 1, 40), new Object[]{ "YX", Character.valueOf('X'), "ingotCoppet", Character.valueOf('Y'), "ingotTin"}); (why copper ingot is so high? i use only for normal items one id) i tryed the recipe out of the fore tutorial too and it dont work because i use the modloader style... (of modding but i work with fml) thanks for reading. Moritz
-
[1.3.2][Solved]Crafting recipes like vannila repair recipes
sry that is not possibel.. i want to make it like industrialcraft lappacks when you have energie in the batpack... public class mod_blabla extends BaseMod { public static Item customStick = new ItemCustomStick(6000).setItemName("customStick"); public static Item customPickaxeHead = new ItemCustomPickaxeHead(6002).setItemName("customPickaxeHead"); public static Item metadataPickaxe = new ItemMetadataPickaxe(6003).setItemName("metadataPickaxe"); //problem Zone public void load() { ModLoader.addRecipe(new ItemStack(mod_DynamicTools.metadatapickaxe, 1, 0), new Object[]{"Y", "X", Character.valueOf('X), new ItemStack(customStick, 1, 0), Character.valueOf('Y), new ItemStack(customPickaxeHead, 1, 0)}); } } what i want is like industrialcraft bat to lap crafting recipe or vannila tool repair recipe. i dont have the variabel. The crafting recipe read the metadata and which is higher will be the metadata of the tool that was my idea but i have no idea how to do it... I read much source codes to find it out... nothing...
-
[1.3.2][Solved]Crafting recipes like vannila repair recipes
Hello. I have problems with my crafting recipes. They are too much. I got an idea how to solve the problem but then comes to much errors. Here is my idea Code: public String getItemDamage() { String var1 = var4; if(var2>var3) { var4 = var2; return; } if(var3>var2) { var4 = var3; return; } Modloader.addRecipe(new ItemStack(mod_Blabla.customTool, 1, var1), new Object[]{"Y", "X", Character.valueOf('Y') new ItemStack(customPick, 1, var2), Character.valueOf('X'), new ItemStack(customStick, 1, var2)});
IPS spam blocked by CleanTalk.