Jump to content

pickaxe_engineer

Members
  • Posts

    66
  • Joined

  • Last visited

Everything posted by pickaxe_engineer

  1. Hi I bet your 'crash' is a _NullPointerException_. The way how you set up the class and (I assume, since you only provided us with one file) your block / item registration works, your block flied is null on run time. Don't use object variables if you try to do something like this! I'd suggest to directly access your mod blocks within the onItemUse method. Sincerely -pick. PS: you CAN rename class / object variables within your own class, this technique makes code more readable
  2. Hi Uh, it looks like you did not understand one core mechanic in minecraft: Each item and each block as only ONE SINGLE object at run time (guess why). So your 'bufferstage' thingy will never work! I'd recommend you the follwing changes to your code: 1. Rewrite the getItemDropped method and always return 1 (or any number of 'default' seed amount). 2. Rewrite the getItemDropped method to return the default output (e.g. seeds) 3. Write the getDrops method as following: 3.1 If metadata equals the 'green-Stage', then add (maybe multiple times) the green paprika to the output ArrayList. 3.2 If 'metadata' equals 'red-Stage', then add (maybe multiple times) the green paprika to the output ArrayList 3.3 If 'metadata' equals 'yellow-Stage', then add (maybe multiple times) the yellow paprika. 3.4 For any other 'metadata' add your seed item to the ArrayList. An example for the getDrops method body(please just don't copy paste it'): But to get back to one of your questions: If you have a construct like switch(someValue){ case 1: return something; break; } The break -statement is unreachable, because you return a line before it. May this reply is helpful Sincerely -pick
  3. @diesieben07 I totally agree. In the given context of '-... have Java experience ...' I thought KatanaKid could split the useful and non-sense info... By the way: Do you know some good tutorials? I mostly read through forge/minecraft code and don't always come to a satisfying point of knowledge. Sincerely -pick
  4. Hi I recently looked into your code on github. Since I'm new-ish, please forgive if I am wrong. Personally, I use the method public void writeToNBT(NBTTagCompound nbt) . Why do you use 'addNBT'? Sometimes logging would help... Hope this was helpful Sincerely -pick
  5. Hi I'd recommend to check out 'NealGaming' on youtube. He has a pretty good series on modding for 1.7.2 - in my view he's comments are just horrible. But once you followed the (mostly too long and filled with unecessary comments) tutorials, you should have a basic understanding of TEs. Hope this was helpful Sincerely -pick
  6. Tried with googling it yourself? When I goolged it some months ago, I found this: player.addChatMessage(new ChatComponentText("SOME MSG"));
  7. Hi I guess you got a little confused by 'stage' and 'meta'. You want to check the meta data before adding ItemStacks to the ArrayList in getDrops. The metadata is given, so something like: switch(metadata){ case 5: //add desired paprika to ret break; case 6: //the other paprika break; case 7: //the last one break; default: //add seeds to the list break; } Hope that helped. Sincerely -pick
  8. Dear all I've recently started to tinker around with custom biomes and their decoration. But now I am slightly confused, with theBiomeDecorator object. In the constructor of my custom biome I use the following code to get only a few trees: this.theBiomeDecorator.treesPerChunk = 1; Which works absolutely fine. Then again, the follwing snipped seems not to work: this.theBiomeDecorator.sandGen = new WorldGenSand(Blocks.clay, 7);//7 just like vanilla May someone knows why this doesn't work while changing the amount of trees per chunk does? The final target is to replace the vanilla sand/gravel near lakes with my custom block, may I am at the wrong place to achieve it? Thanks in advance for any responses! Sincerely -pick
  9. Hi I am a newbie and I just started to play around with the whole TE system. I'm either not sure what you're line there exactely does: If I want to get my TE's nbt stored to disk, I use markDirty() From the (vanilla) TE class. May this helps and you're able to set your issue to null;) Sincerely -pick
  10. Thank you! That really solved the issue.
  11. Hi I am not a pro with nbt, but in your TileEntityVariableBlock class, I see one big difference to when I use NBTs: You have no key set! Usually I use something like: (In void writeToNBT(NBTTagCompound nbt) nbt.setInteger(LABEL, value); Where LABEL a string is, that I defined as a class variable to ensure that while writing and reading, the same key is used. In your second class (TileEntityTradingStatioN), you have the line: I have absolutely no idea why, but I use (following a tutorial) 10 instead of your 0. May this cause your issues? Hope I could help and I whish you to find soon a solotion Sincerely -pick
  12. Hi guys I am slightly new to modding in minecraft and may I overlook an important step. But I try to prevent an EntityItem from despawn after the usual five minutes while being collided with a special block (a conveyor belt). The first attempt did not work, I thought somehting like the following would work: @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity){ if(entity instanceof EntityItem){ //some code to move the item ((EntityItem)entity).ticksExisted = 0; } } So ticksExisted is not used to calculate when it despawns?! The second, more promising, attempt was to use the lovely Forge Events: I wrote a little EventHandler: @Subscribe public void handleItemExpire(ItemExpireEvent event){ World world = event.entityItem.worldObj; double xPos = event.entityItem.lastTickPosX; double yPos = event.entityItem.lastTickPosY; double zPos = event.entityItem.lastTickPosZ; System.out.println("Item despawn event happend"); if(world.getBlock((int)xPos, (int)yPos, (int)zPos) != null && world.getBlock((int)xPos, (int)yPos, (int)zPos) instanceof ConveyorBelt){ event.extraLife = 20 * 60 * 5;//adding another 5min System.out.println("prevented item despawn on conveyor belt"); } } And registered this event handling class in my main mod file, in the init method: @EventHandler public void init(FMLInitializationEvent initEvent) { //Event handerls: MinecraftForge.EVENT_BUS.register(new ForgeEventHandler()); } But as well as the first attempt, the second didn't work and I am a little confused. Maybe some of you could help me? Thanks in advance! Sincerely -pick
  13. Hi there This little trick gives you the abillity to customize your armor even more! Go to your armor class and override the following method: public void onArmorTick(World world, EntityPlayer player, ItemStack armorPiece) This method is called on every tick, the armor is weared. Insert in the method's body whatever you want. Maybe quick test if its really you're armor piece or whether the armor is complete. After you'd wrote those lines of code, you want to add the potion effect (or several): Insert the following line of code and adapt it to fit you're wishes: player.addPotionEffect(new PotionEffect( potionID, duration, amplifier)); A little explanatation: - potionID is the ID of the potion you want. You find this ID either by search through the wiki or by (in eclipse) typing 'Potion.' and let auto complete do its stuff. - duration is the amount of ticks the potion will affect the player for. (I usually use 0, to hide the potion effect bubbles(=particles) ). Remeber: 1tick = 1/20 second - amplifier stands for the effect level. As usual this amplifier begins with 0 to indicate the 'base' level of a potion effect. The following code snipped is an example where the PotionEffect 'Speed II' is added to the player: player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 0, 1)); If you wish to add several effects, repeat the addPotionEffect as often as you want. Since this is my first post, I hope it fits to the rules and may I could help you. Happy coding! -pickaxe_engineer
  14. Don't you have to write your own child class of WorldGenerator and simply insert the following line into your preinit(FMLPreInitializationEvent evt) method: GameRegistry.registerWorldGenerator(WorldGenerator gen, int dimID) ? I use this way with my ore generation and it works like a charm
  15. hi Since I've just started modding I'm not sure how right I am. On the other hand I am coding in java for a long time now my eyes've been catched by the following: Why do you use the blockAccess.getBlockMetadata(1,1,1) since the getBlockMetadata(x,y,z) method returns the metadata of the block at the given coordinates. (Additional tip: if you override a method, you can change the name of each argument, so getBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) would be much easier to read, don't you think? )
  16. Usually you have the coordinate on where the right-click happend. Then you take the y-coordinate and increment it (y+1). But you asked for . I would use the the net.minecraft forge.event.entity.player.PlayerInteractEvent to find out what exactly happend. A very useful tutorial on how to get to event handling, see: (a tutorial by wuppy29) May that helped you?
×
×
  • Create New...

Important Information

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