Jump to content

Koward

Forge Modder
  • Posts

    141
  • Joined

  • Last visited

Posts posted by Koward

  1. I would like to change the base knockback applied when you punch a mob (without any item). There's no way to change that at the moment. I tried a work around applying a "reverse knockback", but has it depends on random values sometimes the knockback would still happen or only the reverse one, resulting in "pulling" the mob towards the player.

    There are also other mechanics in this method that could be useful for some modders.

  2. Hello,

    I would like to edit the way attack is done in EntityLivingBase#attackEntityFrom(DamageSource source, float amount).

    I could cancel LivingAttackEvent and apply the effects myself, but obviously the return value of attackEntityFrom would always be false which could break many parts of the game.

    If instead of always returning false, we could set the return value via a result of the event, it would allow us that kind of modification.

    So, to quote the doc, instead of "If this event is canceled, the Entity does not take attack damage." it would be "If this event is canceled, no more computation is done. the Entity does not take attack damage. If the result is DENY, the Entity did not take attack damage". A DEFAULT to false would not break existing mods.

     

  3. Well it's a bit hard to help "just like that", all I can recommend you is to watch CPW's video ( https://www.youtube.com/watch?v=yanCpy8p2ZE ) if it's not already done.

    There is already a PR to extend substitution, but it's for 1.10 so this one will not be accepted. You can find it here : https://github.com/MinecraftForge/MinecraftForge/pull/3462

    Maybe there could also be a method in IForgeRegistry<T>, that would feel consistent with the new register events introduced in 1.11.

    But all of this is a bit useless if that bloody bug is left unfixed ><".

    • Like 1
  4. Your problem could still reappear later with your mod. If you register or substitue new items, for example. If it happens try changing the order of registration or try to register placeholder entries.

    I reported this bug with substitution here : https://github.com/MinecraftForge/MinecraftForge/issues/3837

    Note I said 19 in the report, but I think there are other value threshold than can trigger the bug. I have been trying for the last few days to precisely figure out the pattern without much success, but there's definitely one. Your classes&JSON are good and unrelated with this.

    • Like 1
  5. Hello.

    For some months I encounter a bug preventing me from using GameRegistry.addSubstitutionAlias. Since I saw at least some people on this forum got it working, I'm posting hoping to get some help.

    I always substitute things at the Register<Block> event.

    What I do for my Blocks is 

    GameRegistry.addSubstitutionAlias(oldBlock.getRegistryName().toString(), GameRegistry.Type.BLOCK, newBlock.setRegistryName(oldBlock.getRegistryName().getResourcePath()).setUnlocalizedName(oldBlock.getUnlocalizedName().split("\\.")[1]));

     

    Crash log : https://pastebin.com/riFX21WF 

    I'm not sure what could be wrong.

    EDIT : Problem solved. As I was not using the Item object for anything other than the substitution I did not hold it in a static reference, instead creating it directly when passing the parameters of addSubstitution. This probably resulted in two separate instances for each thread and funky times.

  6. 9 minutes ago, Terrails said:

    Basically I can name my energy anything and if I use Forge Energy and if some other mod that uses Forge Energy has some other name for their power. Will those two both work? Naming doesn't matter?

    Imagine you use builtin capabilities made for Forge Energy. You could create in your mod a machine that outputs Forge Energy. If another mod has a machine that receives Forge Energy, it will work with your FE machine too.

     

    Imagine you create new capabilities for your energy, then it will only work with machines made for that energy too.

     

    And that's why when people got the idea "machines from many mods compatible together" they needed a standard. For a long time this standard has been RF, now it's becoming FE.

  7. 8 hours ago, larsgerrits said:

    No. It is entirely up to the mod author to decide whether to use the Forge energy capability or not. LexManos explains it here. Also, RF is not deprecated, it just has not updated yet, and a lot of mods which are "RF compatible" are just calling the Forge energy capability "RF". 

    I do not interpret Lex's message the same way. Of course anyone can use, or not, the Forge capabilities. You can always do whatever energy system you want, that's obvious. But if you want to operate with other mods machine, you have to set a standard. Many energy systems, like RF, were meant to be universal standards, a lot of them proliferated. Now Forge uses its de facto authority to set the new standard.

    If you want your machine to not work with/like Forge Energy machines, you can create your own energy with new capabilities (there are a lot of very good reasons to do that). If you want to do compatible machines that use the same Energy as the majority, you use Forge Energy.

  8. As I said the event is triggered once before all pumpkins are generated in chunk. Not for each pumpkin.

    You have to mimic the way pumpkins are generated.

    In vanilla (note : build 1.10.2 2185, check if it's the same for you, it's in BiomeDecorator.java), that is :

            if (random.nextInt(32) == 0)
            {
                int i5 = random.nextInt(16) + 8;
                int k9 = random.nextInt(16) + 8;
                int j13 = worldIn.getHeight(this.chunkPos.add(i5, 0, k9)).getY() * 2;
    
                if (j13 > 0)
                {
                    int k16 = random.nextInt(j13);
                    (new WorldGenPumpkin()).generate(worldIn, random, this.chunkPos.add(i5, k16, k9));
                }
            }
    

    (Use the random of the Decorate event, else you'll break seeds).

     

    I found this by looking with my IDE where the Decorate event was called, and I saw the one where the type PUMPKIN is checked.

    If you paste this code in your event, vanilla pumpkins will generate. Now if you want something different, you have to create a new WorldGenPumpkin. Just extend it and override the methods you need (probably at least generate() as it's called there).

     

    The pos that's given by the event are coordinates of the chunk (or at least the chunk cross-shaped intersection, but that's the idea). So it's basically a position on a 2D map seen from above, and a y value would be meaningless. That's why y = 0. Anyway you do not need it for pumpkins.

    If you wanted to edit trees that would have been trickier because some data used to calculate them are not passed to the event, but for pumpkins everything seems okay.

  9. I would never have been able to find this, thank you.

    I have a new bug with the grass slab whose color is not correct anymore, but I'm sure that's not as tricky as the previous issue.

    EDIT : fixed by setting the model at the variant level (each time setting block/half_slab). So no dummy needed anymore. Maybe that's why the format requires it ?

  10. That's strange. I can't see any obvious problems with your blockstates file, so I'm not sure why the variants aren't being found. You could try setting some breakpoints in the model loading code to see if you notice anything going wrong.

     

    Could you create a Git repository for your mod (if you haven't already done so) and link it here? I'll try to do some debugging and find the source of the issue.

     

    I have a Github repository here : https://github.com/Koward/BetterWithMods/commits/ground

    (It's a fork, I'm only contributor)

    After the commit 817a the models don't work (Forge format). Before that it works using multiple models and vanilla format.

     

    I really wonder how something like that can happen. I don't use any special state mapper.

  11. Hello,

     

    I'm currently using GameRegistry#addSubstitutionAlias to replace the grass block by mine.

    Sometimes the game crash when I run it, sometimes not. I don't see any pattern.

     

    Here's the log when it crashes :

    https://hastebin.com/oyovoqubag.md

     

    To replace it, all I do is

            GameRegistry.addSubstitutionAlias(
                    "minecraft:grass", GameRegistry.Type.BLOCK,
                    new BlockGrassCustom().setRegistryName("grass_custom").setUnlocalizedName("grass"));

    in preInit.

     

    Anyone encountered such issue before ?

  12. So the X and Z for the block position are

    A) The chunk numbers

    B) The X and Z coords of the chunk

     

    I was using .Post before but there is no .getType() method for that

     

    And what is the difference between LOG, LOG2 & LEAVES, LEAVES2

     

    EDIT: Hastebin link isn't working anymore

    You can find the code with the Github links I gave in my post.

     

    In my method, x and z are World-based coordinates. The only time I use something Chunk-based is to get the highest block, and I explicitly convert x and z with &15.

    There's no getType() because it would not make any sense. The Decorate event is triggered before the generation of all <getType>. Before generation of trees, before generation of pumpkins, etc.

    The Post event is triggered after the generation of everything.

    We look for trees in the actual, final, generated world. I defined a pattern "tree" as some suitable block (like dirt or grass) with two logs above it, feel free to adapt the code for any other use.

     

    I'm aware my solution is not ideal, but I can't see a better one without new Forge hooks.

     

    About LOG2&LEAVES2, it's just Mojang who created new blocks when Acacia and Dark oak trees were added.

  13. I wrote something exactly like that some weeks ago for a project I contribute to. It works well but it also identifies 4 logs in some village houses (bottom corners). I can't see a way to fix that.

     

    The idea is :

    For each position in a 16x16 chunk intersection (cross shaped, that's what is populated after the event) start from the heighest block and go down until it reaches the terrain surface. Then, look two blocks above to check if they are logs.

     

    Your mistake was to use the Decorate event. If you look where it's called, you'll see it's called before tree (and big mushroom) generation. It's not something triggered for individual trees, you actually need to iterate through the chunk intersection.

     

    Actual source on Github :

    https://github.com/BeetoGuy/BetterWithMods/blob/master/src/main/java/betterwithmods/event/StumpingEventHandler.java

    https://github.com/BeetoGuy/BetterWithMods/blob/master/src/main/java/betterwithmods/blocks/BlockStump.java

  14. Forge's blockstates format does allow fully-specified variants, i.e. variants that specify a value for multiple properties. These can still define textures like other variants.

    That's amazing.

    I consider that to be the vanilla syntax. While the forge format supports it, it is still the vanilla syntax.

    Still, the ability of setting just some different textures at the blockstate level is great, that reduce the number of files quite a lot.

    My problems are solved, thanks a lot guys.

  15. Can we even specify combinations with the Forge format ? My snowy variant don't always apply the same textures when true, it depends of the variant used.

    All I have ever seen is

    {
        "forge_marker": 1,
        "defaults": {
        },
        "variants": {
            "my_boolean_property": {
                "true": {
                },
                "false": {
                }
            },
            "my_enum_property": {
                "a": {
                },
                "b": {
                },
                "c": {
                }
            }
        }
    }
    

    I would need to get the boolean property inside each of enum options. Is it supported ?

    This is not obvious by the doc http://mcforge.readthedocs.io/en/latest/blockstates/forgeBlockstates/ .

    The way the vanilla formats are described at http://minecraft.gamepedia.com/Model looks much more complete and reliable.

  16. Hi.

     

    I'm trying to make a slab model, and I'm getting upward references exception. But I really don't see where I put the cart before the horse.

    The block has two properties, enum "variant" and boolean "snowy".

     

    Blockstate JSON : https://hastebin.com/netecubaji.json

    Model JSON : https://hastebin.com/zucijeqari.json

    Log of a run : https://hastebin.com/ebavohanip.md

    Screenshot ingame : http://i.imgur.com/jQzShNq.png

     

    Note I only get errors for #side, but no textures are displayed at all.

  17. A few things I know:

    Dirt under a log also detects villager farms.

    Trees can also sit on top of gravel or in thin air (hooray lakes!)

    I think the event I use is triggered before village generation. If it's not then checking for two vertical logs should do the trick.

    About gravel trees... Damn. I could add gravel too along with dirt. Thin air trees on the other hand will be discarded, not a big deal.

     

    this is no easy task because you may get false positives say for ex someone builds 2 log and puts 1 leaves block nearby cause it looks cool.

    I use this at world gen, so nobody has built anything yet.

     

    the OTHER way is to tap into worldgen or  chunkgen or sapling custom world gen events by subscribing to events of that kind and figure out what's being spawned that's a tree and keep a track of all the trees you got in some txt file in your save then you would keep updating it. since this system would be based on gen then it will always run when something multiblock is being spawned in the world so is perpetually running checking things that are spawned for tree purpose.

     

    There's no such event, that's why I have to iterate through the blocks this way. The events are triggered before or after everything, not individual features.

     

    EDIT : I think I found one of my problems. Basically, chunk.getBlockState() is NOT just a world.getBlockState() with chunk coordinates. When you use the chunk version, you only ever get terrain stuff like grass block, dirt, gravel, sand. No features at all (leaves, tall grass, flowers, logs..). I used the world version and I got what I wanted. Now just a few tweaks and I'll post here my progress.

    EDIT2 : It does not get all trees, only some. Seems just 1/4 of chunk is tagged.

    http://hastebin.com/buwomusoku.java

    EDIT3 : Solved (Chunk coord were wrongs). I'll update OP with the latest version.

×
×
  • Create New...

Important Information

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