Jump to content

DavidM

Members
  • Posts

    1830
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by DavidM

  1. On 6/25/2020 at 11:08 PM, winnetrie said:

    On fabric they say : forge is old and laggy. Fabric is new and shiny.

    If someone benchmarks a clean Forge install and a Fabric install, then the performance might be a tiny bit (not even noticeable) better on Fabric's side due to its lightweight.

    However such result is not conclusive, as Forge does a lot more (event system, utils, etc) than Fabric. Try benchmarking both API with 100+ mods and Forge API will manifest its advantage.

    Judging APIs solely for its performance is like comparing Tetris to a first person shooter game. "Hey Tetris uses up less RAM and CPU so it is much better than the FPS game!"

     

    But yeah, people might prefer Fabric if all they want is to add a simple tweak/mod to the game. At the end of the day, it is really up to the user and his/her use case.

    • Like 1
  2. 4 hours ago, Mr Bonobo said:

    Thank you for replies, I made it static and thought its the way to go because only example I stumbled upon on the internet (atleast as new forge versions goes) about packets, handling and creating was with Static Itemhandler on packet class (which is as bad as Static BlockPos if I understood it correctly?)

    The packet handler method can be static, as it does not depend on a handler instance (unlike 1.12.2 and before).

     

     

  3. 1 hour ago, diesieben07 said:

    What for? What's the purpose of this? The server.properties is mostly to control things on the server that you control using menus on the client...

    I think OP wants to make a mod that makes the port static (that is the function from the end-user perspective). It might be useful in that the LAN host does not need to tell other players the port number every time the LAN game starts (i.e. on a large campus, students might not be in the same room and thus have difficulties contacting each other).

     

    @yazigegeda Changing that is not going to be a simple task. Your options are either 1) replace the button and replace the IntegratedServer with a custom implementation or 2) use a coremod, which is not supported on these forums.

  4. Using the right click event is way easier and less destructive than your current approach.

    Replacing vanilla items should only be done if there are no other ways.

     

    There is a block pos as well as a direction in the event IIRC, so no ray tracing is required.

  5. I haven't used Fabric before, but from what I've heard:

    Forge uses an event driven system. Fabric (IIRC) treats all mods as coremods (mixins).

    This makes Fabric significantly more lightweight than Forge,  and therefore quicker to develop and update. I wouldn't be surprised if a Forge update's workload is more than 10 times the workload of a Fabric update.

    However, since Fabric mods use mixins, it is very easy to cause incompatibilities between mods (think of Forge coremods), while Forge's event system can theoretically supports infinite amount of mods.

     

    Apart from that, Forge has a much bigger user base than Fabric, therefore the Forge team has to respond to more PRs and issues. I imagine this to be very time consuming.

    • Like 1
  6. 40 minutes ago, Mr Bonobo said:

    i was using c++ previously, so static and non-static members are kinda new for me

    Static in Java is almost exactly like in C++, except for two points (that I can think of):

    1. It does not denote the localness of a header member.

    2. It cannot be used on a local variable to associate it with the static storage area (as opposed to stack).

  7. 28 minutes ago, Mr Bonobo said:

    And im pretty sure,that BlocPos value isnt a problem, because it worked when everything was static.

    It does not. It might appear to be working for you as you either tested it in single player, did an inconclusive test, or got lucky, but making it static is fundamentally broken as it goes against the packet system. In your case, as soon as another packet is constructed in the same JVM before a previous packet is sent, the whole thing breaks.

     

    You should not make something "static" just because "I have no idea what the error means; let me just randomly change something and hope it will work"; instead, static should only be used if you want to make something class-specific (probably not the proper definition).

     

    32 minutes ago, Mr Bonobo said:

    (static values are initialized in both sides, even if I assigned value on server side)

    That is only the case if you are playing on a client distribution, where the two sides exist in the same virtual machine. You should never rely on this, as it will break immediately once the mod is installed on the server distribution.

     

    28 minutes ago, Mr Bonobo said:

    because it worked when everything was static.

    Please elaborate. What doesn't work? What is the error it is giving you? There is no concept of "static class" (unless you meant a static subclass, which doesn't seem to be the case here).

  8. 7 hours ago, DevTech said:
    
    event.getPlayer().getHeldItem(event.getHand()).damageItem(1, event.getPlayer(), Consumer -> {
                event.getPlayer().sendBreakAnimation(event.getHand());

    I would suggest to not post copy-passable code without explaining them, as others might copy it and not understand what it does :)

     

    The consumer is invoked if the item breaks due to that damageItem (aka. if the durability is 0). In the example DevTech provided above, the server will tell the client to play the item breaking animation if the item breaks.

  9. 1 hour ago, Mr Bonobo said:

    Error java.lang.IllegalArgumentException: Registration of network channels is locked

    You are registering your packets in the wrong place. Where are you registering your packets (when non-static)?

     

    1 hour ago, Mr Bonobo said:

    private static BlockPos blockPos;

    That is not going to work. Packets are not singletons.

    A packet is constructed per sending/receiving, and therefore the block pos needs to be an attribute (property?) of the packet object.

  10. Honestly I would say having so many units would be confusing to new players (and some old players).

    I don't see how remembering ounces, nuggets, voxels and the conversions between them is easier than "144mb an ingot, 1000mb a bucket".

    Without a unified measurement (mB), some modders may start to favor certain units over the others, or invent their own units based on atoms, causing more confusion in the system.

    • Like 1
  11. 6 hours ago, Kriptarus said:

    I researched for TileEntity and ITickableTileEntity, and i made it work with my custom block.

     

    But i still trying to update textures, properties, redstone power, ligth according some conditions.
    I was thinking in use TileEntityRender, is that the only option? Is there some simple examples using it?

     

     

    You do not need TESR if the conditions are trivial (i.e. redstone power, light, etc). Check out block state properties and model variants.

    You might also want to look at vanilla redstone lamp or fence for examples.

  12. 49 minutes ago, carlob said:

    Thanks, I took a look, but I don't know programming, think there were tools that did these steps

    Minecraft modding is programming in Java. If you don’t want to learn modding/programming but still want to add stuff into the game, there are mods like Content Tweaker that do that.

×
×
  • Create New...

Important Information

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