Search in sources :

Example 1 with Method

use of net.minecraftforge.fml.common.Optional.Method in project Cavern2 by kegare.

the class HaCPlugin method load.

@Method(modid = LIB_MODID)
public static void load() {
    RecipeAPI.registerSmelting.addRecipe(new ItemStack(CaveBlocks.SLIPPERY_ICE), DCHeatTier.FROSTBITE, DCHumidity.WET, DCAirflow.FLOW, false, new ItemStack(Blocks.PACKED_ICE));
    DamageAPI.armorRegister.registerMaterial(CaveItems.HEXCITE_ARMOR, 0.5F, 0.5F);
    DamageAPI.resistantData.registerEntityResistant(EntityCavenicSkeleton.class, 7.0F, 4.0F);
    DamageAPI.resistantData.registerEntityResistant(EntityCavenicCreeper.class, 2.0F, 5.0F);
    DamageAPI.resistantData.registerEntityResistant(EntityCavenicZombie.class, 8.0F, 5.0F);
    DamageAPI.resistantData.registerEntityResistant(EntityCavenicSpider.class, 6.0F, 4.0F);
    DamageAPI.resistantData.registerEntityResistant(EntityCavenicWitch.class, 6.0F, 6.0F);
    DamageAPI.resistantData.registerEntityResistant(EntityCavenicBear.class, 10.0F, 15.0F);
    DamageAPI.resistantData.registerEntityResistant(EntityCaveman.class, 5.0F, 3.0F);
    if (CaveDimensions.FROST_MOUNTAINS != null) {
        int dim = CaveDimensions.FROST_MOUNTAINS.getId();
        for (Biome biome : BiomeDictionary.getBiomes(BiomeDictionary.Type.COLD)) {
            ClimateAPI.register.addBiomeClimate(biome, dim, DCHeatTier.FROSTBITE, DCHumidity.WET, DCAirflow.NORMAL);
        }
    }
    if (CaveDimensions.WIDE_DESERT != null) {
        int dim = CaveDimensions.WIDE_DESERT.getId();
        for (Biome biome : BiomeDictionary.getBiomes(BiomeDictionary.Type.SANDY)) {
            ClimateAPI.register.addBiomeClimate(biome, dim, DCHeatTier.HOT, DCHumidity.DRY, DCAirflow.NORMAL);
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome) ItemStack(net.minecraft.item.ItemStack) Method(net.minecraftforge.fml.common.Optional.Method)

Example 2 with Method

use of net.minecraftforge.fml.common.Optional.Method in project GregTech by GregTechCE.

the class OreDepositDefinition method ctGetBiomeWeightModifier.

@ZenMethod("getBiomeWeightModifier")
@Method(modid = GTValues.MODID_CT)
public int ctGetBiomeWeightModifier(IBiome biome) {
    int biomeIndex = ArrayUtils.indexOf(CraftTweakerMC.biomes, biome);
    Biome mcBiome = Biome.REGISTRY.getObjectById(biomeIndex);
    return mcBiome == null ? 0 : getBiomeWeightModifier().apply(mcBiome);
}
Also used : IBiome(crafttweaker.api.world.IBiome) Biome(net.minecraft.world.biome.Biome) ZenMethod(stanhebben.zenscript.annotations.ZenMethod) Method(net.minecraftforge.fml.common.Optional.Method) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 3 with Method

use of net.minecraftforge.fml.common.Optional.Method in project GregTech by GregTechCE.

the class RecipeMap method ctFindRecipe.

@ZenMethod("findRecipe")
@Method(modid = GTValues.MODID_CT)
@Nullable
public CTRecipe ctFindRecipe(long maxVoltage, IItemStack[] itemInputs, ILiquidStack[] fluidInputs, @Optional(valueLong = Integer.MAX_VALUE) int outputFluidTankCapacity) {
    List<ItemStack> mcItemInputs = itemInputs == null ? Collections.emptyList() : Arrays.stream(itemInputs).map(CraftTweakerMC::getItemStack).collect(Collectors.toList());
    List<FluidStack> mcFluidInputs = fluidInputs == null ? Collections.emptyList() : Arrays.stream(fluidInputs).map(CraftTweakerMC::getLiquidStack).collect(Collectors.toList());
    Recipe backingRecipe = findRecipe(maxVoltage, mcItemInputs, mcFluidInputs, outputFluidTankCapacity);
    return backingRecipe == null ? null : new CTRecipe(this, backingRecipe);
}
Also used : CTRecipe(gregtech.api.recipes.crafttweaker.CTRecipe) CraftTweakerMC(crafttweaker.api.minecraft.CraftTweakerMC) FluidStack(net.minecraftforge.fluids.FluidStack) CTRecipe(gregtech.api.recipes.crafttweaker.CTRecipe) ItemStack(net.minecraft.item.ItemStack) IItemStack(crafttweaker.api.item.IItemStack) Method(net.minecraftforge.fml.common.Optional.Method) Nullable(javax.annotation.Nullable)

Example 4 with Method

use of net.minecraftforge.fml.common.Optional.Method in project GregTech by GregTechCE.

the class ScoopBehaviour method processButterflyCatch.

@Method(modid = GTValues.MODID_FR)
private boolean processButterflyCatch(ItemStack itemStack, EntityPlayer player, Entity entity) {
    if (entity instanceof IEntityButterfly) {
        if (player.world.isRemote) {
            return true;
        }
        if (player.capabilities.isCreativeMode || GTUtility.doDamageItem(itemStack, this.cost, false)) {
            IEntityButterfly butterfly = (IEntityButterfly) entity;
            IAlleleButterflySpecies species = butterfly.getButterfly().getGenome().getPrimary();
            species.getRoot().getBreedingTracker(entity.world, player.getGameProfile()).registerCatch(butterfly.getButterfly());
            player.world.spawnEntity(new EntityItem(player.world, entity.posX, entity.posY, entity.posZ, species.getRoot().getMemberStack(butterfly.getButterfly().copy(), EnumFlutterType.BUTTERFLY)));
            entity.setDead();
        }
        return true;
    }
    return false;
}
Also used : IEntityButterfly(forestry.api.lepidopterology.IEntityButterfly) EntityItem(net.minecraft.entity.item.EntityItem) IAlleleButterflySpecies(forestry.api.lepidopterology.IAlleleButterflySpecies) Method(net.minecraftforge.fml.common.Optional.Method)

Example 5 with Method

use of net.minecraftforge.fml.common.Optional.Method in project GregTech by GregTechCE.

the class SolidMaterial method ctAddEnchantmentForTools.

@ZenMethod("addToolEnchantment")
@Method(modid = GTValues.MODID_CT)
public void ctAddEnchantmentForTools(IEnchantment enchantment) {
    Enchantment enchantmentType = (Enchantment) enchantment.getDefinition().getInternal();
    toolEnchantments.add(new EnchantmentData(enchantmentType, enchantment.getLevel()));
}
Also used : Enchantment(net.minecraft.enchantment.Enchantment) IEnchantment(crafttweaker.api.enchantments.IEnchantment) EnchantmentData(gregtech.api.enchants.EnchantmentData) ZenMethod(stanhebben.zenscript.annotations.ZenMethod) Method(net.minecraftforge.fml.common.Optional.Method) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Aggregations

Method (net.minecraftforge.fml.common.Optional.Method)7 ItemStack (net.minecraft.item.ItemStack)3 ZenMethod (stanhebben.zenscript.annotations.ZenMethod)3 Biome (net.minecraft.world.biome.Biome)2 IEnchantment (crafttweaker.api.enchantments.IEnchantment)1 IItemStack (crafttweaker.api.item.IItemStack)1 CraftTweakerMC (crafttweaker.api.minecraft.CraftTweakerMC)1 IBiome (crafttweaker.api.world.IBiome)1 IBlockPos (crafttweaker.api.world.IBlockPos)1 IWorld (crafttweaker.api.world.IWorld)1 IAlleleButterflySpecies (forestry.api.lepidopterology.IAlleleButterflySpecies)1 IEntityButterfly (forestry.api.lepidopterology.IEntityButterfly)1 EnchantmentData (gregtech.api.enchants.EnchantmentData)1 CTRecipe (gregtech.api.recipes.crafttweaker.CTRecipe)1 Random (java.util.Random)1 Nullable (javax.annotation.Nullable)1 Enchantment (net.minecraft.enchantment.Enchantment)1 EntityItem (net.minecraft.entity.item.EntityItem)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 IInventory (net.minecraft.inventory.IInventory)1