TominoCZ / FancyBlockParticles

My MC mod that turns 2D digging particles 3D!
https://minecraft.curseforge.com/projects/fancy-block-particles
GNU General Public License v3.0
18 stars 8 forks source link

FBP doesn't like Biomes O' Plenty! - Part 2. #108

Open Adahel opened 5 years ago

Adahel commented 5 years ago

Steps to reproduce issue:

FPB + Biomes O' Plenty: (Déjà vu) Already seen, Matrix! Something wrong is not right.

MC Version:

1.8.9

FBP Version:

2.4.1

Forge Version (e.g. 2604):

1.8.9-11.15.1.2318-1.8.9

http://openeye.openmods.info/crashes/17b9edd413ecb4114d2e9b9fda52a9e5

Adahel commented 5 years ago

The problem may be the "func_174845_l" method. In the vanilla in the variable "i" it calls "getRenderColor", but in the mod is calling "colorMultiplier". The bop override the "colorMultiplier" method and is causing problems by having variations of the same block (formerly metadata). In my test when I replace "colorMultiplier" per "getRenderColor", the game stops crashing, but I do not know what the "func_174845_l" method does. Another workaround was to prevent the mod from calling "colorMultiplier" from "BlockBOPPlant":

    int i;
    //The code only runs if BOP is loaded.
    if (Loader.isModLoaded("BiomesOPlenty"))
    {
        if (sourceState.getBlock() instanceof BlockBOPPlant)
        {
                //The variable "blockBOPPlant" is the instance of the "BlockBOPPlant" class. I did not use this variable, but it can be useful.
            BlockBOPPlant blockBOPPlant = (BlockBOPPlant) sourceState.getBlock();
            i = 0;
        }
        else
        {
            i = sourceState.getBlock().colorMultiplier(this.worldObj, new BlockPos(posX, posY, posZ));
        }
    }
    else
    {
        i = sourceState.getBlock().colorMultiplier(this.worldObj, new BlockPos(posX, posY, posZ));
    }

In the second solution the game still crash, but by another class BOP also override "colorMultiplier": "BlockBOPLeaves".

TominoCZ commented 5 years ago

func_174845_l takes the current position of the particle, gets the block and lastly gets the color multiplier.

func_174846_a on the other hand has one parameter and that is the BlockPos that will be used to get the color multiplier.

I don't know where that piece of code you posted is from, but I hope this helps.

Adahel commented 5 years ago

The code I posted should be the last option. It is not a solution.

TominoCZ commented 5 years ago

I still don't understand the issue here.

Adahel commented 5 years ago

Replace the "colorMultiplier" method per "getRenderColor" here: https://github.com/TominoCZ/FancyBlockParticles/blob/master/src_1.8.9/main/java/com/TominoCZ/FBP/particle/FBPParticleDigging.java#L190

As in minecraft vanilla: The game did not crash after that minor change, solving the problem.

Adahel commented 5 years ago

The game crash, because of the method override: https://github.com/Glitchfiend/BiomesOPlenty/blob/BOP-1.8.9-3.0.x/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java#L305 The game not crash in this method: https://github.com/Glitchfiend/BiomesOPlenty/blob/BOP-1.8.9-3.0.x/src/main/java/biomesoplenty/common/block/BlockBOPPlant.java#L290

Adahel commented 5 years ago

The problem is definitely Block Position, it looks like it is receiving invalid values. I made an algorithm that only calls "colorMultiplier" if Block State by position = "sourceState", else "getRenderColor" is called. To test the algorithm, set "i" = 16777215 so that the particles become gray. Hope this helps.

TominoCZ commented 5 years ago

Thanks, this will be fixed in version 2.4.2.