Sirse / MineFantasyII-Cont

Unofficial MineFantasy II repository
GNU General Public License v3.0
16 stars 17 forks source link

Salvage duplication glith #7

Closed Sirse closed 7 years ago

Sirse commented 7 years ago

Encrusted bars can be duplicated on salvage station (they are drops encrusted bar instead steel bar with diamond shard). Glitch caused by CustomToolHelper.tryDeconstruct method.

    public static ItemStack tryDeconstruct(ItemStack newitem, ItemStack mainItem) {
        String type = null;
        if (newitem != null && newitem.getItem() instanceof ITieredComponent) {
            type = ((ITieredComponent) newitem.getItem()).getMaterialType(newitem);
        }
        if (type != null) {
            CustomMaterial primary = CustomToolHelper.getCustomPrimaryMaterial(mainItem);
            CustomMaterial secondary = CustomToolHelper.getCustomSecondaryMaterial(mainItem);
            if (primary != null && primary.type.equalsIgnoreCase(type)) {
                CustomMaterial.addMaterial(newitem, slot_main, primary.name);
            } else {
                if (secondary != null && secondary.type.equalsIgnoreCase(type)) {
                    CustomMaterial.addMaterial(newitem, slot_main, secondary.name);
                }
            }
        }
        return newitem;
    }

I'm don't understand for what used that method, it are just compares two itemstacks and copies material from second to first IS. Missed logical not operator??