Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Pancake

Members
  • Posts

    43
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Pancake's Achievements

Tree Puncher

Tree Puncher (2/8)

3

Reputation

  1. It worked! One note to future readers though... I got a runtime error because it could not instantiate my class. Apparently you need a constructor with a String for your WorldSavedData class. Keep that in mind
  2. Greetings! I'm trying to save extra data per world, based on this post. The WorldSavedData class is taken care of, now I only need a method that gets called every time a world gets created to add the WorldSavedData object to the world.mapStorage Any suggestions? Thanks in advance, Pancake
  3. The code gets called. That's why if I exit and re-enter the world the blocks are gone. I found a fix. I changed the last return to return true instead of false. All the blocks now dissapear correctly. Sweet.
  4. Greetings! When making a treecapitator axe, I ran across an issue which I can't seem to resolve on my own. When I call the method setBlock(x,y,z,Blocks.air) on the server world object, it doesn't update the client. It should, since that method calls setBlock(x,y,z,Blocks.air,0,3), in which the 3 stands for block update AND send change to client. I also tried calling the setBlock(x,y,z,Blocks.air,0,3) method directly, to no avail. I'm calling it on BlockOldLog and BLockLeaves objects, if that helps narrow the problem down. When I exit and re-enter the world, the blocks are gone, like it's supposed to be. I know one solution would be to just call markBlockForUpdate, but I'm not sure why the setblock method does not do what it tells me it should. Thanks in advance, Pancake
  5. This only gives vanilla recipes. What if we want to iterate through all the modded recipes too? It also gives you the mod-recipes, not only the vanilla ones.
  6. You have 2 kinds of OreRecipe: ShapedOreRecipe and ShapelessOreRecipe. The ShapedOreRecipe object has a method called getInput() which gives you an array of Objects, which are either an ItemStack, an ArrayList<ItemStack>, or null. The ShapelessOreRecipe has the same method, but returns an ArrayList<Object>. The objects in the arraylist are, once again, an ItemStack or an ArrayList<ItemStack>. There is a trick to get the orename from that arraylist of itemstacks (since that's the collection that contains all possible itemstacks). If you can't figure it out I'll tell you, but I don't feel like spoonfeeding you everything. Let's see if you can figure this one out. :3 Good luck!
  7. You could try making an item that, when rightclicked on the master, binds to it (stores it's location or something) When you then click on a slave block, it links the 2 together. It's manual work, but I'm pretty sure that should work. Oh wait. I made it. Ofcourse it works. It also solves some problems that could arise by your method. What if a slaveblock is surrounded by 10 masters? pick a random one? Good luck!
  8. I just figured it out! I was using the TileEntity's blockMetadata. It said -1, but worldObj.getBlockMetadata(xCoord,yCoord,zCoord) gave me the correct metadata. I know I have to use the getBlockMetadata method now, which initialises the blockMetadata if it's -1. My bad! :3 It's weird that that field isn't initialised from the start though. [sOLVED]
  9. Greetings! It's been a while since I've asked a question here. I was wondering if it's necessary to save the metadata in the NBT data of the TileEntity of a block. BlockFurnace does not do that, yet it managas to save the direction it's facing. I took a look at the Transposer from Redpower, it uses NBT. (link to redpower TileMachine) This is my current code: The metadata returned from Utils.getMetaFromDirection(yaw,pitch) is correct, and I added a line to the TileEntity of this block that prints the metadata of the block. It has the correct value. Now, when I exit the world and enter again, it prints -1. What. Am I really supposed to use NBT data here? I thought metadata was something saved automatically? Thanks in advance, Pancake
  10. ~ Bump ~ I usually figure things out +-3 hours after I've posted my question on this forum. This isn't one of those times. :'(
  11. So... Yeah. I'm still looking for solutions. I really can't think of anything other than either: * doing stuff in the tile entity that implements IInventory, which I tried and couldn't configure it the right way for my purposes. * using that itemstack, which keeps returning null. I'll rephrase my original question. I want to make slots that do the same as the creative gui. They increase the held itemstack stacksize by 1 if clicked on the same item. (I want to make some kind of shop, it will check if you have enough of a currency and then increment) Please? :\
  12. Alright, I tried using reflection, and getting that field. It keeps returning null. All relevant code: public class GuiMainframeCore extends GuiContainer{ public GuiMainframeCore(InventoryPlayer inventoryPlayer,TileEntityMainframeCore entity) { super(new ContainerMainframeCore(inventoryPlayer,entity)); ((ContainerMainframeCore)inventorySlots).setGui(this); this.entity=entity; xSize=176; ySize=194; } public ItemStack getHeldItem(){ try { Field heldItemField = GuiContainer.class.getDeclaredField("field_146994_N"); heldItemField.setAccessible(true); return (ItemStack)heldItemField.get(this); } catch (Exception e) { e.printStackTrace(); } return null; } } public class ContainerMainframeCore extends Container { private TileEntityMainframeCore entity; private GuiMainframeCore gui; public ContainerMainframeCore(InventoryPlayer inventoryPlayer,TileEntityMainframeCore entity){ this.entity = entity; for(int i=0;i<entity.getSizeInventory();i++){ addSlotToContainer(new Slot(entity,i,70+(i<6?0:18),10+(i<6?i:i-6)*18)); } for(int x=0;x<9;x++){ addSlotToContainer(new Slot(inventoryPlayer,x,8+18*x,150)); } } @Override public ItemStack slotClick(int slot, int mouseid, int p3,EntityPlayer player){ if(gui!=null){ System.out.println(gui.getHeldItem()); } return super.slotClick(slot,mouseid,p3,player); } public void setGui(GuiMainframeCore gui){ this.gui=gui; } } ... help.
  13. You could try overriding the method getIconFromDamage in your Item class. You'd have to change the item damage to get different textures though. I'm sure there are other ways, but if's just a suggestion
  14. Define 'glow'? Giving off light / changing the texture brightness / giving off particles / ...
×
×
  • Create New...

Important Information

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