Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

BusyBeever

Members
  • Joined

  • Last visited

Everything posted by BusyBeever

  1. dont reuse nbttagcompounds. where are you even using those? I guess most of the confusion comes from the lack of informations provided. in each normal case you wouldn't be write to the same compound you read from (e.g. tileentities)
  2. The empty tag only gets added if the fluidstack is null. read the code. if stack not null do stuff else write empty
  3. why should it never be read? if you create e.g. a tileentity with a fluidtank in the tileentities readFromNBT you will read the tank from nbt, which will get saved to disk in writeToNBT of the tileentity if you code it that way
  4. I dont know why you showed me that piece of code since it has no relation to what I told you but thats just my point of view. If you change the fluidstack inside at runtime it wont be null, so that code wont write empty to the compound
  5. you dont need to remove the tag, because everytime writeToNBT is called they get a clear new NBTTagCompound, which means that the old "empty" key wont be inside of it
  6. From reading your code it looks like you are triing to give your player mana. You should do that using the new capability system, not worldsaved data https://mcforge.readthedocs.org/en/latest/datastorage/capabilities/ (btw how to make clickable links?)
  7. ITickable doesnt work for WorldSavedData. I think it only works for TileEntities
  8. I dont think there is a tutorial for EVERY type of minecraft block, for most of it you will need to look into the miencraft sources and understand how minecraft is doing it. e.g. doors are placing the upper half of themselves in onBlockPlaced
  9. you shouldnt be getting the world the way you do it there.. in most of the cases u want to be using the world the entity is in and not the overworld.
  10. I guess it is crashign with an NullPointerException? You are never checking if the item stacks are null
  11. I think you can do that for custom vanilla crafting table. You just need to return the right stuff in getRemainingItems in ur custom IRecipe
  12. Pipes should not be bigger then 1x1x1. A large pipe consists of multiple small pipes
  13. Hey everyone, I am working on my guicontainer using the new capabilities system. I feel retarded to ask this, but how do I get an IInventory from the IItemHandler, since I need it to add slots to the container.. Thanks for every hint I get ! for (int i = 0; i < handler.getSlots(); i++) { addSlotToContainer(new Slot(handler, i, 10, 10)); }
  14. You should do it how vanilla does it, which is the bed.
  15. Voice recognition is nothing but plain java. So you need to get a speech recognizer and think about what it should do for you. I think sphinx was an library for speech recognition but never really worked with it
  16. you missed the / at the start :b
  17. InputStream is = Schematic.class.getResourceAsStream("/assets/extendedvillages/schematics/"+name+".schematic"); This is my code to access everything inside assets/extendedvillages/schematics/VARIABLENAME.schematic You can replace the Schematic.class with TextResource.class if im not mistaken
  18. The problem seemed to be my java for some reason.. Since I completed working on my mod on another machine and it works now.. Still thank you for the answer :'D
  19. Hello everyone, I am triing to code my own Schematic creator. I already got a working Schematic reader that works like a charm. The problem is that when I try to read my own schematics I get an NPE for the InflaterInputStream, and I have no idea why. Here is my code for creating the schematic private boolean createSchematic(String path, BlockPos first, BlockPos second, World world) { try { int smallerY, smallerX, smallerZ; int biggerY, biggerX, biggerZ; if(first.getX()>second.getX()) { smallerX= second.getX(); biggerX = first.getX(); } else { smallerX = first.getX(); biggerX = second.getX(); } if(first.getY()>second.getY()) { smallerY= second.getY(); biggerY = first.getY(); } else { smallerY = first.getY(); biggerY = second.getY(); } if(first.getZ()>second.getZ()) { smallerZ= second.getZ(); biggerZ = first.getZ(); } else { smallerZ = first.getZ(); biggerZ = second.getZ(); } NBTTagCompound compound = new NBTTagCompound(); int width = biggerX-smallerX+1; int height = biggerY-smallerY+1; int length = biggerZ-smallerZ+1; compound.setInteger("Width", width); compound.setInteger("Height", height); compound.setInteger("Length", length); byte[] blockIDS = new byte[width*height*length]; byte[] metadata = new byte[width*height*length]; int counter=0; for(int y=smallerY; y<=biggerY;y++) { for (int z = smallerZ; z <= biggerZ; z++) { for (int x = smallerX; x <= biggerX; x++) { IBlockState state = world.getBlockState(new BlockPos(x,y,z)); blockIDS[counter] = (byte) Block.getIdFromBlock(state.getBlock()); metadata[counter] = (byte) state.getBlock().getMetaFromState(state); counter++; } } } compound.setByteArray("Blocks", blockIDS); compound.setByteArray("Data", metadata); FileOutputStream fos = new FileOutputStream(path); CompressedStreamTools.writeCompressed(compound, fos); fos.close(); return true; } catch (FileNotFoundException e) { e.printStackTrace(); return false; } catch (IOException e) { e.printStackTrace(); return false; } } And for creating the schematic public Schematic(String name) { try { InputStream is = Schematic.class.getResourceAsStream("/assets/extendedvillages/schematics/"+name+".schematic"); NBTTagCompound compound = CompressedStreamTools.readCompressed(is); is.close(); width = compound.getShort("Width"); //This is where it crashes height = compound.getShort("Height"); length = compound.getShort("Length"); blocks = new BlockInf[width*height*length]; byte[] blockIDS = compound.getByteArray("Blocks"); byte[] metadata = compound.getByteArray("Data"); int counter=0; for (int y = 0; y < height; y++) { for (int z = 0; z < length; z++) { for (int x = 0; x < width; x++) { BlockPos pos = new BlockPos(x,y,z); IBlockState state = Block.getBlockById(blockIDS[counter]!=-92?blockIDS[counter] : 53).getStateFromMeta(metadata[counter]); counter++; blocks[counter] = new BlockInf(pos, state); System.out.println(blocks[counter]); } } } } catch(Exception e) { e.printStackTrace(); } }
  20. you can store everything you need in the itemstacks nbt. I would save the time the "furnace" got opened last time in the nbt, and whenever the player opens the inventory process the items for actualTime-lastTimeOpened ticks
  21. you will need to textures. "checked" and "notchecked", in ur render method make a check if the box is checked or check not. you could also put both textures in one file and paint different parts of it. thats how i would do it, maybe not the best approach
  22. Depends on your computer :b The real question is how long takes it to get worldsaveddata from a worldobj. and of course the more blocks that prevent spawning get spawned the, the more efficent it would be to check the surroudings instead of saving them

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.