Jump to content

mnn

Members
  • Posts

    298
  • Joined

  • Last visited

Everything posted by mnn

  1. you can check out these source files (it's a simple decorative block): https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/block/BlockColumn.java https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/TileEntityColumnRenderer.java https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/ClientProxy.java#L39 https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/ModelColumn.java the model class comes from Techne with just few modifications (if I remember correctly setRotationAngles and render methods). ^source code is working, but some things may be redundant or not done the best way (like manual creation of TE by block).
  2. Well, you'd use it on every place where you need value of your custom "variable" (to be precise it should be called field) - e.g. when rendering mana bar you'd pull from player's entity NBT compound from that persistent compound and from that probably integer with actual mana status so you could draw it on player's screen (it should be probably cached, because accessing NBT every frame seems a bit demanding). Something about NBT is on the wiki - http://www.minecraftforge.net/wiki/How_to_use_NBT_Tag_Compound. NBT is saved only on server side so you need to handle synchronization of your custom data, probably using watchers in entity itself (for integers, inventory is I believe synchronized using the container with gui). I don't know what you mean by this O_o.
  3. You cannot (unless using some crazy hacky stuff) "go back into same method", there are no super easy magical waiting methods which automaticly fork program execution into two ways and at a same time not break the game. But (as I said above) you can use similar approach as event list has. You'll mark into a calendar that in 10 ticks from now it should do something = remove fire. In tick handler you every tick move to a next item in a calendar and look if anything is planned to happen (like extinguish those 30 fires). The upside of this solution is that you don't every tick decrease counters of all events that are planned to happen (like extinguishing all 30 fire blocks). I know my English is far from perfect. I'm sorry, I don't think I can describe it more clearly...
  4. you can use NBT and the persistant tag - http://www.minecraftforge.net/forum/index.php/topic,5483.msg29791.html#msg29791.
  5. for higher depths surely. for anyone interested read the wiki - https://en.wikipedia.org/wiki/Flood_fill#Alternative_implementations (and as said use queue not stack - with queue it should behave like BFS, with stack probably like DFS).
  6. if I were you I would try asking either on their forum or irc channel .
  7. this is not how strings should be compared! http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java I believe it's just URL, so you put there something like "http://www.anirudh.net/courses/cse585/project2/results_runs/images/lenna.gif" (e.g. link to a picture on imageshack).
  8. it's not supposed to read saved data on a client side (well, how it could, when saves are on a server..), it's server responsibility to send status of world to the client. relevant threads: http://www.minecraftforge.net/forum/index.php?topic=2432.0 (read all posts) http://www.minecraftforge.net/forum/index.php/topic,4991.0.html
  9. you ended up with weirdly much code , try using loops. maybe something like this?: floodFill(World w, int x, int y, int z, EntityPlayer p, int depth){ // if(depth > 50) return; for(int sx=-1;sx<=1;sx++){ for(int sy=-1;sy<=1;sy++){ for(int sz=-1;sz<=1;sz++){ int nx=x+sx, ny=y+sy, nz=z+sz; if(w.getBlockMaterial(nx, ny, nz) == Material.wood){ doEntityDropAndDestroyBlock(p, w, nx, ny, nz); w.setBlock(nx, ny, nz, 0); floodFill(w,nx, ny, nz,p,depth + 1); } } } } } //
  10. I'll try write it in pseudo-code: void floodFill(coordinates c, int depth){ if depth > 50 then return; for each neighbour{ if neighbour is blockIron{ floodFill(neighbour's coords, depth+1); } } // iron block processing replace block at my coordinates (param c) } and this method would be called with coordinates of the first iron block (in real implementation you'll probably need more parameters to do the replacement, like passing an instance of World) and zero depth.
  11. https://en.wikipedia.org/wiki/Flood_fill ? if you'll implemented it using recursion don't forget to add a limit or it can crash when recursion goes to deep .
  12. It is possible, you just implement a class extending GuiScreen and then show it (on a client-side) by FMLCommonHandler.instance().showGuiScreen(new YourGui()); . (As usual you have to use custom packets to synchronize stuff between client and server). here's working example: gui - https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/GuiSpawnStone.java opening - https://github.com/mnn/jaffas/blob/master/src/minecraft/monnef/jaffas/food/client/ClientProxy.java#L69
  13. I don't think your solution is compatible with mods like NEI (mine partially is, if a player is in creative and spawns an item it should work), but your approach is definitely less resource demanding (no special NBT is saved, no NBT testing is done on update).
  14. It still has "damage" component, but it's used for identifying sub-items [field itemDamage in ItemStack]. I think you'd have to save your custom damage to NBT and rewrite item rendering to show this special damage. Or from the other side - you'd have to write your own implementation of sub-items using NBT (so rewrite stuff like getting item name shown to a player, icon).
  15. you could try asking on their forum - http://forum.industrial-craft.net/index.php?page=Board&boardID=69 (or take a look at the API - http://forum.industrial-craft.net/index.php?page=Thread&threadID=3923)
  16. That code snippet is from your packet handler. If you're talking about my code than you're doing something wrong. My handler uses 2 types of packets and each type is strictly either client->server or server->client, so it's not possible to loop infinitely (one is request for update from client, second is update packet for client. on a second one client does not respond, so there can't be a loop).
  17. I don't think so. You can force check if a client has your mod installed (I believe it's done using NetworkMod annotation and clientSideRequired = true). Normal way of running mods is having them on server AND on client as well (of course there are exceptions, like client-only usually affecting rendering stuff like optifine or map mods and server-only like backup mods).
  18. Just to be sure, when isRemote is true then the code is running on the client. I'm writing it, because in your code you're sending packet client -> server. But in the incoming packet code is: if(!world.isRemote){ PacketDispatcher.sendPacketToServer(packet); } ~ On a server side if it is a server side you resend same packet to a server? I compared it to mine packet handling and I can't see anything bad (I'm using getEffectiveSide but world object should carry same information). You can take a look (it's functional code): https://github.com/mnn/jaffas/blob/b6b35d87e3a00b2fa36baf297569982a38fd5250/src/minecraft/monnef/jaffas/food/common/SpawnStonePacketUtils.java https://github.com/mnn/jaffas/blob/b6b35d87e3a00b2fa36baf297569982a38fd5250/src/minecraft/monnef/jaffas/food/common/PacketHandler.java
  19. I don't have much experience with reflection so it may not be entrirely true what I'm writing. Using relection is not cheap, it doesn't seem right to me to do in every tick when GUI is open. Also you're in every tick creating a new button? And with that button you are rewriting collection with GUI elements? I might be reading it wrong though...
  20. You can try just put your library jar into mods folder. It's not a nice solution, but it worked for me. (FML complained, but it didn't break anything.)
  21. I'm a bit confused, why would you need a "Material" for a crafting recipe? It only describes stuff like this material can burn, be pushed and so on. Looking at the Materail class, it does not have any ID. Could you please describe better your problem?
  22. Opera (11.62), Chrome(23), IE9 - all of them works fine. Only in FF it's broken. I have tried trurning off all addons that can change pages, no success. PS: I tried it in clean FF19 (no addons, new profile) and it still wasn't working. It would seem this site does not support Firefox O_0.
  23. Most (maybe all) javascript on this forum is dead for my Firefox 19. I can't see a toolbar when writing this post, I can't see fancy effects on buttons on top of this page, I had to hack css of this site just to see text in spoiler tags.. I think it might be related to this crash of JS: Timestamp: 23/02/2013 19:39:05 Error: TypeError: b is null Source File: http://ajax.cloudflare.com/cdn-cgi/nexp/abv=4114775854/cloudflare.min.js Line: 22 Any idea what might be causing this (I suppose it's not a bug of this site, but some problem with my browser)?
  24. probably with some sort of queue, each item would have activation time (in ticks, measured maybe from a start of minecraft?) and a collection of fire blocks which would go out (to be precise it would be dimmension id and coordinates, not the actial Block). [something similar to event calendar of discrete simulation - http://en.wikipedia.org/wiki/Discrete_event_simulation#Events_List.] by adding your own fire you're risking incompatibility with mods depending on fire detection.
  25. you have to implement your own tickhandler (implementing interface ITickHandler) and then register it. example of tick handler is here - http://www.minecraftforge.net/wiki/Upgrading_To_Forge_for_1.3.1#Ticking. second one is a server tick handler and that's I believe what you wanted .
×
×
  • Create New...

Important Information

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