Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Cadiboo

Members
  • Posts

    3624
  • Joined

  • Last visited

  • Days Won

    58

Posts posted by Cadiboo

  1. IBlockReader#getBlockState(new BlockPos(entity.getPosX(), (Math.ceil(entity.getPosY()) - 1), entity.getPosZ()).getBlock().getClass();

    With the current mappings this is

    IBlockReader#getBlockState(new BlockPos(entity.func_226277_ct_(), (Math.ceil(entity.func_226278_cu_()) - 1), entity.func_226281_cx_())).getBlock().getClass();

    The Math.ceil(y) - 1 is to ensure that you get the block that you're standing on, not the block below (So if you're standing on a carpet/trapdoor you'll get that block rather than the block under it)

  2. On 1/18/2020 at 11:09 PM, Ugdhar said:

    Honestly not 100% sure the reasoning, but everyone that knows what they're doing on here says not to

    What: Not using static initialisers.
    Why: Using static initialisers does not allow you to control when your objects are created or the order in which your objects are created.
    Consequences: Using static initialisers prevents other mods from overriding your objects, prevents forge from being able to dynamically load/unload mods and can cause weird, unreproducible crashes.
    How: Use the @ObjectHolder annotation if you need static references to your objects and create & register your objects in the appropriate registry event. (Note: before registry events Modders created and registered their items in preInit. This practice became out of date in 1.7 with the introduction of registry events, and is no longer possible in 1.13).


    If you have a creative tab that uses an item for its icon & that item references that creative tab in its constructor, and both use static initialisers, they both depend on the other being loaded first to function properly. So whichever one actually gets loaded first will cause the other one to get loaded & the other one will use a null reference to the initial one. Since you don’t control the order in which classes are initialised this means that either the item or the creative tab will have a null creative tab/icon and you don’t know which it will be. This causes hard to track down bugs (if you don’t know about this behaviour as it will compile fine).

    Related: (trying to find SO article about how 3 classes that depend on eachother for a value will have the runtime value depend on the order in which they are loaded, will edit this to add the article if I find it)

    • Thanks 1
  3. If you don't have a workspace, set one up. (Docs currently out of date, updated ones here (Includes much needed info about Launch/Run Configs)) (More comprehensive tutorial here, read all chapters up to and including 1.3)

    If you don't have a basic mod, make one. (Docs currently out of date, updated ones here (Info about @Mod and mods.toml))

    Subscribe to the LivingHurtEvent and check if the entity from the event (LivingEvent#getEntityLiving()) is an instanceof PlayerEntity. If it is, are call Entity#sendMessage with a StringTextComponent with "You have been hurted" (or TranslationTextComponent with a translation key) as the parameter.

  4. 2 hours ago, diesieben07 said:

    Anyone who is willing to make a pull request to update the modern version of Forge Gradle to support the older Minecraft versions is welcome to do so.

    Someone told me that a fix for this was

    > update to latest forge mdk

    > replace the gradle.jar with the 1.8 gradle.jar

    > http turns into https

    1 hour ago, RobinCirex said:

    Okay, is there any way to build a project without the use of gradle? That would really save me

    No

  5. 54 minutes ago, Nuparu00 said:

    One of the arguments the method takes is of type MatrixStack. I suppose it is used to calculate positions and rotations of the horizon and celestial objects.

    All rendering is now deferred (theoretically) so MatrixStack is the replacement for GL calls that modify the matrix like push, pop, rotate, translate and scale.

    55 minutes ago, Nuparu00 said:

    I do not know where should I get an instance of MatrixStack. It seems that it is created and passed from inside a method and is not stored in any field. Do you have any tips? Or is this just something that will be solved in the stable release?

    See https://github.com/MinecraftForge/MinecraftForge/pull/6444

  6. 7 hours ago, transfarmer said:

    Currently, I handle packets sent to a client and packets sent to the server inside the same function, separated by a check on FMLEnvironment.dist. Is this correct?

    Uh, show your code please.

    Heres a request packet (client -> server). I register it here. Remember to mark it as handled.

    Heres is the response packet (server -> client). I register it here.

    Also take a look at this post

     

  7. 10 hours ago, DragonITA said:

    Did your entity have an OBJ file or a normal Json file?

    My entity had 3 json models. But json, obj & b3d models all get turned into the same BakedModels for rendering so it doesn't matter.

    10 hours ago, DragonITA said:

    How did you do it if your entity had an OBJ Model? Or did you just do it with a Classic Java file?

    I did it by loading the models, loading & stitching their textures, baking the models and then rendering them in my renderer.

    • Thanks 1
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.