Jump to content

TheSparkst3r

Members
  • Posts

    30
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Location
    Lurking in the UK

TheSparkst3r's Achievements

Tree Puncher

Tree Puncher (2/8)

6

Reputation

  1. You still shouldn't be putting it in the constructor.
  2. Yeah, that'd work. But you'll also need to make sure the normal drop is disabled or you'll have 2 items dropping. You'll also need to create an entityitem in the breakBlock method and spawn that in the world manually for your drop.
  3. Hmm, I was afraid of that. TE uses a tool to dismantle the blocks safely by purposely calling the methods to break the block and saving the tile data in the correct order. You'll have to look around for a method in your block that calls before the tile is deleted so long as you have access to the world and coordinates and able to return the stack to drop.
  4. It doesn't at all need to be separate, it just ended up that way. And that's what I'm doing currently(see the container constructor) what I need is for the slots to be added WHILE the gui is open to make it look like its being upgraded. But I probably can merge the inventories it would be far easier to deal with shift clicking that way too.
  5. You'll need to use the ItemStack's NBTTagCompound. In your Block's getDrops method you should get the TileEntity. TileYours being your TileEntity TileYours tile = (TileYours)world.getTileEntity(x, y, z) You should probably also perform a check on the tile to ensure it is instanceof TileYours Then you need to get the value from the tile. You need to create the getPlayerName method in your tile entity class and insert it into a new stack's nbttag @Override public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList<ItemStack> items = new ArrayList<ItemStack>(); TileEntity t = world.getTileEntity(x, y, z); if (t instanceof TileYours) { TileYours tile = (TileYours)t; String name = tile.getPlayerName(); ItemStack stack = new ItemStack(world.getBlock(x, y, z), 1, metadata); if (!stack.hasTagCompound()) { stack.setTagCompound(new NBTTagCompound()); } stack.getTagCompound().setString("playerName", name); items.add(stack); } return items; } And in your onBlockPlaced you will need do the opposite and set the name in the tileentity
  6. The smelting code is wrong. You need to define if it's a block or not by going to the end of the block your smelting and put .blockID . For 1.6 you do, but this is 1.7, you don't need to do that anymore. You now only need to pass in the Item or block to the method and the appropriate method is inferred
  7. Smelting needs to go after the registration of the blocks/items! And inside load events. You really need to learn Java and thoroughly read beginner tutorials, it's worth doing. I havent checked the syntax, so you may need to import some things if they aren't already. But this is how your main class should look roughly
  8. Can you add an extra parameter to your entity? You could probably do it so world.spawnEntityInWorld(new EntityKanokaTeleportation(world, entityPlayer, stack.getTagCompound())); If you are calling it in the use item method in Item and have access to the ItemStack And then set a variable in your entity to the tagcompound, then when it lands. After you've created the item stack you can do discDrop.setTagCompound(this.thetagcompound) So your entity would now look like this
  9. This has been bugging me for a while and I have absolutely no clue how to do it, so a detailed description of how to do this would be awesome! I have a backpack Each of those 4 3x3 grids are seperate IInventories and are added by upgrading with a pouch item. To upgrade it, you click the grid to add slots to with a "storage" item which is non removable. The grids dont exist if it hasnt been upgraded, however, they are also tripped(A value set in the container to keep all grids) so they stay there while im debugging. I have an invisible button over those areas which when clicked sends a packet, I don't know what to put in this packet to tell it that it needs to add slots though. I also need to be able to add these slots after the container has been initialised and sync them with the client. I have tried calling a method in the container from the packet to add the slots but the slots don't exist on the client and end up getting IOOBoundsExceptions when hovering over where they "should" be. So I imagine this is a sync issue. Thanks for any help in advance This is my code: GUI Container Packet
  10. I presume this is loading from the root dir of the server, is there a way to do the same from a resource pack? But as a last ditch attempt this might be a great solution. Thanks EDIT: I've just realised "ResourceLocation" exists. That might be a solution with a BufferedReader to get the content. Need to look at MC's .json to NBT parser too.
  11. How does it consume the exchanger item? Is this exchange performed via a GUI? Would you provide your current source code please.
  12. I am currently working on a mod which provides information about blocks as a companion mod to WAILA and NEI. It's currently part of another mod but I wish to split it into its own mod. I have all the functionality worked out but I am stuck for a method of storing the info. To test the functionality I've just made classes with the info as variables and pull the classes into a hashmap with the unlocalised name of the stack(passed when info is requested) as the key. Rough specification: -Language support -Non dependant/obtrusive; doesn't complain if a file doesn't exist. I don't want console spam like if textures aren't available. -Modular; a user can add a pack and have it detect and use it. Ties into last point. An example file structure might be: "pack-root"/ assets/ info/ "lang"/ "mod"/ items/ blocks/ The logical choice would be resource packs. And to use .json files for storing the information. I have no idea how load them, though. How should I go about doing this?
  13. Same for me. It's happened to me just now I had updated to 1.5.1 and hadn't run the server yet(Client runs fine) But when i needed to test the server side ticks. This happened! Although this was working correctly in 1.5 and and the files havn't been moved or changed. Im assuming something must have changed 1.5 > 1.5.1 And diesieben my commonproxy exists too. And it worked in 1.5. And the files havn't moved. Sooo, odd. Imma redownload mcp and forge again and see if I had gotten a naff build before. EDIT: The decompiling feature in MCP takes SOOOO long
  14. A better solution public boolean onItemUse(ItemStack item, EntityPlayer player, World world, int x, int y, int z, int par7, float xFloat, float yFloat, float zFloat) { //Can the player alter this block? if (!player.canPlayerEdit(x, y, z, par7, item)) { return false; } //Was the block clicked on a dirt block? if(world.getBlockId(x, y, z) == Block.blockDirt.blockID){ world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blah item here))); return true; } return false; } This goes in your item class
  15. world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Blah item here))); Should do what you want
×
×
  • Create New...

Important Information

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