Jump to content

V0idWa1k3r

Members
  • Posts

    1773
  • Joined

  • Last visited

  • Days Won

    61

Posts posted by V0idWa1k3r

  1. Your errorlog doesn't match your code at all.

    As for the code you've provided:

     

    Don't extend Gui on your event handler class, that makes no sense. 

    The resourcelocation currently points to assets/minecraft/vezythieme/vezy.png.

    if (e.getType() != null) {
                if (e.getType() == ElementType.TEXT) 

    The first check is redundant. If the type is TEXT it can't be null.

    RenderGameOverlayEvent is a parent class for Pre and Post events. Pick the one you need.

     

    However that doesn't matter since your error log indicates that the code you are using is completely different.

    Make sure the file is actually there. Check that it isn't test.png.png or something like that, check that eclipse isn't being a derp and is actually including your resources, etc. 

    A screenshot of the file in your folder structure would also help.

    • Like 1
  2. 3 hours ago, Cadiboo said:

    They are also the only solution (aside from ASM) to definalise a Class/Field/Method.

    This is not entirely true.

    https://stackoverflow.com/questions/3301635/change-private-static-final-field-using-java-reflection

    In fact I am pretty sure I saw similar code in forge at some point.

    Doing this is not a good idea though.

     

    3 hours ago, Cadiboo said:

    In some cases they are. They are better when you have a private/protected/package private Field that you want to get/set or you have a private/protected/package private Class that you want to access.

     

    "In some cases they are better than reflection. That is in ALL of access cases."

    There is nothing wrong with using reflection and you should prefer reflection to ATs in most cases IMO. Use ATs if your reflective operation is too expensive(eg. called multiple times a frame).

  3. As I've said

    On 5/31/2019 at 12:03 AM, V0idWa1k3r said:

    With the current parameters you are passing to the method the game would look for your textures in assets/modid/horse_armor_wood.

    Your file isn't horse_armor_wood. It's horse_armor_wood.png(I presume anyway since you have file extensions hidden it may be any other image extension - and it has an image extension because it has an image thumbnail).

     

    • Thanks 1
  4. 6 minutes ago, PhilipChonacky said:

     new Item (new ItemBlock (new Block() , new Properties())...

    This would not work since new Block() != new Block(). You must pass the same object to the ItemBlock that you have registered, not an identical one.

     

    6 minutes ago, PhilipChonacky said:

    That brings up the challenge of how I would pass the requisite ItemBlocks to the Item registry

    https://mcforge.readthedocs.io/en/1.13.x/concepts/registries/#injecting-registry-values-into-fields

  5. 19 minutes ago, PhilipChonacky said:

    ...as to the other issue: Are you implying I should register in the same classes where I initialize (after making non-static)? or just use non-static fields for my entries?

     

    Instantinate in the registry event.

    event.registerAll(new BlockA(), new BlockB(), new Block(Material.IRON).setRegistryName(...), new ...)

     

    19 minutes ago, PhilipChonacky said:

    It looks like my issue was I hadn't refreshed the assets folder in my IDE (eclipse) after making changes to the JSON files - it works now. 

     

    One of the many reasons I chose a different IDE...

  6. Your system will not work.

    Registry entries MUST be instantinated in the appropriate registry event, now more than ever. Don't ever use static inializers for registry entries. Rework this right now, before it gets too big.

    You will also make your code much more readable and will write way less code.

     

    The code in your repository doesn't match the code you've posted.

    So yeah, fix the static initializer issue first, then I can debug your repository.

  7. The title of your post suggests you are using 1.14.2. Please clarify what version are you actually using. And whether you are using forge at all.

     

    5 minutes ago, Ywes said:

    and your Model .json file

    This has nothing to do with the model file of either of the blocks. OP just needs to override Block#isFullCube and Block#isOpaqueCube to return false.

  8. https://github.com/JGgithub2018/Simple-Batteries/blob/master/src/main/java/jgcodes/sb/SimpleBatteries.java#L24

    A common proxy makes no sense. Proxies exist to separate sided-only code. If your code is common then it goes anywhere else but the proxy.

     

    https://github.com/JGgithub2018/Simple-Batteries/blob/master/src/main/java/jgcodes/sb/content/ModBlocks.java#L15

    1. Don't ever use static initializers for registry entries. They must be instantinated in the appropriate registry event.
    2. This is not how ObjectHolders are used. ObjectHolders inject values into fields.

    https://github.com/JGgithub2018/Simple-Batteries/blob/master/src/main/java/jgcodes/sb/proxy/CommonProxy.java#L21

    Your proxy can't be an event handler since it will load the class and crash the game.

     

    https://github.com/JGgithub2018/Simple-Batteries/blob/master/src/main/java/jgcodes/sb/content/blocks/BlockBase.java

    Don't do XBase. There is already a BlockBase, it's called Block. Do not abuse inheritance.

     

    Your issue is caused by you not setting the registry name for your blocks/items. You need to set the registry name before registering them.

  9. LivingAttackEvent allows you to cancel the damage alltogether, with the effects.

    If you want to only cancel the effects then it's more tricky. You would need to use a tick handler and basically do the reverse of what the EntityLivingBase#attackEntityFrom does to the entity that took damage that you caught in this event.

  10. A supplier would just give you a thing every time you asked it for one. In most cases it would be a new instance of said thing.

    A LazyWhatever would work in this way when asked for a thing - it would check if it has initialized it, if not it would do so, and then return the thing stored in it, thus only initializing/evaluating it once. Lazy is usually used for expensive operations that should only be done once.

  11. If it's a soft dependency then nothing changed apart from Loader.isModLoaded => ModList.get().isLoaded()

    A hard dependency would be defined in your mods.toml file. There are already 2 examples of that in a default mods.toml provided by the example mod.

  12. 2 hours ago, PapaVinny said:

    - One that sends damage from the player to an entity within hitting distance(weapon dmg considered).

     

    LivingHurtEvent, LivingDamageEvent, etc. Check for the distance and the source yourselves.

     

    2 hours ago, PapaVinny said:

     - One that prevents the player from swinging on click/tick, maybe an event to cancel???

     

    I am not sure there is such an event. You could still use one of the damage events to cancel the damage and just reset the cooldown/animation.

  13. https://github.com/GloriousAlpaca/Leer/blob/master/Void Mod/src/main/java/mod/leer/network/VoidcomReturnMessage.java#L63

    Well, you are returning the same packet as a response packet to send back, which will return itself as a response packet to send back ....... rince, repeat and you have a memory leak. Return null if you don't want to send a response packet.

     

    https://github.com/GloriousAlpaca/Leer/blob/master/Void Mod/src/main/java/mod/leer/network/VoidcomReturnMessage.java#L62

    You can't do this. Minecraft is a client only class and as such this code will crash the server.

     

    https://github.com/GloriousAlpaca/Leer/blob/master/Void Mod/src/main/java/mod/leer/network/VoidcomReturnMessage.java#L66

    But WHY if you are the owner of these classes? Why would you use reflection on your own classes when you can just create a setter?

×
×
  • Create New...

Important Information

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