net.minecraftforge.fml.common.Optional.Method Java Examples

The following examples show how to use net.minecraftforge.fml.common.Optional.Method. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ScoopBehaviour.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: IEcompat.java    From Sakura_mod with MIT License 5 votes vote down vote up
@SubscribeEvent
@Method(modid = "immersiveengineering")
public static void registerRecipe(RegistryEvent.Register<IRecipe> event) {
	CokeOvenRecipe.addRecipe(new ItemStack(BlockLoader.BAMBOO_CHARCOAL_BLOCK), new ItemStack(BlockLoader.BAMBOO_BLOCK), 3200, 2000);
	CokeOvenRecipe.addRecipe(new ItemStack(ItemLoader.MATERIAL, 1,51), new ItemStack(BlockLoader.BAMBOO, 1), 800, 500);
	BlastFurnaceRecipe.addBlastFuel(new ItemStack(ItemLoader.MATERIAL, 1,51), 500);
	BlastFurnaceRecipe.addBlastFuel(new ItemStack(BlockLoader.BAMBOO_CHARCOAL_BLOCK), 2500);
}
 
Example #3
Source File: FluidPipeNet.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Method(modid = GTValues.MODID_FMP)
private static void removeMultipartPipePartFromTile(TileEntity tileEntity) {
    if (tileEntity instanceof TileMultipart) {
        TileMultipart tileMultipart = (TileMultipart) tileEntity;
        List<TMultiPart> partList = tileMultipart.jPartList();
        for (TMultiPart tMultiPart : partList) {
            if (tMultiPart instanceof IPipeTile) {
                tileMultipart.remPart(tMultiPart);
            }
        }
    }
}
 
Example #4
Source File: FluidMaterial.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenGetter("plasma")
@Method(modid = GTValues.MODID_CT)
@Nullable
public ILiquidDefinition ctGetPlasma() {
    Fluid materialFluid = getMaterialPlasma();
    return materialFluid == null ? null : CraftTweakerMC.getILiquidDefinition(materialFluid);
}
 
Example #5
Source File: FluidMaterial.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenGetter("fluid")
@Method(modid = GTValues.MODID_CT)
@Nullable
public ILiquidDefinition ctGetFluid() {
    Fluid materialFluid = getMaterialFluid();
    return materialFluid == null ? null : CraftTweakerMC.getILiquidDefinition(materialFluid);
}
 
Example #6
Source File: ShapeGenerator.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public void generate(long randomSeed, IWorld world, IBlockPos centerPos, IBlockState blockState) {
    World mcWorld = CraftTweakerMC.getWorld(world);
    net.minecraft.block.state.IBlockState mcBlockState = CraftTweakerMC.getBlockState(blockState);
    BlockPos blockPos = CraftTweakerMC.getBlockPos(centerPos);
    generate(new Random(randomSeed), (x, y, z) -> mcWorld.setBlockState(blockPos, mcBlockState));
}
 
Example #7
Source File: OreDepositDefinition.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example #8
Source File: BlacklistedBlockFiller.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenGetter("blacklist")
@Method(modid = GTValues.MODID_CT)
public List<crafttweaker.api.block.IBlockState> ctGetBlacklist() {
    return blacklist.stream()
        .map(CraftTweakerMC::getBlockState)
        .collect(Collectors.toList());
}
 
Example #9
Source File: RecipeMap.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenGetter("recipes")
@Method(modid = GTValues.MODID_CT)
public List<CTRecipe> ccGetRecipeList() {
    return getRecipeList().stream()
        .map(recipe -> new CTRecipe(this, recipe))
        .collect(Collectors.toList());
}
 
Example #10
Source File: RecipeMap.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example #11
Source File: RecipeLoader.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@Method(modid = "crafttweaker")
public static void doDelayTask()
{
    for (IAction act : actions)
    {
        CraftTweakerAPI.apply(act);
        if (act.describe() != null)
        {
        	TofuMain.logger.log(Level.INFO, act.describe());
        }
    }
    actions.clear();
}
 
Example #12
Source File: SakuraRecipeRegister.java    From Sakura_mod with MIT License 5 votes vote down vote up
@Method(modid = "crafttweaker")
public static void doDelayTask() {
    for (IAction act : actions) {
        CraftTweakerAPI.apply(act);
        if (act.describe() != null)
        	SakuraMain.logger.log(Level.INFO, act.describe());
    }
    actions.clear();
}
 
Example #13
Source File: FuelRecipe.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenGetter("fluid")
@Method(modid = GTValues.MODID_CT)
public ILiquidStack ctGetFluid() {
    return new MCLiquidStack(getRecipeFluid());
}
 
Example #14
Source File: GregTechMod.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Method(modid = GTValues.MODID_CT)
private void runEarlyCraftTweakerScripts() {
    CraftTweakerAPI.tweaker.loadScript(false, "gregtech");
}
 
Example #15
Source File: GregTechMod.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Method(modid = GTValues.MODID_FMP)
private void registerForgeMultipartCompat() {
    GTMultipartFactory.INSTANCE.registerFactory();
}
 
Example #16
Source File: SolidMaterial.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@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()));
}
 
Example #17
Source File: PrimitiveBlastFurnaceRecipe.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenGetter("input")
@Method(modid = GTValues.MODID_CT)
public InputIngredient ctGetInput() {
    return new InputIngredient(getInput());
}
 
Example #18
Source File: PrimitiveBlastFurnaceRecipe.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenGetter("output")
@Method(modid = GTValues.MODID_CT)
public IItemStack ctGetOutput() {
    return CraftTweakerMC.getIItemStack(getOutput());
}
 
Example #19
Source File: FuelRecipe.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod("create")
@Method(modid = GTValues.MODID_CT)
public static FuelRecipe craftTweakerCreate(ILiquidStack liquidStack, int duration, long minVoltage) {
    return new FuelRecipe(CraftTweakerMC.getLiquidStack(liquidStack), duration, minVoltage);
}
 
Example #20
Source File: OreDepositDefinition.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod("canGenerateIn")
@Method(modid = GTValues.MODID_CT)
public boolean ctCanGenerateIn(crafttweaker.api.block.IBlockState blockState, crafttweaker.api.world.IBlockAccess blockAccess, crafttweaker.api.world.IBlockPos blockPos) {
    IBlockState mcBlockState = CraftTweakerMC.getBlockState(blockState);
    return getGenerationPredicate().test(mcBlockState, (IBlockAccess) blockAccess.getInternal(), (BlockPos) blockPos.getInternal());
}
 
Example #21
Source File: OreDepositDefinition.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod("checkDimension")
@Method(modid = GTValues.MODID_CT)
public boolean ctCheckDimension(int dimensionId) {
    WorldProvider worldProvider = DimensionManager.getProvider(dimensionId);
    return worldProvider != null && getDimensionFilter().test(worldProvider);
}
 
Example #22
Source File: CokeOvenRecipe.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenGetter("fluidOutput")
@Method(modid = GTValues.MODID_CT)
public ILiquidStack ctGetLiquidOutput() {
    return new MCLiquidStack(getFluidOutput());
}
 
Example #23
Source File: CokeOvenRecipe.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenGetter("input")
@Method(modid = GTValues.MODID_CT)
public InputIngredient ctGetInput() {
    return new InputIngredient(getInput());
}
 
Example #24
Source File: EnchantmentData.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenGetter("enchantment")
@Method(modid = GTValues.MODID_CT)
public IEnchantmentDefinition ctGetEnchantment() {
    return new MCEnchantmentDefinition(enchantment);
}
 
Example #25
Source File: FuelRecipeMap.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod("findRecipe")
@Method(modid = GTValues.MODID_CT)
public FuelRecipe ctFindRecipe(long maxVoltage, ILiquidStack inputFluid) {
    return findRecipe(maxVoltage, CraftTweakerMC.getLiquidStack(inputFluid));
}
 
Example #26
Source File: CokeOvenRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public CokeOvenRecipeBuilder output(IItemStack itemStack) {
    return output(CraftTweakerMC.getItemStack(itemStack));
}
 
Example #27
Source File: CokeOvenRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public CokeOvenRecipeBuilder fluidOutput(ILiquidStack liquidStack) {
    return fluidOutput(CraftTweakerMC.getLiquidStack(liquidStack));
}
 
Example #28
Source File: CokeOvenRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public CokeOvenRecipeBuilder input(IIngredient ingredient) {
    return input(new CraftTweakerIngredientWrapper(ingredient), ingredient.getAmount());
}
 
Example #29
Source File: PBFRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public PBFRecipeBuilder output(IItemStack itemStack) {
    return output(CraftTweakerMC.getItemStack(itemStack));
}
 
Example #30
Source File: PBFRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
@Method(modid = GTValues.MODID_CT)
public PBFRecipeBuilder input(IIngredient ingredient) {
    return input(new CraftTweakerIngredientWrapper(ingredient), ingredient.getAmount());
}