package net.shadowfacts.enfusion.machine.grinder;

import net.shadowfacts.enfusion.EnFusion;
import net.shadowfacts.enfusion.client.EFBlockTextures;
import nova.core.block.Block;
import nova.core.block.component.StaticBlockRenderer;
import nova.core.component.Category;
import nova.core.component.misc.Collider;
import nova.core.component.renderer.ItemRenderer;
import nova.core.gui.Gui;
import nova.core.gui.GuiEvent;
import nova.core.gui.component.Container;
import nova.core.gui.component.inventory.Slot;
import nova.core.gui.layout.FlowLayout;
import nova.core.inventory.Inventory;
import nova.core.inventory.InventorySimple;
import nova.core.render.texture.Texture;
import nova.core.util.Direction;

import java.util.Optional;

/**
 * @author shadowfacts
 */
public class BlockGrinder extends Block {

	public Inventory inventory = new InventorySimple(2);

	public BlockGrinder() {
		add(new StaticBlockRenderer(this)).setTexture(this::getTexture);
		add(new ItemRenderer(this));
		add(new Collider());
		add(new Category(EnFusion.id + ".category.machines"));

		events.on(RightClickEvent.class).bind(this::onRightClick);
	}

	private Optional<Texture> getTexture(Direction dir) {
		return Optional.of(EFBlockTextures.grinderFront);
	}

	private void onRightClick(RightClickEvent event) {
		EnFusion.guiManager.showGui(EnFusion.id + ".gui.grinder", event.entity, position());
		event.result = true;
	}

	@Override
	public String getID() {
		return EnFusion.id + ".machine.grinder";
	}

}

@@ -172,16 +172,49 @@
 .Block;%0A
+import nova.core.block.Stateful;%0A
 import n
@@ -677,28 +677,165 @@
 ore.
-render.texture.Textu
+network.Sync;%0Aimport nova.core.network.Syncable;%0Aimport nova.core.render.texture.Texture;%0Aimport nova.core.retention.Storable;%0Aimport nova.core.retention.Sto
 re;%0A
@@ -967,18 +967,73 @@
 s Block 
-%7B%0A
+implements Storable, Stateful, Syncable %7B%0A%0A%09@Sync%0A%09@Store
 %0A%09public
@@ -1079,9 +1079,9 @@
 ple(
-2
+1
 );%0A%0A

Add Sync and Store to Inventory