use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class OneToNoneRecipes method add.
public void add(@Nonnull final IItemStack item) {
if (item == null)
throw new IllegalArgumentException("item cannot be null");
final RecipeData data = new RecipeData();
data.setInput(CraftTweakerMC.getItemStack(item));
CraftTweakerIntegration.defer("Add item " + data + " to " + this.name, () -> {
this.recipes.add(data);
CraftTweakerAPI.logInfo(this.name + ": Added item " + data);
});
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class OneToOneRecipes method addRecipe.
public void addRecipe(@Nonnull final IItemStack output, @Nonnull final IItemStack input) {
if (output == null)
throw new IllegalArgumentException("output cannot be null");
if (input == null)
throw new IllegalArgumentException("input cannot be null");
final RecipeData data = new RecipeData();
data.setOutput(CraftTweakerMC.getItemStack(output));
data.setInput(CraftTweakerMC.getItemStack(input));
CraftTweakerIntegration.defer("Add recipe " + data + " to " + this.name, () -> {
this.recipes.add(data);
CraftTweakerAPI.logInfo(this.name + ": Added recipe " + data);
});
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class TileEntityMicrowave method update.
@Override
public void update() {
if (cooking) {
if (this.world.isRemote) {
double posX = pos.getX() + 0.35D + (rand.nextDouble() / 3);
double posZ = pos.getZ() + 0.35D + (rand.nextDouble() / 3);
ParticleSpawner.spawnParticle("smoke", posX, pos.getY() + 0.065D, posZ);
}
progress++;
if (progress >= 40) {
if (!getStackInSlot(0).isEmpty()) {
RecipeData data = RecipeAPI.getMicrowaveRecipeFromIngredients(getStackInSlot(0));
if (data != null) {
this.setInventorySlotContents(0, data.getOutput().copy());
}
}
if (world.isRemote) {
world.playSound(pos.getX(), pos.getY(), pos.getZ(), FurnitureSounds.microwave_finish, SoundCategory.BLOCKS, 0.75F, 1.0F, true);
}
timer = 0;
progress = 0;
cooking = false;
world.updateComparatorOutputLevel(pos, blockType);
} else {
if (timer == 20) {
timer = 0;
}
if (timer == 0) {
world.playSound(pos.getX(), pos.getY(), pos.getZ(), FurnitureSounds.microwave_running, SoundCategory.BLOCKS, 0.75F, 1.0F, true);
}
timer++;
}
}
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class TileEntityMicrowave method startCooking.
public void startCooking() {
if (!getStackInSlot(0).isEmpty()) {
RecipeData data = RecipeAPI.getMicrowaveRecipeFromIngredients(getStackInSlot(0));
if (data != null) {
cooking = true;
world.updateComparatorOutputLevel(pos, blockType);
}
}
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class TileEntityToaster method update.
@Override
public void update() {
if (toasting) {
if (toastingTime == 200) {
for (int i = 0; i < slots.length; i++) {
if (slots[i] != null) {
if (!world.isRemote) {
RecipeData data = RecipeAPI.getToasterRecipeFromInput(slots[i]);
EntityItem entityItem = new EntityItem(world, pos.getX() + 0.5, pos.getY() + 0.6, pos.getZ() + 0.5, data.getOutput().copy());
world.spawnEntity(entityItem);
}
slots[i] = null;
}
}
if (!world.isRemote) {
world.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, FurnitureSounds.toaster_down, SoundCategory.BLOCKS, 0.75F, 1.0F);
}
toastingTime = 0;
toasting = false;
TileEntityUtil.markBlockForUpdate(world, pos);
world.updateComparatorOutputLevel(pos, blockType);
} else {
toastingTime++;
}
}
}
Aggregations