use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.
the class CTDrying method removeRecipe.
@ZenMethod
public static void removeRecipe(IItemStack output) {
if (output == null)
throw new IllegalArgumentException("Output not allowed to be empty");
ArrayList<DryingRecipe> removeList = new ArrayList<>();
RegistriesFL.DRYING.getValuesCollection().stream().filter(x -> x.getOutputItem(ItemStack.EMPTY).isItemEqual(InputHelper.toStack(output))).forEach(removeList::add);
for (DryingRecipe recipe : removeList) {
CraftTweakerAPI.apply(new IAction() {
@Override
public void apply() {
IForgeRegistryModifiable<DryingRecipe> DRYING = (IForgeRegistryModifiable<DryingRecipe>) RegistriesFL.DRYING;
DRYING.remove(recipe.getRegistryName());
}
@Override
public String describe() {
return "Removing Drying recipe for output " + output.getDisplayName();
}
});
}
}
use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.
the class TELeafMat method dry.
private void dry() {
ItemStack input = inventory.getStackInSlot(0);
if (!input.isEmpty()) {
DryingRecipe recipe = DryingRecipe.get(input);
if (recipe != null && !world.isRemote) {
inventory.setStackInSlot(0, HelpersFL.updateFoodFuzzed(input, recipe.getOutputItem(input)));
setAndUpdateSlots(0);
markForSync();
}
}
markDirty();
}
use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.
the class TELeafMat method setDuration.
private void setDuration() {
ItemStack input = inventory.getStackInSlot(0);
int recipeTime = 0;
if (!input.isEmpty() && !world.isRemote) {
DryingRecipe recipe = DryingRecipe.get(input);
if (recipe != null) {
recipeTime = DryingRecipe.getDuration(recipe);
}
}
tickGoal = recipeTime;
}
use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.
the class LeafMatProvider method getTooltip.
@Nonnull
@Override
public List<String> getTooltip(World world, @Nonnull BlockPos pos, @Nonnull NBTTagCompound nbt) {
List<String> currentTooltip = new ArrayList<>();
TileEntity te = world.getTileEntity(pos);
if (te instanceof TELeafMat) {
TELeafMat leafMat = (TELeafMat) te;
ItemStack mainSlot = leafMat.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).getStackInSlot(0);
DryingRecipe recipe = DryingRecipe.get(mainSlot);
if (!mainSlot.isEmpty() && recipe != null) {
long remainingTicks = leafMat.getTicksRemaining();
switch(ConfigTFC.Client.TOOLTIP.timeTooltipMode) {
case NONE:
break;
case TICKS:
currentTooltip.add(new TextComponentTranslation("waila.tfc.devices.ticks_remaining", remainingTicks).getFormattedText());
case MINECRAFT_HOURS:
long remainingHours = Math.round(remainingTicks / (float) ICalendar.TICKS_IN_HOUR);
currentTooltip.add(new TextComponentTranslation("waila.tfc.devices.hours_remaining", remainingHours).getFormattedText());
break;
case REAL_MINUTES:
long remainingMinutes = Math.round(remainingTicks / 1200.0f);
currentTooltip.add(new TextComponentTranslation("waila.tfc.devices.minutes_remaining", remainingMinutes).getFormattedText());
break;
}
currentTooltip.add(new TextComponentTranslation(recipe.getOutputItem(mainSlot).getTranslationKey() + ".name").getFormattedText());
}
}
return currentTooltip;
}
use of com.eerussianguy.firmalife.recipe.DryingRecipe in project firmalife by eerussianguy.
the class CTDrying method addRecipe.
@ZenMethod
public static void addRecipe(String recipe_name, IIngredient input, IItemStack output, int duration) {
DryingRecipe recipe = new DryingRecipe(CTHelper.getInternalIngredient(input), InputHelper.toStack(output), duration).setRegistryName(recipe_name);
CraftTweakerAPI.apply(new IAction() {
@Override
public void apply() {
RegistriesFL.DRYING.register(recipe);
}
@Override
public String describe() {
return "Adding Drying recipe " + recipe.getRegistryName().toString();
}
});
}
Aggregations