Zeno410 / UndergroundBiomesConstructs1.10

Underground Biomes Constructs for Minecraft 10.2
7 stars 28 forks source link

UBOre 'damageDropped' passes the wrong blockstate #5

Closed mallrat208 closed 7 years ago

mallrat208 commented 7 years ago

UBC Version: UndergroundBiomesConstructs-1.10-0.9-beta.16

For the current version of UBC, any ores I submit are properly "UBified" and skinned, they are just not dropping their base ore block if they use meta values to define the block. Whenever blocks like those are mined, it throws an exception in the log and drops nothing.

Exception: https://gist.github.com/mallrat208/8150064a3666ea2755244c4135f97080

Checking out what those functions actually are, the exception is triggered at line 117 in UBOre.

    @Override
    public int damageDropped(IBlockState state) {
            int test = this.baseOre.damageDropped(state);
            if (test>0) return test;
        if (baseOreMeta == NO_METADATA)
            return 0;
        else
            return baseOreMeta;
    }

As it is, method seems a bit overlay complicated for what it should do, all that's needed should be to return baseOreMeta or 0, whichever is larger.

That's not the exception however, I believe what's happening is that the blockstate for the UBOre block is being based to the baseOre which is where the problem lies. The baseOre has no idea what to do with the UBOre State and just ... dies.

rayzr522 commented 7 years ago

This error is entirely screwing up my server. All my copper, tin, etc. that's been generated by UBC-Ore-Registrar isn't dropping anything and that's a pretty big problem.

rayzr522 commented 7 years ago

@Zeno410 any update on this? As a side note, fixing this myself would be a lot easier if you'd included stuff like your build.gradle...

mallrat208 commented 7 years ago

Alright, as an update to this there are a few instances where 'state' is improperly passed to the base ore block.

    @Override
    public int quantityDropped(IBlockState state, int fortune, Random random) {
                return baseOre.quantityDropped(state, fortune, random);
    }

    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
        Item item = Item.getItemFromBlock(baseOre);
        Item drop = baseOre.getItemDropped(state, rand, fortune);
        if (drop != item){
                    return drop;
                } else {
                    return drop;
}
    }

    @Override
    public int damageDropped(IBlockState state) {
            int test = this.baseOre.damageDropped(state);
            if (test>0) return test;
        if (baseOreMeta == NO_METADATA)
            return 0;
        else
            return baseOreMeta;
    }

It should instead be passed baseOreState

rayzr522 commented 7 years ago

That's all it'll take to fix this? I can easily apply those patches myself, you just saved me a couple hours of sorting out where everything is and what it does. Thanks! I would, of course, prefer a proper update, but for now this'll work.