Jump to content

Ernio

Forge Modder
  • Posts

    2638
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Ernio

  1. ,,This post won't help you much but I can assure you that println will " Probably when some method from TileEntity is calling for result (res) it gets wrong shit Place println before/after every calling of getPowerRequirement and also inside it when there is try/finally part. I can't help much when I don't see whole code
  2. I don't have that much time to go through whole code: Container is good that I can tell, as to TileEntity - at some point you are PROBABLY making ghost items - that means they have different properties (stacksize etc.) that are actually showed. Hint for you: Add println before and after getting ANY itemstacks - like: ItemStack is1 = ExtractorRecipes.extracting() .getFirstExtractResult(this.extractorItemStacks[0]); ItemStack is2 = ExtractorRecipes.extracting() .getSecondExtractResult(this.extractorItemStacks[0]); or extractorItemStacks[2].stackSize += is2.stackSize; Also check if you are not stacking over Stacklimits (saw you did it in canExtract - but just make sure) This post won't help you much but I can assure you that println will Also (as a guy before me said) - GuiHandler should look like this, so make sure it does: public class GuiHandler implements IGuiHandler { @Override public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity TE = world.getBlockTileEntity(x, y, z); switch(id) { case 1: return new MyContainer(player.inventory, (MyTileEntity) TE); } return null; } @Override public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { TileEntity TE = world.getBlockTileEntity(x, y, z); switch(id) { case 1: return new MyGui(player.inventory, (MyTileEntity) TE); } return null; } }
  3. How could I miss that... Thanks anyway
  4. So here I am with this strage thingy: System.out.println(this.ItemStacks[Container.OUTPUT[j]]); System.out.println(smeltingResult[i]); if (this.ItemStacks[Container.OUTPUT[j]] != null && (this.ItemStacks[Container.OUTPUT[j]] == smeltingResult[i])) { System.out.println("YES"); } System.out.println("NO"); 2013-11-03 23:51:18 [iNFO] [sTDOUT] 2xitem.BarBronze@0 2013-11-03 23:51:18 [iNFO] [sTDOUT] 2xitem.BarBronze@0 2013-11-03 23:51:18 [iNFO] [sTDOUT] NO YES - item is equal and stacks; NO - is not equal, it will search for null ItemStack (empty slot) and place it there. Both "2xitem.BarBronze@0" seen on console are from the same crafting. Now what the hell? Also I've tries this: this.ForgeItemStacks[ContainerForge.OUTPUT[j]].equals(smeltingResult[i]) Doesn't work either... Am I missing something about ItemStacks? How can I check if they are equal? Thanks for help!
  5. The mod FMLMod:MyMod{} is attempting to register a block whilst it it being constructed. This is bad modding practice - please use a proper mod lifecycle event. Mod is registering 24 blocks NOT in MainMod class, but in it's constructor class BlockBase.class - it allows me to load tons of blocks while not writing GameRagistry to each and everyone of them. Everything is working well, but I don't like having warnings in my console. Tell me honestly: Is there a chance this can crash my game? ANY?
  6. Hello, Does anybody know any opensource or where should I look for Methods that'll allow me to add different properties to item, while I am crafting it? What I mean is for example: We take out 4x5 Grid and craft an Axe (This grid/crafting works - that's not my problem) and we make basic Axe, BUT when we add something to specific SlotID it will change our CraftResult. Where Gold Slot is out custom item (which will add special effect). Our goal is to: *Make one recipe for multiple crafting. - PRIMAL *Save this data to NBT, not to Item ID (item Id stays the same for all) *Make sure that saved data (let's say we added fire gem to an axe recipe) will be called everytime we hit something and will set it on fire. Structure would look like: Axe.class: -Main stuff (constructor, blah blah) -Function 1, 2, 3, ..., n, that will be called if an item has ,,this" NBT. -Textures that are loaded depending on what this item is: So if we got Fire axe, we get FireAxeTexture, not AxeTexture. And yes, I know - NBT items can be only crafted, since they don't have specific ID. And if this stuff is just pointless to put into NBT's we can just use MetaData. Most important here is this crafting thing. EDIT This grid has custom CraftingManager, RecipeSorter and Shaped/ShapelessRecipe.class - based on vanillia ones, so you are free to edit them (they are nearly same as vanilia).
  7. Well I could just add if statement for my item to ModelBiped class because it wont cause incompatibility (it will also work with other ModelBiped entities like zombies) but this idea is just wrong for Forge coding. So any other ideas? I need to know how to tell ModelBiped to start rendering stuff different way.
  8. Hello, I've lantern item which when held will use Cutom Renderer (model). What I want is when player is holding this item his hand will be lifted. You know - when you are holding a lantern you usually lift it up, not swing it arount How can I do that? Maybe using Player API? (have this one implemented).
  9. Oh god... I don't have code but maybe my memory is good enough. if(entity instanceof EntityPlayer) { entity.attackEntityFrom(MyDamageSource.MyDamage, damagevalue); } Normally I would use it in hitEntity() (where you have attacker and target), but here you have only attacker, so this will be wrong (but you can always try implementing it). In this case you have to replace your: ((EntityLiving)entity).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)entity), 1); I really can't do anything now but this should work (i mean - try doing stuff with it).
  10. When extending ItemSword you cannot assign CreativeTab. What you can do is extend Item and then copy ItemSword code to it (since ItemSword extends Item it will be the same). About this ,,you cannot" - I am not sure, but after 1h of going through code I cannot get it working too. Its probably bug or you need to find some special method to do it - I realy don't know but I know that there are many who can't get it working either.
  11. Hello, I am rewriting my mod from ML to FML and I can't get this stuff working. What we have is MyModWeapon which extends ItemSword and MyModWeaponBlunt which extends MyModWeapon. ItemSword>>MyModWeapon>>MyModWeaponBlunt Now what Blunt weapon should do is to hitEntity() get attacked entity inventory and check what type of armour it is wearing (platemail protects from blunt damage, but weak armours will be crushed and ignored/lowered). @Override public boolean hitEntity(ItemStack ItemStack, EntityLivingBase ent, EntityLivingBase ent2) { ItemStack.damageItem(1, ent2); if(ent instanceof EntityPlayer) { EntityPlayer attackedPlayer = (EntityPlayer)ent; ItemStack helmet = attackedPlayer.getCurrentItemOrArmor(4); ItemStack chest = attackedPlayer.getCurrentItemOrArmor(3); ItemStack legs = attackedPlayer.getCurrentItemOrArmor(2); ItemStack boots = attackedPlayer.getCurrentItemOrArmor(1); //if armour == light give piercing damage else give normal values } } Now the problem is I have no idea what am I doing here so I need help. Will this work? Which one of these calls for what? Not sure if I am using them properly... Mine: EntityLivingBase ent, EntityLivingBase ent2 Vanilia: EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase
  12. About ignoring armour: Create new DamageSources: package xxx import net.minecraft.util.DamageSource; public class MyDamageSource extends DamageSource { public MyDamageSource(String par1Str) { super(par1Str); } public static MyDamageSource ArmorPiercing = new MyDamageSource("MyMod.ArmorPiercing").setDamageBypassesArmor(); public static MyDamageSource Magic = new MyDamageSource("MyMod.Magic").setMagicDamage(); public MyDamageSource setDamageBypassesArmor() { return (MyDamageSource) super.setDamageBypassesArmor(); } public MyDamageSource setMagicDamage() { return (MyDamageSource) super.setMagicDamage(); } } Here you got two lol (I just wrote it). You can also use EXISTING damage sources from net.minecraft.util.DamageSource; Hope it will help
  13. Thanks for trying, but... Let me just say one thing: I am turning for others people help only if it's neccesary (time is everything). I don't need tutorials ,,How to export a mod" (it's even on wiki I think). I need help because I've checked code 10 times, reistalled whole MCP 3 times, and reinstalled Minecraft with forge like 4 times. And yet: My mod only works in eclypse and in 1.6.2-Forge.jar, but not in freaking mod directory. Every single mod works normally (in /mods/) but mine NOT. WHY?! :C This is what I writed first... Fixed problem - IT WAS PAIN! No, really - pain in the ass with my damn eclipse shortcuts Sorry guys
  14. Thanks but that was a extra question (mod worked well with that - public static final Block BlockName, after your change that nothing happens). Main question was: what do I do wrong while exporting my mod? Again: Mod is working in eclypse, mod is working when extracted to .jar, but is NOT when it is in /.minecraft/mods/MyMod.zip (or .jar). File structure: MyMod.zip >net >>mymod >>>mod >>>>Main.class
  15. Smart/quick way: Into MyMod.class: public static CreativeTabs MyTab = new CreativeTabs("MyTab") { public int getTabIconItemIndex() { return MyMod.itemID/.blockID } }; If you want to have InGame name: public void load(FMLInitializationEvent event) { LanguageRegistry.instance().addStringLocalization("itemGroup.MyTab", "en_US", "MyTabInGameName"); } And here is some unknown (never watched) tutorial found just by writing 3 words into google ;p http://www.youtube.com/watch?v=KIisB001LG8 Only thing I know that this one is way longer.
  16. Hello, I've recently updated my mod to MC 1.6.2 - Forge 9.10.0.804 and it seems that I am stupid or blind (or maybe not). When I launch my mod in Eclypse it works fine (everything), but when I've reobf it and put Classes into .zip/.jar Forge won't even see this mod. Info: Forge 9.10.0.804 installed by installer on fresh client with 1.6.2 (run once). Forge is working, actually all other mods are working, but mine. Funny thing is that if I'll pick up my mod from .minecraft/mods/MyMod.zip and extract it into .minecraft/versions/Forge-x/.jar the mod (MyMod) actally works fine. What could be WONG?! I just need some ideas, code is 100% fine because it works. And one more thing: Is this a VERY bad way to do? The mod FMLMod:MyMod{0.3.0.PB} is attempting to register a block whilst it it being constructed. This is bad modding practice - please use a proper mod lifecycle event. I mean - is there any way that Minecraft can crash if i am registering whole block in Block.class and in MyMod.class i am only creating static final for block? ANY?
  17. At first I was thinking that's maybe beacuse Server is running in the background, or maybe it's just bug, but now it started to bother me. I am using this code: @Override public void onBlockDestroyedByPlayer(World par1World, int x, int y, int z, int m) { Random generator = new Random(); int X = generator.nextInt(10000) + 1; System.out.println(X); } It gives me 2x random numbers every time I destroy block - WHY?! And will it cause problems on MP? Note that no matter if I use Random or not, all the System.out will run twice.
  18. Question to this: Besides modyfying base class (which is easy), how would you just replace it with Forge Mod? I mean: If I am using MCPC+ I cannot get into Server files (I can, but compilation uses maven, and there are literally daily updates so I would have to keep up with updating my changes in source). What I want to get is to via ForgeMod make both client and server use my inventory .class, not the vanilia one, or just maybe somehow extend this one and override needed methods. Is there some Forge method to do so? Or do I have to use CoreModding / Reflection?
  19. You could use something close to event handler - i mean, do the tick and when block below you == something, then set player speed to something. I am sure I can find those methods, because I've been making a road block (sadly mine was full ModBlock so i used just call for EntityWalking or something like this, yours are vanilia ones, thats why you would need to use ticks). And other way is to of course make Reflection and stuff proposed before.
  20. As far as i know, no you don't public Block(int par1, Material par2Material) { } Or maybe there has been changes on 1.5.2? because i am using 1.5.1 (No need to update, will when I'm finished or if I would really need something). As to you Soldier - do you even know how constructors work? Ok man, look: You got my code, so you just leave it. Copy to BlockOre.class (or something) Next go to the MainMod.class and write this: public static final Block IridiumOre = new BlockOre(1000, Material.rock, "IridiumOre"); //1 - ID, 2 - Material, 3 - Unlocalized name Now you just need to register block and add IngameName (which you can also do in BlockOre.class by adding more code of course). ObsequiousNewt - thanks pal, didn't noticed that, but in BlockOre I personally wont use it (but in other yes)
  21. Use this one... (please read, not copy) package MyMod.blocks; import java.util.Random; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.Icon; import net.minecraft.world.World; import MyMod.Main; public class BlockOre extends Block { public BlockOre (int id, Material material, String Unlocalized) { super(id, material); setCreativeTab(CreativeTabs.tabBlock); setStepSound(Block.soundMetalFootstep); setUnlocalizedName(Unlocalized); } public int idDropped (int par1, Random random, int par2) { return this.blockID; } @SideOnly(Side.CLIENT) public Icon getIcon(int par1, int par2) { return this.blockIcon; } @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", "")); } } This one: blockIcon = iconRegister.registerIcon("MyMod:" + getUnlocalizedName().replace("tile.", "")); Will call for /minecarft.jar/mods/MyMod/textures/blocks/Unlocalized.png Where unlocalized is your String. .replace("tile.", "") - and yes, this is needed.
  22. ItemStack itemstack; Item item; @Override public int idDropped(int id, Random rand, int idDropped, EntityPlayer player) { itemstack = player.getCurrentEquippedItem(); if (itemstack != null) { item = player.getCurrentEquippedItem().getItem(); if(item == MyMod.Pickaxe1) return Blocks.dirt.blockId; else if (item == MyMod.Pickaxe2) return Blocks.cobblestone.blockId; else return something; } } Not sure about whole code beacuse I am writing it from memory, but this should give you idea Best regards, Ernio
  23. Hello, I am just wondering: How can I call this function to get biome on x,y when I rightclick item, or anything else, for example for a tick inside item code? Let's say (I just came up with this, this is not my target) i want to make item that will update it's texture depending what biome you are standing in. I tried a lot of stuff and cannot get this working (not working, or crashing). How can I get this for ex. onItemRightClick?
  24. Are you talking about structure generation? It's quite easy (at least was on 1.3.x). You want your village to be just one big model (or more) that will generate like big dungeon, or you want like 50 buildings which will randomly connect and create village?
  25. Through I am not THAT experienced with forge yet, I can tell you this is possible, and this has been alredy made by one of coders. Chceck out ,,Mine & Blade: BATTLEGEAR" - sadly this is version for 1.2.5 but... ...well - the author is working on OPEN-SOURCE continuation of it called Mine & Blade: Battlegear 2 - Knight's Armour. Since this is an open source [WIP] there a lot of modders that are adding some custom stuff in it. Here's the Github: https://github.com/amedw/Battlegear2 Note: This is Github of 1.5.2 - which doesnt contain dual-wielding code (which was in 1.2.5). Go talk to nerd-boy if you want some help with this, because he's not planning to make D-W till MC 1.6 ;p
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.