Jump to content

makromoo

Members
  • Posts

    20
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

makromoo's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Yea I'd do that.. Use the vanilla stem method and just override where necessary.
  2. Source: http://www.minecraftforge.net/wiki/Create_a_Fluid
  3. One that extends RecipesArmorDyes... Less work..
  4. FYI: If the player is hurt it doesn't return null: Last attacker was EntityZombie['Zombie'/81939, l='New World', x=705.84, y=4.00, z=-2137.55]
  5. Ah I see at what you getting at @Kriki98, @diesieben07 I also figured out why it was returning 0, 0, 0. I shouldn't put that in the constructor but in the updateEntity() method. Thanks for all your help!
  6. a) Alright done b) When I use xCoord, yCoord, zCoord. Problem is they always are 0, 0, 0 c) Ahh never knew that So how could I get xCoord, yCoord, zCoord not to be 0, 0, 0?
  7. Hello Everybody! I'm having issues getting a TileEntity from using: worldObj.getTileEntity(xCoord, yCoord, zCoord); I just get null pointer exceptions... -Using try/catch solved the crash but doesn't fix the issue... Below is the TileEntity Class: package com.example.examplemod.entity; import net.minecraft.tileentity.TileEntity; public class TileMultiBlock extends TileEntity { public TileMultiBlock(int x, int y, int z) { System.out.println(String.format("X: %d y: %d Z: %d", x, y, z)); // Returns block's co-ordinates System.out.println(String.format("X: %d y: %d Z: %d", xCoord, yCoord, zCoord)); // Returns 0, 0, 0 try { TileEntity TE = worldObj.getTileEntity(xCoord, yCoord, zCoord); System.out.println(TE.blockMetadata); } catch (Exception e) { e.printStackTrace(); } //updateEntity(); //TileEntity tileEnt2 = worldObj.getTileEntity(x, y, z); } And below here is the Block Class: I have it passing it's co-ordinates to the TileEntity.. package com.example.examplemod.blocks; import com.example.examplemod.entity.TileMultiBlock; import com.example.examplemod.misc.CreativeTab; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockMainBlock extends BlockContainer { int x; int y; int z; public BlockMainBlock(Material mat) { super(mat); setBlockName("mainBlock"); setCreativeTab(CreativeTab.tabSlime); } @Override public void onBlockAdded(World world, int x, int y, int z) { this.x = x; this.y = y; this.z = z; } @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new TileMultiBlock(x, y, z); } } Thanks for all your troubles!
  8. So, diesieben07: Would this be the correct way of going about it? @SubscribeEvent public void brokeBlock(BreakEvent event) { if (event.block instanceof BlockOre) { event.setExpToDrop(0); } }
  9. I'm going further on what Lomeli12 has said: He has showed you how to create a tile entity. --Make sure it is registered by the game. Create a Block Class which extends the BlockContainer Class: Below is an example, I have to it passing the x, y, z co-ordinates which the block was placed. package com.example.examplemod.blocks; import com.example.examplemod.entity.TileMultiBlock; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockMainBlock extends BlockContainer { // Normal setting up block stuff public BlockMainBlock() { super(Material.rock); setBlockName("mainBlock"); setCreativeTab(CreativeTabs.tabBlock); } // Called when block is placed @Override public void onBlockAdded(World world, int x, int y, int z) { this.x = x; this.y = y; this.z = z; } // Method you must use to create a new TileEntity. @Override public TileEntity createNewTileEntity(World world, int p_149915_2_) { return new TileMultiBlock(x, y, z); } } Later I'll get back to you on detecting stone.. Thank You Lomeli12, For your tutorial! Helped me a ton!
  10. Oh yes, a topic hijack: When it changes the block metadata, it changes all of the placed blocks metadata. Would there be a way to change just that specific block's metadata that got right-clicked. Or Would it be better to have a separate block and delete and replace block1 with block2?
  11. Ah, Blind me! Thank You, very much! Works like a bomb now! Yea you we're right about it being "random.fizz"
  12. Will do! Tried print line as well just not meeting if conditional..
  13. Thank you! I love your tutorials! The layout with the images and pieces of code, AMAZING! Please continue to post more tutorials!
  14. Hey guys! I want to check if this block is right-clicked with a slime ball. Everything works just even if it is right-clicked with a slime ball the code doesn't know that... [embed=425,349]@Override public boolean onBlockActivated(World world, int parX, int parY, int parZ, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(); ItemStack stack2 = player.inventory.getCurrentItem(); if(stack != null) { if(stack == (new ItemStack(Items.slime_ball))) { metaToBe = 1; world.playSoundAtEntity(player, "random:fizz", 0.7F, 0.8F); } } world.setBlockMetadataWithNotify(parX, parY, parZ, metaToBe, 2); return false; }[/embed] Thanks in advance for the help!
×
×
  • Create New...

Important Information

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