use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class PageFreezer method draw.
@Override
public void draw(GuiRecipeBook gui, int x, int y, int mouseX, int mouseY, float partialTicks) {
for (int i = 0; i < recipes.size(); i++) {
int px = x + ((i / 4) * 150) + 15;
int py = y + ((i % 4) * spacing);
RecipeData data = recipes.get(i);
gui.getItemRenderer().zLevel = 100.0F;
gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getInput(), px, py);
gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getInput(), px, py);
gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getOutput(), px + 60, py);
gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getOutput(), px + 60, py);
gui.getItemRenderer().zLevel = 0.0F;
gui.drawProgressArrow(px + 27, py + 2, partialTicks);
}
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class PageWashingMachine method draw.
@Override
public void draw(GuiRecipeBook gui, int x, int y, int mouseX, int mouseY, float partialTicks) {
gui.getFontRenderer().drawString(I18n.format("cfm.recipe_book.page.dishwasher1"), x + 150, 40, 16739840);
gui.getFontRenderer().drawString(I18n.format("cfm.recipe_book.page.washingmachine2"), x + 150, 50, 16739840);
gui.getFontRenderer().drawString(I18n.format("cfm.recipe_book.page.washingmachine3"), x + 150, 60, 16739840);
gui.getFontRenderer().drawString(I18n.format("cfm.recipe_book.page.dishwasher1"), x + 4, 40, 16739840);
gui.getFontRenderer().drawString(I18n.format("cfm.recipe_book.page.washingmachine2"), x + 4, 50, 16739840);
gui.getFontRenderer().drawString(I18n.format("cfm.recipe_book.page.washingmachine3"), x + 4, 60, 16739840);
for (int i = 0; i < recipes.size(); i++) {
int px = x + ((i % 5) * 20) + ((i / 20) * 145) + 7;
int py = y + ((i / 5) * 20) - ((i / 20) * (4 * 20)) + 30;
RecipeData data = recipes.get(i);
gui.getItemRenderer().zLevel = 100.0F;
gui.getItemRenderer().renderItemAndEffectIntoGUI(data.getInput(), px, py);
gui.getItemRenderer().renderItemOverlays(gui.getFontRenderer(), data.getInput(), px, py);
gui.getItemRenderer().zLevel = 0.0F;
}
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class MessageMineBayBuy method onMessage.
@Override
public IMessage onMessage(MessageMineBayBuy message, MessageContext ctx) {
final WorldServer world = ctx.getServerHandler().player.getServerWorld();
world.addScheduledTask(() -> {
EntityPlayer player = ctx.getServerHandler().player;
TileEntity tileEntity = player.world.getTileEntity(new BlockPos(message.x, message.y, message.z));
if (tileEntity instanceof TileEntityComputer) {
TileEntityComputer tileEntityComputer = (TileEntityComputer) tileEntity;
ItemStack buySlot = tileEntityComputer.getStackInSlot(0);
if (buySlot.isEmpty())
return;
RecipeData[] data = Recipes.getMineBayItems();
if (message.itemNum < 0 || message.itemNum >= data.length)
return;
RecipeData recipe = data[message.itemNum];
int price = recipe.getPrice();
if (recipe.getCurrency().getItem() == buySlot.getItem() && buySlot.getCount() >= price) {
tileEntityComputer.takeEmeraldFromSlot(price);
EntityItem entityItem = new EntityItem(player.world, player.posX, player.posY + 1, player.posZ, data[message.itemNum].getInput().copy());
player.world.spawnEntity(entityItem);
Triggers.trigger(Triggers.MINEBAY_PURCHASE, player);
}
}
});
return null;
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class TileEntityOven method canCook.
private int canCook() {
boolean hasItem = false;
int itemNum = -1;
for (int x = 0; x < 4; x++) {
if (!getStackInSlot(x).isEmpty()) {
hasItem = true;
itemNum = x;
break;
}
}
if (hasItem) {
RecipeData data = Recipes.getOvenRecipeFromInput(getStackInSlot(itemNum));
if (data == null) {
return -1;
}
if (getStackInSlot(itemNum + 4).isEmpty()) {
return itemNum;
}
if (getStackInSlot(itemNum + 4).getItem() != data.getOutput().getItem())
return -1;
if (getStackInSlot(itemNum + 4).getCount() < this.getInventoryStackLimit() && getStackInSlot(itemNum + 4).getCount() < getStackInSlot(itemNum + 4).getMaxStackSize()) {
return itemNum;
}
if (getStackInSlot(itemNum + 4).getCount() < data.getOutput().getMaxStackSize()) {
return itemNum;
} else {
return -1;
}
}
return -1;
}
use of com.mrcrayfish.furniture.api.RecipeData in project MrCrayfishFurnitureMod by MrCrayfish.
the class TileEntityGrill method removeFood.
public boolean removeFood(BlockGrill.ClickedSide clickedSide) {
if (!world.isRemote) {
if (clickedSide.id <= 1) {
if (inventory[clickedSide.id] != null) {
resetSide(clickedSide);
RecipeData data = RecipeAPI.getGrillRecipeFromInput(inventory[clickedSide.id]);
if (isCooked(clickedSide) && data != null) {
spawnItem(data.getOutput());
} else {
spawnItem(inventory[clickedSide.id]);
}
inventory[clickedSide.id] = null;
TileEntityUtil.markBlockForUpdate(world, pos);
return true;
}
}
}
return false;
}
Aggregations