Search in sources :

Example 1 with RegistryObject

use of net.minecraftforge.fmllegacy.RegistryObject in project Tropicraft by Tropicraft.

the class TropicraftRenderLayers method registerLayers.

@SubscribeEvent
public static void registerLayers(EntityRenderersEvent.RegisterLayerDefinitions event) {
    KOA_HUNTER_LAYER = registerMain("koa_hunter", KoaModel::create, event);
    TROPI_CREEPER_LAYER = registerMain("tropi_creeper", TropiCreeperModel::create, event);
    IGUANA_LAYER = registerMain("iguana", IguanaModel::create, event);
    UMBRELLA_LAYER = registerMain("umbrella", UmbrellaModel::create, event);
    BEACH_FLOAT_LAYER = registerMain("beach_float", BeachFloatModel::create, event);
    CHAIR_LAYER = registerMain("chair", ChairModel::create, event);
    TROPI_SKELLY_LAYER = registerMain("tropi_skelly", TropiSkellyModel::create, event);
    EIH_LAYER = registerMain("eih", EIHModel::create, event);
    SEA_TURTLE_LAYER = registerMain("sea_turtle", SeaTurtleModel::create, event);
    MARLIN_LAYER = registerMain("marlin", MarlinModel::create, event);
    FAILGULL_LAYER = registerMain("failgull", FailgullModel::create, event);
    DOLPHIN_LAYER = registerMain("dolphin", TropicraftDolphinModel::create, event);
    SEAHORSE_LAYER = registerMain("seahorse", SeahorseModel::create, event);
    TREE_FROG_LAYER = registerMain("tree_frog", TreeFrogModel::create, event);
    SEA_URCHIN_LAYER = registerMain("sea_urchin", SeaUrchinModel::create, event);
    SEA_URCHIN_EGG_ENTITY_LAYER = registerMain("sea_urchin_egg", EggModel::create, event);
    STARFISH_EGG_LAYER = registerMain("starfish_egg", EggModel::create, event);
    V_MONKEY_LAYER = registerMain("v_monkey", VMonkeyModel::create, event);
    PIRANHA_LAYER = registerMain("piranha", PiranhaModel::create, event);
    RIVER_SARDINE_LAYER = registerMain("river_sardine", SardineModel::create, event);
    TROPICAL_FISH_LAYER = registerMain("tropical_fish", TropicraftTropicalFishModel::create, event);
    EAGLE_RAY_LAYER = registerMain("eagle_ray", EagleRayModel::create, event);
    TROPI_SPIDER_EGG_LAYER = registerMain("tropi_spider_egg", EggModel::create, event);
    ASHEN_LAYER = registerMain("ashen", AshenModel::create, event);
    HAMMERHEAD_LAYER = registerMain("hammerhead", SharkModel::create, event);
    SEA_TURTLE_EGG_LAYER = registerMain("turtle_egg", EggModel::create, event);
    TROPI_BEE_LAYER = registerMain("tropi_bee", TropiBeeModel::createBodyLayer, event);
    COWKTAIL_LAYER = registerMain("cowktail", CowModel::createBodyLayer, event);
    MAN_O_WAR_OUTER_LAYER = registerMain("man_o_war", ManOWarModel::createOuterModel, event);
    MAN_O_WAR_GEL_LAYER = registerMain("man_o_war_gel", ManOWarModel::createGelLayerModel, event);
    BAMBOO_MUG = registerMain("bamboo_mug", BambooMugModel::create, event);
    // BAMBOO_CHEST = registerMain("bamboo_chest", BambooChestRenderer);
    // BAMBOO_DOUBLE_CHEST_LEFT = registerMain("bamboo_double_chest_left", () -> BambooChestBlockEntityRenderer.getLeftDoubleTexturedModelData());
    // BAMBOO_DOUBLE_CHEST_RIGHT = registerMain("bamboo_double_chest_right", () -> BambooChestBlockEntityRenderer.getRightDoubleTexturedModelData());
    EIHMACHINE_LAYER = registerMain("drink_mixer", EIHMachineModel::create, event);
    AIRCOMPRESSOR_LAYER = registerMain("air_compressor", EIHMachineModel::create, event);
    BASILISK_LIZARD_LAYER = registerMain("basilisk_lizard", BasiliskLizardModel::create, event);
    CUBERA_LAYER = registerMain("cubera", CuberaModel::create, event);
    FIDDLER_CRAB_LAYER = registerMain("fiddler_crab", FiddlerCrabModel::create, event);
    HUMMINGBIRD_LAYER = registerMain("hummingbird", HummingbirdModel::create, event);
    JAGUAR_LAYER = registerMain("jaguar", JaguarModel::create, event);
    TAPIR_LAYER = registerMain("tapir", TapirModel::create, event);
    SPIDER_MONKEY_LAYER = registerMain("spider_monkey", SpiderMonkeyModel::create, event);
    WHITE_LIPPED_PECCARY_LAYER = registerMain("white_lipped_peccary", WhiteLippedPeccaryModel::create, event);
    // ArrayList<MaskArmorProvider> MASK_PROVIDER = new ArrayList<>();
    final List<RegistryObject<AshenMaskItem>> masks = TropicraftItems.ASHEN_MASKS.values().asList();
    for (RegistryObject<AshenMaskItem> maskItem : masks) {
        ModelLayerLocation ashen_mask_layer = registerMain("ashen_mask_" + maskItem.get().getMaskType().name().toLowerCase(Locale.ROOT), PlayerHeadpieceModel::create, event);
        ASHEN_MASK_LAYERS.add(ashen_mask_layer);
    }
    STACHE_LAYER = registerMain("nigel_stache", PlayerHeadpieceModel::create, event);
    HEAD_SCUBA_LAYER = registerMain("scuba_goggles", ModelScubaGear::create, event);
    CHEST_SCUBA_LAYER = registerMain("scuba_harness", ModelScubaGear::create, event);
    FEET_SCUBA_LAYER = registerMain("scuba_flippers", ModelScubaGear::create, event);
    TANK_SCUBA_LAYER = registerMain("pony_bottle", ModelScubaGear::create, event);
    setupScubaGearModels();
}
Also used : PlayerHeadpieceModel(net.tropicraft.core.client.entity.model.PlayerHeadpieceModel) AshenMaskItem(net.tropicraft.core.common.item.AshenMaskItem) RegistryObject(net.minecraftforge.fmllegacy.RegistryObject) ModelLayerLocation(net.minecraft.client.model.geom.ModelLayerLocation) SubscribeEvent(net.minecraftforge.eventbus.api.SubscribeEvent)

Example 2 with RegistryObject

use of net.minecraftforge.fmllegacy.RegistryObject in project Tropicraft by Tropicraft.

the class CowktailEntity method mobInteract.

@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
    ItemStack itemstack = player.getItemInHand(hand);
    if (itemstack.getItem() == TropicraftItems.BAMBOO_MUG.get() && !this.isBaby()) {
        if (player.getAbilities().instabuild) {
            itemstack.shrink(1);
        }
        final List<RegistryObject<CocktailItem>> cocktails = new ArrayList<>(TropicraftItems.COCKTAILS.values());
        // Remove generic cocktail from cowktail
        cocktails.removeIf(cocktail -> cocktail.isPresent() && cocktail.get().getDrink() == Drink.COCKTAIL);
        final ItemStack cocktailItem = new ItemStack(cocktails.get(random.nextInt(cocktails.size())).get());
        if (itemstack.isEmpty()) {
            player.setItemInHand(hand, cocktailItem);
        } else if (!player.getInventory().add(cocktailItem)) {
            player.drop(cocktailItem, false);
        }
        this.playSound(SoundEvents.MOOSHROOM_MILK_SUSPICIOUSLY, 1.0F, 1.0F);
        return InteractionResult.SUCCESS;
    }
    return super.mobInteract(player, hand);
}
Also used : ArrayList(java.util.ArrayList) ItemStack(net.minecraft.world.item.ItemStack) RegistryObject(net.minecraftforge.fmllegacy.RegistryObject)

Aggregations

RegistryObject (net.minecraftforge.fmllegacy.RegistryObject)2 ArrayList (java.util.ArrayList)1 ModelLayerLocation (net.minecraft.client.model.geom.ModelLayerLocation)1 ItemStack (net.minecraft.world.item.ItemStack)1 SubscribeEvent (net.minecraftforge.eventbus.api.SubscribeEvent)1 PlayerHeadpieceModel (net.tropicraft.core.client.entity.model.PlayerHeadpieceModel)1 AshenMaskItem (net.tropicraft.core.common.item.AshenMaskItem)1