Search in sources :

Example 1 with UpgradePart

use of net.silentchaos512.gear.gear.part.UpgradePart in project Silent-Gear by SilentChaos512.

the class RepairHandler method onAnvilUpdate.

@SubscribeEvent
public static void onAnvilUpdate(AnvilUpdateEvent event) {
    if (event.getLeft().getItem() instanceof ICoreItem) {
        MaterialInstance material = MaterialInstance.from(event.getRight());
        PartData part = PartData.from(event.getRight());
        if (material != null) {
            handleGearRepair(event, material);
        } else if (part != null && part.get() instanceof UpgradePart) {
            handleUpgradeApplication(event, part);
        }
    }
}
Also used : PartData(net.silentchaos512.gear.gear.part.PartData) UpgradePart(net.silentchaos512.gear.gear.part.UpgradePart) ICoreItem(net.silentchaos512.gear.api.item.ICoreItem) MaterialInstance(net.silentchaos512.gear.gear.material.MaterialInstance) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 2 with UpgradePart

use of net.silentchaos512.gear.gear.part.UpgradePart in project Silent-Gear by SilentChaos512.

the class PartsProvider method getParts.

protected Collection<PartBuilder> getParts() {
    Collection<PartBuilder> ret = new ArrayList<>();
    ret.add(part("adornment", GearType.CURIO, PartType.ADORNMENT, ModItems.ADORNMENT));
    ret.add(part("binding", GearType.TOOL, PartType.BINDING, ModItems.BINDING));
    ret.add(part("bowstring", GearType.RANGED_WEAPON, PartType.CORD, ModItems.CORD));
    ret.add(part("coating", GearType.ALL, PartType.COATING, ModItems.COATING).blacklistGearType(GearType.ELYTRA));
    ret.add(part("fletching", GearType.PROJECTILE, PartType.FLETCHING, ModItems.FLETCHING));
    ret.add(part("grip", GearType.TOOL, PartType.GRIP, ModItems.GRIP));
    ret.add(part("lining", GearType.ARMOR, PartType.LINING, ModItems.LINING));
    ret.add(part("long_rod", GearType.TOOL, PartType.ROD, ModItems.LONG_ROD));
    ret.add(part("rod", GearType.TOOL, PartType.ROD, ModItems.ROD));
    ret.add(part("tip", GearType.TOOL, PartType.TIP, ModItems.TIP));
    Registration.getItems(MainPartItem.class).forEach(item -> {
        PartBuilder builder = part(NameUtils.fromItem(item).getPath(), item.getGearType(), item.getPartType(), item);
        ret.add(addHeadStats(builder));
    });
    ret.add(upgradePart("misc/spoon", CraftingItems.SPOON_UPGRADE).upgradeGearTypes(GearType.PICKAXE.getMatcher(false)).stat(ItemStats.DURABILITY, 0.2f, StatInstance.Operation.MUL1).stat(ItemStats.RARITY, 10, StatInstance.Operation.ADD).trait(Const.Traits.SPOON, 1).display(GearType.PICKAXE, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("spoon"), Color.VALUE_WHITE)));
    ret.add(upgradePart("misc/road_maker", CraftingItems.ROAD_MAKER_UPGRADE).upgradeGearTypes(GearType.EXCAVATOR.getMatcher(false)).stat(ItemStats.DURABILITY, 0.1f, StatInstance.Operation.MUL1).stat(ItemStats.RARITY, 10, StatInstance.Operation.ADD).trait(Const.Traits.ROAD_MAKER, 1).display(GearType.EXCAVATOR, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("road_maker"), Color.VALUE_WHITE)));
    ret.add(upgradePart("misc/wide_plate", CraftingItems.WIDE_PLATE_UPGRADE).upgradeGearTypes(new GearTypeMatcher(false, GearType.HAMMER, GearType.EXCAVATOR)).stat(ItemStats.DURABILITY, 0.1f, StatInstance.Operation.MUL1).stat(ItemStats.RARITY, 10, StatInstance.Operation.ADD).trait(Const.Traits.WIDEN, 1).display(GearType.HAMMER, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("wide_plate"), Color.VALUE_WHITE)).display(GearType.EXCAVATOR, PartType.MISC_UPGRADE, new MaterialLayer(SilentGear.getId("wide_plate"), Color.VALUE_WHITE)));
    ret.add(upgradePart("misc/red_card", CraftingItems.RED_CARD_UPGRADE).upgradeGearTypes(GearTypeMatcher.ALL).stat(ItemStats.RARITY, -5, StatInstance.Operation.ADD).trait(Const.Traits.RED_CARD, 1));
    return ret;
}
Also used : GearTypeMatcher(net.silentchaos512.gear.api.item.GearTypeMatcher) MaterialLayer(net.silentchaos512.gear.api.material.MaterialLayer) ArrayList(java.util.ArrayList) MainPartItem(net.silentchaos512.gear.item.MainPartItem)

Aggregations

ArrayList (java.util.ArrayList)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1 GearTypeMatcher (net.silentchaos512.gear.api.item.GearTypeMatcher)1 ICoreItem (net.silentchaos512.gear.api.item.ICoreItem)1 MaterialLayer (net.silentchaos512.gear.api.material.MaterialLayer)1 MaterialInstance (net.silentchaos512.gear.gear.material.MaterialInstance)1 PartData (net.silentchaos512.gear.gear.part.PartData)1 UpgradePart (net.silentchaos512.gear.gear.part.UpgradePart)1 MainPartItem (net.silentchaos512.gear.item.MainPartItem)1