Jump to content

Whov

Members
  • Posts

    59
  • Joined

  • Last visited

Everything posted by Whov

  1. and adding the @Override annotation helps too (especially when you'll need to update!)
  2. make a field onPreviousTick and, at the end of the tick method, change that to the current value. Next tick you will have it handy and comparable to the new one (and so on..)
  3. Sorry, missed that . Are the other tasks working? EDIT: also, does this happen also when spawn on earth and then pushed?
  4. As he said. Task to make it swim should do
  5. But first, make that RenderTileEntityAt working (also, are you sure your block is generating a tile? Just checking everything)
  6. Not sure about your problem, but you can use NBTTagList and add nbt tags to it (and then save the list as a tag in the main nbt). Go look for some docs on NBTTagList
  7. Howdy, everyone I want to share with you my new (and first) modding api for... Connected Textures! It looks to me like there is none like mine in the net, so I hope you'll find it useful. http://whov.altervista.org/connected-textures-modding-api/ for download and tutorial. Documentation in provided inside methods too. Basically you will need to extend my class and create a bunch of textures (you can also create one and modify it a bit, even just rotate it). Full customization is possible (that's the plan at least). Post here for questions or bug reports and please share and give a thank if it was useful to you! EDIT: just edited one little thing about just1 rendering wrong texture on side 4 horizontal
  8. IIcon icon = FluidStack#.getFluid().getIcon(); Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture); tessellator.addVertexWithUV(0, height, 1, icon.getMaxU(), icon.getMaxV()); tessellator.addVertexWithUV(1, height, 1, icon.getMinU(), icon.getMaxV()); tessellator.addVertexWithUV(1, height, 0, icon.getMinU(), icon.getMinV()); tessellator.addVertexWithUV(0, height, 0, icon.getMaxU(), icon.getMinV());
  9. Slow down: how are you telling the tank to fill? From gui like put cell in slot and it gets eaten up? Then when you eat it up do the tank#.fill(..). To get the master tile just do world#.getTileEntity(x, y, z) and, if you are sure it's a master tile entity, cast MasterTile to it: MasterTile tile2 = (MasterTile) world.get... Just do some math for the height (tileValve#.y-tileMaster#.y>6 then A, else if >4 then B, else if >2 then C...)
  10. I believe there are a couple of methods for automation (like can input and extract from side). In the tile entities of those blocks override the method that does that and set it to refer to a specific tank in the master.
  11. What do you mean you "can't" see any more replies? We need breaks from time to time
  12. Oh, I see your problem (I think, because it's weird it doesn't break earlier), but you are getting renderer using forge getInstance(), but to have the world set you need the other constructor, the one with the parameter world (IBlockAccess to be exact). So just initialize it somewhere else and pass the world object as argument. Bye!
  13. You mean strike lightnings around it? There must be a method to do that. If you mean like Thaumcraft shock wand focus then it's a problem...
  14. each tank is separate, so just tank1.fill(..) for each one (to fill each one of them). You can choose which tank to fill based on the side and the fluid in input too. Rember doFill=true if you want to perform the action!
  15. Try to go in Block and put a breakpoint in line 612 and check what is null there (either the world or the coordinates, but they should really be valid because many other methods use those before). In Eclipse it's just number of the line->right click->toggle breakpoint and then run in debug mode. While in debug perspective you should see to your left some buttons like variables and breakpoints.
  16. path.listFiles() probably return an array of 2 elements, but mind that you count from 0 when using arrays (or in programming in general), so filesList[0] and filesList[1] get you the first and second elements. That might not be the whole problem though, because I suppose the error would have been IndexOutOfBoundsException, not NullPointerException. Are you sure the exception raises only on filesList[2]?
  17. for (int i=-4;i<=0;i++) do... it means in range -4 to 0 included (so -4, -3, -2, -1, 0). Same for [0;4] from 0 to 4 included (by the way, ]0;4[ would mean excluded)
  18. for x1, y1, z1 [-4;0] getBlock. if block==... then isMultiBlock(x+x1, y+y1, z+z1); //if the corner were further then this block wouldn't be in the structure anyway isMultiBlock(x, y, z) { for x1, y1, z1 [0;4] {block = getBlock(x+x1, y+y1, z+z1); if (inside&&block!=air||corner&&block!=yours) return false; } formMultiBlock(x, y, z);//do the things return true; }
  19. With the first (3) for loops, the ones from -4 to 0. if block is valid then check assuming it is left bottom corner
  20. Ok. You will need a function that checks if multiblock structure is valid and that eventually makes it setting the metadata values and activating some tile entities maybe. That would be called from onBlockActivated. You will also need a breakMultiblock method that is called when you do something like breaking a block that is part of the structure. For some code to check if multiblock structure is valid you must be either creative or copy from some tutorials on the net. I suggest something like 3 nested for loops from -4 to 0 and check every block: if it's valid (metadata==0 so not already part of multiblock and block==yourBlock) the consider it the bottom left left corner and perform a check (like 3 more nested for loops 0-4 and, if one of the variables is 0 or 4, then you are in a face/edge/corner => must be yourblock and metadata==0, else must be air block). If returns false then just keep on looping. Else found multiblock at coords of the bottom left left corner x,y,z and call a method to set metadata (like 1 for corner, 2 for edge and 3 for face, just base on the variables of the for loops and see if the are the min or the max) and, I suggest, set all the tile entities of the blocks to refer to a master block (like the center bottom one) doing something like coords of bottom left left corner + 2 on x and z and that is the master. Every other tile entity will send every request to that tile. Now make sure that onBlockActivated does that only if metadata==0, else open some kind of gui or whatever sending the request like this: ((MultiBlockTile)world.getTileEntity(x, y, z)).getMasterBlock().doWhateverYouWant(). getMasterBlock gets the tile entity from the same world of the one you clicked but with the saved (also in NBT!!) coordinates. Last but not least in your onBlockDestroyed (might be another name) if your block has metadata>0 than get the tile entity, get the master and from those coords (might be useful to shift x and z back 2 so that you can use the same algorithm of the create method) break the multiblock setting metadata=0 and tileEntity master=null or something. Don't necessarely wipe out all the data from the master, just delete all references to it for the time being. That will allow players to change every other block in the structure (swap blocks for others like tank valve for gauge) and not lose all the honey..I mean data . Of course, if you attach a custom tileEntitySpecialRenderer to your tiles and, based on metadata or something, do some magic rendering that would be the best Post again if you have more questions
  21. Actually, I got it wrong. The server overrides the client. Always. Unless, before that happens, you send that packet using those 2 methods to update the server before it can override the client. If the pipes are wrong in the client, they are either wrong in the server too or the custom renderer is doing something wrong (maybe using old data saved in a field instead of grabbing new one each tick? That would not be really good practice anyway, at least if it's just a intArray).
  22. It depends on what you want to get. There is no cookbook ready to use because you can have various multiblock structures. Do you have a shape for your multiblock or does it need to change a lot (like irregular shapes, far from cuboids)? Moreover, do you have a particular block that is like a "masterpiece" (like ars magica has that key block for the portals and the altar) or, like railcraft, it's just blocks from your mod that are used specifically for that purpose? Do you want to allow multiple multiblocks of the same type side by side? Besides, is the multiblock formed on some event (right click of a valve like good old XYcraft tanks)?. The key to make it is considering exactly what you want and find common schemes present in each one. Give me a general idea and I'll come up with something. Bye! PS: please, don't tell me you want a totally irregular one, I made one (the first and only multiblock I ever made), but they are crazy. Basically it would keep looking for adiacent blocks until it found valid ones and then save all the coords. Fun times when it comes to break such a thing..
  23. When you form the multiblock, look (once only) for the master block and save the coords on every other fetch tile entity (every other block in the multiblock). Don't initialize not-static field outside of a method!
  24. Hang on, if it's just a tile entity sync issue this should fix it (as long as Write and Read NBT are complete). Put these in your tile entity @Override public Packet getDescriptionPacket() {//sends packet Packet packet = super.getDescriptionPacket(); NBTTagCompound tag = packet != null ? ((S35PacketUpdateTileEntity)packet).func_148857_g() : new NBTTagCompound(); writeToNBT(tag); return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 1, tag); } @Override public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {//receives the packet super.onDataPacket(net, pkt); NBTTagCompound tag = pkt.func_148857_g(); readFromNBT(tag); }
  25. Does breakConnection run smoothly or you get some weird behaviour? Also, in breakAllConnections getTarget returns an object with x, y, z of the pipe this pipe connects to, right? connections.contains might be a problem, because I believe it uses equals to check if they are the same object, and they might not be for some reason. Either overwrite equals for PipeDirection or check for the coordinates individually (I suggest last one).
×
×
  • Create New...

Important Information

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