crafttweaker.api.minecraft.CraftTweakerMC Java Examples

The following examples show how to use crafttweaker.api.minecraft.CraftTweakerMC. 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: CTSakuraStoneMortar.java    From Sakura_mod with MIT License 6 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient[] input,IItemStack[] output) {
	if(input.length>0&&output.length>0){
		Object[] array = new Object[input.length];
		ItemStack[] array2 = new ItemStack[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack) 
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}
	    
	    for(int i = 0; i < output.length;i++)
	    		array2[i]=CraftTweakerMC.getItemStack(output[i]);
		
	    SakuraRecipeRegister.actions.add(new Addition(array, array2));
	}
}
 
Example #2
Source File: CTRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public CTRecipeBuilder fluidOutputs(ILiquidStack... ingredients) {
    this.backingBuilder.fluidOutputs(Arrays.stream(ingredients)
        .map(CraftTweakerMC::getLiquidStack)
        .collect(Collectors.toList()));
    return this;
}
 
Example #3
Source File: GTCraftTweakerCentrifuge.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public static void addCellRecipe(IItemStack[] output, IIngredient input1, int cells,
		@Optional(valueLong = 3200L) int totalEu) {
	if (cells > 0) {
		GTCraftTweakerActions.apply(new IndustrialCentrifugeRecipeAction(GTCraftTweakerActions.of(input1), new RecipeInputItemStack(new ItemStack(GTItems.testTube, cells)), totalEu, CraftTweakerMC.getItemStacks(output)));
	} else {
		CraftTweakerAPI.logError(CraftTweakerAPI.getScriptFileAndLine() + " > "
				+ "Cell count must be greater then 0!!");
	}
}
 
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: CTRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public boolean apply(@Nullable ItemStack itemStack) {
    itemStack = itemStack.copy();
    //because CT is dump enough to compare stack sizes by default...
    itemStack.setCount(ingredient.getAmount());
    return ingredient.matches(CraftTweakerMC.getIItemStack(itemStack));
}
 
Example #10
Source File: CTTFAdvancedAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void removeRecipe(IIngredient[] input) {
    ArrayList<Object> converted = new ArrayList<>();
    for (IIngredient i : input) {
        if (i instanceof IItemStack) {
            converted.add(CraftTweakerMC.getItemStack(i));
        } else if (i instanceof IOreDictEntry) {
            converted.add(new OredictItemStack(((IOreDictEntry) i).getName(), 1));
        }
    }
    RecipeLoader.actions.add(new Removal(converted));
}
 
Example #11
Source File: CTRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public CTRecipeBuilder outputs(IItemStack... ingredients) {
    this.backingBuilder.outputs(Arrays.stream(ingredients)
        .map(CraftTweakerMC::getItemStack)
        .collect(Collectors.toList()));
    return this;
}
 
Example #12
Source File: CTRecipeBuilder.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@ZenMethod
public CTRecipeBuilder fluidInputs(ILiquidStack... ingredients) {
    this.backingBuilder.fluidInputs(Arrays.stream(ingredients)
        .map(CraftTweakerMC::getLiquidStack)
        .collect(Collectors.toList()));
    return this;
}
 
Example #13
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 #14
Source File: CTSakuraCampfirePot.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient[] input,IItemStack output,ILiquidStack input_fluid) {
	if(input.length>0){
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack) 
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}

	    SakuraRecipeRegister.actions.add(new Addition(array, CraftTweakerMC.getItemStack(output),CraftTweakerMC.getLiquidStack(input_fluid)));
	}
}
 
Example #15
Source File: CTSakuraCampfirePot.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(ILiquidStack input_fluid,IIngredient[] input) {
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack) 
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}
	    SakuraRecipeRegister.actions.add(new Removal(CraftTweakerMC.getLiquidStack(input_fluid),array));
}
 
Example #16
Source File: CTSakuraStoneMortar.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(IIngredient[] input) {
	if(input.length>0){
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack)
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}
	    SakuraRecipeRegister.actions.add(new Removal(array));
	}
}
 
Example #17
Source File: CTTFCompressor.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient input,IItemStack output) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Addition(itemInput,CraftTweakerMC.getItemStack(output)));
}
 
Example #18
Source File: CTTFAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(IIngredient input) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Removal(itemInput));
}
 
Example #19
Source File: CTSakuraBarrel.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(ILiquidStack input_fluid,IIngredient[] input,ILiquidStack output) {
	if(input.length>0){
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack) 
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}

	    SakuraRecipeRegister.actions.add(new Addition(array, CraftTweakerMC.getLiquidStack(output),CraftTweakerMC.getLiquidStack(input_fluid)));
	}
}
 
Example #20
Source File: CTTFCompressor.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(IIngredient input) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Removal(itemInput));
}
 
Example #21
Source File: CTTFCrusher.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient input,IItemStack output) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Addition(itemInput,CraftTweakerMC.getItemStack(output)));
}
 
Example #22
Source File: CTTFCrusher.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(IIngredient input) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Removal(itemInput));
}
 
Example #23
Source File: CTTFAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(IIngredient input,IItemStack output) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		RecipeLoader.actions.add(new Addition(itemInput,CraftTweakerMC.getItemStack(output)));
}
 
Example #24
Source File: CTSakuraDistillation.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void AddRecipe(ILiquidStack input_fluid,IIngredient[] input,ILiquidStack output) {
	if(input.length>0){
		Object[] array = new Object[input.length];
	    for(int i = 0; i < input.length;i++){
	    	if (input[i] instanceof IItemStack) 
	    		array[i]=CraftTweakerMC.getItemStack(input[i]);
			else if(input[i] instanceof IOreDictEntry) 
				array[i]=((IOreDictEntry)input[i]).getName();	
		}

	    SakuraRecipeRegister.actions.add(new Addition(array, CraftTweakerMC.getLiquidStack(output),CraftTweakerMC.getLiquidStack(input_fluid)));
	}
}
 
Example #25
Source File: CTSakuraL2IS.java    From Sakura_mod with MIT License 5 votes vote down vote up
@ZenMethod
public static void RemoveRecipe(ILiquidStack input_fluid,IIngredient input) {
	Object itemInput=null;
	if (input instanceof IItemStack) {
		itemInput=CraftTweakerMC.getItemStack(input);
	} 
	else if(input instanceof IOreDictEntry) {
		itemInput=((IOreDictEntry)input).getName();
	}
	if(itemInput!=null)
		SakuraRecipeRegister.actions.add(new Removal(CraftTweakerMC.getLiquidStack(input_fluid),itemInput));
}
 
Example #26
Source File: CTTFAdvancedAggregator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
@ZenMethod
public static void addRecipe(IIngredient[] input, IItemStack output) {
    if (input.length > 0) {
        ArrayList<Object> converted = new ArrayList<>();
        for (IIngredient i : input) {
            if (i instanceof IItemStack) {
                converted.add(CraftTweakerMC.getItemStack(i));
            } else if (i instanceof IOreDictEntry) {
                converted.add(new OredictItemStack(((IOreDictEntry) i).getName(), i.getAmount()));
            }
        }
        RecipeLoader.actions.add(new Addition(converted.toArray(), CraftTweakerMC.getItemStack(output)));
    }
}
 
Example #27
Source File: GTCraftTweakerUUMAssembler.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@ZenMethod
public static void addRecipe(int neededUU, IItemStack output) {
	GTCraftTweakerActions.apply(new UUMAssemblerRecipeAction(neededUU, CraftTweakerMC.getItemStack(output)));
}
 
Example #28
Source File: GTCraftTweakerIngredientInput.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
private ItemStack[] toNatives() {
	return CraftTweakerMC.getItemStacks(this.ingredient.getItems());
}
 
Example #29
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 #30
Source File: GTCraftTweakerIngredientInput.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean matches(ItemStack item) {
	return this.ingredient.matches(CraftTweakerMC.getIItemStack(item));
}