Jump to content

DarkGuardsman

Forge Modder
  • Posts

    1479
  • Joined

  • Last visited

Posts posted by DarkGuardsman

  1. I'm doing a quick survey on how other devs use onBlockDestroyedByExplosion in there own work.

     

    Who am I

    I'm the current owner/developer of ICBM and head developer for Universal Electricity modding organization.

     

    Why the survey

        I've been making an effort to reach out to more devs before assuming things. This way my work is well supported, handles how each dev does there own work, and is very flexable. In this case i'm working on increasing the functionality of the original ICBM mod while rewriting it from the ground up.

     

    How to answer the survey

        Give the use case a quick name followed by what happens. Keep it short and generic so it can be applied to any block out side your own work. You do not need to explain why you code your block with the use in mind. Instead just say what the block does when the method is called and any related logic after the call.

     

      Your are not required to but feel free to list the mod, block/tile, and example code. This way other devs can use this thread to understand the same thing i'm working on. Mod name and blocks will only be used to compile a list per use case. Code will not be used without your permission and it is advised to list the code's copy right if it has one.

     

    [h2]Use Cases[/h2]

        A use case is  a unique example of how something will work or be used. For those that have never used them they are widely used to help design how code will work. Mainly to plan out every realistic action the code should support. In this case the action is triggered by the block being removed by an explosion with or without item drops.

     

        Each case is either unique or a sub case of generic use case. While all uses cases are nice there is also a list of use cases that will end up being blocked. This is to prevent issue that most player do not like to see in mods. Mainly duplication of items and crashes due to assumptions made when creating blocks.

     

    #1 Event Trigger

    Any event fired to let other mods, blocks, entities, or object know the block has been destroyed. Example of this are mods that need the event to trigger an action for cleanup. Another example is an entity linked to the block that may be removed if the block is gone.

     

    #2 Blow up

    Explosive like blocks that trigger more removal of blocks. Example of these blocks are Minecraft's TNT, explosive+, icbm, and resonant induction's reactors.

     

    #3 Visual Effects

    Blocks that create effect when they are removed. For example generating particles of smoke or pixel to indicate the block is done.

     

    #4 Block Placement

    Blocks that turn into another block when destroyed by an explosive. Example of this are glass to glass fragments, stone bricks to cracked stone bricks, stone to cobble stone, or wood to mulch.

     

    #5 Unique Item Drops

    Blocks that drop special items when destroyed by explosives. A few mods do this to gain crafting items as an extra step in getting high level blocks.

     

    #5 Normal Item Drops

    Blocks that drop items or call the dropItem method when remove by explosives. In which the same items are drop as if it was removed by a player. This is actually something a block should never do as most explosives will call the dropItem method. This way result in duplicated items as a future warning to other devs. If any dev does this in there code they need to ensure that the dropItem method doesn't drop blocks as well. This can be done by adding a location based boolean HashMap<Vec3, boolean> or List<Vec3>

     

    #6 Fragment Effects

    Any block that creates entity projectiles to harm entities around the block. Examples are ICBM's explosives that turn blocks into shrapnel and generate shrapnel entities drop the explosive block.

     

    #7 Spawn Entity

    Blocks that create new entities when destroyed. I'm unsure of example of this as its not commonly done. However, depending on the entity i may skip calling the destroy method to save memory creating the entity. As the explosive can cause 1 to 1/2 Million points of damage to any entity it finds after destroying all blocks.

     

    #8 Mutliblocks

    Not entirely related to the method call but it is useful to know if a multiblock system will cause issues. I've run into several examples of mods assuming blocks exist. For example a mutliblock barrel/crate mod that uses vec3 to find its core block. In which it never checked if the tile exists but just cast right away to its assumed type. Causing both NPE and can't cast exceptions.

     

  2. Without actually reading threw your code it should be as simple as making a list, shuffling the list, and then pulling out a random item from the list. You'll want to store either new Entity instances or classes in the list. Then do the rest after getting a valid Entity from the list.

  3. I've been running a server for a while and have never run into this issue before. As well the company i rent the server threw(fragnet) has never seen this error can't help me more. I've done 2 clean installs of my server to try to resolve this issue as well other normal error resolution when it comes to mods. Nothing seem to work and since i'm running forge i though to ask here.

     

    Details

    *MC 1.5.1 Forge 7.7.1.615 & 687

    *Server is virtual and managed by McMyAdmin

    *Error with and without mods

    *Used both normal client and technic Launcher

    *Server IP: 108.174.48.205

    *Server modpack threw technic http://www.technicpack.net/api/modpack/built-broken-server-pack

     

    Recent Changes

    Added: Modular force field system

    Added: Flan's Planes

    Added: Enjin_Minecraft_Plugin

    Updated: Assembly Line and Fluid Mechanics

    which both i code so there not the issue since i use

    the custom packet payload(ID 250 if i'm correct)

     

    Error log

    2013-06-10 19:21:12 [iNFO] [sTDERR] java.io.IOException: Bad packet id 86
    2013-06-10 19:21:12 [iNFO] [sTDERR] 	at net.minecraft.network.packet.Packet.func_73272_a(Packet.java:153)
    2013-06-10 19:21:12 [iNFO] [sTDERR] 	at net.minecraft.network.TcpConnection.func_74447_i(TcpConnection.java:327)
    2013-06-10 19:21:12 [iNFO] [sTDERR] 	at net.minecraft.network.TcpConnection.func_74450_c(TcpConnection.java:547)
    2013-06-10 19:21:12 [iNFO] [sTDERR] 	at net.minecraft.network.TcpReaderThread.run(SourceFile:94)
    

     

    Mod list

    *sorry its a pic but i need to get back to work

    http://puu.sh/3cVi0.png

    Its the same on the server just without the mini-map mod and the server as well has the Enjin_Minecraft_Plugin for forge.

  4. Forge build 660+

    This is the strangest error i've gotten and i have no clue how to fix it. When my dev environment crashes i don't get a stack trace but rather a crash when it tries to make one. I've tried several version of forge between 650-674. I've re-install mcp, eclipse, java tested with and without mod code. In debug it will crash with the error bellow or a memory leak.

     

    http://pastebin.com/zMhrZUHB

     

    If you need anymore info i can give a setup of my dev environment and how i use it.

  5. Forge build 660+

    This is the strangest error i've gotten and i have no clue how to fix it. When my dev environment crashes i don't get a stack trace but rather a crash when it tries to make one. I've tried several version of forge between 650-674. I've re-install mcp, eclipse, java tested with and without mod code. In debug it will crash with the error bellow or a memory leak.

     

    http://pastebin.com/zMhrZUHB

     

    If you need anymore info i can give a setup of my dev environment and how i use it.

  6. Create a player handler that keeps track of each player. Then when a player is told to follow have the handler take over movement for the player. In which you'll have to tell it to change direction, and velocity.

     

    I would tell you more but i've not made a player handler myself. As for changing the direction and velocity you need to get the player and simple tell it to rotate X degrees and increase or decrease by X velocity.

     

    look at a few things in here for some help. This mod manages the player to provide jump, fly, and run assist. https://github.com/MachineMuse/MachineMusePowersuits/tree/master/src/minecraft/net/machinemuse/powersuits

  7. Save it to the world's NBT?

    i'm trying to avoid saving to a custom NBT file. Really want to see if i can just save to the player first though i'm already working on a backup plan.

     

    You could just keep a server side HashMap. You wouldn't really need to save it either if you do it right, do a redundancy system, where info is stored to the player and the map, and if either is null, restore with what the other has. This would allow you to get away with not actually saving the mapped data entirely.

    I have yet to use a hashMap in programming but good idea to have a way to check to make sure the data matches. I might make a system after i'm done to catch cheating/hacks to cause players stats to go up. However, i do need to save since i will be copying data between servers. 

  8. might want to think about sending a packet to all client in the area of the sign saying its being edited. That might solve some issues. Another would be to create an event handler to store server side who is editing which sign. Third create a new gui that on every key pressed sends a packet to the server causing the sign to update. This way several people can edit it and see the changes in progress.

  9. The problem is that ALL the GameRegistry that I did like the GameRegistry.registerBlock, the LanguageRegistry.addName, and the GameRegistry.addRecipe does not work ! I have a serious problem because it's for a server... (I'll all put that on Bukkit...)

    hmm might want to link your code using paste bin or github so i can try to help your future. However, by the sound of it you messed up your main class file. Might want to use forge tuts to check your code over.

  10. a cool trick would be to override iron ore in the blockList and let minecraft gen your ore in iron ores place. This would cause already generated ore to become your ore as well as new ores.

    int i = Block.glass.blockID;//get the blocks id
    Block.blocksList[i] = null;    //set the block to null in the block list
    Block BlockGlass = new net.minecraft.src.GSM.BlockGlass(20);//let modloader replace block slot 20 with yours
    

  11. I have a few mods i've been developing for keep player scores and simple data like home teleport locations. The issue i'm having is the data saved to the player is lost when the player dies. For something this is not so bad however for my kill and death counters this kills things. The only thing i can think of at the moment, which i'm trying out, is to catch the player's data before death, store, and then resave it. This most likely will work however is a bit around the issue and will break down the road.

  12. you need to set the creative tab for your block then add it to the creative list.

    Use this as an example https://github.com/DarkGuardsman/BasicUtilities/blob/master/common/dark/BasicUtilities/ItemParts.java

    You want

    this.setCreativeTab(CreativeTabs.tabMaterials);

    and this, though it might be diffrent for Block.class

      @Override
        public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
        {
          
                par3List.add(new ItemStack(this, 1, meta));
        }

×
×
  • Create New...

Important Information

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