Work the new crafting system in the code. Messy, unfinished and untested
This commit is contained in:
@@ -23,6 +23,11 @@ public interface ICraftingPattern {
|
||||
*/
|
||||
boolean isValid();
|
||||
|
||||
/**
|
||||
* @return true if the crafting pattern can be treated as a processing pattern, false otherwise
|
||||
*/
|
||||
boolean isProcessing();
|
||||
|
||||
/**
|
||||
* @return the inputs
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package refinedstorage.api.autocrafting;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
@@ -17,11 +16,6 @@ public interface ICraftingPatternContainer {
|
||||
*/
|
||||
int getSpeed();
|
||||
|
||||
/**
|
||||
* @return the tile that this container is facing
|
||||
*/
|
||||
TileEntity getFacingTile();
|
||||
|
||||
/**
|
||||
* @return the inventory that this container is facing
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -16,12 +17,13 @@ public interface ICraftingTaskFactory {
|
||||
/**
|
||||
* Returns a crafting task for a given NBT tag and pattern.
|
||||
*
|
||||
* @param world the world
|
||||
* @param depth the depth of the crafting task to create
|
||||
* @param tag the NBT tag, if this is null it isn't reading from disk but is used for making a task on demand
|
||||
* @param pattern the pattern
|
||||
* @param world the world
|
||||
* @param network the network
|
||||
* @param pattern the pattern
|
||||
* @param quantity the quantity
|
||||
* @param tag the NBT tag, if this is null it isn't reading from disk but is used for making a task on demand
|
||||
* @return the crafting task
|
||||
*/
|
||||
@Nonnull
|
||||
ICraftingTask create(World world, int depth, @Nullable NBTTagCompound tag, ICraftingPattern pattern);
|
||||
ICraftingTask create(World world, INetworkMaster network, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag);
|
||||
}
|
||||
|
||||
@@ -1,186 +0,0 @@
|
||||
package refinedstorage.api.autocrafting.task;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagIntArray;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.tile.TileController;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A default implementation for crafting tasks.
|
||||
*/
|
||||
public abstract class CraftingTask implements ICraftingTask {
|
||||
public static final int MAX_DEPTH = 100;
|
||||
|
||||
public static final String NBT_CHILDREN_CREATED = "ChildrenCreated";
|
||||
public static final String NBT_SATISFIED = "Satisfied";
|
||||
public static final String NBT_CHECKED = "Checked";
|
||||
public static final String NBT_TOOK = "Took";
|
||||
public static final String NBT_PATTERN_STACK = "Pattern";
|
||||
public static final String NBT_PATTERN_TYPE = "Type";
|
||||
public static final String NBT_PATTERN_CONTAINER = "Container";
|
||||
|
||||
private static final String NBT_CHILD = "Child";
|
||||
|
||||
protected int depth;
|
||||
|
||||
protected ICraftingPattern pattern;
|
||||
protected ICraftingTask child;
|
||||
|
||||
protected List<ItemStack> took = new ArrayList<>();
|
||||
|
||||
protected boolean childrenCreated[];
|
||||
protected boolean satisfied[];
|
||||
protected boolean checked[];
|
||||
|
||||
public CraftingTask(ICraftingPattern pattern, int depth) {
|
||||
this.pattern = pattern;
|
||||
this.childrenCreated = new boolean[pattern.getInputs().size()];
|
||||
this.satisfied = new boolean[pattern.getInputs().size()];
|
||||
this.checked = new boolean[pattern.getInputs().size()];
|
||||
this.depth = depth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingPattern getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
public void setTook(List<ItemStack> took) {
|
||||
this.took = took;
|
||||
}
|
||||
|
||||
public List<ItemStack> getTook() {
|
||||
return took;
|
||||
}
|
||||
|
||||
public boolean[] getChildrenCreated() {
|
||||
return childrenCreated;
|
||||
}
|
||||
|
||||
public void setChildrenCreated(boolean[] childrenCreated) {
|
||||
this.childrenCreated = childrenCreated;
|
||||
}
|
||||
|
||||
public boolean[] getSatisfied() {
|
||||
return satisfied;
|
||||
}
|
||||
|
||||
protected boolean hasReceivedInputs() {
|
||||
for (boolean item : satisfied) {
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setSatisfied(boolean[] satisfied) {
|
||||
this.satisfied = satisfied;
|
||||
}
|
||||
|
||||
public boolean[] getChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean[] checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
protected void tryCreateChild(INetworkMaster network, int i) {
|
||||
if (!childrenCreated[i] && depth + 1 < MAX_DEPTH) {
|
||||
ICraftingPattern pattern = NetworkUtils.getPattern(network, this.pattern.getInputs().get(i));
|
||||
|
||||
if (pattern != null) {
|
||||
child = NetworkUtils.createCraftingTask(network, depth + 1, pattern);
|
||||
|
||||
childrenCreated[i] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public ICraftingTask getChild() {
|
||||
return child;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChild(@Nullable ICraftingTask child) {
|
||||
this.child = child;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancelled(INetworkMaster network) {
|
||||
for (ItemStack stack : took) {
|
||||
// @TODO: Handle remainder
|
||||
network.insertItem(stack, stack.stackSize, false);
|
||||
}
|
||||
|
||||
if (child != null) {
|
||||
child.onCancelled(network);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
if (child != null) {
|
||||
tag.setTag(NBT_CHILD, child.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
tag.setString(NBT_PATTERN_TYPE, pattern.getId());
|
||||
tag.setTag(NBT_PATTERN_STACK, pattern.getStack().serializeNBT());
|
||||
tag.setLong(NBT_PATTERN_CONTAINER, pattern.getContainer().getPosition().toLong());
|
||||
|
||||
writeBooleanArray(tag, NBT_CHILDREN_CREATED, childrenCreated);
|
||||
writeBooleanArray(tag, NBT_SATISFIED, satisfied);
|
||||
writeBooleanArray(tag, NBT_CHECKED, checked);
|
||||
|
||||
NBTTagList took = new NBTTagList();
|
||||
|
||||
for (ItemStack stack : this.took) {
|
||||
took.appendTag(stack.serializeNBT());
|
||||
}
|
||||
|
||||
tag.setTag(NBT_TOOK, took);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void readChildNBT(World world, NBTTagCompound tag) {
|
||||
if (tag.hasKey(NBT_CHILD)) {
|
||||
child = TileController.readCraftingTask(world, depth + 1, tag.getCompoundTag(NBT_CHILD));
|
||||
}
|
||||
}
|
||||
|
||||
public static void writeBooleanArray(NBTTagCompound tag, String name, boolean[] array) {
|
||||
int[] intArray = new int[array.length];
|
||||
|
||||
for (int i = 0; i < intArray.length; ++i) {
|
||||
intArray[i] = array[i] ? 1 : 0;
|
||||
}
|
||||
|
||||
tag.setTag(name, new NBTTagIntArray(intArray));
|
||||
}
|
||||
|
||||
public static boolean[] readBooleanArray(NBTTagCompound tag, String name) {
|
||||
int[] intArray = tag.getIntArray(name);
|
||||
|
||||
boolean array[] = new boolean[intArray.length];
|
||||
|
||||
for (int i = 0; i < intArray.length; ++i) {
|
||||
array[i] = intArray[i] == 1 ? true : false;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +1,37 @@
|
||||
package refinedstorage.api.autocrafting.task;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a crafting task.
|
||||
*/
|
||||
public interface ICraftingTask {
|
||||
/**
|
||||
* @return the pattern
|
||||
*/
|
||||
ICraftingPattern getPattern();
|
||||
String NBT_QUANTITY = "Quantity";
|
||||
String NBT_PATTERN_ID = "PatternID";
|
||||
String NBT_PATTERN_STACK = "PatternStack";
|
||||
String NBT_PATTERN_CONTAINER = "PatternContainer";
|
||||
|
||||
/**
|
||||
* @return the child task
|
||||
*/
|
||||
@Nullable
|
||||
ICraftingTask getChild();
|
||||
void calculate();
|
||||
|
||||
/**
|
||||
* @param child the child task
|
||||
*/
|
||||
void setChild(@Nullable ICraftingTask child);
|
||||
void onCancelled();
|
||||
|
||||
/**
|
||||
* @param world the world
|
||||
* @param network the network
|
||||
* @return true if the crafting task is done, false otherwise
|
||||
*/
|
||||
boolean update(World world, INetworkMaster network);
|
||||
boolean update();
|
||||
|
||||
/**
|
||||
* Gets called when the crafting task is cancelled.
|
||||
*
|
||||
* @param network the network
|
||||
*/
|
||||
void onCancelled(INetworkMaster network);
|
||||
int getQuantity();
|
||||
|
||||
/**
|
||||
* Writes this crafting task to NBT.
|
||||
*
|
||||
* @param tag the NBT tag to write to
|
||||
* @return the written NBT tag
|
||||
*/
|
||||
NBTTagCompound writeToNBT(NBTTagCompound tag);
|
||||
|
||||
/**
|
||||
* Returns the status of this crafting task that is used for the tooltip in the crafting monitor.
|
||||
*
|
||||
* @param network the network
|
||||
* @return the status
|
||||
*/
|
||||
String getStatus(INetworkMaster network);
|
||||
ICraftingPattern getPattern();
|
||||
|
||||
/**
|
||||
* @return the progress for display in the crafting monitor, or -1 to not display any progress
|
||||
*/
|
||||
int getProgress();
|
||||
Deque<ItemStack> getToTake();
|
||||
|
||||
Multimap<Item, ItemStack> getToCraft();
|
||||
|
||||
Multimap<Item, ItemStack> getMissing();
|
||||
|
||||
List<IProcessable> getToProcess();
|
||||
}
|
||||
|
||||
12
src/main/java/refinedstorage/api/autocrafting/task/IProcessable.java
Executable file
12
src/main/java/refinedstorage/api/autocrafting/task/IProcessable.java
Executable file
@@ -0,0 +1,12 @@
|
||||
package refinedstorage.api.autocrafting.task;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
|
||||
import java.util.Deque;
|
||||
|
||||
public interface IProcessable {
|
||||
ICraftingPattern getPattern();
|
||||
|
||||
Deque<ItemStack> getToInsert();
|
||||
}
|
||||
@@ -3,11 +3,18 @@ package refinedstorage.api.network;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import refinedstorage.api.RefinedStorageAPI;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternProvider;
|
||||
import refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
|
||||
@@ -27,8 +34,8 @@ public final class NetworkUtils {
|
||||
return network.getPattern(stack, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
}
|
||||
|
||||
public static ICraftingTask createCraftingTask(INetworkMaster network, int depth, ICraftingPattern pattern) {
|
||||
return RefinedStorageAPI.instance().getCraftingTaskRegistry().getFactory(pattern.getId()).create(network.getNetworkWorld(), depth, null, pattern);
|
||||
public static ICraftingTask createCraftingTask(INetworkMaster network, ICraftingPattern pattern, int quantity) {
|
||||
return RefinedStorageAPI.instance().getCraftingTaskRegistry().getFactory(pattern.getId()).create(network.getNetworkWorld(), network, pattern, quantity, null);
|
||||
}
|
||||
|
||||
public static boolean hasPattern(INetworkMaster network, ItemStack stack) {
|
||||
@@ -62,11 +69,31 @@ public final class NetworkUtils {
|
||||
ICraftingPattern pattern = network.getPattern(stack, compare);
|
||||
|
||||
if (pattern != null) {
|
||||
network.addCraftingTask(createCraftingTask(network, 0, pattern));
|
||||
network.addCraftingTask(createCraftingTask(network, pattern, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ICraftingTask readCraftingTask(World world, INetworkMaster network, NBTTagCompound tag) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(ICraftingTask.NBT_PATTERN_STACK));
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternProvider) {
|
||||
TileEntity container = world.getTileEntity(BlockPos.fromLong(tag.getLong(ICraftingTask.NBT_PATTERN_CONTAINER)));
|
||||
|
||||
if (container instanceof ICraftingPatternContainer) {
|
||||
ICraftingPattern pattern = ((ICraftingPatternProvider) stack.getItem()).create(world, stack, (ICraftingPatternContainer) container);
|
||||
|
||||
ICraftingTaskFactory factory = RefinedStorageAPI.instance().getCraftingTaskRegistry().getFactory(tag.getString(ICraftingTask.NBT_PATTERN_ID));
|
||||
|
||||
if (factory != null) {
|
||||
return factory.create(world, network, pattern, tag.getInteger(ICraftingTask.NBT_QUANTITY), tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeItemStack(ByteBuf buf, INetworkMaster network, ItemStack stack) {
|
||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||
buf.writeInt(stack.stackSize);
|
||||
|
||||
@@ -11,7 +11,6 @@ import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryNormal;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryProcessing;
|
||||
import refinedstorage.item.ItemPattern;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -79,6 +78,11 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
return !inputs.isEmpty() && !outputs.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProcessing() {
|
||||
return ItemPattern.isProcessing(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
return inputs;
|
||||
@@ -96,7 +100,7 @@ public class CraftingPattern implements ICraftingPattern {
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return ItemPattern.isProcessing(stack) ? CraftingTaskFactoryProcessing.ID : CraftingTaskFactoryNormal.ID;
|
||||
return CraftingTaskFactoryNormal.ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
package refinedstorage.apiimpl.autocrafting.preview;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.task.CraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.apiimpl.autocrafting.CraftingPattern;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class CraftingPreviewData {
|
||||
private HashMap<Integer, CraftingPreviewStack> data = new HashMap<>();
|
||||
private INetworkMaster network;
|
||||
private boolean depthCheck = false;
|
||||
|
||||
public CraftingPreviewData(INetworkMaster network) {
|
||||
this.network = network;
|
||||
}
|
||||
|
||||
public void calculate(ItemStack stack, int quantity) {
|
||||
calculate(stack, quantity, true, 0);
|
||||
}
|
||||
|
||||
private void calculate(ItemStack stack, int quantity, boolean baseStack, int depth) {
|
||||
if (!this.depthCheck) {
|
||||
quantity = -add(stack, quantity, baseStack);
|
||||
|
||||
if (quantity > 0 && !get(stack).cantCraft()) {
|
||||
ICraftingPattern pattern = NetworkUtils.getPattern(network, stack);
|
||||
|
||||
if (pattern != null && depth < CraftingTask.MAX_DEPTH) {
|
||||
int quantityPerRequest = pattern.getQuantityPerRequest(stack);
|
||||
|
||||
while (quantity > 0) {
|
||||
for (ItemStack ingredient : pattern.getInputs()) {
|
||||
calculate(ingredient, ingredient.stackSize, false, depth + 1);
|
||||
}
|
||||
|
||||
get(stack).addExtras(quantityPerRequest);
|
||||
|
||||
quantity -= quantityPerRequest;
|
||||
}
|
||||
} else {
|
||||
if (depth >= CraftingTask.MAX_DEPTH) {
|
||||
this.depthCheck = true;
|
||||
}
|
||||
get(stack).setCantCraft(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int add(ItemStack stack, int quantity, boolean baseStack) {
|
||||
int hash = NetworkUtils.getItemStackHashCode(stack);
|
||||
|
||||
CraftingPreviewStack previewStack;
|
||||
if (data.containsKey(hash)) {
|
||||
previewStack = data.get(hash);
|
||||
|
||||
previewStack.addNeeded(quantity);
|
||||
} else {
|
||||
ItemStack networkStack = network.getItemStorage().get(stack, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
|
||||
previewStack = new CraftingPreviewStack(stack, quantity, networkStack == null || baseStack ? 0 : networkStack.stackSize);
|
||||
|
||||
data.put(hash, previewStack);
|
||||
}
|
||||
return baseStack ? -quantity : previewStack.getAvailable();
|
||||
}
|
||||
|
||||
public CraftingPreviewStack get(ItemStack stack) {
|
||||
return data.get(NetworkUtils.getItemStackHashCode(stack));
|
||||
}
|
||||
|
||||
public Collection<CraftingPreviewStack> values() {
|
||||
return this.depthCheck ? Collections.emptyList() : this.data.values();
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package refinedstorage.apiimpl.autocrafting.preview;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CraftingPreviewStack {
|
||||
private ItemStack stack;
|
||||
private int needed;
|
||||
private int stock;
|
||||
private int extras;
|
||||
private boolean cantCraft;
|
||||
|
||||
public CraftingPreviewStack(ItemStack stack, int needed, int stock) {
|
||||
this.stack = stack;
|
||||
this.needed = needed;
|
||||
this.stock = stock;
|
||||
this.extras = 0;
|
||||
this.cantCraft = false;
|
||||
}
|
||||
|
||||
public void writeToByteBuf(ByteBuf buf) {
|
||||
buf.writeInt(Item.getIdFromItem(stack.getItem()));
|
||||
buf.writeInt(stack.getMetadata());
|
||||
buf.writeInt(needed);
|
||||
buf.writeInt(stock);
|
||||
buf.writeInt(extras);
|
||||
buf.writeBoolean(cantCraft);
|
||||
}
|
||||
|
||||
public static CraftingPreviewStack fromByteBuf(ByteBuf buf) {
|
||||
Item item = Item.getItemById(buf.readInt());
|
||||
int meta = buf.readInt();
|
||||
int toCraft = buf.readInt();
|
||||
int available = buf.readInt();
|
||||
|
||||
CraftingPreviewStack stack = new CraftingPreviewStack(new ItemStack(item, 1, meta), toCraft, available);
|
||||
|
||||
stack.extras = buf.readInt();
|
||||
stack.cantCraft = buf.readBoolean();
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void addNeeded(int quantity) {
|
||||
this.needed += quantity;
|
||||
}
|
||||
|
||||
public void addExtras(int quantity) {
|
||||
this.extras += quantity;
|
||||
}
|
||||
|
||||
public int getAvailable() {
|
||||
return this.stock + this.extras - this.needed;
|
||||
}
|
||||
|
||||
public ItemStack getStack() {
|
||||
return stack;
|
||||
}
|
||||
|
||||
public int getStock() {
|
||||
return stock;
|
||||
}
|
||||
|
||||
public int getNeeded() {
|
||||
return needed;
|
||||
}
|
||||
|
||||
public boolean needsCrafting() {
|
||||
return this.needed > this.stock;
|
||||
}
|
||||
|
||||
public boolean cantCraft() {
|
||||
return this.cantCraft;
|
||||
}
|
||||
|
||||
public int getToCraft() {
|
||||
return this.needed - this.stock;
|
||||
}
|
||||
|
||||
public void setCantCraft(boolean cantCraft) {
|
||||
this.cantCraft = cantCraft;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +1,22 @@
|
||||
package refinedstorage.apiimpl.autocrafting.registry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
|
||||
import refinedstorage.api.autocrafting.task.CraftingTask;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.apiimpl.autocrafting.task.CraftingTaskNormal;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CraftingTaskFactoryNormal implements ICraftingTaskFactory {
|
||||
public static final String ID = "normal";
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ICraftingTask create(World world, int depth, @Nullable NBTTagCompound tag, ICraftingPattern pattern) {
|
||||
CraftingTaskNormal task = new CraftingTaskNormal(pattern, depth);
|
||||
|
||||
if (tag != null) {
|
||||
task.setChildrenCreated(CraftingTask.readBooleanArray(tag, CraftingTask.NBT_CHILDREN_CREATED));
|
||||
task.setSatisfied(CraftingTask.readBooleanArray(tag, CraftingTask.NBT_SATISFIED));
|
||||
task.setChecked(CraftingTask.readBooleanArray(tag, CraftingTask.NBT_CHECKED));
|
||||
|
||||
List<ItemStack> took = new ArrayList<>();
|
||||
|
||||
NBTTagList tookTag = tag.getTagList(CraftingTask.NBT_TOOK, Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < tookTag.tagCount(); ++i) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tookTag.getCompoundTagAt(i));
|
||||
|
||||
if (stack != null) {
|
||||
took.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
task.setTook(took);
|
||||
|
||||
task.readChildNBT(world, tag);
|
||||
}
|
||||
|
||||
return task;
|
||||
public ICraftingTask create(World world, INetworkMaster network, ICraftingPattern pattern, int quantity, @Nullable NBTTagCompound tag) {
|
||||
return new CraftingTaskNormal(network, pattern, quantity);
|
||||
}
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package refinedstorage.apiimpl.autocrafting.registry;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.registry.ICraftingTaskFactory;
|
||||
import refinedstorage.api.autocrafting.task.CraftingTask;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.apiimpl.autocrafting.task.CraftingTaskProcessing;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CraftingTaskFactoryProcessing implements ICraftingTaskFactory {
|
||||
public static final String ID = "processing";
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ICraftingTask create(World world, int depth, @Nullable NBTTagCompound tag, ICraftingPattern pattern) {
|
||||
CraftingTaskProcessing task = new CraftingTaskProcessing(pattern, depth);
|
||||
|
||||
if (tag != null) {
|
||||
task.setChildrenCreated(CraftingTask.readBooleanArray(tag, CraftingTask.NBT_CHILDREN_CREATED));
|
||||
task.setSatisfied(CraftingTask.readBooleanArray(tag, CraftingTask.NBT_SATISFIED));
|
||||
task.setSatisfiedInsertion(CraftingTask.readBooleanArray(tag, CraftingTaskProcessing.NBT_SATISFIED_INSERTION));
|
||||
task.setChecked(CraftingTask.readBooleanArray(tag, CraftingTask.NBT_CHECKED));
|
||||
|
||||
if (tag.hasKey(CraftingTaskProcessing.NBT_TILE_IN_USE)) {
|
||||
task.setTileInUse(BlockPos.fromLong(tag.getLong(CraftingTaskProcessing.NBT_TILE_IN_USE)));
|
||||
}
|
||||
|
||||
List<ItemStack> took = new ArrayList<>();
|
||||
|
||||
NBTTagList tookTag = tag.getTagList(CraftingTask.NBT_TOOK, Constants.NBT.TAG_COMPOUND);
|
||||
|
||||
for (int i = 0; i < tookTag.tagCount(); ++i) {
|
||||
ItemStack stack = ItemStack.loadItemStackFromNBT(tookTag.getCompoundTagAt(i));
|
||||
|
||||
if (stack != null) {
|
||||
took.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
task.setTook(took);
|
||||
|
||||
task.readChildNBT(world, tag);
|
||||
}
|
||||
|
||||
return task;
|
||||
}
|
||||
}
|
||||
@@ -1,105 +1,233 @@
|
||||
package refinedstorage.apiimpl.autocrafting.task;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.task.CraftingTask;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.autocrafting.task.IProcessable;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidUtils;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
|
||||
public class CraftingTaskNormal extends CraftingTask {
|
||||
public CraftingTaskNormal(ICraftingPattern pattern, int depth) {
|
||||
super(pattern, depth);
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
|
||||
public class CraftingTaskNormal implements ICraftingTask {
|
||||
private INetworkMaster network;
|
||||
private ICraftingPattern pattern;
|
||||
private int quantity;
|
||||
private Deque<ItemStack> toTake = new ArrayDeque<>();
|
||||
private List<IProcessable> toProcess = new ArrayList<>();
|
||||
private Multimap<Item, ItemStack> toCraft = ArrayListMultimap.create();
|
||||
private Multimap<Item, ItemStack> missing = ArrayListMultimap.create();
|
||||
private Multimap<Item, ItemStack> extras = ArrayListMultimap.create();
|
||||
|
||||
public CraftingTaskNormal(INetworkMaster network, ICraftingPattern pattern, int quantity) {
|
||||
this.network = network;
|
||||
this.pattern = pattern;
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public void calculate() {
|
||||
calculate(network.getItemStorage().copy(), pattern, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(World world, INetworkMaster network) {
|
||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||
checked[i] = true;
|
||||
public void onCancelled() {
|
||||
|
||||
ItemStack input = pattern.getInputs().get(i);
|
||||
}
|
||||
|
||||
if (!satisfied[i]) {
|
||||
ItemStack received = FluidUtils.extractItemOrIfBucketLookInFluids(network, input, input.stackSize);
|
||||
private void calculate(IGroupedItemStorage storage, ICraftingPattern pattern, boolean basePattern) {
|
||||
for (int i = 0; i < quantity; ++i) {
|
||||
if (pattern.isProcessing()) {
|
||||
IProcessable processable = new Processable(pattern);
|
||||
|
||||
if (received != null) {
|
||||
satisfied[i] = true;
|
||||
for (int j = pattern.getInputs().size() - 1; j >= 0; --j) {
|
||||
processable.getToInsert().push(pattern.getInputs().get(j).copy());
|
||||
}
|
||||
|
||||
took.add(received);
|
||||
toProcess.add(processable);
|
||||
}
|
||||
|
||||
for (ItemStack input : pattern.getInputs()) {
|
||||
ItemStack inputInNetwork = storage.get(input, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
|
||||
if (inputInNetwork == null || inputInNetwork.stackSize == 0) {
|
||||
if (getExtrasFor(input) != null) {
|
||||
decrOrRemoveExtras(input);
|
||||
} else {
|
||||
ICraftingPattern inputPattern = NetworkUtils.getPattern(network, input);
|
||||
|
||||
if (inputPattern != null) {
|
||||
for (ItemStack output : inputPattern.getOutputs()) {
|
||||
addToCraft(output);
|
||||
}
|
||||
|
||||
calculate(storage, inputPattern, false);
|
||||
} else {
|
||||
addMissing(input);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tryCreateChild(network, i);
|
||||
}
|
||||
if (!pattern.isProcessing()) {
|
||||
toTake.push(input);
|
||||
}
|
||||
|
||||
break;
|
||||
storage.remove(input);
|
||||
}
|
||||
}
|
||||
|
||||
if (!basePattern) {
|
||||
addExtras(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasReceivedInputs()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (ItemStack output : pattern.getOutputs()) {
|
||||
// @TODO: Handle remainder
|
||||
network.insertItem(output, output.stackSize, false);
|
||||
}
|
||||
|
||||
for (ItemStack byproduct : pattern.getByproducts()) {
|
||||
// @TODO: Handle remainder
|
||||
network.insertItem(byproduct, byproduct.stackSize, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus(INetworkMaster network) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
public String toString() {
|
||||
return "\nCraftingTask{quantity=" + quantity +
|
||||
"\n, toTake=" + toTake +
|
||||
"\n, toCraft=" + toCraft +
|
||||
"\n, toProcess=" + toProcess +
|
||||
"\n, missing=" + missing +
|
||||
'}';
|
||||
}
|
||||
|
||||
boolean missingItems = false;
|
||||
public boolean update() {
|
||||
for (IProcessable processable : toProcess) {
|
||||
if (processable.getPattern().getContainer().getFacingInventory() != null && !processable.getToInsert().isEmpty()) {
|
||||
ItemStack toInsert = NetworkUtils.extractItem(network, processable.getToInsert().peek(), 1);
|
||||
|
||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||
ItemStack input = pattern.getInputs().get(i);
|
||||
if (ItemHandlerHelper.insertItem(processable.getPattern().getContainer().getFacingInventory(), toInsert, true) == null) {
|
||||
ItemHandlerHelper.insertItem(processable.getPattern().getContainer().getFacingInventory(), toInsert, false);
|
||||
|
||||
if (!satisfied[i] && !childrenCreated[i] && checked[i]) {
|
||||
if (!missingItems) {
|
||||
builder.append("I=gui.refinedstorage:crafting_monitor.missing_items\n");
|
||||
|
||||
missingItems = true;
|
||||
processable.getToInsert().pop();
|
||||
}
|
||||
|
||||
builder.append("T=").append(input.getUnlocalizedName()).append(".name\n");
|
||||
}
|
||||
}
|
||||
|
||||
boolean itemsCrafting = false;
|
||||
if (!toTake.isEmpty()) {
|
||||
ItemStack took = NetworkUtils.extractItem(network, toTake.peek(), 1);
|
||||
|
||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||
ItemStack input = pattern.getInputs().get(i);
|
||||
|
||||
if (!satisfied[i] && childrenCreated[i] && checked[i]) {
|
||||
if (!itemsCrafting) {
|
||||
builder.append("I=gui.refinedstorage:crafting_monitor.items_crafting\n");
|
||||
|
||||
itemsCrafting = true;
|
||||
}
|
||||
|
||||
builder.append("T=").append(input.getUnlocalizedName()).append(".name\n");
|
||||
if (took != null) {
|
||||
toTake.pop();
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
if (toTake.isEmpty() && missing.isEmpty()) {
|
||||
for (ItemStack output : pattern.getOutputs()) {
|
||||
// @TODO: Handle remainder
|
||||
network.insertItem(output, output.stackSize, false);
|
||||
}
|
||||
|
||||
for (ItemStack byproduct : pattern.getByproducts()) {
|
||||
// @TODO: Handle remainder
|
||||
network.insertItem(byproduct, byproduct.stackSize, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProgress() {
|
||||
int satisfiedAmount = 0;
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
for (boolean item : satisfied) {
|
||||
if (item) {
|
||||
satisfiedAmount++;
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingPattern getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Deque<ItemStack> getToTake() {
|
||||
return toTake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<Item, ItemStack> getToCraft() {
|
||||
return toCraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multimap<Item, ItemStack> getMissing() {
|
||||
return missing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IProcessable> getToProcess() {
|
||||
return toProcess;
|
||||
}
|
||||
|
||||
private void addMissing(ItemStack stack) {
|
||||
for (ItemStack m : missing.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
m.stackSize += stack.stackSize;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
return (int) ((float) satisfiedAmount / (float) satisfied.length * 100F);
|
||||
missing.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
|
||||
private void addExtras(ICraftingPattern pattern) {
|
||||
pattern.getOutputs().stream().filter(o -> o.stackSize > 1).forEach(o -> addExtras(ItemHandlerHelper.copyStackWithSize(o, o.stackSize - 1)));
|
||||
}
|
||||
|
||||
private void addExtras(ItemStack stack) {
|
||||
ItemStack extras = getExtrasFor(stack);
|
||||
|
||||
if (extras != null) {
|
||||
extras.stackSize += stack.stackSize;
|
||||
} else {
|
||||
this.extras.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getExtrasFor(ItemStack stack) {
|
||||
for (ItemStack m : extras.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void decrOrRemoveExtras(ItemStack stack) {
|
||||
ItemStack extras = getExtrasFor(stack);
|
||||
|
||||
extras.stackSize--;
|
||||
|
||||
if (extras.stackSize == 0) {
|
||||
this.extras.remove(extras.getItem(), extras);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToCraft(ItemStack stack) {
|
||||
for (ItemStack m : toCraft.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
m.stackSize += stack.stackSize;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
toCraft.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,226 +0,0 @@
|
||||
package refinedstorage.apiimpl.autocrafting.task;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.ICraftingPatternContainer;
|
||||
import refinedstorage.api.autocrafting.task.CraftingTask;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidUtils;
|
||||
|
||||
public class CraftingTaskProcessing extends CraftingTask {
|
||||
public static final String NBT_SATISFIED_INSERTION = "SatisfiedInsertion";
|
||||
public static final String NBT_TILE_IN_USE = "TileInUse";
|
||||
|
||||
private boolean satisfiedInsertion[];
|
||||
private BlockPos tileInUse;
|
||||
|
||||
public CraftingTaskProcessing(ICraftingPattern pattern, int depth) {
|
||||
super(pattern, depth);
|
||||
|
||||
this.satisfiedInsertion = new boolean[pattern.getOutputs().size()];
|
||||
}
|
||||
|
||||
public void setSatisfiedInsertion(boolean[] satisfiedInsertion) {
|
||||
this.satisfiedInsertion = satisfiedInsertion;
|
||||
}
|
||||
|
||||
public void setTileInUse(BlockPos tileInUse) {
|
||||
this.tileInUse = tileInUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(World world, INetworkMaster network) {
|
||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||
checked[i] = true;
|
||||
|
||||
ItemStack input = pattern.getInputs().get(i);
|
||||
|
||||
if (!satisfied[i]) {
|
||||
ItemStack received = FluidUtils.extractItemOrIfBucketLookInFluids(network, input, input.stackSize);
|
||||
|
||||
if (received != null) {
|
||||
satisfied[i] = true;
|
||||
|
||||
took.add(received);
|
||||
} else {
|
||||
tryCreateChild(network, i);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasReceivedInputs()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ICraftingPatternContainer container = pattern.getContainer();
|
||||
|
||||
if (container.getFacingTile() != null && !isTileInUse(network)) {
|
||||
tileInUse = pattern.getContainer().getFacingTile().getPos();
|
||||
|
||||
if (!took.isEmpty()) {
|
||||
ItemStack toInsert = took.get(0);
|
||||
|
||||
if (ItemHandlerHelper.insertItem(container.getFacingInventory(), toInsert, true) == null) {
|
||||
ItemHandlerHelper.insertItem(container.getFacingInventory(), toInsert, false);
|
||||
|
||||
took.remove(0);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tileInUse = null;
|
||||
}
|
||||
|
||||
return hasReceivedOutputs();
|
||||
}
|
||||
|
||||
private boolean hasReceivedOutputs() {
|
||||
for (boolean item : satisfiedInsertion) {
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private boolean isTileInUse(INetworkMaster network) {
|
||||
for (ICraftingTask task : network.getCraftingTasks()) {
|
||||
if (isTileInUse(task)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isTileInUse(ICraftingTask task) {
|
||||
if (task == this) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (task.getChild() != null) {
|
||||
return isTileInUse(task.getChild());
|
||||
}
|
||||
|
||||
if (task instanceof CraftingTaskProcessing) {
|
||||
CraftingTaskProcessing other = (CraftingTaskProcessing) task;
|
||||
|
||||
if (other.tileInUse != null && other.tileInUse.equals(pattern.getContainer().getFacingTile().getPos()) && !other.pattern.equals(pattern)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean onInserted(ItemStack stack) {
|
||||
if (!hasReceivedOutputs() && hasReceivedInputs()) {
|
||||
for (int i = 0; i < pattern.getOutputs().size(); ++i) {
|
||||
ItemStack output = pattern.getOutputs().get(i);
|
||||
|
||||
if (!satisfiedInsertion[i]) {
|
||||
if (CompareUtils.compareStackNoQuantity(output, stack)) {
|
||||
satisfiedInsertion[i] = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
if (tileInUse != null) {
|
||||
tag.setLong(NBT_TILE_IN_USE, tileInUse.toLong());
|
||||
}
|
||||
|
||||
writeBooleanArray(tag, NBT_SATISFIED_INSERTION, satisfiedInsertion);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus(INetworkMaster network) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
boolean missingItems = false;
|
||||
|
||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||
ItemStack input = pattern.getInputs().get(i);
|
||||
|
||||
if (!satisfied[i] && !childrenCreated[i]) {
|
||||
if (!missingItems) {
|
||||
builder.append("I=gui.refinedstorage:crafting_monitor.missing_items\n");
|
||||
|
||||
missingItems = true;
|
||||
}
|
||||
|
||||
builder.append("T=").append(input.getUnlocalizedName()).append(".name\n");
|
||||
}
|
||||
}
|
||||
|
||||
boolean itemsCrafting = false;
|
||||
|
||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||
ItemStack input = pattern.getInputs().get(i);
|
||||
|
||||
if (!satisfied[i] && childrenCreated[i]) {
|
||||
if (!itemsCrafting) {
|
||||
builder.append("I=gui.refinedstorage:crafting_monitor.items_crafting\n");
|
||||
|
||||
itemsCrafting = true;
|
||||
}
|
||||
|
||||
builder.append("T=").append(input.getUnlocalizedName()).append(".name\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (hasReceivedInputs()) {
|
||||
builder.append("I=gui.refinedstorage:crafting_monitor.items_processing\n");
|
||||
|
||||
for (int i = 0; i < pattern.getInputs().size(); ++i) {
|
||||
builder.append("T=").append(pattern.getInputs().get(i).getUnlocalizedName()).append(".name\n");
|
||||
}
|
||||
|
||||
if (pattern.getContainer().getFacingTile() == null) {
|
||||
builder.append("B=gui.refinedstorage:crafting_monitor.machine_none");
|
||||
} else if (isTileInUse(network)) {
|
||||
builder.append("B=gui.refinedstorage:crafting_monitor.machine_in_use");
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getProgress() {
|
||||
int satisfiedAmount = 0;
|
||||
|
||||
for (boolean item : satisfied) {
|
||||
if (item) {
|
||||
satisfiedAmount++;
|
||||
}
|
||||
}
|
||||
|
||||
for (boolean item : satisfiedInsertion) {
|
||||
if (item) {
|
||||
satisfiedAmount++;
|
||||
}
|
||||
}
|
||||
|
||||
return (int) ((float) satisfiedAmount / (float) (satisfied.length + satisfiedInsertion.length) * 100F);
|
||||
}
|
||||
}
|
||||
35
src/main/java/refinedstorage/apiimpl/autocrafting/task/Processable.java
Executable file
35
src/main/java/refinedstorage/apiimpl/autocrafting/task/Processable.java
Executable file
@@ -0,0 +1,35 @@
|
||||
package refinedstorage.apiimpl.autocrafting.task;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.task.IProcessable;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
|
||||
public class Processable implements IProcessable {
|
||||
private ICraftingPattern pattern;
|
||||
private Deque<ItemStack> toInsert = new ArrayDeque<>();
|
||||
|
||||
public Processable(ICraftingPattern pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICraftingPattern getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Deque<ItemStack> getToInsert() {
|
||||
return toInsert;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProcessablePattern{" +
|
||||
"pattern=" + pattern +
|
||||
", toInsert=" + toInsert +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,208 +0,0 @@
|
||||
package refinedstorage.apiimpl.autocrafting.v2;
|
||||
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryProcessing;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
|
||||
public class CraftingTask {
|
||||
class ProcessablePattern {
|
||||
private ICraftingPattern pattern;
|
||||
private Deque<ItemStack> toInsert = new ArrayDeque<>();
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProcessablePattern{" +
|
||||
"pattern=" + pattern +
|
||||
", toInsert=" + toInsert +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
private INetworkMaster network;
|
||||
private ICraftingPattern pattern;
|
||||
private int quantity;
|
||||
private Deque<ItemStack> toTake = new ArrayDeque<>();
|
||||
private List<ProcessablePattern> toProcess = new ArrayList<>();
|
||||
private Multimap<Item, ItemStack> toCraft = ArrayListMultimap.create();
|
||||
private Multimap<Item, ItemStack> missing = ArrayListMultimap.create();
|
||||
private Multimap<Item, ItemStack> extras = ArrayListMultimap.create();
|
||||
|
||||
public CraftingTask(INetworkMaster network, ICraftingPattern pattern, int quantity) {
|
||||
this.network = network;
|
||||
this.pattern = pattern;
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public void calculate() {
|
||||
calculate(network.getItemStorage().copy(), pattern, true);
|
||||
}
|
||||
|
||||
private void calculate(IGroupedItemStorage storage, ICraftingPattern pattern, boolean basePattern) {
|
||||
for (int i = 0; i < quantity; ++i) {
|
||||
boolean isProcessing = pattern.getId().equals(CraftingTaskFactoryProcessing.ID);
|
||||
|
||||
if (isProcessing) {
|
||||
ProcessablePattern processable = new ProcessablePattern();
|
||||
|
||||
processable.pattern = pattern;
|
||||
|
||||
for (int j = pattern.getInputs().size() - 1; j >= 0; --j) {
|
||||
processable.toInsert.push(pattern.getInputs().get(j).copy());
|
||||
}
|
||||
|
||||
toProcess.add(processable);
|
||||
}
|
||||
|
||||
for (ItemStack input : pattern.getInputs()) {
|
||||
ItemStack inputInNetwork = storage.get(input, CompareUtils.COMPARE_DAMAGE | CompareUtils.COMPARE_NBT);
|
||||
|
||||
if (inputInNetwork == null || inputInNetwork.stackSize == 0) {
|
||||
if (getExtrasFor(input) != null) {
|
||||
decrOrRemoveExtras(input);
|
||||
} else {
|
||||
ICraftingPattern inputPattern = NetworkUtils.getPattern(network, input);
|
||||
|
||||
if (inputPattern != null) {
|
||||
for (ItemStack output : inputPattern.getOutputs()) {
|
||||
addToCraft(output);
|
||||
}
|
||||
|
||||
calculate(storage, inputPattern, false);
|
||||
} else {
|
||||
addMissing(input);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!isProcessing) {
|
||||
toTake.push(input);
|
||||
}
|
||||
|
||||
storage.remove(input);
|
||||
}
|
||||
}
|
||||
|
||||
if (!basePattern) {
|
||||
addExtras(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "\nCraftingTask{quantity=" + quantity +
|
||||
"\n, toTake=" + toTake +
|
||||
"\n, toCraft=" + toCraft +
|
||||
"\n, toProcess=" + toProcess +
|
||||
"\n, missing=" + missing +
|
||||
'}';
|
||||
}
|
||||
|
||||
public boolean update() {
|
||||
for (ProcessablePattern processable : toProcess) {
|
||||
if (processable.pattern.getContainer().getFacingInventory() != null && !processable.toInsert.isEmpty()) {
|
||||
ItemStack toInsert = NetworkUtils.extractItem(network, processable.toInsert.peek(), 1);
|
||||
|
||||
if (ItemHandlerHelper.insertItem(processable.pattern.getContainer().getFacingInventory(), toInsert, true) == null) {
|
||||
ItemHandlerHelper.insertItem(processable.pattern.getContainer().getFacingInventory(), toInsert, false);
|
||||
|
||||
processable.toInsert.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!toTake.isEmpty()) {
|
||||
ItemStack took = NetworkUtils.extractItem(network, toTake.peek(), 1);
|
||||
|
||||
if (took != null) {
|
||||
toTake.pop();
|
||||
}
|
||||
}
|
||||
|
||||
if (toTake.isEmpty() && missing.isEmpty()) {
|
||||
for (ItemStack output : pattern.getOutputs()) {
|
||||
// @TODO: Handle remainder
|
||||
network.insertItem(output, output.stackSize, false);
|
||||
}
|
||||
|
||||
for (ItemStack byproduct : pattern.getByproducts()) {
|
||||
// @TODO: Handle remainder
|
||||
network.insertItem(byproduct, byproduct.stackSize, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void addMissing(ItemStack stack) {
|
||||
for (ItemStack m : missing.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
m.stackSize += stack.stackSize;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
missing.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
|
||||
private void addExtras(ICraftingPattern pattern) {
|
||||
pattern.getOutputs().stream().filter(o -> o.stackSize > 1).forEach(o -> addExtras(ItemHandlerHelper.copyStackWithSize(o, o.stackSize - 1)));
|
||||
}
|
||||
|
||||
private void addExtras(ItemStack stack) {
|
||||
ItemStack extras = getExtrasFor(stack);
|
||||
|
||||
if (extras != null) {
|
||||
extras.stackSize += stack.stackSize;
|
||||
} else {
|
||||
this.extras.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getExtrasFor(ItemStack stack) {
|
||||
for (ItemStack m : extras.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
return m;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void decrOrRemoveExtras(ItemStack stack) {
|
||||
ItemStack extras = getExtrasFor(stack);
|
||||
|
||||
extras.stackSize--;
|
||||
|
||||
if (extras.stackSize == 0) {
|
||||
this.extras.remove(extras.getItem(), extras);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToCraft(ItemStack stack) {
|
||||
for (ItemStack m : toCraft.get(stack.getItem())) {
|
||||
if (CompareUtils.compareStackNoQuantity(m, stack)) {
|
||||
m.stackSize += stack.stackSize;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
toCraft.put(stack.getItem(), stack.copy());
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,11 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.api.autocrafting.ICraftingPattern;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
import refinedstorage.api.network.NetworkUtils;
|
||||
import refinedstorage.api.network.grid.IItemGridHandler;
|
||||
import refinedstorage.api.storage.CompareUtils;
|
||||
import refinedstorage.apiimpl.autocrafting.v2.CraftingTask;
|
||||
import refinedstorage.tile.TileController;
|
||||
import refinedstorage.apiimpl.autocrafting.task.CraftingTaskNormal;
|
||||
|
||||
public class ItemGridHandler implements IItemGridHandler {
|
||||
private INetworkMaster network;
|
||||
@@ -125,10 +122,11 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
ItemStack stack = network.getItemStorage().get(hash);
|
||||
|
||||
if (stack != null) {
|
||||
CraftingTask t = new CraftingTask(network, NetworkUtils.getPattern(network, stack), quantity);
|
||||
t.calculate();
|
||||
System.out.println(t.toString());
|
||||
((TileController) network).craftingTasksV2.add(t);
|
||||
CraftingTaskNormal task = new CraftingTaskNormal(network, NetworkUtils.getPattern(network, stack), quantity);
|
||||
|
||||
task.calculate();
|
||||
|
||||
network.addCraftingTask(task);
|
||||
|
||||
/*CraftingPreviewData previewData = new CraftingPreviewData(network);
|
||||
|
||||
@@ -140,7 +138,7 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
|
||||
@Override
|
||||
public void onCraftingRequested(int hash, int quantity) {
|
||||
if (quantity <= 0) {
|
||||
/*if (quantity <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -160,12 +158,12 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
|
||||
quantity -= quantityPerRequest;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftingCancelRequested(int id, int depth) {
|
||||
if (id >= 0 && id < network.getCraftingTasks().size()) {
|
||||
/*if (id >= 0 && id < network.getCraftingTasks().size()) {
|
||||
ICraftingTask task = network.getCraftingTasks().get(id);
|
||||
|
||||
if (depth == 0) {
|
||||
@@ -188,6 +186,6 @@ public class ItemGridHandler implements IItemGridHandler {
|
||||
for (ICraftingTask task : network.getCraftingTasks()) {
|
||||
network.cancelCraftingTask(task);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.container.ContainerCraftingMonitor;
|
||||
import refinedstorage.gui.sidebutton.SideButtonRedstoneMode;
|
||||
import refinedstorage.network.MessageCraftingMonitorCancel;
|
||||
import refinedstorage.tile.ClientCraftingTask;
|
||||
import refinedstorage.tile.TileCraftingMonitor;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiCraftingMonitor extends GuiBase {
|
||||
@@ -95,7 +92,7 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
itemSelectedX = -1;
|
||||
itemSelectedY = -1;
|
||||
|
||||
for (int i = 0; i < VISIBLE_ROWS; ++i) {
|
||||
/*for (int i = 0; i < VISIBLE_ROWS; ++i) {
|
||||
if (item < getTasks().size()) {
|
||||
ClientCraftingTask task = getTasks().get(item);
|
||||
|
||||
@@ -150,7 +147,7 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
|
||||
if (lines != null) {
|
||||
drawTooltip(mouseX, mouseY, Arrays.asList(lines));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private int getRows() {
|
||||
@@ -162,9 +159,9 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
super.actionPerformed(button);
|
||||
|
||||
if (button == cancelButton && itemSelected != -1) {
|
||||
ClientCraftingTask task = getTasks().get(itemSelected);
|
||||
/*ClientCraftingTask task = getTasks().get(itemSelected);
|
||||
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, task.getId(), task.getDepth()));
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, task.getId(), task.getDepth()));*/
|
||||
} else if (button == cancelAllButton && getTasks().size() > 0) {
|
||||
RefinedStorage.INSTANCE.network.sendToServer(new MessageCraftingMonitorCancel(craftingMonitor, -1, 0));
|
||||
}
|
||||
@@ -190,7 +187,7 @@ public class GuiCraftingMonitor extends GuiBase {
|
||||
}
|
||||
}
|
||||
|
||||
private List<ClientCraftingTask> getTasks() {
|
||||
return TileCraftingMonitor.TASKS.getValue();
|
||||
private List<Integer> getTasks() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
package refinedstorage.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.apiimpl.autocrafting.preview.CraftingPreviewStack;
|
||||
import refinedstorage.network.MessageGridCraftingStart;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiCraftingPreview extends GuiBase {
|
||||
private static final int VISIBLE_ROWS = 4;
|
||||
|
||||
private List<CraftingPreviewStack> stacks;
|
||||
//private List<CraftingPreviewStack> stacks;
|
||||
private GuiScreen parent;
|
||||
|
||||
private int hash;
|
||||
@@ -31,7 +23,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
private GuiButton startButton;
|
||||
private GuiButton cancelButton;
|
||||
|
||||
public GuiCraftingPreview(GuiScreen parent, Collection<CraftingPreviewStack> stacks, int hash, int quantity) {
|
||||
public GuiCraftingPreview(GuiScreen parent, /*Collection<CraftingPreviewStack> stacks, */int hash, int quantity) {
|
||||
super(new Container() {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
@@ -39,7 +31,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
}
|
||||
}, 168, 171);
|
||||
|
||||
this.stacks = new ArrayList<>(stacks);
|
||||
//this.stacks = new ArrayList<>(stacks);
|
||||
this.parent = parent;
|
||||
|
||||
this.hash = hash;
|
||||
@@ -52,7 +44,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
public void init(int x, int y) {
|
||||
cancelButton = addButton(x + 16, y + 144, 50, 20, t("gui.cancel"));
|
||||
startButton = addButton(x + 85, y + 144, 50, 20, t("misc.refinedstorage:start"));
|
||||
startButton.enabled = !stacks.isEmpty();
|
||||
//startButton.enabled = !stacks.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +59,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
|
||||
drawTexture(x, y, 0, 0, width, height);
|
||||
|
||||
if (stacks.isEmpty()) {
|
||||
/*if (stacks.isEmpty()) {
|
||||
drawRect(x + 7, y + 20, x + 142, y + 139, 0xFFDBDBDB);
|
||||
}
|
||||
else {
|
||||
@@ -94,7 +86,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
|
||||
slot++;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +97,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
int y = 22;
|
||||
float scale = 0.5f;
|
||||
|
||||
if (stacks.isEmpty()) {
|
||||
/*if (stacks.isEmpty()) {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.scale(scale, scale, 1);
|
||||
|
||||
@@ -163,7 +155,7 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
if (hoveringStack != null) {
|
||||
drawTooltip(mouseX, mouseY, hoveringStack.getTooltip(Minecraft.getMinecraft().thePlayer, false));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -195,7 +187,8 @@ public class GuiCraftingPreview extends GuiBase {
|
||||
}
|
||||
|
||||
private int getRows() {
|
||||
return Math.max(0, (int) Math.ceil((float) stacks.size() / 2F));
|
||||
/*return Math.max(0, (int) Math.ceil((float) stacks.size() / 2F));*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void close() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package refinedstorage.network;
|
||||
|
||||
/*
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler;
|
||||
@@ -57,3 +58,4 @@ public class MessageGridCraftingPreviewResponse implements IMessage, IMessageHan
|
||||
return null;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -4,8 +4,6 @@ import mcmultipart.client.multipart.ModelMultipartContainer;
|
||||
import mcmultipart.raytrace.PartMOP;
|
||||
import mcmultipart.raytrace.RayTraceUtils;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
@@ -22,7 +20,6 @@ import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -31,10 +28,7 @@ import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.block.*;
|
||||
import refinedstorage.gui.GuiCraftingPreview;
|
||||
import refinedstorage.gui.grid.GuiCraftingStart;
|
||||
import refinedstorage.item.*;
|
||||
import refinedstorage.network.MessageGridCraftingPreviewResponse;
|
||||
import refinedstorage.tile.TileController;
|
||||
|
||||
import java.util.List;
|
||||
@@ -154,56 +148,56 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
// Item Variants
|
||||
ModelBakery.registerItemVariants(RefinedStorageItems.STORAGE_DISK,
|
||||
new ResourceLocation("refinedstorage:1k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:4k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:16k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:64k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:creative_storage_disk")
|
||||
new ResourceLocation("refinedstorage:1k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:4k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:16k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:64k_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:creative_storage_disk")
|
||||
);
|
||||
|
||||
ModelBakery.registerItemVariants(RefinedStorageItems.STORAGE_PART,
|
||||
new ResourceLocation("refinedstorage:1k_storage_part"),
|
||||
new ResourceLocation("refinedstorage:4k_storage_part"),
|
||||
new ResourceLocation("refinedstorage:16k_storage_part"),
|
||||
new ResourceLocation("refinedstorage:64k_storage_part")
|
||||
new ResourceLocation("refinedstorage:1k_storage_part"),
|
||||
new ResourceLocation("refinedstorage:4k_storage_part"),
|
||||
new ResourceLocation("refinedstorage:16k_storage_part"),
|
||||
new ResourceLocation("refinedstorage:64k_storage_part")
|
||||
);
|
||||
|
||||
ModelBakery.registerItemVariants(RefinedStorageItems.FLUID_STORAGE_DISK,
|
||||
new ResourceLocation("refinedstorage:64k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:128k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:256k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:512k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:creative_fluid_storage_disk")
|
||||
new ResourceLocation("refinedstorage:64k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:128k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:256k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:512k_fluid_storage_disk"),
|
||||
new ResourceLocation("refinedstorage:creative_fluid_storage_disk")
|
||||
);
|
||||
|
||||
ModelBakery.registerItemVariants(RefinedStorageItems.FLUID_STORAGE_PART,
|
||||
new ResourceLocation("refinedstorage:64k_fluid_storage_part"),
|
||||
new ResourceLocation("refinedstorage:128k_fluid_storage_part"),
|
||||
new ResourceLocation("refinedstorage:256k_fluid_storage_part"),
|
||||
new ResourceLocation("refinedstorage:512k_fluid_storage_part")
|
||||
new ResourceLocation("refinedstorage:64k_fluid_storage_part"),
|
||||
new ResourceLocation("refinedstorage:128k_fluid_storage_part"),
|
||||
new ResourceLocation("refinedstorage:256k_fluid_storage_part"),
|
||||
new ResourceLocation("refinedstorage:512k_fluid_storage_part")
|
||||
);
|
||||
|
||||
ModelBakery.registerItemVariants(RefinedStorageItems.PROCESSOR,
|
||||
new ResourceLocation("refinedstorage:basic_printed_processor"),
|
||||
new ResourceLocation("refinedstorage:improved_printed_processor"),
|
||||
new ResourceLocation("refinedstorage:advanced_printed_processor"),
|
||||
new ResourceLocation("refinedstorage:basic_processor"),
|
||||
new ResourceLocation("refinedstorage:improved_processor"),
|
||||
new ResourceLocation("refinedstorage:advanced_processor"),
|
||||
new ResourceLocation("refinedstorage:printed_silicon")
|
||||
new ResourceLocation("refinedstorage:basic_printed_processor"),
|
||||
new ResourceLocation("refinedstorage:improved_printed_processor"),
|
||||
new ResourceLocation("refinedstorage:advanced_printed_processor"),
|
||||
new ResourceLocation("refinedstorage:basic_processor"),
|
||||
new ResourceLocation("refinedstorage:improved_processor"),
|
||||
new ResourceLocation("refinedstorage:advanced_processor"),
|
||||
new ResourceLocation("refinedstorage:printed_silicon")
|
||||
);
|
||||
|
||||
ModelBakery.registerItemVariants(RefinedStorageItems.CORE,
|
||||
new ResourceLocation("refinedstorage:construction_core"),
|
||||
new ResourceLocation("refinedstorage:destruction_core")
|
||||
new ResourceLocation("refinedstorage:construction_core"),
|
||||
new ResourceLocation("refinedstorage:destruction_core")
|
||||
);
|
||||
|
||||
ModelBakery.registerItemVariants(RefinedStorageItems.UPGRADE,
|
||||
new ResourceLocation("refinedstorage:upgrade"),
|
||||
new ResourceLocation("refinedstorage:range_upgrade"),
|
||||
new ResourceLocation("refinedstorage:speed_upgrade"),
|
||||
new ResourceLocation("refinedstorage:stack_upgrade"),
|
||||
new ResourceLocation("refinedstorage:interdimensional_upgrade")
|
||||
new ResourceLocation("refinedstorage:upgrade"),
|
||||
new ResourceLocation("refinedstorage:range_upgrade"),
|
||||
new ResourceLocation("refinedstorage:speed_upgrade"),
|
||||
new ResourceLocation("refinedstorage:stack_upgrade"),
|
||||
new ResourceLocation("refinedstorage:interdimensional_upgrade")
|
||||
);
|
||||
|
||||
// Items
|
||||
@@ -301,7 +295,7 @@ public class ClientProxy extends CommonProxy {
|
||||
});
|
||||
}
|
||||
|
||||
public static void onReceiveCraftingPreviewResponse(MessageGridCraftingPreviewResponse message) {
|
||||
/*public static void onReceiveCraftingPreviewResponse(MessageGridCraftingPreviewResponse message) {
|
||||
Minecraft.getMinecraft().addScheduledTask(() -> {
|
||||
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
|
||||
|
||||
@@ -311,5 +305,5 @@ public class ClientProxy extends CommonProxy {
|
||||
|
||||
FMLCommonHandler.instance().showGuiScreen(new GuiCraftingPreview(screen, message.stacks, message.hash, message.quantity));
|
||||
});
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import refinedstorage.RefinedStorageItems;
|
||||
import refinedstorage.api.RefinedStorageAPI;
|
||||
import refinedstorage.api.solderer.SoldererRecipe;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryNormal;
|
||||
import refinedstorage.apiimpl.autocrafting.registry.CraftingTaskFactoryProcessing;
|
||||
import refinedstorage.apiimpl.solderer.*;
|
||||
import refinedstorage.apiimpl.storage.fluid.FluidStorageNBT;
|
||||
import refinedstorage.apiimpl.storage.item.ItemStorageNBT;
|
||||
@@ -47,7 +46,6 @@ public class CommonProxy {
|
||||
}
|
||||
|
||||
RefinedStorageAPI.instance().getCraftingTaskRegistry().addFactory(CraftingTaskFactoryNormal.ID, new CraftingTaskFactoryNormal());
|
||||
RefinedStorageAPI.instance().getCraftingTaskRegistry().addFactory(CraftingTaskFactoryProcessing.ID, new CraftingTaskFactoryProcessing());
|
||||
|
||||
int id = 0;
|
||||
|
||||
@@ -70,7 +68,7 @@ public class CommonProxy {
|
||||
RefinedStorage.INSTANCE.network.registerMessage(MessageProcessingPatternEncoderClear.class, MessageProcessingPatternEncoderClear.class, id++, Side.SERVER);
|
||||
RefinedStorage.INSTANCE.network.registerMessage(MessageGridFilterUpdate.class, MessageGridFilterUpdate.class, id++, Side.SERVER);
|
||||
RefinedStorage.INSTANCE.network.registerMessage(MessageGridCraftingPreview.class, MessageGridCraftingPreview.class, id++, Side.SERVER);
|
||||
RefinedStorage.INSTANCE.network.registerMessage(MessageGridCraftingPreviewResponse.class, MessageGridCraftingPreviewResponse.class, id++, Side.CLIENT);
|
||||
//RefinedStorage.INSTANCE.network.registerMessage(MessageGridCraftingPreviewResponse.class, MessageGridCraftingPreviewResponse.class, id++, Side.CLIENT);
|
||||
RefinedStorage.INSTANCE.network.registerMessage(MessageProcessingPatternEncoderTransfer.class, MessageProcessingPatternEncoderTransfer.class, id++, Side.SERVER);
|
||||
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(RefinedStorage.INSTANCE, new GuiHandler());
|
||||
@@ -158,315 +156,315 @@ public class CommonProxy {
|
||||
|
||||
// Quartz Enriched Iron
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON, 4),
|
||||
"II",
|
||||
"IQ",
|
||||
'I', new ItemStack(Items.IRON_INGOT),
|
||||
'Q', new ItemStack(Items.QUARTZ)
|
||||
"II",
|
||||
"IQ",
|
||||
'I', new ItemStack(Items.IRON_INGOT),
|
||||
'Q', new ItemStack(Items.QUARTZ)
|
||||
);
|
||||
|
||||
// Machine Casing
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
"EEE",
|
||||
"E E",
|
||||
"EEE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
"EEE",
|
||||
"E E",
|
||||
"EEE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
);
|
||||
|
||||
// Construction Core
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(Items.GLOWSTONE_DUST)
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(Items.GLOWSTONE_DUST)
|
||||
);
|
||||
|
||||
// Destruction Core
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(Items.QUARTZ)
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(Items.QUARTZ)
|
||||
);
|
||||
|
||||
// Relay
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(RefinedStorageBlocks.RELAY),
|
||||
new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
new ItemStack(Blocks.REDSTONE_TORCH)
|
||||
new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
new ItemStack(Blocks.REDSTONE_TORCH)
|
||||
);
|
||||
|
||||
// Controller
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageBlocks.CONTROLLER, 1, EnumControllerType.NORMAL.getId()),
|
||||
"EDE",
|
||||
"SMS",
|
||||
"ESE",
|
||||
'D', new ItemStack(Items.DIAMOND),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'S', "itemSilicon"
|
||||
"EDE",
|
||||
"SMS",
|
||||
"ESE",
|
||||
'D', new ItemStack(Items.DIAMOND),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'S', "itemSilicon"
|
||||
));
|
||||
|
||||
// Solderer
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.SOLDERER),
|
||||
"ESE",
|
||||
"E E",
|
||||
"ESE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', new ItemStack(Blocks.STICKY_PISTON)
|
||||
"ESE",
|
||||
"E E",
|
||||
"ESE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', new ItemStack(Blocks.STICKY_PISTON)
|
||||
);
|
||||
|
||||
// Disk Drive
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
new ItemStack(RefinedStorageBlocks.DISK_DRIVE),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
new ItemStack(Blocks.CHEST)
|
||||
new ItemStack(RefinedStorageBlocks.DISK_DRIVE),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
new ItemStack(Blocks.CHEST)
|
||||
));
|
||||
|
||||
// Cable
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageBlocks.CABLE, 12),
|
||||
"EEE",
|
||||
"GRG",
|
||||
"EEE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE)
|
||||
"EEE",
|
||||
"GRG",
|
||||
"EEE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE)
|
||||
));
|
||||
|
||||
// Wireless Transmitter
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.WIRELESS_TRANSMITTER),
|
||||
"EPE",
|
||||
"EME",
|
||||
"EAE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'P', new ItemStack(Items.ENDER_PEARL),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING)
|
||||
"EPE",
|
||||
"EME",
|
||||
"EAE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'P', new ItemStack(Items.ENDER_PEARL),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING)
|
||||
);
|
||||
|
||||
// Grid
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
|
||||
"ECE",
|
||||
"PMP",
|
||||
"EDE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING)
|
||||
"ECE",
|
||||
"PMP",
|
||||
"EDE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING)
|
||||
);
|
||||
|
||||
// Crafting Grid
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.CRAFTING.getId()),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
|
||||
new ItemStack(Blocks.CRAFTING_TABLE)
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.CRAFTING.getId()),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
|
||||
new ItemStack(Blocks.CRAFTING_TABLE)
|
||||
));
|
||||
|
||||
// Pattern Grid
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.PATTERN.getId()),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
|
||||
new ItemStack(RefinedStorageItems.PATTERN)
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.PATTERN.getId()),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
|
||||
new ItemStack(RefinedStorageItems.PATTERN)
|
||||
));
|
||||
|
||||
// Fluid Grid
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.FLUID.getId()),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
|
||||
new ItemStack(Items.BUCKET)
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.FLUID.getId()),
|
||||
500,
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
new ItemStack(RefinedStorageBlocks.GRID, 1, EnumGridType.NORMAL.getId()),
|
||||
new ItemStack(Items.BUCKET)
|
||||
));
|
||||
|
||||
// Wireless Grid
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageItems.WIRELESS_GRID, 1, ItemWirelessGrid.TYPE_NORMAL),
|
||||
"EPE",
|
||||
"EAE",
|
||||
"EEE",
|
||||
'P', new ItemStack(Items.ENDER_PEARL),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
"EPE",
|
||||
"EAE",
|
||||
"EEE",
|
||||
'P', new ItemStack(Items.ENDER_PEARL),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
);
|
||||
|
||||
// Crafter
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.CRAFTER),
|
||||
"ECE",
|
||||
"AMA",
|
||||
"EDE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING)
|
||||
"ECE",
|
||||
"AMA",
|
||||
"EDE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING)
|
||||
);
|
||||
|
||||
// Processing Pattern Encoder
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.PROCESSING_PATTERN_ENCODER),
|
||||
"ECE",
|
||||
"PMP",
|
||||
"EFE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'P', new ItemStack(RefinedStorageItems.PATTERN),
|
||||
'C', new ItemStack(Blocks.CRAFTING_TABLE),
|
||||
'F', new ItemStack(Blocks.FURNACE)
|
||||
"ECE",
|
||||
"PMP",
|
||||
"EFE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'P', new ItemStack(RefinedStorageItems.PATTERN),
|
||||
'C', new ItemStack(Blocks.CRAFTING_TABLE),
|
||||
'F', new ItemStack(Blocks.FURNACE)
|
||||
);
|
||||
|
||||
// External Storage
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.EXTERNAL_STORAGE),
|
||||
"CED",
|
||||
"HMH",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'H', new ItemStack(Blocks.CHEST),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
"CED",
|
||||
"HMH",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'H', new ItemStack(Blocks.CHEST),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
);
|
||||
|
||||
// Importer
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(RefinedStorageBlocks.IMPORTER),
|
||||
new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
);
|
||||
|
||||
// Exporter
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(RefinedStorageBlocks.EXPORTER),
|
||||
new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
);
|
||||
|
||||
// Destructor
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageBlocks.DESTRUCTOR),
|
||||
"EDE",
|
||||
"RMR",
|
||||
"EIE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'M', new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
'I', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
"EDE",
|
||||
"RMR",
|
||||
"EIE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'M', new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
'I', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
);
|
||||
|
||||
// Constructor
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageBlocks.CONSTRUCTOR),
|
||||
"ECE",
|
||||
"RMR",
|
||||
"EIE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'M', new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
'I', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
"ECE",
|
||||
"RMR",
|
||||
"EIE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'M', new ItemStack(RefinedStorageBlocks.CABLE),
|
||||
'I', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
);
|
||||
|
||||
// Detector
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageBlocks.DETECTOR),
|
||||
"ECE",
|
||||
"RMR",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'C', new ItemStack(Items.COMPARATOR),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
"ECE",
|
||||
"RMR",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'C', new ItemStack(Items.COMPARATOR),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
);
|
||||
|
||||
// Storage Parts
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K),
|
||||
"SES",
|
||||
"GRG",
|
||||
"SGS",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', "itemSilicon",
|
||||
'G', "blockGlass"
|
||||
"SES",
|
||||
"GRG",
|
||||
"SGS",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', "itemSilicon",
|
||||
'G', "blockGlass"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K),
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K)
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_1K)
|
||||
);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K),
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K)
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_4K)
|
||||
);
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_64K),
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K)
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, ItemStoragePart.TYPE_16K)
|
||||
);
|
||||
|
||||
// Fluid Storage Parts
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_64K),
|
||||
"SES",
|
||||
"GRG",
|
||||
"SGS",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', "itemSilicon",
|
||||
'G', "blockGlass"
|
||||
"SES",
|
||||
"GRG",
|
||||
"SGS",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', "itemSilicon",
|
||||
'G', "blockGlass"
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_128K),
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
'S', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_64K)
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
'S', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_64K)
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_256K),
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'S', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_128K)
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'S', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_128K)
|
||||
));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_512K),
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'S', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_256K)
|
||||
"PEP",
|
||||
"SRS",
|
||||
"PSP",
|
||||
'R', new ItemStack(Items.BUCKET),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED),
|
||||
'S', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, ItemFluidStoragePart.TYPE_256K)
|
||||
));
|
||||
|
||||
// Storage Housing
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(ItemStorageNBT.createStackWithNBT(new ItemStack(RefinedStorageItems.STORAGE_HOUSING)),
|
||||
"GRG",
|
||||
"R R",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
"GRG",
|
||||
"R R",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
));
|
||||
|
||||
// Storage Disks
|
||||
@@ -474,18 +472,18 @@ public class CommonProxy {
|
||||
ItemStack disk = ItemStorageNBT.createStackWithNBT(new ItemStack(RefinedStorageItems.STORAGE_DISK, 1, type));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(disk,
|
||||
"GRG",
|
||||
"RPR",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'P', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, type),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
"GRG",
|
||||
"RPR",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'P', new ItemStack(RefinedStorageItems.STORAGE_PART, 1, type),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
));
|
||||
|
||||
GameRegistry.addShapelessRecipe(disk,
|
||||
new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
|
||||
new ItemStack(RefinedStorageItems.STORAGE_PART, 1, type)
|
||||
new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
|
||||
new ItemStack(RefinedStorageItems.STORAGE_PART, 1, type)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -494,39 +492,39 @@ public class CommonProxy {
|
||||
ItemStack disk = FluidStorageNBT.createStackWithNBT(new ItemStack(RefinedStorageItems.FLUID_STORAGE_DISK, 1, type));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(disk,
|
||||
"GRG",
|
||||
"RPR",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'P', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, type),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
"GRG",
|
||||
"RPR",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'P', new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, type),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
));
|
||||
|
||||
GameRegistry.addShapelessRecipe(disk,
|
||||
new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
|
||||
new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, type)
|
||||
new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
|
||||
new ItemStack(RefinedStorageItems.FLUID_STORAGE_PART, 1, type)
|
||||
);
|
||||
}
|
||||
|
||||
// Pattern
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.PATTERN),
|
||||
"GRG",
|
||||
"RGR",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
"GRG",
|
||||
"RGR",
|
||||
"EEE",
|
||||
'G', "blockGlass",
|
||||
'R', new ItemStack(Items.REDSTONE),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
));
|
||||
|
||||
// Upgrade
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageItems.UPGRADE, 1, 0),
|
||||
"EGE",
|
||||
"EPE",
|
||||
"EGE",
|
||||
'G', "blockGlass",
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
"EGE",
|
||||
"EPE",
|
||||
"EGE",
|
||||
'G', "blockGlass",
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED),
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON)
|
||||
));
|
||||
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_RANGE));
|
||||
@@ -535,11 +533,11 @@ public class CommonProxy {
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipeUpgrade(ItemUpgrade.TYPE_CRAFTING));
|
||||
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageItems.UPGRADE, 1, ItemUpgrade.TYPE_STACK),
|
||||
"USU",
|
||||
"SUS",
|
||||
"USU",
|
||||
'U', new ItemStack(Items.SUGAR),
|
||||
'S', new ItemStack(RefinedStorageItems.UPGRADE, 1, ItemUpgrade.TYPE_SPEED)
|
||||
"USU",
|
||||
"SUS",
|
||||
"USU",
|
||||
'U', new ItemStack(Items.SUGAR),
|
||||
'S', new ItemStack(RefinedStorageItems.UPGRADE, 1, ItemUpgrade.TYPE_SPEED)
|
||||
);
|
||||
|
||||
// Storage Blocks
|
||||
@@ -556,87 +554,87 @@ public class CommonProxy {
|
||||
|
||||
// Crafting Monitor
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(RefinedStorageBlocks.CRAFTING_MONITOR),
|
||||
"EGE",
|
||||
"GMG",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'G', "blockGlass",
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
"EGE",
|
||||
"GMG",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'G', "blockGlass",
|
||||
'P', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_IMPROVED)
|
||||
));
|
||||
|
||||
// Interface
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
new ItemStack(RefinedStorageBlocks.INTERFACE),
|
||||
200,
|
||||
new ItemStack(RefinedStorageBlocks.IMPORTER),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(RefinedStorageBlocks.EXPORTER)
|
||||
new ItemStack(RefinedStorageBlocks.INTERFACE),
|
||||
200,
|
||||
new ItemStack(RefinedStorageBlocks.IMPORTER),
|
||||
new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_BASIC),
|
||||
new ItemStack(RefinedStorageBlocks.EXPORTER)
|
||||
));
|
||||
|
||||
// Fluid Interface
|
||||
RefinedStorageAPI.instance().getSoldererRegistry().addRecipe(new SoldererRecipe(
|
||||
new ItemStack(RefinedStorageBlocks.FLUID_INTERFACE),
|
||||
200,
|
||||
new ItemStack(Items.BUCKET),
|
||||
new ItemStack(RefinedStorageBlocks.INTERFACE),
|
||||
new ItemStack(Items.BUCKET)
|
||||
new ItemStack(RefinedStorageBlocks.FLUID_INTERFACE),
|
||||
200,
|
||||
new ItemStack(Items.BUCKET),
|
||||
new ItemStack(RefinedStorageBlocks.INTERFACE),
|
||||
new ItemStack(Items.BUCKET)
|
||||
));
|
||||
|
||||
// Grid Filter
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageItems.GRID_FILTER),
|
||||
"EPE",
|
||||
"PHP",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(Items.PAPER),
|
||||
'H', new ItemStack(Blocks.HOPPER)
|
||||
"EPE",
|
||||
"PHP",
|
||||
"EPE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(Items.PAPER),
|
||||
'H', new ItemStack(Blocks.HOPPER)
|
||||
);
|
||||
|
||||
// Network Card
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageItems.NETWORK_CARD),
|
||||
"EEE",
|
||||
"PAP",
|
||||
"EEE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(Items.PAPER),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
|
||||
"EEE",
|
||||
"PAP",
|
||||
"EEE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'P', new ItemStack(Items.PAPER),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
|
||||
);
|
||||
|
||||
// Network Transmitter
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageBlocks.NETWORK_TRANSMITTER),
|
||||
"EEE",
|
||||
"CMD",
|
||||
"AAA",
|
||||
'E', new ItemStack(Items.ENDER_PEARL),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
|
||||
"EEE",
|
||||
"CMD",
|
||||
"AAA",
|
||||
'E', new ItemStack(Items.ENDER_PEARL),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
|
||||
);
|
||||
|
||||
// Network Receiver
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageBlocks.NETWORK_RECEIVER),
|
||||
"AAA",
|
||||
"CMD",
|
||||
"EEE",
|
||||
'E', new ItemStack(Items.ENDER_PEARL),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
|
||||
"AAA",
|
||||
"CMD",
|
||||
"EEE",
|
||||
'E', new ItemStack(Items.ENDER_PEARL),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION),
|
||||
'A', new ItemStack(RefinedStorageItems.PROCESSOR, 1, ItemProcessor.TYPE_ADVANCED)
|
||||
);
|
||||
|
||||
// Disk Manipulator
|
||||
GameRegistry.addShapedRecipe(new ItemStack(RefinedStorageBlocks.DISK_MANIPULATOR),
|
||||
"ESE",
|
||||
"CMD",
|
||||
"ESE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION)
|
||||
"ESE",
|
||||
"CMD",
|
||||
"ESE",
|
||||
'E', new ItemStack(RefinedStorageItems.QUARTZ_ENRICHED_IRON),
|
||||
'S', new ItemStack(RefinedStorageItems.STORAGE_HOUSING),
|
||||
'C', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_CONSTRUCTION),
|
||||
'M', new ItemStack(RefinedStorageBlocks.MACHINE_CASING),
|
||||
'D', new ItemStack(RefinedStorageItems.CORE, 1, ItemCore.TYPE_DESTRUCTION)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
package refinedstorage.tile;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import refinedstorage.api.autocrafting.task.ICraftingTask;
|
||||
import refinedstorage.api.network.INetworkMaster;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ClientCraftingTask {
|
||||
private ItemStack output;
|
||||
private int id;
|
||||
private String status;
|
||||
private int depth;
|
||||
private int children;
|
||||
private int progress;
|
||||
|
||||
// Used server-side while sending
|
||||
private List<ItemStack> outputs;
|
||||
private ClientCraftingTask child;
|
||||
|
||||
public ClientCraftingTask(ItemStack output, int id, String status, int depth, int children, int progress) {
|
||||
this.output = output;
|
||||
this.id = id;
|
||||
this.status = status;
|
||||
this.depth = depth;
|
||||
this.children = children;
|
||||
this.progress = progress;
|
||||
}
|
||||
|
||||
public ClientCraftingTask(INetworkMaster network, ICraftingTask task) {
|
||||
this.status = task.getStatus(network);
|
||||
this.outputs = task.getPattern().getOutputs();
|
||||
this.progress = task.getProgress();
|
||||
this.child = task.getChild() != null ? new ClientCraftingTask(network, task.getChild()) : null;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public ClientCraftingTask getChild() {
|
||||
return child;
|
||||
}
|
||||
|
||||
public int getDepth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
public int getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public int getProgress() {
|
||||
return progress;
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,6 @@ import refinedstorage.api.storage.fluid.IFluidStorage;
|
||||
import refinedstorage.api.storage.fluid.IGroupedFluidStorage;
|
||||
import refinedstorage.api.storage.item.IGroupedItemStorage;
|
||||
import refinedstorage.api.storage.item.IItemStorage;
|
||||
import refinedstorage.apiimpl.autocrafting.task.CraftingTaskProcessing;
|
||||
import refinedstorage.apiimpl.autocrafting.v2.CraftingTask;
|
||||
import refinedstorage.apiimpl.network.NetworkNodeGraph;
|
||||
import refinedstorage.apiimpl.network.WirelessGridHandler;
|
||||
import refinedstorage.apiimpl.network.grid.FluidGridHandler;
|
||||
@@ -176,7 +174,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
private List<ICraftingPattern> patterns = new ArrayList<>();
|
||||
|
||||
public List<CraftingTask> craftingTasksV2 = new ArrayList<>();
|
||||
private List<ICraftingTask> craftingTasks = new ArrayList<>();
|
||||
private List<ICraftingTask> craftingTasksToAdd = new ArrayList<>();
|
||||
private List<ICraftingTask> craftingTasksToCancel = new ArrayList<>();
|
||||
@@ -240,7 +237,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
if (!craftingTasksToRead.isEmpty()) {
|
||||
for (NBTTagCompound tag : craftingTasksToRead) {
|
||||
ICraftingTask task = readCraftingTask(worldObj, 0, tag);
|
||||
ICraftingTask task = NetworkUtils.readCraftingTask(worldObj, this, tag);
|
||||
|
||||
if (task != null) {
|
||||
addCraftingTask(task);
|
||||
@@ -260,7 +257,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
boolean craftingTasksChanged = !craftingTasksToAdd.isEmpty() || !craftingTasksToCancel.isEmpty();
|
||||
|
||||
for (ICraftingTask taskToCancel : craftingTasksToCancel) {
|
||||
taskToCancel.onCancelled(this);
|
||||
taskToCancel.onCancelled();
|
||||
}
|
||||
|
||||
craftingTasks.removeAll(craftingTasksToCancel);
|
||||
@@ -272,12 +269,12 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
craftingTasksToAdd.clear();
|
||||
|
||||
/*Iterator<ICraftingTask> craftingTaskIterator = craftingTasks.iterator();
|
||||
Iterator<ICraftingTask> craftingTaskIterator = craftingTasks.iterator();
|
||||
|
||||
while (craftingTaskIterator.hasNext()) {
|
||||
ICraftingTask task = craftingTaskIterator.next();
|
||||
|
||||
if (updateCraftingTask(task)) {
|
||||
if (task.update()) {
|
||||
craftingTaskIterator.remove();
|
||||
|
||||
craftingTasksChanged = true;
|
||||
@@ -287,17 +284,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
if (!craftingTasks.isEmpty() || craftingTasksChanged) {
|
||||
markDirty();
|
||||
|
||||
updateCraftingTasks();
|
||||
}*/
|
||||
|
||||
Iterator<CraftingTask> craftingTaskIterator = craftingTasksV2.iterator();
|
||||
|
||||
while (craftingTaskIterator.hasNext()) {
|
||||
CraftingTask task = craftingTaskIterator.next();
|
||||
|
||||
if (task.update()) {
|
||||
craftingTaskIterator.remove();
|
||||
}
|
||||
updateCraftingMonitors();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,24 +318,10 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
super.update();
|
||||
}
|
||||
|
||||
private boolean updateCraftingTask(ICraftingTask task) {
|
||||
if (task.getChild() != null) {
|
||||
if (updateCraftingTask(task.getChild())) {
|
||||
task.setChild(null);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ICraftingPatternContainer container = task.getPattern().getContainer();
|
||||
|
||||
return container != null && ticks % container.getSpeed() == 0 && task.update(worldObj, this);
|
||||
}
|
||||
|
||||
public void updateCraftingTasks() {
|
||||
public void updateCraftingMonitors() {
|
||||
for (INetworkNode node : nodeGraph.all()) {
|
||||
if (node instanceof TileCraftingMonitor) {
|
||||
((TileCraftingMonitor) node).dataManager.sendParameterToWatchers(TileCraftingMonitor.TASKS);
|
||||
//((TileCraftingMonitor) node).dataManager.sendParameterToWatchers(TileCraftingMonitor.TASKS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -557,7 +530,7 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
if (!simulate && inserted > 0) {
|
||||
itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false);
|
||||
|
||||
for (int i = 0; i < inserted; ++i) {
|
||||
/*for (int i = 0; i < inserted; ++i) {
|
||||
for (ICraftingTask task : craftingTasks) {
|
||||
if (inserted == 0) {
|
||||
break;
|
||||
@@ -567,20 +540,12 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
inserted--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return remainder;
|
||||
}
|
||||
|
||||
private boolean onInserted(ItemStack stack, ICraftingTask task) {
|
||||
if (task.getChild() != null) {
|
||||
return onInserted(stack, task.getChild());
|
||||
}
|
||||
|
||||
return task instanceof CraftingTaskProcessing && ((CraftingTaskProcessing) task).onInserted(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(ItemStack stack, int size, int flags) {
|
||||
int requested = size;
|
||||
@@ -710,26 +675,6 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
}
|
||||
}
|
||||
|
||||
public static ICraftingTask readCraftingTask(World world, int depth, NBTTagCompound tag) {
|
||||
/* ItemStack stack = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(CraftingTask.NBT_PATTERN_STACK));
|
||||
|
||||
if (stack != null && stack.getItem() instanceof ICraftingPatternProvider) {
|
||||
TileEntity container = world.getTileEntity(BlockPos.fromLong(tag.getLong(CraftingTask.NBT_PATTERN_CONTAINER)));
|
||||
|
||||
if (container instanceof ICraftingPatternContainer) {
|
||||
ICraftingPattern pattern = ((ICraftingPatternProvider) stack.getItem()).create(world, stack, (ICraftingPatternContainer) container);
|
||||
|
||||
ICraftingTaskFactory factory = RefinedStorageAPI.instance().getCraftingTaskRegistry().getFactory(tag.getString(CraftingTask.NBT_PATTERN_TYPE));
|
||||
|
||||
if (factory != null) {
|
||||
return factory.create(world, depth, tag, pattern);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||
super.writeToNBT(tag);
|
||||
|
||||
@@ -1,31 +1,8 @@
|
||||
package refinedstorage.tile;
|
||||
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.tile.data.ITileDataProducer;
|
||||
import refinedstorage.tile.data.RefinedStorageSerializers;
|
||||
import refinedstorage.tile.data.TileDataParameter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TileCraftingMonitor extends TileNode {
|
||||
public static final TileDataParameter<List<ClientCraftingTask>> TASKS = new TileDataParameter<>(RefinedStorageSerializers.CLIENT_CRAFTING_TASK_SERIALIZER, new ArrayList<>(), new ITileDataProducer<List<ClientCraftingTask>, TileCraftingMonitor>() {
|
||||
@Override
|
||||
public List<ClientCraftingTask> getValue(TileCraftingMonitor tile) {
|
||||
if (tile.connected) {
|
||||
return tile.network.getCraftingTasks().stream().map(t -> new ClientCraftingTask(tile.network, t)).collect(Collectors.toList());
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
public TileCraftingMonitor() {
|
||||
dataManager.addParameter(TASKS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyUsage() {
|
||||
return RefinedStorage.INSTANCE.config.craftingMonitorUsage;
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
package refinedstorage.tile.data;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializer;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.network.ByteBufUtils;
|
||||
import refinedstorage.tile.ClientCraftingTask;
|
||||
import refinedstorage.tile.ClientNode;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -46,83 +44,6 @@ public final class RefinedStorageSerializers {
|
||||
}
|
||||
};
|
||||
|
||||
public static final DataSerializer<List<ClientCraftingTask>> CLIENT_CRAFTING_TASK_SERIALIZER = new DataSerializer<List<ClientCraftingTask>>() {
|
||||
@Override
|
||||
public void write(PacketBuffer buf, List<ClientCraftingTask> tasks) {
|
||||
buf.writeInt(tasks.size());
|
||||
|
||||
for (ClientCraftingTask task : tasks) {
|
||||
int children = 0;
|
||||
|
||||
ClientCraftingTask child = task.getChild();
|
||||
|
||||
while (child != null) {
|
||||
children++;
|
||||
|
||||
child = child.getChild();
|
||||
}
|
||||
|
||||
writeTask(buf, task, children);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeTask(PacketBuffer buf, ClientCraftingTask task, int children) {
|
||||
ByteBufUtils.writeUTF8String(buf, task.getStatus());
|
||||
|
||||
buf.writeInt(children);
|
||||
|
||||
buf.writeInt(task.getProgress());
|
||||
|
||||
buf.writeInt(task.getOutputs().size());
|
||||
|
||||
for (ItemStack output : task.getOutputs()) {
|
||||
ByteBufUtils.writeItemStack(buf, output);
|
||||
}
|
||||
|
||||
buf.writeBoolean(task.getChild() != null);
|
||||
|
||||
if (task.getChild() != null) {
|
||||
writeTask(buf, task.getChild(), children);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClientCraftingTask> read(PacketBuffer buf) {
|
||||
int size = buf.readInt();
|
||||
|
||||
List<ClientCraftingTask> tasks = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
readTask(buf, i, 0, tasks);
|
||||
}
|
||||
|
||||
return tasks;
|
||||
}
|
||||
|
||||
private void readTask(PacketBuffer buf, int i, int depth, List<ClientCraftingTask> tasks) {
|
||||
String status = ByteBufUtils.readUTF8String(buf);
|
||||
|
||||
int children = buf.readInt();
|
||||
|
||||
int progress = buf.readInt();
|
||||
|
||||
int outputs = buf.readInt();
|
||||
|
||||
for (int j = 0; j < outputs; ++j) {
|
||||
tasks.add(new ClientCraftingTask(ByteBufUtils.readItemStack(buf), i, status, depth, children, progress));
|
||||
}
|
||||
|
||||
if (buf.readBoolean()) {
|
||||
readTask(buf, i, depth + 1, tasks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataParameter<List<ClientCraftingTask>> createKey(int id) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
public static final DataSerializer<FluidStack> FLUID_STACK_SERIALIZER = new DataSerializer<FluidStack>() {
|
||||
@Override
|
||||
public void write(PacketBuffer buf, FluidStack value) {
|
||||
|
||||
Reference in New Issue
Block a user